Skip to content

feat(otel): Centralize OTEL metric names and shared tag builders#14117

Merged
owenlin0 merged 1 commit intomainfrom
owen/refactor_metrics
Mar 9, 2026
Merged

feat(otel): Centralize OTEL metric names and shared tag builders#14117
owenlin0 merged 1 commit intomainfrom
owen/refactor_metrics

Conversation

@owenlin0
Copy link
Copy Markdown
Collaborator

@owenlin0 owenlin0 commented Mar 9, 2026

This cleans up a bunch of metric plumbing that had started to drift.

The main change is making codex-otel the canonical home for shared metric definitions and metric tag helpers. I moved the turn/thread metric names that were still duplicated into the OTEL metric registry, added a shared metrics::tags module for common tag keys and session tag construction, and updated SessionTelemetry to build its metadata tags through that shared path.

On the codex-core side, TTFT/TTFM now use the shared metric-name constants instead of local string definitions. I also switched the obvious remaining turn/thread metric callsites over to the shared constants, and added a small helper so TTFT/TTFM can attach an optional sanitized client.name tag from TurnContext.

This should make follow-on telemetry work less ad hoc:

  • one canonical place for metric names
  • one canonical place for common metric tag keys/builders
  • less duplication between codex-core and codex-otel
@owenlin0 owenlin0 force-pushed the owen/refactor_metrics branch from df85099 to 36597d6 Compare March 9, 2026 19:02
@owenlin0 owenlin0 marked this pull request as ready for review March 9, 2026 19:03
@owenlin0
Copy link
Copy Markdown
Collaborator Author

owenlin0 commented Mar 9, 2026

@codex review

@owenlin0 owenlin0 force-pushed the owen/refactor_metrics branch from 36597d6 to 2fff7e7 Compare March 9, 2026 19:08
@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Nice work!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@owenlin0 owenlin0 requested a review from apanasenko-oai March 9, 2026 19:45
@owenlin0 owenlin0 merged commit da991bd into main Mar 9, 2026
29 of 31 checks passed
@owenlin0 owenlin0 deleted the owen/refactor_metrics branch March 9, 2026 19:46
@github-actions github-actions bot locked and limited conversation to collaborators Mar 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants