Context API Reference¶
Request-scoped context and correlation IDs.
Request-scoped context for correlation IDs and metadata.
RequestContext
dataclass
¶
Per-request context propagated through middleware and handlers.
Source code in src/istos/context.py
token
property
¶
The auth token from the request attachment (envelope-aware).
RequestEnvelope
dataclass
¶
Auth token (+ optional correlation/trace) carried in the Zenoh attachment.
A bare UTF-8 string is still just a token — old clients keep working. When
you also need correlation_id or traceparent, we send compact JSON::
{"tok": "...", "cid": "...", "tp": "..."}
Source code in src/istos/context.py
get_request_context()
¶
Return the current request context, creating one if absent.
peek_request_context()
¶
Return the active request context without creating one.
Used by outbound calls to propagate metadata (correlation_id, traceparent) only when they originate inside a request — a root call carries nothing.