claude-code - 💡(How to fix) Fix OTEL per-request events not emitted on Microsoft Foundry (CLI, v2.1.126) [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#55984Fetched 2026-05-05 06:01:10
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×4
RAW_BUFFERClick to expand / collapse

Environment

  • Claude Code 2.1.126
  • macOS, terminal CLI (iTerm.app)
  • CLAUDE_CODE_USE_FOUNDRY=1 with ANTHROPIC_FOUNDRY_BASE_URL and ANTHROPIC_FOUNDRY_API_KEY set
  • CLAUDE_CODE_ENABLE_TELEMETRY=1, OTEL_*_EXPORTER=otlp, OTLP/HTTP endpoint configured and verified working

Steps to reproduce

  1. Configure CLAUDE_CODE_USE_FOUNDRY=1 + ANTHROPIC_FOUNDRY_BASE_URL + ANTHROPIC_FOUNDRY_API_KEY.
  2. Configure standard OTEL OTLP export to a working collector.
  3. Launch claude from a terminal and issue several prompts.
  4. Inspect the collector.

Expected

Per-request OTEL events emit on Foundry.

Actual

The following events did not emit during 2.5 hours of active Foundry use:

  • claude_code.api_request
  • claude_code.api_error
  • claude_code.cost.usage
  • claude_code.token.usage
  • claude_code.tool_decision
  • claude_code.tool_result
  • claude_code.skill_activated

The following events did emit normally:

  • claude_code.session.count
  • claude_code.active_time.total
  • claude_code.mcp_server_connection
  • claude_code.user_prompt
  • claude_code.hook_execution_complete

Comparison (same user, same OTEL config)

Window (UTC)Providerapi_requestcost.usagetoken.usage
07:12 – 07:44Anthropic API42yesyes
08:14 – 10:42Foundry000
10:43 – 10:59Anthropic API3yesyes

Removing the Foundry env vars restored the full event stream within minutes.

extent analysis

TL;DR

The issue is likely related to the integration with Foundry, and removing the Foundry environment variables restores the full event stream, suggesting a configuration or compatibility issue.

Guidance

  • Verify that the ANTHROPIC_FOUNDRY_BASE_URL and ANTHROPIC_FOUNDRY_API_KEY are correctly set and valid for the Foundry environment.
  • Check the Claude Code documentation for any specific requirements or limitations for using Foundry with OTEL OTLP export.
  • Investigate potential differences in how Claude Code handles API requests and events between the Anthropic API and Foundry providers.
  • Review the OTLP collector logs for any errors or warnings related to the Foundry events.

Example

No code snippet is provided as the issue seems to be related to configuration and environment variables.

Notes

The issue may be specific to the combination of Claude Code version 2.1.126, Foundry, and OTEL OTLP export. Further investigation is needed to determine the root cause.

Recommendation

Apply workaround: Remove the Foundry environment variables to restore the full event stream, and then re-add them one by one to identify the specific variable causing the issue. This will help to isolate the problem and potentially identify a configuration or compatibility issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix OTEL per-request events not emitted on Microsoft Foundry (CLI, v2.1.126) [1 participants]