Integration with api-service

api-service already exposes all metrics except Prometheus. Now we need to add a micrometer library and change api-service to expose a separate Prometheus endpoint to export the metrics in a format accepted by Prometheus.

Once Prometheus endpoints start producing metrics data, we can configure Prometheus server to pull metrics data from the API service's /actuator/prometheus endpoint.

Please download Prometheus from based on your operating system and install it before proceeding.

We'll take the following steps to integrate api-service with Prometheus. We'll start by making a few modifications in api-service:

  1. Maven dependency: First, we'll add the micrometer-registry-prometheus

Get Mastering Microservices with Java - Third Edition 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.