redisotel

package module
v9.0.0-...-9c969f2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2023 License: BSD-2-Clause Imports: 17 Imported by: 1

README

OpenTelemetry instrumentation for go-redis

Installation

go get github.com/wgqi1126/go-redis/extra/redisotel/v9

Usage

Tracing is enabled by adding a hook:

import (
    "github.com/wgqi1126/go-redis/v9"
    "github.com/wgqi1126/go-redis/extra/redisotel/v9"
)

rdb := rdb.NewClient(&rdb.Options{...})

rdb.AddHook(redisotel.NewTracingHook())

See example and Monitoring Go Redis Performance and Errors for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstrumentMetrics

func InstrumentMetrics(rdb redis.UniversalClient, opts ...MetricsOption) error

InstrumentMetrics starts reporting OpenTelemetry Metrics.

Based on https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/semantic_conventions/database-metrics.md

func InstrumentTracing

func InstrumentTracing(rdb redis.UniversalClient, opts ...TracingOption) error

Types

type MetricsOption

type MetricsOption interface {
	// contains filtered or unexported methods
}

func WithMeterProvider

func WithMeterProvider(mp metric.MeterProvider) MetricsOption

WithMeterProvider configures a metric.Meter used to create instruments.

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithAttributes

func WithAttributes(attrs ...attribute.KeyValue) Option

WithAttributes specifies additional attributes to be added to the span.

func WithDBSystem

func WithDBSystem(dbSystem string) Option

type TracingOption

type TracingOption interface {
	// contains filtered or unexported methods
}

func WithDBStatement

func WithDBStatement(on bool) TracingOption

WithDBStatement tells the tracing hook not to log raw redis commands.

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) TracingOption

WithTracerProvider specifies a tracer provider to use for creating a tracer. If none is specified, the global provider is used.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL