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
feat: Add open telemetry metrics and traces (#3404)
## Relevant issue(s)
Resolves#293Resolves#74
## Description
This PR adds OpenTelemetry metrics and tracing. Telemetry is only
enabled if the `telemetry` build flag is set.
Our default telemetry configuration uses the `http` exporter, but we can
expand it to `grpc` and `console` if needed.
The exporters are configured through the standardized OpenTelemetry
environment variables found here:
https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttphttps://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp
## Tasks
- [x] I made sure the code is well commented, particularly
hard-to-understand areas.
- [x] I made sure the repository-held documentation is changed
accordingly.
- [x] I made sure the pull request title adheres to the conventional
commit style (the subset used in the project can be found in
[tools/configs/chglog/config.yml](tools/configs/chglog/config.yml)).
- [x] I made sure to discuss its limitations such as threats to
validity, vulnerability to mistake and misuse, robustness to
invalidation of assumptions, resource requirements, ...
## How has this been tested?
Manually testing with Jaeger
```
docker run --rm --name jaeger \
-p 16686:16686 \
-p 4317:4317 \
-p 4318:4318 \
-p 5778:5778 \
-p 9411:9411 \
jaegertracing/jaeger:2.2.0
```
```
DEFRA_KEYRING_SECRET=secret \
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 \
go run -tags telemetry ./cmd/defradb start
```
> Trace dashboard

> Detailed trace example

> Nested trace example

Specify the platform(s) on which this was tested:
- MacOS
Copy file name to clipboardExpand all lines: README.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,7 @@ Read the documentation on [docs.source.network](https://docs.source.network/).
34
34
*[Access Control System](#access-control-system)
35
35
*[Supporting CORS](#supporting-cors)
36
36
*[Backing up and restoring](#backing-up-and-restoring)
37
+
*[Telemetry](#telemetry)
37
38
*[Community](#community)
38
39
*[Licensing](#licensing)
39
40
*[Contributors](#contributors)
@@ -473,6 +474,14 @@ To restore the data, run the following command:
473
474
defradb client backup import path/to/backup.json
474
475
```
475
476
477
+
## Telemetry
478
+
479
+
DefraDB has no telemetry reporting by default. To enable OpenTelemetry in DefraDB you must build with the `telemetry` tag set. To configure the HTTP exporters use the environment variables in the links below.
Discuss on [Discord](https://discord.gg/w7jYQVJ) or [Github Discussions](https://github.com/sourcenetwork/defradb/discussions). The Source project is on [Twitter](https://twitter.com/sourcenetwrk).
0 commit comments