Skip to content

Commit 5c770d5

Browse files
committed
chore: add Grafana and Prometheus setup for observability with Docker Compose
1 parent 1935711 commit 5c770d5

File tree

5 files changed

+86
-1
lines changed

5 files changed

+86
-1
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"image": "mcr.microsoft.com/devcontainers/dotnet:1-9.0-bookworm",
77
// Features to add to the dev container. More info: https://containers.dev/features.
88
"features": {
9+
"ghcr.io/devcontainers/features/docker-in-docker:1": {},
910
"ghcr.io/devcontainers/features/desktop-lite:1": {}
1011
},
1112
"customizations": {
@@ -34,4 +35,4 @@
3435
// "customizations": {},
3536
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
3637
// "remoteUser": "root"
37-
}
38+
}

samples/Observability/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# TestR Observability
2+
3+
Idea is to have a local Grafana instance that visualizes OpenTelemetry metrics from the Test Runs generated by the TestR tool. Like that we can visualize the results of the tests in Grafana and setup alerts based on the results.
4+
5+
## Big Picture
6+
7+
```mermaid
8+
graph LR
9+
TestR --> Prometheus
10+
Prometheus --> Grafana
11+
```
12+
13+
## Services
14+
15+
| Service | URL |
16+
| ------------- | --------------------- |
17+
| Grafana | http://localhost:3000 |
18+
| Prometheus | http://localhost:9090 |
19+
20+
Grafana Default credentials:
21+
- User: admin
22+
- Password: grafana
23+
24+
## Resources
25+
26+
- [OpenTelemetry .NET](https://opentelemetry.io/docs/languages/dotnet/getting-started/)
27+
- [Use OpenTelemetry with Prometheus, Grafana, and Jaeger](https://learn.microsoft.com/en-us/dotnet/core/diagnostics/observability-prgrja-example)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
services:
2+
grafana:
3+
image: grafana/grafana
4+
container_name: grafana
5+
ports:
6+
- 3000:3000
7+
restart: unless-stopped
8+
environment:
9+
- GF_SECURITY_ADMIN_USER=admin
10+
- GF_SECURITY_ADMIN_PASSWORD=grafana
11+
volumes:
12+
- ./grafana:/etc/grafana/provisioning/datasources
13+
14+
prometheus:
15+
image: prom/prometheus
16+
container_name: prometheus
17+
command:
18+
- '--config.file=/etc/prometheus/prometheus.yml'
19+
ports:
20+
- 9090:9090
21+
restart: unless-stopped
22+
volumes:
23+
- ./prometheus:/etc/prometheus
24+
- prom_data:/prometheus
25+
26+
volumes:
27+
prom_data:
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: 1
2+
3+
datasources:
4+
- name: Prometheus
5+
type: prometheus
6+
url: http://prometheus:9090
7+
isDefault: true
8+
access: proxy
9+
editable: true
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
global:
2+
scrape_interval: 15s
3+
scrape_timeout: 10s
4+
evaluation_interval: 15s
5+
alerting:
6+
alertmanagers:
7+
- static_configs:
8+
- targets: []
9+
scheme: http
10+
timeout: 10s
11+
api_version: v2
12+
scrape_configs:
13+
- job_name: prometheus
14+
honor_timestamps: true
15+
scrape_interval: 15s
16+
scrape_timeout: 10s
17+
metrics_path: /metrics
18+
scheme: http
19+
static_configs:
20+
- targets:
21+
- localhost:9090

0 commit comments

Comments
 (0)