Java Code Examples for io.smallrye.metrics.MetricRegistries#get()

The following examples show how to use io.smallrye.metrics.MetricRegistries#get() . 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: OpenMetricsExporterTest.java    From smallrye-metrics with Apache License 2.0 6 votes vote down vote up
@Test
public void testUptimeGaugeUnitConversion() {
    OpenMetricsExporter exporter = new OpenMetricsExporter();
    MetricRegistry baseRegistry = MetricRegistries.get(MetricRegistry.Type.BASE);

    Gauge gauge = new MGaugeImpl(JmxWorker.instance(), "java.lang:type=Runtime/Uptime");
    Metadata metadata = new ExtendedMetadata("jvm.uptime", "display name", "description", MetricType.GAUGE, "milliseconds");
    baseRegistry.register(metadata, gauge);

    long actualUptime /* in ms */ = ManagementFactory.getRuntimeMXBean().getUptime();
    double actualUptimeInSeconds = actualUptime / 1000.0;

    StringBuilder out = exporter.exportOneMetric(MetricRegistry.Type.BASE, new MetricID("jvm.uptime"));
    assertNotNull(out);

    double valueFromOpenMetrics = -1;
    for (String line : out.toString().split(System.getProperty("line.separator"))) {
        if (line.startsWith("base_jvm_uptime_seconds")) {
            valueFromOpenMetrics /* in seconds */ = Double
                    .valueOf(line.substring("base:jvm_uptime_seconds".length()).trim());
        }
    }
    assertTrue("Value should not be -1", valueFromOpenMetrics != -1);
    assertTrue(valueFromOpenMetrics >= actualUptimeInSeconds);
}
 
Example 2
Source File: JsonExporterTest.java    From smallrye-metrics with Apache License 2.0 6 votes vote down vote up
@Test
public void testExportOfDifferentHistogramImplementations() {

    JsonExporter exporter = new JsonExporter();
    MetricRegistry applicationRegistry = MetricRegistries.get(MetricRegistry.Type.APPLICATION);

    // the export should behave identical for any class derived from Histogram
    Histogram[] histograms = { new HistogramImpl(new ExponentiallyDecayingReservoir()), new SomeHistogram() };
    int idx = 0;
    for (Histogram h : histograms) {
        String name = "histo_" + idx++;
        applicationRegistry.register(name, h);
        StringBuilder out = exporter.exportOneMetric(MetricRegistry.Type.APPLICATION, new MetricID(name));
        assertNotNull(out);
        System.out.println(out.toString());
        List<String> lines = Arrays.asList(out.toString().split(LINE_SEPARATOR));
        assertEquals(1, lines.stream().filter(line -> line.contains("\"" + name + "\"")).count());
        assertEquals(1, lines.stream().filter(line -> line.contains("\"count\": 0")).count());
    }
}
 
Example 3
Source File: OpenMetricsExporterTest.java    From smallrye-metrics with Apache License 2.0 6 votes vote down vote up
/**
 * Test the cases where OpenMetrics keys are different from metric names.
 * For example, with a counter named gc.time, the dot will be converted to an underscore.
 * This is mainly to make sure that we don't accidentally log the HELP and TYPE lines multiple times if there are
 * multiple metrics under such name.
 */
@Test
public void testMetricsWhereKeysAreDifferentFromNames() {
    OpenMetricsExporter exporter = new OpenMetricsExporter();
    MetricRegistry registry = MetricRegistries.get(MetricRegistry.Type.APPLICATION);

    Metadata metadata = Metadata.builder()
            .withName("metric.a")
            .withType(MetricType.COUNTER)
            .withDescription("Great")
            .build();
    Tag tag1 = new Tag("tag1", "value1");
    Tag tag2 = new Tag("tag1", "value2");
    registry.counter(metadata, tag1);
    registry.counter(metadata, tag2);

    String result = exporter.exportAllScopes().toString();
    System.out.println(result);
    assertHasHelpLineExactlyOnce(result, "application_metric_a_total", "Great");
    assertHasTypeLineExactlyOnce(result, "application_metric_a_total", "counter");
}
 
Example 4
Source File: ExportersMetricScalingTest.java    From smallrye-metrics with Apache License 2.0 6 votes vote down vote up
/**
 * Given a Timer with unit=MINUTES,
 * check that the statistics from JsonExporter will be presented in MINUTES.
 */
@Test
public void timer_json() {
    MetricRegistry registry = MetricRegistries.get(MetricRegistry.Type.APPLICATION);
    Metadata metadata = Metadata.builder()
            .withName("timer1")
            .withType(MetricType.TIMER)
            .withUnit(MetricUnits.MINUTES)
            .build();
    Timer metric = registry.timer(metadata);
    metric.update(Duration.ofHours(1));
    metric.update(Duration.ofHours(2));
    metric.update(Duration.ofHours(3));

    JsonExporter exporter = new JsonExporter();
    String exported = exporter.exportOneMetric(MetricRegistry.Type.APPLICATION, new MetricID("timer1")).toString();

    JsonObject json = Json.createReader(new StringReader(exported)).read().asJsonObject().getJsonObject("timer1");
    assertEquals(120.0, json.getJsonNumber("p50").doubleValue(), 0.001);
    assertEquals(120.0, json.getJsonNumber("mean").doubleValue(), 0.001);
    assertEquals(60.0, json.getJsonNumber("min").doubleValue(), 0.001);
    assertEquals(180.0, json.getJsonNumber("max").doubleValue(), 0.001);
    assertEquals(360.0, json.getJsonNumber("elapsedTime").doubleValue(), 0.001);
}
 
Example 5
Source File: SmallRyeMetricsRecorder.java    From quarkus with Apache License 2.0 6 votes vote down vote up
public void registerMetricFromProducer(String beanId, MetricType metricType,
        String metricName, String[] tags, String description,
        String displayName, String unit) {
    ArcContainer container = Arc.container();
    InjectableBean<Object> injectableBean = container.bean(beanId);
    BeanManager beanManager = container.beanManager();
    Metric reference = (Metric) beanManager.getReference(injectableBean, Metric.class,
            beanManager.createCreationalContext(injectableBean));
    MetricRegistry registry = MetricRegistries.get(MetricRegistry.Type.APPLICATION);
    Metadata metadata = Metadata.builder()
            .withType(metricType)
            .withName(metricName)
            .withDescription(description)
            .withDisplayName(displayName)
            .withUnit(unit)
            .notReusable()
            .build();
    registry.register(metadata, reference, TagsUtils.parseTagsAsArray(tags));
}
 
Example 6
Source File: ExportersMetricScalingTest.java    From smallrye-metrics with Apache License 2.0 6 votes vote down vote up
/**
 * Given a Counter,
 * check that the statistics from OpenMetricsExporter will not be scaled in any way.
 */
@Test
public void counter_openMetrics() {
    MetricRegistry registry = MetricRegistries.get(MetricRegistry.Type.APPLICATION);
    Metadata metadata = Metadata.builder()
            .withName("counter1")
            .withType(MetricType.COUNTER)
            .build();
    Counter metric = registry.counter(metadata);
    metric.inc(30);
    metric.inc(40);
    metric.inc(50);

    OpenMetricsExporter exporter = new OpenMetricsExporter();
    String exported = exporter.exportOneMetric(MetricRegistry.Type.APPLICATION, new MetricID("counter1")).toString();

    Assert.assertThat(exported, containsString("application_counter1_total 120.0"));
}
 
Example 7
Source File: OpenMetricsExporterTest.java    From smallrye-metrics with Apache License 2.0 6 votes vote down vote up
/**
 * In OpenMetrics exporter and counters, if the metric name does not end with _total, then _total should be appended
 * automatically.
 * If it ends with _total, nothing extra will be appended.
 */
@Test
public void testAppendingOfTotal() {
    OpenMetricsExporter exporter = new OpenMetricsExporter();
    MetricRegistry registry = MetricRegistries.get(MetricRegistry.Type.APPLICATION);
    Tag tag = new Tag("a", "b");

    // in this case _total should be appended
    registry.counter("counter1", tag);
    String export = exporter.exportOneMetric(MetricRegistry.Type.APPLICATION, new MetricID("counter1", tag)).toString();
    assertThat(export, containsString("application_counter1_total{a=\"b\"}"));

    // in this case _total should NOT be appended
    registry.counter("counter2_total", tag);
    export = exporter.exportOneMetric(MetricRegistry.Type.APPLICATION, new MetricID("counter2_total", tag)).toString();
    assertThat(export, containsString("application_counter2_total{a=\"b\"}"));

}
 
