codex - 💡(How to fix) Fix Include user identity in Codex OTel standard attributes [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#19897Fetched 2026-04-28 06:35:23
View on GitHub
Comments
0
Participants
1
Timeline
8
Reactions
0
Participants
Timeline (top)
labeled ×5unlabeled ×3

Root Cause

This makes org-wide dashboards hard to build without adding a separate proxy/collector layer that injects identity outside Codex. That workaround is fragile because the Codex client already knows the authenticated account context.

Fix Action

Fix / Workaround

This makes org-wide dashboards hard to build without adding a separate proxy/collector layer that injects identity outside Codex. That workaround is fragile because the Codex client already knows the authenticated account context.

Current workaround and why it is insufficient

Code Example

[otel]
include_user_id = true
include_user_email = false
RAW_BUFFERClick to expand / collapse

What feature would you like to see?

Please include stable user identity attributes in Codex OpenTelemetry exports by default, especially for metrics.

For organizational usage monitoring, it is a common and expected requirement to answer questions like:

  • Which users are actively using Codex?
  • How much token/tool/session usage is attributable to each user?
  • Which users or teams need enablement, support, or cost review?
  • How can metrics be correlated with logs/traces when investigating usage or reliability?

Today, Codex OTel metrics include useful dimensions such as app.version, auth_mode, model, originator, and session_source, but they do not appear to include a stable Codex/OpenAI user identifier such as user.id, user.email, account.id, or equivalent.

This makes org-wide dashboards hard to build without adding a separate proxy/collector layer that injects identity outside Codex. That workaround is fragile because the Codex client already knows the authenticated account context.

Why this should be a default standard attribute

User-level usage segmentation is not a niche requirement for enterprise telemetry. It is one of the most basic use cases for OTel-based usage monitoring.

For comparison, Claude Code documents user/account identity as part of its standard telemetry attributes:

https://code.claude.com/docs/en/monitoring-usage#standard-attributes

Their documented standard attributes include, when available:

  • organization.id
  • user.account_uuid
  • user.account_id
  • user.id
  • user.email

The same page also documents cardinality controls such as OTEL_METRICS_INCLUDE_ACCOUNT_UUID, with account UUID/account ID included by default.

Codex should have a comparable first-class identity dimension for enterprise monitoring.

Suggested behavior

At minimum, Codex OTel should include a stable, non-secret user identifier in the standard attributes for metrics, logs, and traces when authenticated, for example:

  • user.id or user.account_id: stable authenticated Codex/OpenAI account identifier
  • organization.id or workspace.id: stable org/workspace identifier, when available

If exposing email by default is a privacy concern, then a reasonable compromise would be:

  • include a stable pseudonymous user/account ID by default
  • include user.email only when available and allowed by policy, or behind an explicit config flag
  • document the exact privacy/cardinality behavior

Possible config controls could mirror the existing telemetry-cardinality approach used by other coding agents, for example:

[otel]
include_user_id = true
include_user_email = false

or equivalent environment/config options.

Current workaround and why it is insufficient

I tried using standard OTEL_RESOURCE_ATTRIBUTES to inject a static user email from the shell environment, but that is not a good solution for org rollout:

  • it has to be configured separately for every user/device
  • it is easy to misconfigure or forget
  • it may not be reflected in Codex metrics depending on exporter/collector behavior
  • it duplicates identity that Codex already has through authentication

A collector/proxy can inject labels, but then the usage identity is no longer a Codex-native telemetry attribute and becomes deployment-specific glue.

Related issues

  • #6390 requested additional OTel labels, but was closed as not planned due to low upvotes. This request is narrower and more fundamental: user/account identity should be part of the standard telemetry schema, not just arbitrary custom labels.
  • #15905 asks for conversation.id on OTel metrics. That solves conversation-level correlation; this issue is about user/account-level attribution.

Acceptance criteria

  • Codex OTel metrics include a stable authenticated user/account identity attribute by default when available.
  • Codex OTel logs/traces use the same identity keys for consistency.
  • The behavior is documented in the Codex OTel docs and config reference.
  • If email is considered sensitive, Codex documents whether user.email is omitted, gated, or opt-in, while still providing a stable non-secret user/account ID by default.

extent analysis

TL;DR

Include a stable user identifier, such as user.id or user.account_id, in Codex OpenTelemetry exports by default to enable user-level usage segmentation.

Guidance

  • Consider adding a configuration option, such as include_user_id and include_user_email, to control the inclusion of user identity attributes in OTel exports.
  • Document the exact privacy and cardinality behavior of user identity attributes in Codex OTel docs and config reference.
  • Evaluate the feasibility of including a stable pseudonymous user/account ID by default, with optional inclusion of user.email behind an explicit config flag.
  • Review related issues, such as #6390 and #15905, to ensure consistency in OTel labeling and attribution.

Example

A possible configuration option could be:

[otel]
include_user_id = true
include_user_email = false

This would allow users to control the inclusion of user identity attributes in OTel exports.

Notes

The inclusion of user identity attributes in OTel exports may have privacy implications, and careful consideration should be given to the default behavior and configuration options.

Recommendation

Apply a workaround by adding a configuration option to include user identity attributes in OTel exports, as this is a fundamental requirement for user-level usage segmentation and org-wide dashboards.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Include user identity in Codex OTel standard attributes [1 participants]