serveridentity

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SpanError

func SpanError(span trace.Span, err error, msg string)

spanError records an error on the span and sets its status to Error. If err is nil, only the status message is set.

func SpanSetStatusCode

func SpanSetStatusCode(span trace.Span, code int)

spanSetStatusCode sets the http.response.status_code attribute on the span.

Types

type Instrumentation

type Instrumentation struct {
	Verbose bool // useful for guarding expensive log calls
	// contains filtered or unexported fields
}

Instrumentation provides reusable logging and span annotations for token flows.

func NewInstrumentation

func NewInstrumentation(ctx context.Context) Instrumentation

NewInstrumentation creates an instrumentation instance from the context's logger and span.

func (*Instrumentation) AddEvent

func (o *Instrumentation) AddEvent(name string, attrs ...attribute.KeyValue)

AddEvent records a span event if the span is recording.

func (*Instrumentation) LogDebug

func (o *Instrumentation) LogDebug(msg string, keysAndValues ...any)

LogDebug emits a V(2) structured log. Callers should guard with Verbose to avoid allocations.

func (*Instrumentation) ManagerHooks

func (o *Instrumentation) ManagerHooks() *manager.Hooks

ManagerHooks returns cache manager hooks wired to this instrumentation.

func (*Instrumentation) RecordError

func (o *Instrumentation) RecordError(err error, attrs ...attribute.KeyValue)

RecordError records an error on the span and logs at Error level.

type TokenCache

type TokenCache[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewTokenCache

func NewTokenCache[K comparable, V any](ctx context.Context, size int, expiryBuffer, cleanUpInterval time.Duration) *TokenCache[K, V]

func (*TokenCache[K, V]) Get

func (c *TokenCache[K, V]) Get(_ context.Context, key K) (V, bool)

func (*TokenCache[K, V]) Set

func (c *TokenCache[K, V]) Set(_ context.Context, key K, value V, ttl time.Duration)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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