Skip to content

feat(metering): emit provider and reasoning tokens in usage CloudEvents - #1201

Open
crstrn13 wants to merge 7 commits into
praxis-proxy:mainfrom
crstrn13:fix/metering-provider-reasoning
Open

crstrn13 wants to merge 7 commits into
praxis-proxy:mainfrom
crstrn13:fix/metering-provider-reasoning

Conversation

@crstrn13

Copy link
Copy Markdown
Contributor

Problem

Metering CloudEvents (inference.tokens.used) were not fully configurable from the deployment. The provider/cluster attribute was derived from ctx.cluster_name(), but the ext-proc adapter hard-codes cluster: None and there was no config field to set it — so the controller could not render a correct value. Reasoning tokens were also not surfaced in the usage event.

See opendatahub-io/praxis-extproc#80.

Changes

  • Add a provider config field to the external_metering filter so the emitted CloudEvents carry a statically configurable provider, independent of ctx.cluster_name().
  • Emit reasoning_tokens in the usage CloudEvent when present.
  • Update examples/configs/external-metering.yaml, filter docs, unit tests, and the example integration suite to cover the new field and reasoning-token emission.

Tests

  • Unit tests in filters/src/metering/tests.rs.
  • Example integration coverage in the external metering suite.

Refs opendatahub-io/praxis-extproc#80

@crstrn13
crstrn13 requested review from a team and franciscojavierarceo September 16, 2026 16:39
Signed-off-by: Alexander Cristurean <acristur@redhat.com>
@crstrn13
crstrn13 force-pushed the fix/metering-provider-reasoning branch from bc97846 to 89ef0cd Compare September 16, 2026 16:42
@crstrn13
crstrn13 requested a review from alexsnaps September 16, 2026 16:48
Signed-off-by: Alexander Cristurean <acristur@redhat.com>
Lock the fail-closed contract for the file-backed credential_inject
filter across startup seeding, rotation under traffic, and deletion,
driving the real provider-route pipeline in-process.

Signed-off-by: Alexander Cristurean <acristur@redhat.com>
Signed-off-by: Alexander Cristurean <acristur@redhat.com>

@praxis-bot praxis-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review: feat(metering) — provider and reasoning tokens

The metering changes are clean, well-structured, and thoroughly tested. Provider resolution with static config > cluster name > empty fallback is correct and covers the ext-proc data path where cluster_name() is always None. Reasoning token plumbing from token_count metadata through TokenCounts into the CloudEvent is straightforward. Tests cover all three provider resolution branches, reasoning token round-trip, and the zero-default case.

One scope concern below.

Findings: 1

@@ -0,0 +1,438 @@
// SPDX-License-Identifier: Apache-2.0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[Medium] This 438-line file adds credential-store parity acceptance tests that are unrelated to the metering provider/reasoning-token feature. The PR description does not mention it, and the commit (ca94a64a) is a separate concern. Consider splitting this into its own PR so each change set can be reviewed and reverted independently.

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