Categorygithub.com/valkey-io/valkey-go/valkeyotel
modulepackage
1.0.51
Repository: https://github.com/valkey-io/valkey-go.git
Documentation: pkg.go.dev

# README

OpenTelemetry Tracing & Connection Metrics

Use valkeyotel.NewClient to create a client with OpenTelemetry Tracing and Connection Metrics enabled. Builtin connection metrics are:

  • valkey_dial_attempt: number of dial attempts
  • valkey_dial_success: number of successful dials
  • valkey_dial_conns: number of connections
  • valkey_dial_latency: dial latency in seconds

Client side caching metrics:

  • valkey_do_cache_miss: number of cache miss on client side
  • valkey_do_cache_hits: number of cache hits on client side
package main

import (
    "github.com/valkey-io/valkey-go"
    "github.com/valkey-io/valkey-go/valkeyotel"
)

func main() {
    client, err := valkeyotel.NewClient(valkey.ClientOption{InitAddress: []string{"127.0.0.1:6379"}})
    if err != nil {
        panic(err)
    }
    defer client.Close()
}

See valkeyhook if you want more customizations.

Note: valkeyotel.NewClient is not supported on go1.18 and go1.19 builds. Reference

# Functions

MetricAttrs set additional attributes to append to each metric.
NewClient creates a new Client.
TraceAttrs set additional attributes to append to each trace.
WithClient creates a new valkey.Client with OpenTelemetry tracing enabled.
WithDBStatement tells the tracing hook to add raw valkey commands to db.statement attribute.
WithHistogramOption sets the HistogramOption.
WithMeterProvider sets the MeterProvider for the otelclient.
WithTracerProvider sets the TracerProvider for the otelclient.

# Structs

No description provided by the author

# Type aliases

Option is the Functional Options interface.
StatementFunc is a the function that maps a command's tokens to a string to put in the db.statement attribute.