telemetry

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExporterInvalid uint8 = iota
	ExporterPrometheus
	ExporterJaeger
	ExporterOTLP
	ExporterStdout
)

Variables

View Source
var KeyEndpoint = attribute.Key(keyPrefix + "endpoint")
View Source
var KeyOrigin = attribute.Key(keyPrefix + "origin")

Functions

func InitExporter

func InitExporter(ctx context.Context, opts *Options, memStore *cache.MemoryStore, logEntry *logrus.Entry) error

InitExporter initialises configured metrics and/or trace exporter.

func NewSpanFromContext

func NewSpanFromContext(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)

Types

type ActiveKeyCounter added in v1.14.0

type ActiveKeyCounter interface {
	Name() string
	ActiveKeyCount() int
}

ActiveKeyCounter is implemented by rate limiters to report their active key count.

type ErrorHandleFunc

type ErrorHandleFunc func(error)

func (ErrorHandleFunc) Handle

func (f ErrorHandleFunc) Handle(err error)

type InstrumentedRoundTripper added in v1.14.0

type InstrumentedRoundTripper struct {
	// contains filtered or unexported fields
}

InstrumentedRoundTripper wraps an http.RoundTripper with OpenTelemetry tracing and metrics. It creates a CLIENT span for each outgoing request, injects the trace context (traceparent) into request headers, records span attributes and metrics.

func NewInstrumentedRoundTripper added in v1.14.0

func NewInstrumentedRoundTripper(next http.RoundTripper) *InstrumentedRoundTripper

NewInstrumentedRoundTripper wraps the given RoundTripper with tracing and metrics instrumentation.

func (*InstrumentedRoundTripper) RoundTrip added in v1.14.0

func (t *InstrumentedRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

type MetricsServer

type MetricsServer struct {
	// contains filtered or unexported fields
}

func NewMetricsServer

func NewMetricsServer(log *logrus.Entry, registry *WrappedRegistry, port int) *MetricsServer

func (*MetricsServer) Close

func (m *MetricsServer) Close() error

func (*MetricsServer) ListenAndServe

func (m *MetricsServer) ListenAndServe()

type Options

type Options struct {
	Metrics              bool
	MetricsCollectPeriod time.Duration // internal collect for pusher configuration
	MetricsEndpoint      string
	MetricsExporter      string
	MetricsPort          int
	ServiceName          string
	Traces               bool
	TracesEndpoint       string
}

type WrappedRegistry

type WrappedRegistry struct {
	// contains filtered or unexported fields
}

func NewWrappedRegistry

func NewWrappedRegistry(promRegistry *prom.Registry, labels ...*dto.LabelPair) *WrappedRegistry

func (*WrappedRegistry) Gather

func (wr *WrappedRegistry) Gather() ([]*dto.MetricFamily, error)

func (*WrappedRegistry) MustRegister

func (wr *WrappedRegistry) MustRegister(collector ...prom.Collector)

func (*WrappedRegistry) Register

func (wr *WrappedRegistry) Register(collector prom.Collector) error

func (*WrappedRegistry) Unregister

func (wr *WrappedRegistry) Unregister(collector prom.Collector) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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