2021-09-08 15:54:10 +03:00
|
|
|
# Example for go-redis OpenTelemetry instrumentation
|
2020-07-15 12:07:07 +03:00
|
|
|
|
2022-04-13 15:53:17 +03:00
|
|
|
See
|
2022-10-11 15:37:34 +03:00
|
|
|
[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:
|
2020-07-15 12:07:07 +03:00
|
|
|
|
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 .
|
|
|
|
```
|
|
|
|
|
2022-10-11 15:37:34 +03:00
|
|
|
[Uptrace](https://github.com/uptrace/uptrace) exporter:
|
2021-11-05 17:17:17 +03:00
|
|
|
|
|
|
|
```shell
|
2022-10-11 15:37:34 +03:00
|
|
|
UPTRACE_DSN="https://<token>@uptrace.dev/<project_id>" go run .
|
2021-11-05 17:17:17 +03:00
|
|
|
```
|
|
|
|
|
2022-10-11 15:37:34 +03:00
|
|
|
**Jaeger** exporter:
|
2021-11-05 17:17:17 +03:00
|
|
|
|
|
|
|
```shell
|
2022-10-11 15:37:34 +03:00
|
|
|
OTEL_EXPORTER_JAEGER_ENDPOINT=http://localhost:14268/api/traces go run .
|
2021-11-05 17:17:17 +03:00
|
|
|
```
|
|
|
|
|
2022-10-11 15:37:34 +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
|
|
|
|
|
2022-10-11 15:37:34 +03:00
|
|
|
- [OpenTelemetry Go instrumentations](https://uptrace.dev/opentelemetry/instrumentations/?lang=go)
|
|
|
|
- [OpenTelemetry Go Tracing API](https://uptrace.dev/opentelemetry/go-tracing.html)
|