Skip to content

feat: add trace content config#588

Merged
yaozheng-fang merged 1 commit into
volcengine:mainfrom
feng-95:feat/traceContent
Jun 9, 2026
Merged

feat: add trace content config#588
yaozheng-fang merged 1 commit into
volcengine:mainfrom
feng-95:feat/traceContent

Conversation

@feng-95

@feng-95 feng-95 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Feature: Add Trace Content Collection Config

Overview

This PR adds a VeADK tracing content collection switch. It allows users to disable input/output content collection for Agent, LLM, and tool calls while still keeping non-content trace data, such as span structure, model parameters, token usage, tool name, and latency.

Config example:

observability:
  opentelemetry:
    trace_content: false

Environment variable override:

OBSERVABILITY_OPENTELEMETRY_TRACE_CONTENT=false

Changes

Configuration

  • Added OpenTelemetryConfig.trace_content, defaulting to true
  • Reused the existing VeADK configuration flow
  • Supports the unified priority order across system env vars, .env, and config.yaml

Tracing

  • Added should_trace_content() as the centralized content tracing switch
  • Added content attribute filtering in the attributes layer for LLM and tool spans
  • Agent root span input/output content now follows the same config
  • When disabled, LLM prompts, completions, messages, choices, and tool input/output are no longer added to spans

Metrics / Exporter

  • APMPlus tool metrics skip tool token usage when gen_ai.tool.input/output is not present
  • Non-content metrics such as span latency, tool name, and tool type are still preserved
  • Avoids reading tool arguments or responses from the exporter when content tracing is disabled

Documentation

  • Updated config.yaml.full
  • Updated Chinese and English configuration docs, tracing docs, observability overview, and span attributes docs

Test

  • ./.venv/bin/python -m pytest -q -p no:rerunfailures tests/test_tracing_content.py tests/test_tracing.py
  • git diff --check

Covered scenarios:

  • Content tracing is enabled by default
  • Content tracing can be disabled through config or environment variables
  • LLM, tool, and Agent root spans all skip input/output content when disabled
  • Context override can temporarily enable content tracing
  • APMPlus skips tool token usage when tool input/output content is missing, while keeping non-content metrics

@yaozheng-fang yaozheng-fang merged commit 7ef3b8f into volcengine:main Jun 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants