Skip to content

Latest commit

 

History

History

micrometer

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

SpringBoot Micrometer

This project shows how to set-up Micrometer in a Spring Boot application, using Influx and Prometheus.

How to Run the project

Application

This springboot app has enabled actuator to persist metrics in 2 micrometer implementations:

Setup

wget https://raw.githubusercontent.com/guedim/spring-projects/master/micrometer/docker-compose.yml
docker-compose up

Run Tests

For getting service metrics run multiple times SpringBoot endpoint :

http://localhost:8080/jobs/github/1

http://localhost:8080/jobs/github/2

http://localhost:8080/jobs/github/3

Influx Metrics

First, connect to the container:

docker exec -it micrometer_influxdb_1 influx

Into influx container, run the command:

SHOW DATABASES;

Next, connect to metrics database and list all metrics:

USE metrics;
SHOW MEASUREMENTS;

Finally, run querys for some specific MEASUREMENTS i.e:

select * from process_cpu_usage;

Prometheus Metrics

Validate Prometheus is collecting SpringBoot metrics checking our endpoint my.local.machine and job prometheus-spring are running:

http://localhost:9090/targets

Next, check we have Spring metrics in section Highest Cardinality Metric Names:

http://localhost:9090/status

Finally, query some metrics using next endpoint:

http://localhost:9090/graph

Notes

  • For build project in local env without docker use next command:
mvn clean package docker:build -DskipTests
  • For osx with docker, please run next command:
sudo ifconfig lo0 alias 172.16.222.111

References