Example 8
Source File: ExportersMetricScalingTest.java    From smallrye-metrics with Apache License 2.0 6 votes vote down vote up
/**
 * Given a Meter,
 * check that the statistics from OpenMetrics will be presented as per_second.
 */
@Test
public void meter_openMetrics() throws InterruptedException {
    MetricRegistry registry = MetricRegistries.get(MetricRegistry.Type.APPLICATION);
    Metadata metadata = Metadata.builder()
            .withName("meter1")
            .withType(MetricType.METERED)
            .build();
    Meter metric = registry.meter(metadata);
    metric.mark(10);
    TimeUnit.SECONDS.sleep(1);

    OpenMetricsExporter exporter = new OpenMetricsExporter();
    String exported = exporter.exportOneMetric(MetricRegistry.Type.APPLICATION, new MetricID("meter1")).toString();

    Assert.assertThat(exported, containsString("application_meter1_total 10.0"));
    double ratePerSecond = Double.parseDouble(Arrays.stream(exported.split("\\n"))
            .filter(line -> line.contains("application_meter1_rate_per_second"))
            .filter(line -> !line.contains("TYPE") && !line.contains("HELP"))
            .findFirst()
            .get()
            .split(" ")[1]);
    Assert.assertTrue("Rate per second should be between 1 and 10 but is " + ratePerSecond,
            ratePerSecond > 1 && ratePerSecond < 10);
}
 
Example 9
Source File: JsonMetadataExporterTest.java    From smallrye-metrics with Apache License 2.0 6 votes vote down vote up
@Test
public void exportByMetricNameWithMultipleMetrics() {
    JsonMetadataExporter exporter = new JsonMetadataExporter();
    MetricRegistry applicationRegistry = MetricRegistries.get(MetricRegistry.Type.APPLICATION);
    applicationRegistry.counter("counter1", new Tag("key1", "value1"));
    applicationRegistry.counter("counter1", new Tag("key1", "value2"));
    applicationRegistry.counter("counter1", new Tag("key1", "value3"));

    String result = exporter.exportMetricsByName(MetricRegistry.Type.APPLICATION, "counter1").toString();
    JsonObject json = Json.createReader(new StringReader(result)).read().asJsonObject();

    JsonArray outerTagsArray = json.getJsonObject("counter1").getJsonArray("tags");
    assertEquals(3, outerTagsArray.size());

    JsonArray innerArray1 = outerTagsArray.getJsonArray(0);
    assertEquals(1, innerArray1.size());
    assertEquals("key1=value1", innerArray1.getString(0));

    JsonArray innerArray2 = outerTagsArray.getJsonArray(1);
    assertEquals(1, innerArray2.size());
    assertEquals("key1=value2", innerArray2.getString(0));

    JsonArray innerArray3 = outerTagsArray.getJsonArray(2);
    assertEquals(1, innerArray3.size());
    assertEquals("key1=value3", innerArray3.getString(0));
}
 
Example 10
Source File: JsonMetadataExporter.java    From smallrye-metrics with Apache License 2.0 5 votes vote down vote up
@Override
public StringBuilder exportOneScope(MetricRegistry.Type scope) {
    MetricRegistry registry = MetricRegistries.get(scope);
    if (registry == null) {
        return null;
    }

    JsonObject obj = registryJSON(registry);
    return stringify(obj);
}
 
Example 11
Source File: JsonExporterTest.java    From smallrye-metrics with Apache License 2.0 5 votes vote down vote up
@Test
public void testDoubleQuotesInTagValue() {
    JsonExporter exporter = new JsonExporter();
    MetricRegistry registry = MetricRegistries.get(MetricRegistry.Type.APPLICATION);

    registry.counter("counter1",
            new Tag("tag1", "i_have\"quotes\""));

    String result = exporter.exportMetricsByName(MetricRegistry.Type.APPLICATION, "counter1").toString();
    JsonObject json = Json.createReader(new StringReader(result)).read().asJsonObject();

    assertEquals("Double quotes in tag values should be escaped", "counter1;tag1=i_have\"quotes\"",
            json.keySet().stream().findFirst().get());
}
 
Example 12
Source File: JsonExporterTest.java    From smallrye-metrics with Apache License 2.0 5 votes vote down vote up
@Test
public void testSimpleTimers() {
    JsonExporter exporter = new JsonExporter();
    MetricRegistry registry = MetricRegistries.get(MetricRegistry.Type.APPLICATION);
    Metadata metadata = new MetadataBuilder()
            .withUnit(MetricUnits.SECONDS)
            .withName("mysimpletimer")
            .build();

    SimpleTimer timerWithoutTags = registry.simpleTimer(metadata);
    SimpleTimer timerRed = registry.simpleTimer(metadata, new Tag("color", "red"));
    SimpleTimer timerBlue = registry.simpleTimer(metadata, new Tag("color", "blue"), new Tag("foo", "bar"));

    timerWithoutTags.update(Duration.ofSeconds(1));
    timerRed.update(Duration.ofSeconds(2));
    timerBlue.update(Duration.ofSeconds(3));
    timerBlue.update(Duration.ofSeconds(4));

    String result = exporter.exportMetricsByName(MetricRegistry.Type.APPLICATION, "mysimpletimer").toString();
    JsonObject json = Json.createReader(new StringReader(result)).read().asJsonObject();

    JsonObject mytimerObject = json.getJsonObject("mysimpletimer");

    assertEquals(1.0, mytimerObject.getJsonNumber("count").doubleValue(), 1e-10);
    assertEquals(1.0, mytimerObject.getJsonNumber("count;color=red").doubleValue(), 1e-10);
    assertEquals(2.0, mytimerObject.getJsonNumber("count;color=blue;foo=bar").doubleValue(), 1e-10);

    assertEquals(1.0, mytimerObject.getJsonNumber("elapsedTime").doubleValue(), 1e-10);
    assertEquals(2.0, mytimerObject.getJsonNumber("elapsedTime;color=red").doubleValue(), 1e-10);
    assertEquals(7.0, mytimerObject.getJsonNumber("elapsedTime;color=blue;foo=bar").doubleValue(), 1e-10);
}
 
Example 13
Source File: JsonMetadataExporterTest.java    From smallrye-metrics with Apache License 2.0 5 votes vote down vote up
@Test
public void exportByMetricNameWithOneMetricSingleTag() {
    JsonMetadataExporter exporter = new JsonMetadataExporter();
    MetricRegistry applicationRegistry = MetricRegistries.get(MetricRegistry.Type.APPLICATION);
    applicationRegistry.counter("counter1", new Tag("key1", "value1"));

    String result = exporter.exportMetricsByName(MetricRegistry.Type.APPLICATION, "counter1").toString();

    JsonObject json = Json.createReader(new StringReader(result)).read().asJsonObject();
    JsonArray outerTagsArray = json.getJsonObject("counter1").getJsonArray("tags");
    assertEquals(1, outerTagsArray.size());
    JsonArray innerArray = outerTagsArray.getJsonArray(0);
    assertEquals(1, innerArray.size());
    assertEquals("key1=value1", innerArray.getString(0));
}
 
Example 14
Source File: JsonExporterTest.java    From smallrye-metrics with Apache License 2.0 5 votes vote down vote up
@Test
public void testMeters() {
    JsonExporter exporter = new JsonExporter();
    MetricRegistry registry = MetricRegistries.get(MetricRegistry.Type.APPLICATION);

    Meter meterWithoutTags = registry.meter("mymeter");
    Meter meterRed = registry.meter("mymeter", new Tag("color", "red"));
    Meter meterBlue = registry.meter("mymeter", new Tag("color", "blue"), new Tag("foo", "bar"));

    meterWithoutTags.mark(1);
    meterRed.mark(2);
    meterBlue.mark(3);

    String result = exporter.exportMetricsByName(MetricRegistry.Type.APPLICATION, "mymeter").toString();
    JsonObject json = Json.createReader(new StringReader(result)).read().asJsonObject();

    JsonObject myMeterObject = json.getJsonObject("mymeter");
    assertEquals(1, myMeterObject.getInt("count"));
    assertEquals(2, myMeterObject.getInt("count;color=red"));
    assertEquals(3, myMeterObject.getInt("count;color=blue;foo=bar"));

    assertNotNull(myMeterObject.getJsonNumber("meanRate"));
    assertNotNull(myMeterObject.getJsonNumber("meanRate;color=red"));
    assertNotNull(myMeterObject.getJsonNumber("meanRate;color=blue;foo=bar"));

    assertNotNull(myMeterObject.getJsonNumber("oneMinRate"));
    assertNotNull(myMeterObject.getJsonNumber("oneMinRate;color=red"));
    assertNotNull(myMeterObject.getJsonNumber("oneMinRate;color=blue;foo=bar"));

    assertNotNull(myMeterObject.getJsonNumber("fiveMinRate"));
    assertNotNull(myMeterObject.getJsonNumber("fiveMinRate;color=red"));
    assertNotNull(myMeterObject.getJsonNumber("fiveMinRate;color=blue;foo=bar"));

    assertNotNull(myMeterObject.getJsonNumber("fifteenMinRate"));
    assertNotNull(myMeterObject.getJsonNumber("fifteenMinRate;color=red"));
    assertNotNull(myMeterObject.getJsonNumber("fifteenMinRate;color=blue;foo=bar"));
}
 
Example 15
Source File: SmallRyeMetricsRecorder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public void createRegistries(BeanContainer container) {
    MetricRegistries.get(MetricRegistry.Type.APPLICATION);
    MetricRegistries.get(MetricRegistry.Type.BASE);
    MetricRegistries.get(MetricRegistry.Type.VENDOR);

    //HACK: registration is done via statics, but cleanup is done via pre destroy
    //however if the bean is not used it will not be created, so no cleanup will be done
    //we force bean creation here to make sure the container can restart correctly
    container.instance(MetricRegistries.class).getApplicationRegistry();
}
 
Example 16
Source File: JsonExporterTest.java    From smallrye-metrics with Apache License 2.0 4 votes vote down vote up
@Test
public void testTimers() {
    JsonExporter exporter = new JsonExporter();
    MetricRegistry registry = MetricRegistries.get(MetricRegistry.Type.APPLICATION);
    Metadata metadata = new MetadataBuilder()
            .withUnit(MetricUnits.SECONDS)
            .withName("mytimer")
            .build();

    Timer timerWithoutTags = registry.timer(metadata);
    Timer timerRed = registry.timer(metadata, new Tag("color", "red"));
    Timer timerBlue = registry.timer(metadata, new Tag("color", "blue"), new Tag("foo", "bar"));

    timerWithoutTags.update(Duration.ofSeconds(1));
    timerRed.update(Duration.ofSeconds(2));
    timerBlue.update(Duration.ofSeconds(3));

    String result = exporter.exportMetricsByName(MetricRegistry.Type.APPLICATION, "mytimer").toString();
    JsonObject json = Json.createReader(new StringReader(result)).read().asJsonObject();

    JsonObject mytimerObject = json.getJsonObject("mytimer");

    assertEquals(1.0, mytimerObject.getJsonNumber("count").doubleValue(), 1e-10);
    assertEquals(1.0, mytimerObject.getJsonNumber("count;color=red").doubleValue(), 1e-10);
    assertEquals(1.0, mytimerObject.getJsonNumber("count;color=blue;foo=bar").doubleValue(), 1e-10);

    assertEquals(1.0, mytimerObject.getJsonNumber("elapsedTime").doubleValue(), 1e-10);
    assertEquals(2.0, mytimerObject.getJsonNumber("elapsedTime;color=red").doubleValue(), 1e-10);
    assertEquals(3.0, mytimerObject.getJsonNumber("elapsedTime;color=blue;foo=bar").doubleValue(), 1e-10);

    assertEquals(1.0, mytimerObject.getJsonNumber("p50").doubleValue(), 1e-10);
    assertEquals(2.0, mytimerObject.getJsonNumber("p50;color=red").doubleValue(), 1e-10);
    assertEquals(3.0, mytimerObject.getJsonNumber("p50;color=blue;foo=bar").doubleValue(), 1e-10);

    assertEquals(1.0, mytimerObject.getJsonNumber("p75").doubleValue(), 1e-10);
    assertEquals(2.0, mytimerObject.getJsonNumber("p75;color=red").doubleValue(), 1e-10);
    assertEquals(3.0, mytimerObject.getJsonNumber("p75;color=blue;foo=bar").doubleValue(), 1e-10);

    assertEquals(1.0, mytimerObject.getJsonNumber("p95").doubleValue(), 1e-10);
    assertEquals(2.0, mytimerObject.getJsonNumber("p95;color=red").doubleValue(), 1e-10);
    assertEquals(3.0, mytimerObject.getJsonNumber("p95;color=blue;foo=bar").doubleValue(), 1e-10);

    assertEquals(1.0, mytimerObject.getJsonNumber("p98").doubleValue(), 1e-10);
    assertEquals(2.0, mytimerObject.getJsonNumber("p98;color=red").doubleValue(), 1e-10);
    assertEquals(3.0, mytimerObject.getJsonNumber("p98;color=blue;foo=bar").doubleValue(), 1e-10);

    assertEquals(1.0, mytimerObject.getJsonNumber("p99").doubleValue(), 1e-10);
    assertEquals(2.0, mytimerObject.getJsonNumber("p99;color=red").doubleValue(), 1e-10);
    assertEquals(3.0, mytimerObject.getJsonNumber("p99;color=blue;foo=bar").doubleValue(), 1e-10);

    assertEquals(1.0, mytimerObject.getJsonNumber("p999").doubleValue(), 1e-10);
    assertEquals(2.0, mytimerObject.getJsonNumber("p999;color=red").doubleValue(), 1e-10);
    assertEquals(3.0, mytimerObject.getJsonNumber("p999;color=blue;foo=bar").doubleValue(), 1e-10);

    assertEquals(1.0, mytimerObject.getJsonNumber("min").doubleValue(), 1e-10);
    assertEquals(2.0, mytimerObject.getJsonNumber("min;color=red").doubleValue(), 1e-10);
    assertEquals(3.0, mytimerObject.getJsonNumber("min;color=blue;foo=bar").doubleValue(), 1e-10);

    assertEquals(1.0, mytimerObject.getJsonNumber("mean").doubleValue(), 1e-10);
    assertEquals(2.0, mytimerObject.getJsonNumber("mean;color=red").doubleValue(), 1e-10);
    assertEquals(3.0, mytimerObject.getJsonNumber("mean;color=blue;foo=bar").doubleValue(), 1e-10);

    assertEquals(1.0, mytimerObject.getJsonNumber("max").doubleValue(), 1e-10);
    assertEquals(2.0, mytimerObject.getJsonNumber("max;color=red").doubleValue(), 1e-10);
    assertEquals(3.0, mytimerObject.getJsonNumber("max;color=blue;foo=bar").doubleValue(), 1e-10);

    assertEquals(0.0, mytimerObject.getJsonNumber("stddev").doubleValue(), 1e-10);
    assertEquals(0.0, mytimerObject.getJsonNumber("stddev;color=red").doubleValue(), 1e-10);
    assertEquals(0.0, mytimerObject.getJsonNumber("stddev;color=blue;foo=bar").doubleValue(), 1e-10);
}
 
