fix: forward trace-related OTEL env vars to Claude Code subprocess#1195
Open
jeanleeb wants to merge 3 commits intoanthropics:mainfrom
Open
fix: forward trace-related OTEL env vars to Claude Code subprocess#1195jeanleeb wants to merge 3 commits intoanthropics:mainfrom
jeanleeb wants to merge 3 commits intoanthropics:mainfrom
Conversation
PR anthropics#886 added forwarding for metrics/logs OTEL variables but missed three variables required for trace export: - CLAUDE_CODE_ENHANCED_TELEMETRY_BETA: enables span tracing (required alongside CLAUDE_CODE_ENABLE_TELEMETRY for traces) - OTEL_TRACES_EXPORTER: selects the traces exporter (e.g. "otlp") - OTEL_LOG_TOOL_DETAILS: controls tool parameter detail in spans Without these, setting trace-related env vars in the workflow step has no effect because composite actions only forward explicitly listed vars. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The generic OTEL_EXPORTER_OTLP_ENDPOINT may not be picked up by all OTEL SDK implementations. Adding the signal-specific variants (OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, _HEADERS, _PROTOCOL) ensures traces reach the configured endpoint regardless of SDK behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
These vars control the detail level of trace spans: - OTEL_LOG_TOOL_CONTENT: includes full tool I/O in spans (truncated at 60KB) - OTEL_LOG_USER_PROMPTS: includes user prompt text in spans Without these, traces arrive but contain no meaningful content — only timing and metadata. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR #886 added forwarding for metrics/logs OTEL environment variables to the Claude Code subprocess, but missed several variables required for trace export and content detail:
Trace enablement (without these, no traces are exported):
CLAUDE_CODE_ENHANCED_TELEMETRY_BETA— required alongsideCLAUDE_CODE_ENABLE_TELEMETRYto enable span tracingOTEL_TRACES_EXPORTER— selects the traces exporter (e.g.otlp,console); without this, traces are not exported even when the endpoint is configuredSignal-specific transport (takes precedence over generic vars):
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT— trace-specific endpoint URL (e.g. MLflow requires full/v1/tracespath)OTEL_EXPORTER_OTLP_TRACES_HEADERS— trace-specific headers (e.g. experiment routing)OTEL_EXPORTER_OTLP_TRACES_PROTOCOL— trace-specific protocol overrideTrace content detail (without these, traces arrive but are empty):
OTEL_LOG_TOOL_DETAILS— tool parameters in spansOTEL_LOG_TOOL_CONTENT— full tool I/O content in spans (truncated at 60KB)OTEL_LOG_USER_PROMPTS— user prompt text in spansWithout these, setting trace-related env vars in the workflow step's
env:block has no effect because composite actions only forward explicitly listed variables (same root cause as #887).Reproduction
No traces are received at the OTLP endpoint despite all variables being set.
Changes
Added the 8 missing variables to the telemetry section of
action.ymlandbase-action/action.yml, following the same${{ env.VAR }}pattern used by existing telemetry variables.Test plan
bun testandbun run typecheckpass (no TS changes, YAML only)🤖 Generated with Claude Code