O'Reilly logo

Hands-On Enterprise Java Microservices with Eclipse MicroProfile by Scott Stark, Antoine Sabot-Durand, Pavol Loffay, Jeff Mesnil, Heiko W. Rupp, Cesar Saavedra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Tagging

Tags now also serve to distinguish metrics with the same name and type, but different tags. They could be used to support many metrics result_code on a REST endpoint to count the number of (un)successful calls:

@Inject@Metric(tags="{code,200}", name="result_code")Counter result_code_200k;@Inject@Metric(tags="{code,500}", name="result_code")Counter result_code_500;@GET@Path("/")public String getData(String someParam) { String result = getSomeData(someParam); if (result == null ) {   result_code_500.inc(); } else {   result_code_200.inc(); } return result;}

Under the covers, metrics are no longer only keyed by name and type, but also by their tags. For this, new MetricID has been introduced to host the name and the tags.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required