otelstore

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package otelstore instruments any storage.Adapter with OpenTelemetry.

It wraps the transaction seam rather than any one implementation, so a third-party adapter gets the same timings as sqlitestore without writing them itself, and so the numbers mean the same thing across adapters: everything the caller waited for, including whatever the adapter did internally to serve the request.

It lives in its own package so that storage, which every adapter implementation imports, stays free of the OpenTelemetry dependency.

store, err := sqlitestore.Open(path)
…
instrumented, err := otelstore.Wrap(store)
…
srv, err := server.New(instrumented, …)

Wrap once, at the root. A Manager partitions the root adapter per app with prefixstore, which forwards to what it wraps, so one call at the root instruments every app — wrapping again per app would double-count.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wrap

func Wrap(inner storage.Adapter, opts ...Option) (storage.Adapter, error)

Wrap returns inner instrumented with transaction spans and timings.

Wrap does not take ownership: Close forwards to inner, exactly as every other method does, so the usual "the caller closes the store" rule is unchanged.

Types

type Option

type Option func(*config)

Option configures Wrap.

func WithMeterProvider

func WithMeterProvider(mp metric.MeterProvider) Option

WithMeterProvider sets the meter provider (default: the global one, no-op until an SDK is installed).

func WithTracerProvider

func WithTracerProvider(tp trace.TracerProvider) Option

WithTracerProvider sets the tracer provider (default: the global one, no-op until an SDK is installed).

Jump to

Keyboard shortcuts

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