redis/example/otel/README.md

41 lines
1.0 KiB
Markdown
Raw Normal View History

2021-09-08 15:54:10 +03:00
# Example for go-redis OpenTelemetry instrumentation
2022-04-13 15:53:17 +03:00
See
[Monitoring Go Redis Performance and Errors](https://redis.uptrace.dev/guide/go-redis-monitoring.html)
2022-04-13 15:53:17 +03:00
for details.
2021-11-05 17:17:17 +03:00
This example requires Redis Server on port `:6379`. You can start Redis Server using Docker:
2021-09-08 15:54:10 +03:00
```shell
docker-compose up -d
```
2021-11-05 17:17:17 +03:00
You can run this example with different OpenTelemetry exporters by providing environment variables.
**Stdout** exporter (default):
2021-09-08 15:54:10 +03:00
```shell
go run .
```
[Uptrace](https://github.com/uptrace/uptrace) exporter:
2021-11-05 17:17:17 +03:00
```shell
UPTRACE_DSN="https://<token>@uptrace.dev/<project_id>" go run .
2021-11-05 17:17:17 +03:00
```
**Jaeger** exporter:
2021-11-05 17:17:17 +03:00
```shell
OTEL_EXPORTER_JAEGER_ENDPOINT=http://localhost:14268/api/traces go run .
2021-11-05 17:17:17 +03:00
```
To instrument Redis Cluster client, see
[go-redis-cluster](https://github.com/uptrace/opentelemetry-go-extra/tree/main/example/go-redis-cluster)
example.
2021-11-05 17:17:17 +03:00
## Links
- [OpenTelemetry Go instrumentations](https://uptrace.dev/opentelemetry/instrumentations/?lang=go)
- [OpenTelemetry Go Tracing API](https://uptrace.dev/opentelemetry/go-tracing.html)