Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SpanError ¶
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 ¶
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]