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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.