tracing

package
v1.16.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartSpanFromContext

func StartSpanFromContext(ctx context.Context, operationName string) (opentracing.Span, context.Context)

StartSpanFromContext starts a span only if there's a parent span in the context. Otherwise, it returns a noop span. To be used in places where we might not have access to the original context.

Types

type ContextRegistry

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

ContextRegistry maintains a mapping of IDs to contexts for tracing purposes. This allows us to propagate tracing context from HTTP handlers down to BoltDB transactions without persisting the context in Raft logs.

The registry is only used on the leader node where Propose() is called. Followers will not have contexts available and will use context.Background() instead.

func NewContextRegistry

func NewContextRegistry(reg prometheus.Registerer) *ContextRegistry

NewContextRegistry creates a new context registry with background cleanup.

func (*ContextRegistry) Delete

func (r *ContextRegistry) Delete(id string)

Delete removes the context for the given ID.

func (*ContextRegistry) Retrieve

func (r *ContextRegistry) Retrieve(id string) (context.Context, bool)

Retrieve gets the context for the given ID.

func (*ContextRegistry) Shutdown

func (r *ContextRegistry) Shutdown()

Shutdown stops the cleanup loop.

func (*ContextRegistry) Size

func (r *ContextRegistry) Size() int

Size returns the current number of entries in the registry. This is primarily useful for metrics and testing.

func (*ContextRegistry) Store

func (r *ContextRegistry) Store(id string, ctx context.Context)

Store saves a context for the given ID.

Jump to

Keyboard shortcuts

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