Search in sources :

Example 6 with Histogram

use of org.eclipse.microprofile.metrics.Histogram in project wildfly by wildfly.

the class MicroProfileMetricsHistogramResource method hello.

@GET
@Path("/hello/{n}")
public Response hello(@PathParam("n") String n) {
    Metadata histogramMetadata = Metadata.builder().withName("helloHistogram").withType(MetricType.HISTOGRAM).build();
    Histogram histogram = registry.histogram(histogramMetadata);
    histogram.update(Long.valueOf(n));
    return Response.ok("Hello World!").build();
}
Also used : Histogram(org.eclipse.microprofile.metrics.Histogram) Metadata(org.eclipse.microprofile.metrics.Metadata) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Aggregations

Histogram (org.eclipse.microprofile.metrics.Histogram)6 Test (org.junit.Test)5 MetricID (org.eclipse.microprofile.metrics.MetricID)4 Snapshot (org.eclipse.microprofile.metrics.Snapshot)4 Metadata (org.eclipse.microprofile.metrics.Metadata)3 Tag (org.eclipse.microprofile.metrics.Tag)3 HistogramImpl (fish.payara.microprofile.metrics.impl.HistogramImpl)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1