Skip to content

Spring Petclinic app to demo Grafana o11y - logs, metrics, traces

License

Notifications You must be signed in to change notification settings

adamquan/petclinic-grafana-o11y

Repository files navigation

Spring PetClinic Sample Application - Grafana Obaservability

Spring Petclinic app to demo Grafana o11y - logs, metrics, traces

Understanding the Spring Petclinic application with a few diagrams

See the presentation here

Spring PetClinic

Simple Spring Boot application to demonstrate collecting and correlating logs, metrics and traces with Prometheus, OpenTelemetry, and Grafana Cloud. It is built using Maven.

Running everything locally

You can run the whole stack locally inside Docker, after building the application container. The whole stack contains:

  • The Pet Clinic application
  • The simple load runner
  • Prometheus for metrics
  • Loki for logs
  • Tempo for traces
  • Grafana Agent to collect logs, metrics and traces
  • Grafana
git clone adamquan/petclinic-grafana-o11y
cd petclinic-grafana-o11y
./mvnw package
docker build -t spring-petclinic .
cd local
docker-compose up

After all the containers are up, you can access the appliction here: http://localhost:8080/, and Grafana here: http://localhost:3000

petclinic-screenshot

Grafana

Go to dashboards, and open the PetClinic dashboard, you will see something beautiful!

Dashboard

The dashboard has a few different rows/sections. The first section is an application overview section:

Dashboard

The second section shows span metrics automatically generated by Tempo:

Dashboard

The last section shows the metrics generated from logs and raw logs:

Dashboard

Sending logs, metrics and traces to Grafana Cloud

You can also run the application locally, but send logs, metrics and traces to Grafana Cloud. You do need to configure the cloud/config/agent.yaml file with your Grafana Cloud information. Local components that starts inside Docker include:

  • The Hello Observability application
  • The simple load runner
  • Grafana Agent to collect logs, metrics and traces

The architecture looks like:

architecture

cd hello-observability/cloud
docker-compose up

Import the dashboard from the dashboard.json file,

Import Dashboard

Similary as you have done locally, import the dashboard and enjoy!

Here is a live version of the dashboard

Spring Boot metrics exemplar

Exemplar was added by following this blog

Exemplar

About

Spring Petclinic app to demo Grafana o11y - logs, metrics, traces

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published