Skip to content

fix: flatten OTEL cache attribute names for Sentry compatibility#3492

Merged
lpcox merged 1 commit into
mainfrom
fix/otel-flatten-cache-attrs
May 21, 2026
Merged

fix: flatten OTEL cache attribute names for Sentry compatibility#3492
lpcox merged 1 commit into
mainfrom
fix/otel-flatten-cache-attrs

Conversation

@lpcox
Copy link
Copy Markdown
Collaborator

@lpcox lpcox commented May 21, 2026

Sentry's OTLP ingestion drops span attributes with deeply nested dot notation (4+ segments). This flattens cache/reasoning attribute names so they appear in Sentry.

  • gen_ai.usage.cache_read.input_tokensgen_ai.usage.cache_read_input_tokens
  • gen_ai.usage.cache_creation.input_tokensgen_ai.usage.cache_creation_input_tokens
  • gen_ai.usage.reasoning.output_tokensgen_ai.usage.reasoning_output_tokens

Tests: 32/32 pass

Copilot AI review requested due to automatic review settings May 21, 2026 00:26
Sentry's OTLP ingestion drops attributes with deeply nested dot notation
(4+ segments). Flatten cache and reasoning token attribute names:

- gen_ai.usage.cache_read.input_tokens → gen_ai.usage.cache_read_input_tokens
- gen_ai.usage.cache_creation.input_tokens → gen_ai.usage.cache_creation_input_tokens
- gen_ai.usage.reasoning.output_tokens → gen_ai.usage.reasoning_output_tokens

The 3-segment names (gen_ai.usage.input_tokens, gen_ai.usage.output_tokens)
continue to work fine.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lpcox lpcox force-pushed the fix/otel-flatten-cache-attrs branch from 7d88866 to b78e7dc Compare May 21, 2026 00:26
@lpcox lpcox merged commit 930f66b into main May 21, 2026
14 checks passed
@lpcox lpcox deleted the fix/otel-flatten-cache-attrs branch May 21, 2026 00:26
@github-actions
Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 95.75% 95.83% 📈 +0.08%
Statements 95.58% 95.65% 📈 +0.07%
Functions 96.88% 96.88% ➡️ +0.00%
Branches 89.30% 89.34% 📈 +0.04%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/config-writer.ts 83.0% → 85.6% (+2.54%) 83.0% → 85.6% (+2.54%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@github-actions
Copy link
Copy Markdown
Contributor

Smoke Test Results

✅ GitHub API: 2 PR entries confirmed in recent-prs.json
✅ Playwright: GitHub homepage title contains "GitHub"
✅ File verify: smoke-test-claude-26197951962.txt exists

PASS — All smoke tests passed.

💥 [THE END] — Illustrated by Smoke Claude

@github-actions
Copy link
Copy Markdown
Contributor

🤖 Copilot Smoke Test Results

Test Result
GitHub MCP ✅ PR fetched: "fix: flatten OTEL cache attribute names for Sentry compatibility"
GitHub.com connectivity ✅ Reachable
File write/read /tmp/gh-aw/agent/smoke-test-copilot-26197951896.txt confirmed

Overall: PASS

Author: @lpcox

📰 BREAKING: Report filed by Smoke Copilot

@github-actions
Copy link
Copy Markdown
Contributor

🔥 Smoke Test: Copilot BYOK (Offline) Mode

Test Result
GitHub MCP connectivity ✅ PR listed successfully
GitHub.com HTTP ⚠️ Template vars unexpanded (${{ steps.smoke-data.outputs.SMOKE_HTTP_CODE }})
File write/read ⚠️ Template vars unexpanded (${{ steps.smoke-data.outputs.SMOKE_FILE_PATH }})
BYOK inference (api-proxy → api.githubcopilot.com) ✅ Responding via BYOK offline mode

Running in BYOK offline mode (COPILOT_OFFLINE=true) via api-proxy → api.githubcopilot.com.

PR by @lpcox · reviewer: @Copilot

Overall: PARTIAL — BYOK inference ✅, but smoke-data template variables were not expanded (workflow config issue).

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions
Copy link
Copy Markdown
Contributor

GitHub PR review ✅ fix: flatten OTEL cache attribute names for Sentry compatibility; fix: align OTEL attributes with gen_ai semconv spec
Safe Inputs GH CLI ❌ safeinputs-gh missing
Playwright ✅ title contains GitHub
Tavily search ❌ no Tavily tools available
File/Bash ✅ smoke-test-codex-26197951797.txt verified
Discussion interaction ❌ github-discussion-query missing
Build AWF ✅ npm ci && npm run build
Overall status: FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • registry.npmjs.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "registry.npmjs.org"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex

@github-actions
Copy link
Copy Markdown
Contributor

Smoke Test: API Proxy OpenTelemetry Tracing

Scenario Status Notes
1. Module Loading otel.js loads successfully; exports: startRequestSpan, setTokenAttributes, endSpan, endSpanError, shutdown, isEnabled
2. Test Suite 32/32 tests passed in otel.test.js — span creation, token attributes, parent context, error handling, OTLP export, file fallback
3. Env Var Forwarding src/services/api-proxy-service.ts forwards OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, OTEL_SERVICE_NAME, GITHUB_AW_OTEL_TRACE_ID, GITHUB_AW_OTEL_PARENT_SPAN_ID
4. Token Tracker Integration onUsage callback exists in token-tracker-http.js (line 232) as the OTEL hook point
5. OTEL Diagnostics isEnabled() returns true; graceful file fallback to /var/log/api-proxy/otel.jsonl when OTLP endpoint unset

All 5 scenarios passed. OTEL tracing integration is fully functional.

📡 OTel tracing validated by Smoke OTel Tracing

@github-actions
Copy link
Copy Markdown
Contributor

Chroot Version Comparison

Runtime Host Version Chroot Version Match?
Python Python 3.12.13 Python 3.12.3
Node.js v24.15.0 v20.20.2
Go go1.22.12 go1.22.12

Result: Not all tests passed — Python and Node.js versions differ between host and chroot.

Tested by Smoke Chroot

@github-actions
Copy link
Copy Markdown
Contributor

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia 1/1 passed ✅ PASS
Bun hono 1/1 passed ✅ PASS
C++ fmt N/A ✅ PASS
C++ json N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world N/A ✅ PASS
.NET json-parse N/A ✅ PASS
Go color 1/1 passed ✅ PASS
Go env 1/1 passed ✅ PASS
Go uuid 1/1 passed ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx passed ✅ PASS
Node.js execa passed ✅ PASS
Node.js p-limit passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — ✅ PASS

Generated by Build Test Suite for issue #3492 · ● 5.4M ·

@github-actions
Copy link
Copy Markdown
Contributor

Smoke Test Results

  • Redis PING: ❌ (timeout — no response on host.docker.internal:6379)
  • PostgreSQL pg_isready: ❌ (no response on host.docker.internal:5432)
  • PostgreSQL SELECT 1: ❌ (skipped — pg_isready failed)

Overall: FAIL — service containers unreachable via host.docker.internal.

🔌 Service connectivity validated by Smoke Services

@github-actions
Copy link
Copy Markdown
Contributor

Gemini Smoke Test Results - FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • localhost

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "localhost"

See Network Configuration for more information.

💎 Faceted by Smoke Gemini

@lpcox lpcox review requested due to automatic review settings May 21, 2026 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant