symfonic.services.observability.trace_policy¶
trace_policy ¶
Tracing policy: metadata by default, content only by explicit consent.
TraceMode ¶
Bases: StrEnum
How much diagnostic information may leave the process.
TracePolicy
dataclass
¶
TracePolicy(mode: TraceMode = TraceMode.METADATA, sample_rate: float = 1.0, failed_turns_always: bool = True, content_ttl_hours: int = 24, max_artifact_bytes: int = 262144)
One deployment's tracing, sampling and content-retention contract.
from_config
classmethod
¶
Build from modern trace_* fields, then legacy OTEL flags.
Source code in src/symfonic/services/observability/trace_policy.py
redact_trace_value ¶
Recursively redact credentials and bound strings before export.
The result is JSON-shaped. Unknown objects are represented by their type,
never by repr: a repr is allowed to contain precisely the secret the
redactor is meant to keep out of the collector.
Source code in src/symfonic/services/observability/trace_policy.py
strip_trace_reasoning ¶
Recursively remove provider reasoning blocks before trace export.
Provider history can carry reasoning under nested content blocks or additional metadata. Redaction is not sufficient: raw chain-of-thought is data the tracing contract never collects, even in content mode.
Source code in src/symfonic/services/observability/trace_policy.py
trace_has_reasoning ¶
Whether a trace-shaped value contains reasoning rather than metadata.