fix: rename OTEL cache attrs to avoid Sentry PII scrubber#3504
Conversation
Sentry's data scrubbing redacts any attribute containing 'token' in the name (assumes it's a secret). Rename to avoid the scrubber: - awf.cache_read_tokens → awf.cached_read - awf.cache_write_tokens → awf.cached_write - awf.reasoning_tokens → awf.reasoning Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
There was a problem hiding this comment.
Pull request overview
This PR updates the api-proxy’s OpenTelemetry (OTEL) token-usage attribute names to avoid Sentry’s PII scrubber redacting values for any attribute key containing "token", while keeping the emitted values as strings for Sentry compatibility.
Changes:
- Renamed OTEL span/event attributes from
awf.*_tokenstoawf.cached_*andawf.reasoning. - Updated the OTEL unit test expectations to use the new cache attribute keys.
Show a summary per file
| File | Description |
|---|---|
| containers/api-proxy/otel.js | Renames emitted OTEL attribute keys for cache/reasoning usage to avoid Sentry redaction. |
| containers/api-proxy/otel.test.js | Updates assertions to validate the renamed cache attribute keys. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 3
| // Cache and reasoning as strings — avoid "token" in name (Sentry PII scrubber redacts it) | ||
| 'awf.cached_read': String(normalizedUsage.cache_read_tokens), | ||
| 'awf.cached_write': String(normalizedUsage.cache_write_tokens), | ||
| 'awf.reasoning': String(normalizedUsage.reasoning_tokens || 0), |
| expect(s.attributes['awf.cache_read_tokens']).toBe('200'); | ||
| expect(s.attributes['awf.cache_write_tokens']).toBe('50'); | ||
| expect(s.attributes['awf.cached_read']).toBe('200'); | ||
| expect(s.attributes['awf.cached_write']).toBe('50'); |
| const usageEvent = s.events.find(e => e.name === 'gen_ai.usage'); | ||
| expect(usageEvent).toBeDefined(); | ||
| expect(usageEvent.attributes['gen_ai.usage.input_tokens']).toBe(1000); | ||
| expect(usageEvent.attributes['gen_ai.usage.output_tokens']).toBe(500); | ||
| expect(usageEvent.attributes['awf.cache_read_tokens']).toBe('200'); | ||
| expect(usageEvent.attributes['awf.cache_write_tokens']).toBe('50'); | ||
| expect(usageEvent.attributes['awf.cached_read']).toBe('200'); | ||
| expect(usageEvent.attributes['awf.cached_write']).toBe('50'); |
|
✅ GitHub API: Confirmed 2 PR entries in recent-prs.json Result: PASS ✅ All smoke tests passed.
|
🔬 Smoke Test Results
Overall: FAIL — Pre-step outputs ( PR by @lpcox · reviewer:
|
🧪 Smoke Test: Copilot BYOK (Offline) Mode
Running in BYOK offline mode ( PR: fix: rename OTEL cache attrs to avoid Sentry PII scrubber by @lpcox Overall: PARTIAL (pre-step outputs not injected into prompt)
|
This comment has been minimized.
This comment has been minimized.
🔍 Smoke Test: API Proxy OpenTelemetry Tracing
All scenarios pass. OTEL integration is complete and working correctly.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Smoke Test Results
Overall: FAIL — Service containers are not reachable from this environment.
|
|
Smoke Test FAIL: connectivity 000, mcpscripts missing. Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "localhost"See Network Configuration for more information.
|
Chroot Smoke Test Results
Result: ❌ Not all tests passed — Python and Node.js versions differ between host and chroot.
|
|
Smoke test Codex: FAIL Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "registry.npmjs.org"See Network Configuration for more information.
|
Sentry's data scrubbing redacts values for any attribute with 'token' in the name (assumes it's a credential). Renamed:
awf.cache_read_tokens→awf.cached_readawf.cache_write_tokens→awf.cached_writeawf.reasoning_tokens→awf.reasoningValues are still emitted as strings (Sentry drops unknown numeric custom attributes).