Skip to content

Commit

Permalink
Merge pull request #43 from spt-development/grafana-integration
Browse files Browse the repository at this point in the history
Updated project to make use of Spring Boot's Docker Compose support o…
  • Loading branch information
SimonTaylor authored Dec 31, 2024
2 parents 8aa8bcd + 1a7a6c5 commit 8a9e390
Show file tree
Hide file tree
Showing 13 changed files with 4,258 additions and 13 deletions.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,22 @@ The [docker-compose.service.yml](./docker-compose.service.yml) can then be used
```shell
$ docker compose -f docker-compose.yml -f docker-compose.service.yml up -d
```
The cURL commands above can again be used to test the API.
The cURL commands above can again be used to test the API.

Grafana
=======

Spring Boot 3.4.0 extended the Docker Compose support to support
[Grafana LGTM](https://grafana.com/blog/2024/03/13/an-opentelemetry-backend-in-a-docker-image-introducing-grafana/otel-lgtm/).

This project's Docker Compose files have been updated to include Grafana LGTM and whether running the demo with the Spring Boot
Maven plugin or with Docker Compose, Grafana can be accessed [here](http://localhost:3000/). The application will send metrics,
logs and traces to Grafana which has been provisioned with the following dashboards for visualising this data:

* JVM Overview
* RED Metrics
* Spring Boot 3.x Statistics
* Spring Boot Observability

**NOTE** As stated on the Grafana LGTM page, Grafana LGTM is not production ready and "is an open source backend for OpenTelemetry
that’s intended for development, demo, and testing environments."
4 changes: 4 additions & 0 deletions docker-compose.service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ services:
SPRING_DATASOURCE_USERNAME: postgres
SPRING_DATASOURCE_PASSWORD: p@ssw0rd
SPRING_ACTIVEMQ_BROKER_URL: tcp://spt-development-demo-activemq-1:61616
MANAGEMENT_OTLP_METRICS_EXPORT_URL: http://spt-development-demo-lgtm-1:4318/v1/metrics
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: http://spt-development-demo-lgtm-1:4318/v1/logs
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT: http://spt-development-demo-lgtm-1:4318/v1/metrics
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: http://spt-development-demo-lgtm-1:4318/v1/traces
ports:
- "8080:8080"
- "8081:8081"
13 changes: 12 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ services:
- "5432:5432"

activemq:
image: apache/activemq-classic:6.1.2
image: apache/activemq-classic:6.1.4
ports:
- "61616:61616"

# TODO: Need to update README as well
# TODO: Update docker-compose.service.yml environment with settings for grafana integration
lgtm:
image: grafana/otel-lgtm:0.8.1
ports:
- "4317:4317"
- "4318:4318"
- "3000:3000"
volumes:
- "./grafana/dashboards:/otel-lgtm/grafana/conf/provisioning/dashboards"
6 changes: 6 additions & 0 deletions grafana/dashboards/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Grafana Dashboards

- [grafana-dashboards.yaml](./grafana-dashboards.yaml) - configures available dashboards.
- Originally copied from running `grafana/otel-lgtm:0.8.1` Docker container and extended with extra dashboards.
- [spring-boot-3.x-statistics.json](./spring-boot-3.x-statistics.json) imported from [here](https://grafana.com/grafana/dashboards/19004-spring-boot-statistics/) and then exported.
- [spring-boot-observability.json](./spring-boot-observability.json) imported from [here](https://grafana.com/grafana/dashboards/17175-spring-boot-observability/) and then exported.
23 changes: 23 additions & 0 deletions grafana/dashboards/grafana-dashboards.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: 1

providers:
- name: 'RED Metrics (exponential/native histogram)'
type: file
options:
path: /otel-lgtm/grafana-dashboard-red-metrics-native.json
foldersFromFilesStructure: false
- name: 'JVM Metrics'
type: file
options:
path: /otel-lgtm/grafana-dashboard-jvm-metrics.json
foldersFromFilesStructure: false
- name: 'Spring Boot 3.x Statistics'
type: file
options:
path: /otel-lgtm/grafana/conf/provisioning/dashboards/spring-boot-3.x-statistics.json
foldersFromFilesStructure: false
- name: 'Spring Boot Observability'
type: file
options:
path: /otel-lgtm/grafana/conf/provisioning/dashboards/spring-boot-observability.json
foldersFromFilesStructure: false
Loading

0 comments on commit 8a9e390

Please sign in to comment.