Skip to content

feat(observability): make streamed output export to trace span attributes opt-in #66

@coderabbitai

Description

@coderabbitai

Background

When a chat completion request is streamed, the handler currently exports the full collected output messages and tool-call arguments to trace span attributes unconditionally via output_collector.output_message_span_properties() (called in both the error path and the normal stream-end path of handle_stream_request in src/proxy/handlers/chat_completions/mod.rs).

Problem

Exporting full model output content (including tool-call arguments and assistant message text) into tracing storage by default may leak sensitive user/model content to trace backends (e.g., Jaeger, OTLP collectors). Not all deployments want or should have this data stored in their observability infrastructure.

Proposed Solution

  • Add a configuration flag (e.g., observability.trace.export_content or similar) that controls whether message/tool-call content is included in span attributes.
  • Gate the span.add_properties(|| output_collector.output_message_span_properties()) calls behind this flag — disabled by default (opt-in).
  • Optionally, provide a redaction/truncation mode (e.g., truncate to N characters) as an alternative to full suppression.
  • Apply the same gating to both call sites (stream-error path and stream-end path).

References

/cc @bzp2010

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions