You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This guide explains how to test OpenTelemetry traces locally using OpenTelemetry, Grafana and Tempo.
4
+
5
+
*This setup is intended for local development and testing purposes only.*
6
+
7
+
## Overview
8
+
9
+
This setup enables observability for local development by capturing traces from the application and visualising them in Grafana, using Tempo as the backend.
10
+
11
+
## Prerequisites
12
+
13
+
- Docker and Docker Compose installed
14
+
- A properly configured `.env` file
15
+
16
+
## Setup Instructions
17
+
18
+
### 1. Configure environment variables
19
+
20
+
In your `.env` file, make the following changes:
21
+
22
+
- Uncomment the appropriate `OTEL_EXPORTER_OTLP_ENDPOINT` based on your operating system.
23
+
- Uncomment `OTEL_SERVICE_NAME` to enable tracing.
24
+
25
+
### 2. Start observability stack
26
+
27
+
Open a new terminal window and run:
28
+
29
+
`cd observability`
30
+
`docker compose up -d`
31
+
32
+
This starts the OpenTelemetry Collector, Grafana and Tempo containers for tracing.
33
+
34
+
### 3. Run the application
35
+
36
+
Back in the main terminal (in the root of the project), run `dotrun`
37
+
38
+
### 4. Generate traces
39
+
40
+
Interact with the application by visiting various pages such as:
41
+
42
+
- Homepage (list of charms)
43
+
- Charm pages
44
+
- Login page
45
+
- Publisher pages
46
+
47
+
These interactions will generate traces.
48
+
49
+
### 5. View traces in Grafana
50
+
51
+
Open Grafana in the browser at: http://localhost:3000
52
+
53
+
Login using the default credentials:
54
+
55
+
- Username: `admin`
56
+
- Password: `admin`
57
+
58
+
Then:
59
+
1. Go to `Explore`
60
+
2. The Tempo datasource should be selected
61
+
3. Click `Search`
62
+
4. You should see a list of trace IDs
63
+
5. Click on a trace ID to view detailed nested spans
64
+
65
+
### 6. Stop the observability stack
66
+
Once you're done testing, you can shut down the containers:
0 commit comments