Documentation ¶
Index ¶
- func NewClient(clientOption rueidis.ClientOption, opts ...Option) (rueidis.Client, error)
- func WithClient(client rueidis.Client, opts ...Option) rueidis.Clientdeprecated
- type HistogramOption
- type Option
- func MetricAttrs(attrs ...attribute.KeyValue) Option
- func TraceAttrs(attrs ...attribute.KeyValue) Option
- func WithDBStatement(f StatementFunc) Option
- func WithHistogramOption(histogramOption HistogramOption) Option
- func WithMeterProvider(provider metric.MeterProvider) Option
- func WithTracerProvider(provider trace.TracerProvider) Option
- type StatementFunc
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
NewClient creates a new Client. The following metrics are recorded: - rueidis_dial_attempt: number of dial attempts - rueidis_dial_success: number of successful dials - rueidis_dial_conns: number of active connections - rueidis_dial_latency: dial latency in seconds
func WithClient
deprecated
WithClient creates a new rueidis.Client with OpenTelemetry tracing enabled.
Deprecated: use NewClient() instead.
Example (OpenTelemetry) ¶
client, err := rueidis.NewClient(rueidis.ClientOption{InitAddress: []string{"127.0.0.1:6379"}}) if err != nil { panic(err) } client = WithClient(client) defer client.Close()
Output:
Types ¶
type HistogramOption ¶
type HistogramOption struct {
Buckets []float64
}
type Option ¶
type Option func(o *otelclient)
Option is the Functional Options interface
func MetricAttrs ¶
MetricAttrs set additional attributes to append to each metric.
func TraceAttrs ¶
TraceAttrs set additional attributes to append to each trace.
func WithDBStatement ¶ added in v1.0.34
func WithDBStatement(f StatementFunc) Option
WithDBStatement tells the tracing hook to add raw redis commands to db.statement attribute.
func WithHistogramOption ¶
func WithHistogramOption(histogramOption HistogramOption) Option
WithHistogramOption sets the HistogramOption. If not set, DefaultHistogramBuckets will be used.
func WithMeterProvider ¶
func WithMeterProvider(provider metric.MeterProvider) Option
WithMeterProvider sets the MeterProvider for the otelclient.
func WithTracerProvider ¶
func WithTracerProvider(provider trace.TracerProvider) Option
WithTracerProvider sets the TracerProvider for the otelclient.
type StatementFunc ¶ added in v1.0.34
StatementFunc is a the function that maps a command's tokens to a string to put in the db.statement attribute