Skip to content

Conversation

@jif-oai
Copy link
Collaborator

@jif-oai jif-oai commented Dec 19, 2025

Add metrics capabilities to Codex. The README.md is up to date.

This will not be merged with the metrics before this PR of course: #8350

@jif-oai jif-oai changed the title feat: metrics crate feat: metrics capabilities Dec 22, 2025
Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ 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".

}
}

pub fn counter(&self, name: &str, inc: i64, tags: &[(&str, &str)]) -> MetricsResult<()> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we almost always ignore the return value of this method. Is it better to log internally and not force consumers to let _ =..

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can make a wrapper yep

- `auth_mode`: `swic` (AuthMode::ChatGPT) | `api` (AuthMode::ApiKey) | `unknown`.
- `model`: name of the model used.

## Metrics catalog
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it is nice to have these in one place -- is there something we can do to prevent it getting stale?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I was thinking of that... I don't think this is trivial but we can probably build a build time checker
Will think on this...

Comment on lines +40 to +41
| `feature.duration_ms` | histogram | `feature`, `status` | End-to-end feature latency. |
| `feature.used` | counter | `feature` | Feature usage through `/` (e.g., `/undo`, `/review`, ...). |
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you derive counts from a histogram? Is there a reason to have both?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's quite standard actually
Those are ingested "as-is" by statsig

# Conflicts:
#	codex-rs/core/src/client.rs
#	codex-rs/core/tests/chat_completions_payload.rs
#	codex-rs/core/tests/chat_completions_sse.rs
#	codex-rs/core/tests/responses_headers.rs
#	codex-rs/core/tests/suite/client.rs
#	codex-rs/otel/src/traces/otel_manager.rs
@jif-oai jif-oai merged commit 634650d into main Jan 8, 2026
26 checks passed
@jif-oai jif-oai deleted the jif/metric-lib branch January 8, 2026 11:47
@github-actions github-actions bot locked and limited conversation to collaborators Jan 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants