Per-metrics tags

Tags can also be supplied on a per-metric basis:

@Counted(tags=[“version=v1”,”commit=abcde”])void doSomething() {  [...]}

This example defines two labels, version=v1 and commit=abcde, on the metric with the name doSomething. Those will be merged with the global tags for the output. With the preceding global tag, there would thus be three tags in the output.

In this section, we have seen how to add labels to metrics to provide additional metadata. These can be global, for all metrics exposed from a server, or application-specific, for one single metric.

Get Hands-On Enterprise Java Microservices with Eclipse MicroProfile now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.