1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Feature more prominently how to enable OpenTelemetry instrumentation (#3316)

This commit is contained in:
Nikolay Dubina
2025-03-25 15:28:25 +08:00
committed by Nedyalko Dyakov
parent b026cf813b
commit 53b3fd3e76
2 changed files with 19 additions and 0 deletions

View File

@ -29,6 +29,7 @@ Lua
MSSQL MSSQL
namespace namespace
NoSQL NoSQL
OpenTelemetry
ORM ORM
Packagist Packagist
PhpRedis PhpRedis

View File

@ -167,6 +167,24 @@ func ExampleClient() *redis.Client {
``` ```
### Instrument with OpenTelemetry
```go
import (
"github.com/redis/go-redis/v9"
"github.com/redis/go-redis/extra/redisotel/v9"
"errors"
)
func main() {
...
rdb := redis.NewClient(&redis.Options{...})
if err := errors.Join(redisotel.InstrumentTracing(rdb), redisotel.InstrumentMetrics(rdb)); err != nil {
log.Fatal(err)
}
```
### Advanced Configuration ### Advanced Configuration