1
0
mirror of https://github.com/redis/go-redis.git synced 2025-04-17 20:17:02 +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 GitHub
parent 132818033b
commit 482a20d9c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 0 deletions

View File

@ -29,6 +29,7 @@ Lua
MSSQL
namespace
NoSQL
OpenTelemetry
ORM
Packagist
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