io.vertx.core.metrics.Measured Java Examples

The following examples show how to use io.vertx.core.metrics.Measured. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MetricsServiceImpl.java    From vertx-micrometer-metrics with Apache License 2.0 5 votes vote down vote up
public MetricsServiceImpl(Measured measured) {
  MetricsProvider provider = (MetricsProvider) measured;
  Metrics baseMetrics = provider.getMetrics();
  if (baseMetrics instanceof MicrometerMetrics) {
    metrics = (MicrometerMetrics) baseMetrics;
  } else {
    metrics = null;
  }
}
 
Example #2
Source File: WeldVertxObserversTest.java    From weld-vertx with Apache License 2.0 5 votes vote down vote up
@Test
public void testVertxBean() {
    BeanManager beanManager = CDI.current().getBeanManager();
    Bean<?> bean = beanManager.resolve(beanManager.getBeans(Vertx.class));
    assertTrue(bean.getTypes().contains(Vertx.class));
    assertTrue(bean.getTypes().contains(Measured.class));
    Class<?> vertxClass = vertx.getClass();
    for (Class<?> intf : vertxClass.getInterfaces()) {
        assertTrue(bean.getTypes().contains(intf));
    }
}
 
Example #3
Source File: AbstractMetrics.java    From vertx-dropwizard-metrics with Apache License 2.0 5 votes vote down vote up
public static AbstractMetrics unwrap(Measured measured) {
  MetricsProvider provider = (MetricsProvider) measured;
  Metrics baseMetrics = provider.getMetrics();
  if (baseMetrics instanceof AbstractMetrics) {
    return (AbstractMetrics) baseMetrics;
  }
  return null;
}
 
Example #4
Source File: MetricsServiceImpl.java    From vertx-dropwizard-metrics with Apache License 2.0 4 votes vote down vote up
@Override
public String getBaseName(Measured measured) {
  AbstractMetrics codahaleMetrics = AbstractMetrics.unwrap(measured);
  return codahaleMetrics != null ? codahaleMetrics.baseName() : null;
}
 
Example #5
Source File: MetricsServiceImpl.java    From vertx-dropwizard-metrics with Apache License 2.0 4 votes vote down vote up
@Override
public JsonObject getMetricsSnapshot(Measured measured) {
  AbstractMetrics codahaleMetrics = AbstractMetrics.unwrap(measured);
  return codahaleMetrics != null ? codahaleMetrics.metrics() : null;
}
 
Example #6
Source File: ScheduledMetricsConsumer.java    From vertx-dropwizard-metrics with Apache License 2.0 4 votes vote down vote up
public ScheduledMetricsConsumer(Vertx vertx, Measured measured) {
  this.vertx = vertx;
  this.measured = AbstractMetrics.unwrap(measured);
}
 
Example #7
Source File: MetricsService.java    From vertx-micrometer-metrics with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a metric service for a given {@link Measured} object.
 *
 * @param measured the measured object
 * @return the metrics service
 */
static MetricsService create(Measured measured) {
  return new MetricsServiceImpl(measured);
}
 
Example #8
Source File: MetricsService.java    From vertx-dropwizard-metrics with Apache License 2.0 2 votes vote down vote up
/**
 * @param measured the measure object
 * @return the base name of the measured object
 */
String getBaseName(Measured measured);
 
Example #9
Source File: MetricsService.java    From vertx-dropwizard-metrics with Apache License 2.0 2 votes vote down vote up
/**
 * Will return the metrics that correspond with the {@code measured} object, null if no metrics is available.<p/>
 *
 * Note: in the case of scaled servers, the JsonObject returns an aggregation of the metrics as the
 * dropwizard backend reports to a single server.
 *
 * @return the map of metrics where the key is the name of the metric (excluding the base name unless for the Vert.x object)
 * and the value is the json data representing that metric
 */
JsonObject getMetricsSnapshot(Measured measured);