Tabnine Logo
Gauge.getValue
Code IndexAdd Tabnine to your IDE (free)

How to use
getValue
method
in
com.codahale.metrics.Gauge

Best Java code snippets using com.codahale.metrics.Gauge.getValue (Showing top 20 results out of 1,368)

origin: alibaba/jstorm

  /**
   * {@inheritDoc}
   */
  @Override
  public Object getValue(Integer window) {
    return this.gauge.getValue();
  }
}
origin: stagemonitor/stagemonitor

private Double getDoubleFromGauge(Gauge gauge) {
  if (gauge.getValue() instanceof Number) {
    return ((Number) gauge.getValue()).doubleValue();
  } else if (gauge.getValue() instanceof Boolean) {
    return ((Boolean) gauge.getValue()) ? 1.0 : 0;
  } else {
    return -1d;
  }
}
origin: Graylog2/graylog2-server

  @Override
  protected Ratio getRatio() {
    return Ratio.of(sizeGauge.getValue(),
            sizeLimitGauge.getValue());
  }
});
origin: signalapp/Signal-Server

private Object evaluateGauge(Gauge gauge) {
 try {
  return gauge.getValue();
 } catch (RuntimeException e) {
  logger.warn("Error reading gauge", e);
  return "error reading gauge";
 }
}
origin: alibaba/jstorm

@Override
public Map<Integer, Number> getSnapshot() {
  // TODO Auto-generated method stub
  Number value = gauge.getValue();
  Map<Integer, Number> ret = new TreeMap<Integer, Number>();
  for (Integer timeKey : windowSeconds) {
    ret.put(timeKey, value);
  }
  ret.put(StatBuckets.ALL_TIME_WINDOW, value);
  return ret;
}
origin: Alluxio/alluxio

private Map<String, Long> getMetricsInternal() {
 MetricRegistry metricRegistry = MetricsSystem.METRIC_REGISTRY;
 // Get all counters.
 Map<String, Counter> counters = metricRegistry.getCounters();
 // Only the gauge for cached blocks is retrieved here, other gauges are statistics of
 // free/used spaces, those statistics can be gotten via other REST apis.
 String blocksCachedProperty =
   MetricsSystem.getMetricName(DefaultBlockWorker.Metrics.BLOCKS_CACHED);
 @SuppressWarnings("unchecked") Gauge<Integer> blocksCached =
   (Gauge<Integer>) metricRegistry.getGauges().get(blocksCachedProperty);
 // Get values of the counters and gauges and put them into a metrics map.
 SortedMap<String, Long> metrics = new TreeMap<>();
 for (Map.Entry<String, Counter> counter : counters.entrySet()) {
  metrics.put(counter.getKey(), counter.getValue().getCount());
 }
 metrics.put(blocksCachedProperty, blocksCached.getValue().longValue());
 return metrics;
}
origin: apache/incubator-gobblin

private void reportGauge(List<Point> points, String prefix, String name, Gauge gauge, long timestamp)
  throws IOException {
 String metricName = getKey(prefix, name);
 points.add(buildMetricAsPoint(metricName, gauge.getValue(), timestamp));
}
origin: Graylog2/graylog2-server

  @GET
  @Timed
  @RequiresPermissions(RestPermissions.THROUGHPUT_READ)
  @ApiOperation(value = "Current throughput of this node in messages per second")
  @Produces(MediaType.APPLICATION_JSON)
  public Throughput total() {
    final SortedMap<String, Gauge> gauges = metricRegistry.getGauges(MetricUtils.filterSingleMetric(
        GlobalMetricNames.OUTPUT_THROUGHPUT_RATE));
    final Gauge gauge = Iterables.getOnlyElement(gauges.values(), null);
    if (gauge == null || !(gauge.getValue() instanceof Number)) {
      return Throughput.create(0);
    } else {
      return Throughput.create(((Number) gauge.getValue()).longValue());
    }
  }
}
origin: stagemonitor/stagemonitor

private void reportGauges(Map<MetricName, Gauge> gauges, long timestamp) {
  for (Map.Entry<MetricName, Gauge> entry : gauges.entrySet()) {
    final String value = getGaugeValueForInfluxDb(entry.getValue().getValue());
    if (value != null) {
      reportLine(getInfluxDbLineProtocolString(entry.getKey()), value, timestamp);
    }
  }
}
origin: alibaba/jstorm

