Repository navigation
chore: remove dead FORCE_DOUBLE_KEYS logic from OTLP HTTP exporter - #2334
Conversation
|
1763006 to
aba2976
Compare
| if (SimpleOTLPHttpLogExporter.FORCE_DOUBLE_KEYS.has(leafKey)) { | ||
| return { doubleValue: value }; | ||
| } | ||
| return Number.isInteger(value) ? { intValue: String(value) } : { doubleValue: value }; |
There was a problem hiding this comment.
🟡 Integer metrics change wire types
When public callers submit integer-valued metrics under the seven camelCase keys, convertValue now emits integers instead of doubles. OTLP backends can reject them or split those metrics across incompatible types.
Prompt for agents
Restore stable double encoding for the seven camelCase metric keys accepted by SimpleOTLPHttpLogExporter. The class and SimpleLogRecord are exported from agents/src/telemetry/index.ts, so downstream callers can supply these keys even though current internal chat-item serialization uses snake_case. The fix must preserve key context through resource, scope, record, array, object, and toJSON conversion paths, or replace that mechanism with an equivalent normalization that keeps these established attributes as OTLP doubleValue when their numeric value is an integer. Add a public-exporter regression test covering direct and nested integer-valued attributes.
Was this helpful? React with 👍 or 👎 to provide feedback.
|
Closing this pull request because it has had no human activity in 43 days (since 2026-08-24) and was opened 43 days ago. Detail closes its pull requests once they are more than 30 days old and have had no human activity for 14 days. If this change is still useful, reopen the pull request and Detail won't close it again. To keep a Detail pull request open, add the |
Description
Removed the unused
FORCE_DOUBLE_KEYSprivate static set, the leaf-key lookup branch insideconvertValue's number handler, and the now-vestigialpathparameter that was threaded throughconvertValuesolely to feed that lookup.Why it was dead
FORCE_DOUBLE_KEYSheld camelCase metric keys (transcriptConfidence,transcriptionDelay,endOfTurnDelay,onUserTurnCompletedDelay,llmNodeTtft,ttsNodeTtfb,e2eLatency). The only production path that ever produced those keys was the hand-rolledchatItemToProto()intraces.ts, which was deleted in PR #2247 and replaced byencodeChatItem(item).toJson({ useProtoFieldName: true }). That serializer emits snake_case keys (transcript_confidence,e2e_latency, etc., as declared intelemetry/trace_types.ts), soFORCE_DOUBLE_KEYS.has(leafKey)could never match in production. Thepathparameter was only ever read to computeleafKeyfor that check, making it cascading-dead once the set was removed. BothFORCE_DOUBLE_KEYSandconvertValueareprivate, so no external/downstream consumers can be affected. No test exercises this branch.Changes Made
FORCE_DOUBLE_KEYSprivate static set fromSimpleOTLPHttpLogExporter.FORCE_DOUBLE_KEYS.has(leafKey)early-return branch inconvertValue.pathparameter fromconvertValueand its five call sites.History
Pre-Review Checklist
Testing
restaurant_agent.tsandrealtime_agent.tswork properly (for major changes) — N/A, no major changeAdditional Notes
Tooling: Detail: Dead Code
Verified by
pnpm buildandpnpm vitest runagainstotel_http_exporter.test.ts(3),traces.test.ts+recording_disabled.test.ts(40), andchat_item_proto_coverage.test.ts(8). Runtime behavior is unchanged because the removed branch was never taken in production.Dead Code PRs can be configured here.