Micronaut + Micrometer

Run project

./gradlew build run

Run Prometheus and Grafana

  1. Clone augustomarinho/docker-composes.git
git clone https://github.com/augustomarinho/docker-composes.git
  1. Run Prometheus
docker-compose -f ./prometheus/docker-compose.yml up -d --force-recreate

The Prometheus can be access in http://localhost:9000/

  1. Run Grafana
docker-compose -f ./grafana/docker-compose.yml up -d --force-recreate

The Grafana can be access in http://localhost:9001/

Grafana

Login

Follow these steps:

  • In the login page fill admin for user and admin for password
  • Grafana will ask you to create a new password. Change the password

Configure Datasource to access Prometheus

  • Access Configuration/Data Sources
  • Click on Add data source
  • Select Prometheus
  • In field HTTP/ URL fill with http://host.docker.internal:9000
  • Click on Save & Test

After these steps, you'll see the popup message Data source is working

Generate Metrics

Timer Metrics

curl -X GET "http://localhost:8084/v1/api/metrics/timer?name=augusto"

DistributionSummary

curl -X GET "http://localhost:8084/v1/api/metrics/histogram?name=augusto"

Counter

curl -X GET "http://localhost:8084/v1/api/metrics/counter?name=augusto"