Skip to content

Commit 8a9e390

Browse files
authored
Merge pull request #43 from spt-development/grafana-integration
Updated project to make use of Spring Boot's Docker Compose support o…
2 parents 8aa8bcd + 1a7a6c5 commit 8a9e390

File tree

13 files changed

+4258
-13
lines changed

13 files changed

+4258
-13
lines changed

README.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,22 @@ The [docker-compose.service.yml](./docker-compose.service.yml) can then be used
113113
```shell
114114
$ docker compose -f docker-compose.yml -f docker-compose.service.yml up -d
115115
```
116-
The cURL commands above can again be used to test the API.
116+
The cURL commands above can again be used to test the API.
117+
118+
Grafana
119+
=======
120+
121+
Spring Boot 3.4.0 extended the Docker Compose support to support
122+
[Grafana LGTM](https://grafana.com/blog/2024/03/13/an-opentelemetry-backend-in-a-docker-image-introducing-grafana/otel-lgtm/).
123+
124+
This project's Docker Compose files have been updated to include Grafana LGTM and whether running the demo with the Spring Boot
125+
Maven plugin or with Docker Compose, Grafana can be accessed [here](http://localhost:3000/). The application will send metrics,
126+
logs and traces to Grafana which has been provisioned with the following dashboards for visualising this data:
127+
128+
* JVM Overview
129+
* RED Metrics
130+
* Spring Boot 3.x Statistics
131+
* Spring Boot Observability
132+
133+
**NOTE** As stated on the Grafana LGTM page, Grafana LGTM is not production ready and "is an open source backend for OpenTelemetry
134+
that’s intended for development, demo, and testing environments."

docker-compose.service.yml

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ services:
66
SPRING_DATASOURCE_USERNAME: postgres
77
SPRING_DATASOURCE_PASSWORD: p@ssw0rd
88
SPRING_ACTIVEMQ_BROKER_URL: tcp://spt-development-demo-activemq-1:61616
9+
MANAGEMENT_OTLP_METRICS_EXPORT_URL: http://spt-development-demo-lgtm-1:4318/v1/metrics
10+
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: http://spt-development-demo-lgtm-1:4318/v1/logs
11+
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT: http://spt-development-demo-lgtm-1:4318/v1/metrics
12+
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: http://spt-development-demo-lgtm-1:4318/v1/traces
913
ports:
1014
- "8080:8080"
1115
- "8081:8081"

docker-compose.yml

+12-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ services:
99
- "5432:5432"
1010

1111
activemq:
12-
image: apache/activemq-classic:6.1.2
12+
image: apache/activemq-classic:6.1.4
1313
ports:
1414
- "61616:61616"
15+
16+
# TODO: Need to update README as well
17+
# TODO: Update docker-compose.service.yml environment with settings for grafana integration
18+
lgtm:
19+
image: grafana/otel-lgtm:0.8.1
20+
ports:
21+
- "4317:4317"
22+
- "4318:4318"
23+
- "3000:3000"
24+
volumes:
25+
- "./grafana/dashboards:/otel-lgtm/grafana/conf/provisioning/dashboards"

grafana/dashboards/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Grafana Dashboards
2+
3+
- [grafana-dashboards.yaml](./grafana-dashboards.yaml) - configures available dashboards.
4+
- Originally copied from running `grafana/otel-lgtm:0.8.1` Docker container and extended with extra dashboards.
5+
- [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.
6+
- [spring-boot-observability.json](./spring-boot-observability.json) imported from [here](https://grafana.com/grafana/dashboards/17175-spring-boot-observability/) and then exported.
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: 1
2+
3+
providers:
4+
- name: 'RED Metrics (exponential/native histogram)'
5+
type: file
6+
options:
7+
path: /otel-lgtm/grafana-dashboard-red-metrics-native.json
8+
foldersFromFilesStructure: false
9+
- name: 'JVM Metrics'
10+
type: file
11+
options:
12+
path: /otel-lgtm/grafana-dashboard-jvm-metrics.json
13+
foldersFromFilesStructure: false
14+
- name: 'Spring Boot 3.x Statistics'
15+
type: file
16+
options:
17+
path: /otel-lgtm/grafana/conf/provisioning/dashboards/spring-boot-3.x-statistics.json
18+
foldersFromFilesStructure: false
19+
- name: 'Spring Boot Observability'
20+
type: file
21+
options:
22+
path: /otel-lgtm/grafana/conf/provisioning/dashboards/spring-boot-observability.json
23+
foldersFromFilesStructure: false

0 commit comments

Comments
 (0)