Skip to content

chore: remove dead FORCE_DOUBLE_KEYS logic from OTLP HTTP exporter - #2334

Merged
chenghao-mou merged 1 commit into
mainfrom
detail/dead-code/chore-remove-dead-force-double-keys-logic-from-otl-e2b71a
Oct 7, 2026
Merged

chenghao-mou merged 1 commit into
mainfrom
detail/dead-code/chore-remove-dead-force-double-keys-logic-from-otl-e2b71a

Conversation

@detail-app

@detail-app detail-app Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Description

Removed the unused FORCE_DOUBLE_KEYS private static set, the leaf-key lookup branch inside convertValue's number handler, and the now-vestigial path parameter that was threaded through convertValue solely to feed that lookup.

Why it was dead

FORCE_DOUBLE_KEYS held camelCase metric keys (transcriptConfidence, transcriptionDelay, endOfTurnDelay, onUserTurnCompletedDelay, llmNodeTtft, ttsNodeTtfb, e2eLatency). The only production path that ever produced those keys was the hand-rolled chatItemToProto() in traces.ts, which was deleted in PR #2247 and replaced by encodeChatItem(item).toJson({ useProtoFieldName: true }). That serializer emits snake_case keys (transcript_confidence, e2e_latency, etc., as declared in telemetry/trace_types.ts), so FORCE_DOUBLE_KEYS.has(leafKey) could never match in production. The path parameter was only ever read to compute leafKey for that check, making it cascading-dead once the set was removed. Both FORCE_DOUBLE_KEYS and convertValue are private, so no external/downstream consumers can be affected. No test exercises this branch.

Changes Made

  • Removed the FORCE_DOUBLE_KEYS private static set from SimpleOTLPHttpLogExporter.
  • Removed the leaf-key computation and the FORCE_DOUBLE_KEYS.has(leafKey) early-return branch in convertValue.
  • Dropped the now-unused path parameter from convertValue and its five call sites.

History

Pre-Review Checklist

  • Build passes: All builds (lint, typecheck, tests) pass locally
  • AI-generated code reviewed: Removed unnecessary comments and ensured code quality
  • Changes explained: All changes are properly documented and justified above
  • Scope appropriate: All changes relate to the PR title, or explanations provided for why they're included
  • Video demo: N/A (internal dead-code removal, no user-visible behavior change)

Testing

  • Automated tests added/updated (if applicable) — no new tests; existing coverage suffices since the removed branch was unreachable in production
  • All tests pass
  • Make sure both restaurant_agent.ts and realtime_agent.ts work properly (for major changes) — N/A, no major change

Additional Notes

Tooling: Detail: Dead Code

Verified by pnpm build and pnpm vitest run against otel_http_exporter.test.ts (3), traces.test.ts + recording_disabled.test.ts (40), and chat_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.

@detail-app
detail-app Bot requested a review from a team as a code owner August 24, 2026 20:22
@detail-app
detail-app Bot requested a review from lukasIO August 24, 2026 20:23
@changeset-bot

changeset-bot Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: aba2976

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

This report is out of date. Scroll down for Devin Review's latest report on this PR.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@detail-app
detail-app Bot force-pushed the detail/dead-code/chore-remove-dead-force-double-keys-logic-from-otl-e2b71a branch from 1763006 to aba2976 Compare September 4, 2026 21:25

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Devin Review

if (SimpleOTLPHttpLogExporter.FORCE_DOUBLE_KEYS.has(leafKey)) {
return { doubleValue: value };
}
return Number.isInteger(value) ? { intValue: String(value) } : { doubleValue: value };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@detail-app

detail-app Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

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 detail-keep-open label to it.

@detail-app detail-app Bot closed this Oct 7, 2026
@chenghao-mou chenghao-mou reopened this Oct 7, 2026
@chenghao-mou
chenghao-mou merged commit 1e6a6bc into main Oct 7, 2026
11 of 12 checks passed
@chenghao-mou
chenghao-mou deleted the detail/dead-code/chore-remove-dead-force-double-keys-logic-from-otl-e2b71a branch October 7, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants