Documentation
¶
Overview ¶
Package tracing wraps cache backends that talk to remote systems with OpenTelemetry spans. In-memory backends are not wrapped: a span per nanosecond-scale operation costs orders of magnitude more than the operation itself.
Spans never carry a cache key verbatim. Callers routinely build keys from bearer credentials — session ids that are the login cookie's own value, MFA challenge ids, password-reset tokens — so exporting the key would stream live credentials to whatever collects traces, where they are readable by anyone with access to it and replayable until they expire. Each span instead carries the key's namespace, which says which cache domain was touched, and a truncated digest, which lets the same key be correlated across spans without being reversible. Everything a cache span is normally read for survives that substitution.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Wrapper ¶
type Wrapper[T any] struct { // contains filtered or unexported fields }
Wrapper decorates a Cache implementation with distributed tracing. It is stateless: the caller context of each operation parents its span, and when tracing is disabled every operation forwards to the wrapped cache directly.
func NewWrapper ¶
NewWrapper creates a new tracing wrapper for the given cache.