-
clone
https://github.com/Johnny850807/Spring-Boot-Demo-Observability-with-Open-Telemetry.git
cd Spring-Boot-Demo-Observability-with-Open-Telemetry
-
Install docker's loki plugin
docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions
-
Build
./mvnw package -DskipTests
docker-compose build
- Run:
docker-compose -f infra.yml up -d
docker-compose up -d
- Navigate Grafana
Then go to the Grafana's dashboard: http://localhost:3000/
Go to the Explore
page and select the loki data source,
type in the query label {compose_service="user-service"}
then click the "Run Query" button,
and then you will see the live messages produced by the spring boot application.
(Repeat on clicking the "Run Query" button to refresh the messages.)
- Issue a sign-up request:
After the spring boot application has been started, issue a sign-up request by
curl -X POST -H 'Content-Type: application/json' -d '{"name": "test", "email":"[email protected]", "password":"password"}' http://localhost:8080/api/users/signUp
- Log -> Trace:
After the request has succeeded, you should see a log message produced by the sign-up request. Something like:
2021-05-05 14:47:43 2021-05-05 06:47:43 - com.example.demo.UserController - SignUp: User{id=null, name='test', email='[email protected]', password='********'} traceID=81c01158ca964468a4c0b5817863d672
After you found the message, click on the message, grafana will expand it and show the fields of the message.
You can find a blue Tempo
button on the TraceID field. Click it, and then the distributed tracing panel will show up at the right-hand side.