Micrometer library, making integration of our code with monitoring systems like Prometheus and Graphite simpler than ever.
Join the DZone community and get the full member experience. Metrics emitted from applications might contain parameters (i.e., tags or labels) for which a specific metric is measured. Micrometer provides a facade over the instrumentation clients for many widespread monitoring systems like Atlas, Datadog, Graphite, Ganglia, Influx, JMX, and Prometheus. This article’s scope explores some extra practices when combining Micrometer and Quarkus to tailor those metrics or give you some ideas of what you could extra measure. For simplicity and given Prometheus popularity, the Micrometer Prometheus registry will be used as an example to demonstrate most of the use cases. By simply adding micrometer-registry-prometheus extension as a dependency to your Quarkus code, your application code will benefit from some Out Of The Box metrics, accessible on localhost via localhost:8080/q/metrics/q/metrics. In case your application is deployed across multiple regions and the business logic inside it needs to consider specific details (like connecting to third-party services that offer data in different formats), you can add your own global tags to help further you inspecting performance statistics per region. In the example below, the global metrics should be all properties prefixed with global and defined separately in a class. Furthermore, those configuration properties are defined in application.properties file with a default value (for local development work), but the expectation is for them to be configured via environment variables passed from Docker or Kubernetes.