Example 17
Source File: OpenMetricsExporterTest.java    From smallrye-metrics with Apache License 2.0 4 votes vote down vote up
@Test
public void exportHistograms() {
    OpenMetricsExporter exporter = new OpenMetricsExporter();
    MetricRegistry registry = MetricRegistries.get(MetricRegistry.Type.APPLICATION);

    Metadata metadata = Metadata
            .builder()
            .withType(MetricType.HISTOGRAM)
            .withName("MyHisto")
            .withDescription("awesome")
            .build();
    Tag blueTag = new Tag("color", "blue");
    Histogram histogram1 = registry.histogram(metadata, blueTag);
    Tag greenTag = new Tag("color", "green");
    Histogram histogram2 = registry.histogram(metadata, greenTag);

    histogram1.update(5);
    histogram1.update(9);
    histogram2.update(10);
    histogram2.update(12);

    String result = exporter.exportMetricsByName(MetricRegistry.Type.APPLICATION, "MyHisto").toString();
    System.out.println(result);

    assertHasValueLineExactlyOnce(result, "application_MyHisto_min", "5.0", blueTag);
    assertHasValueLineExactlyOnce(result, "application_MyHisto_max", "9.0", blueTag);
    assertHasValueLineExactlyOnce(result, "application_MyHisto_mean", "7.0", blueTag);
    assertHasValueLineExactlyOnce(result, "application_MyHisto_stddev", "2.0", blueTag);
    assertHasValueLineExactlyOnce(result, "application_MyHisto_count", "2.0", blueTag);
    assertHasValueLineExactlyOnce(result, "application_MyHisto", "9.0", blueTag, QUANTILE_0_5);
    assertHasValueLineExactlyOnce(result, "application_MyHisto", "9.0", blueTag, QUANTILE_0_75);
    assertHasValueLineExactlyOnce(result, "application_MyHisto", "9.0", blueTag, QUANTILE_0_95);
    assertHasValueLineExactlyOnce(result, "application_MyHisto", "9.0", blueTag, QUANTILE_0_98);
    assertHasValueLineExactlyOnce(result, "application_MyHisto", "9.0", blueTag, QUANTILE_0_99);
    assertHasValueLineExactlyOnce(result, "application_MyHisto", "9.0", blueTag, QUANTILE_0_999);

    assertHasValueLineExactlyOnce(result, "application_MyHisto_min", "10.0", greenTag);
    assertHasValueLineExactlyOnce(result, "application_MyHisto_max", "12.0", greenTag);
    assertHasValueLineExactlyOnce(result, "application_MyHisto_mean", "11.0", greenTag);
    assertHasValueLineExactlyOnce(result, "application_MyHisto_stddev", "1.0", greenTag);
    assertHasValueLineExactlyOnce(result, "application_MyHisto_count", "2.0", greenTag);
    assertHasValueLineExactlyOnce(result, "application_MyHisto", "12.0", greenTag, QUANTILE_0_5);
    assertHasValueLineExactlyOnce(result, "application_MyHisto", "12.0", greenTag, QUANTILE_0_75);
    assertHasValueLineExactlyOnce(result, "application_MyHisto", "12.0", greenTag, QUANTILE_0_95);
    assertHasValueLineExactlyOnce(result, "application_MyHisto", "12.0", greenTag, QUANTILE_0_98);
    assertHasValueLineExactlyOnce(result, "application_MyHisto", "12.0", greenTag, QUANTILE_0_99);
    assertHasValueLineExactlyOnce(result, "application_MyHisto", "12.0", greenTag, QUANTILE_0_999);

    assertHasTypeLineExactlyOnce(result, "application_MyHisto_min", "gauge");
    assertHasTypeLineExactlyOnce(result, "application_MyHisto_max", "gauge");
    assertHasTypeLineExactlyOnce(result, "application_MyHisto_mean", "gauge");
    assertHasTypeLineExactlyOnce(result, "application_MyHisto_stddev", "gauge");
    assertHasTypeLineExactlyOnce(result, "application_MyHisto", "summary");

    assertHasHelpLineExactlyOnce(result, "application_MyHisto", "awesome");
}
 
Example 18
Source File: CountedInterceptor.java    From smallrye-metrics with Apache License 2.0 4 votes vote down vote up
@Inject
CountedInterceptor() {
    this.registry = MetricRegistries.get(MetricRegistry.Type.APPLICATION);
}
 
Example 19
Source File: SmallRyeMetricsRecorder.java    From quarkus with Apache License 2.0 4 votes vote down vote up
public void registerVendorMetrics() {
    MetricRegistry registry = MetricRegistries.get(MetricRegistry.Type.VENDOR);
    memoryPoolMetrics(registry);
    vendorSpecificMemoryMetrics(registry);
    vendorOperatingSystemMetrics(registry);
}
 
Example 20
Source File: MongoMetricsConnectionPoolListener.java    From quarkus with Apache License 2.0 4 votes vote down vote up
private MetricRegistry getMetricRegistry() {
    return MetricRegistries.get(MetricRegistry.Type.VENDOR);
}