Skip to content

analytics: ingest responses api call events#18029

Open
rhan-oai wants to merge 2 commits intomainfrom
pr18029
Open

analytics: ingest responses api call events#18029
rhan-oai wants to merge 2 commits intomainfrom
pr18029

Conversation

@rhan-oai
Copy link
Copy Markdown
Collaborator

@rhan-oai rhan-oai commented Apr 16, 2026

Why

After defining the Responses API call schema, the analytics client and reducer need to know how to turn a core-facing input into the final backend event. This PR wires that schema into the existing analytics pipeline while keeping Responses item processing inside the analytics crate.

What changed

This adds AnalyticsEventsClient::track_responses_api_call, which accepts a CodexResponsesApiCallInput, carries the precomputed item metadata and item counts into a CustomAnalyticsFact::ResponsesApiCall, derives token fields, and records the custom fact.

The reducer now ingests CustomAnalyticsFact::ResponsesApiCall and emits a codex_responses_api_call_event only when the required context is available: connection metadata, thread lifecycle metadata, turn metadata, and resolved turn config. The emitted event is enriched with thread source, initialization mode, parent/subagent fields, client/runtime metadata, model/provider, and reasoning effort in the same style as the existing turn analytics events.

This also adds serialization and reducer tests for the new event. The tests cover the backend payload shape and verify that a custom Responses API call fact is reduced into the expected event once the normal analytics prerequisites have been observed.

Verification

Verified with cargo test -p codex-analytics, including the new serialization and reducer coverage for codex_responses_api_call_event.


Stack created with Sapling. Best reviewed with ReviewStack.

@rhan-oai rhan-oai force-pushed the pr18029 branch 15 times, most recently from 8c25372 to 8e29b28 Compare April 21, 2026 00:52
@rhan-oai rhan-oai changed the base branch from main to pr18028 April 21, 2026 01:45
@rhan-oai rhan-oai changed the base branch from pr18028 to main April 21, 2026 05:16
@rhan-oai rhan-oai changed the base branch from main to pr18028 April 21, 2026 18:35
@rhan-oai rhan-oai changed the title analytics: reduce responses api call facts analytics: ingest responses api call events Apr 21, 2026
@rhan-oai rhan-oai changed the title analytics: ingest responses api call events analytics: reduce responses api call facts Apr 21, 2026
@rhan-oai rhan-oai changed the base branch from pr18028 to main April 21, 2026 19:14
@rhan-oai rhan-oai changed the title analytics: reduce responses api call facts analytics: ingest responses api call events Apr 21, 2026
@rhan-oai rhan-oai changed the title analytics: ingest responses api call events analytics: reduce responses api call facts Apr 22, 2026
@rhan-oai rhan-oai changed the title analytics: reduce responses api call facts analytics: ingest responses api call events Apr 22, 2026
@rhan-oai rhan-oai changed the title analytics: ingest responses api call events analytics: reduce responses api call facts Apr 22, 2026
@rhan-oai rhan-oai changed the title analytics: reduce responses api call facts analytics: ingest responses api call events Apr 22, 2026
@rhan-oai rhan-oai changed the title analytics: ingest responses api call events analytics: reduce responses api call facts Apr 22, 2026
@rhan-oai rhan-oai changed the title analytics: reduce responses api call facts analytics: ingest responses api call events Apr 22, 2026
@rhan-oai rhan-oai changed the title analytics: ingest responses api call events analytics: reduce responses api call facts Apr 22, 2026
@rhan-oai rhan-oai changed the title analytics: reduce responses api call facts analytics: ingest responses api call events Apr 22, 2026
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.

1 participant