@Override
protected void updateSnapshot(int window) {
  double v = (Double) gauge.getValue();
  AsmSnapshot snapshot = new AsmGaugeSnapshot().setValue(v)
      .setTs(System.currentTimeMillis()).setMetricId(metricId);
  snapshots.put(window, snapshot);
}
origin: stagemonitor/stagemonitor

public static <T> Gauge gauge(T value) {
  final Gauge gauge = mock(Gauge.class);
  when(gauge.getValue()).thenReturn(value);
  return gauge;
}
origin: azkaban/azkaban

 public long getGaugeValue(final String name) {
  // Assume that the gauge value can be converted to type long.
  return (long) this.registry.getGauges().get(name).getValue();
 }
}
origin: Alluxio/alluxio

 private Object getGauge(String name) {
  return MetricsSystem.METRIC_REGISTRY.getGauges().get(MetricsSystem.getMetricName(name))
    .getValue();
 }
}
origin: Alluxio/alluxio

 private Object getGauge(String name) {
  return MetricsSystem.METRIC_REGISTRY.getGauges().get(MetricsSystem.getMetricName(name))
    .getValue();
 }
}
origin: Alluxio/alluxio

private Object getGauge(String name) {
 return MetricsSystem.METRIC_REGISTRY.getGauges().get(MetricsSystem.getClusterMetricName(name))
   .getValue();
}
origin: spotify/helios

private void reportGauge(String name, Gauge gauge) {
 final Metric metric = createMetric(name, "gauge")
   .value(convert(gauge.getValue()));
 send(metric);
}
origin: PipelineAI/pipeline

@Test
public void testCommandSuccess() throws InterruptedException {
  Command command = new Command();
  command.execute();
  Thread.sleep(1000);
  assertThat((Long) metricRegistry.getGauges().get("hystrix.testGroup.testCommand.countSuccess").getValue(), is(1L));
  assertThat((Long) metricRegistry.getGauges().get("hystrix.HystrixThreadPool.threadGroup.totalTaskCount").getValue(), is(1L));
}
origin: Alluxio/alluxio

 private Object getGauge(String metricName, String tagName, String tagValue) {
  return MetricsSystem.METRIC_REGISTRY.getGauges()
    .get(MetricsSystem
      .getClusterMetricName(Metric.getMetricNameWithTags(metricName, tagName, tagValue)))
    .getValue();
 }
}
origin: stagemonitor/stagemonitor

  private Object getGauge(MetricName gaugeName) {
    final Gauge gauge = metricRegistry.getGauges().get(gaugeName);
    assertNotNull(gaugeName + " not found in: " + metricRegistry.getGauges(), gauge);
    return gauge.getValue();
  }
}
origin: stagemonitor/stagemonitor

  @Test
  public void testRegisterMBean() throws Exception {
    MBeanUtils.registerMBean(MBeanUtils.queryMBean("java.lang:type=ClassLoading"), "LoadedClassCount", name("jvm_class_count").build(), metricRegistry);
    final Gauge classLoadingGauge = metricRegistry.getGauges().get(name("jvm_class_count").build());
    assertNotNull(classLoadingGauge);
    assertTrue(((Integer) classLoadingGauge.getValue()) > 1);
  }
}
com.codahale.metricsGaugegetValue

Javadoc

Returns the metric's current value.

Popular methods of Gauge

    Popular in Java

    • Reactive rest calls using spring rest template
    • setRequestProperty (URLConnection)
    • runOnUiThread (Activity)
    • setContentView (Activity)
    • ResultSet (java.sql)
      An interface for an object which represents a database table entry, returned as the result of the qu
    • NoSuchElementException (java.util)
      Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
    • JarFile (java.util.jar)
      JarFile is used to read jar entries and their associated data from jar files.
    • Stream (java.util.stream)
      A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
    • SSLHandshakeException (javax.net.ssl)
      The exception that is thrown when a handshake could not be completed successfully.
    • JFileChooser (javax.swing)
    • Top plugins for WebStorm
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now