Documentation
¶
Overview ¶
Package spanattr carries request-scoped span attributes — tenant, user, feature flag, request ID — on a context.Context, so every span started under that ctx (agent run, iteration, chat, execute_tool, sub-agent runs) can be stamped with them without threading values through each instrumentation layer.
Set them once at the request boundary:
ctx = spanattr.With(ctx,
attribute.String("tenant.id", tenantID),
attribute.String("enduser.id", userID))
for ev := range loop.RunText(ctx, sessionKey, input) { ... }
The stamping itself is done by the span processor otelsetup installs; this package imports only the OpenTelemetry attribute API and stays free for library consumers.
Attributes are in-process only — unlike W3C Baggage they are never written to outbound headers, so identifiers cannot leak to downstream services. They land on spans, never on metrics: per-tenant or per-user metric labels would make series cardinality unbounded.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func From ¶
From returns the attributes carried on ctx, or nil. Callers must not modify the returned slice.
Types ¶
This section is empty.