feat(observability): report model and provider usage - #68881
Merged
jquesnelle merged 9 commits intoAug 4, 2026
Conversation
This was referenced Jul 21, 2026
19 tasks
afourniernv
force-pushed
the
feat/hermes-relay-model-metrics
branch
from
July 22, 2026 14:27
b617116 to
c0531e9
Compare
This was referenced Jul 22, 2026
afourniernv
marked this pull request as ready for review
July 23, 2026 15:09
afourniernv
force-pushed
the
feat/hermes-relay-model-metrics
branch
3 times, most recently
from
July 29, 2026 15:54
5821418 to
c84bc30
Compare
afourniernv
force-pushed
the
feat/hermes-relay-model-metrics
branch
from
July 29, 2026 16:04
c84bc30 to
0331426
Compare
Signed-off-by: Alex Fournier <afournier@nvidia.com>
afourniernv
force-pushed
the
feat/hermes-relay-model-metrics
branch
from
July 29, 2026 18:24
018a170 to
a0476b3
Compare
jquesnelle
previously approved these changes
Jul 29, 2026
Signed-off-by: Alex Fournier <afournier@nvidia.com>
teknium1
reviewed
Jul 30, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for preserving the v1 outbox compatibility path and retaining the opt-in shared-metrics gate.
Problems
hermes_cli/observability/shared_metrics_contract.py:201still accepts only metrics-ownedhermes.model_callscopes. Auxiliary requests useagent/auxiliary_client.py:2597-2619→agent/relay_llm.py:760, which createsrelay_runtime.LOGICAL_LLM_SCOPEinstead. Those events therefore cannot producehermes.model_route.count, despite the PR’s stated logical-call coverage. The addedtests/agent/test_auxiliary_relay.pyexercises native Relay fallback but not the shared-metrics store/package path.
Suggested changes
- Add an auxiliary route projection (including fallback) to the shared-metrics lifecycle, with an integration test proving one terminal
hermes.model_route.count; alternatively document the narrower primary-agent-only scope.
This is an automated hermes-sweeper review.
…el-metrics Signed-off-by: Alex Fournier <afournier@nvidia.com>
Signed-off-by: Alex Fournier <afournier@nvidia.com>
Signed-off-by: Alex Fournier <afournier@nvidia.com>
Signed-off-by: Alex Fournier <afournier@nvidia.com>
Collaborator
|
@afourniernv could you fix up the small merge conflict here? |
Signed-off-by: Alex Fournier <afournier@nvidia.com> # Conflicts: # tests/agent/test_auxiliary_relay.py
Contributor
Author
|
Caught up to current |
Contributor
Author
|
@jquesnelle just wanted to check in here and see if this LGTY :) ? |
randlee
pushed a commit
to randlee/hermes-agent
that referenced
this pull request
Aug 11, 2026
…lay-model-metrics feat(observability): report model and provider usage
33hodl
pushed a commit
to 33hodl/hermes-agent
that referenced
this pull request
Aug 12, 2026
…lay-model-metrics feat(observability): report model and provider usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This adds the model-route slice on top of the Hermes-to-Relay shared-metrics pipeline now present on
main.Each logical model call increments
hermes.model_route.countusing only the terminal model identifier and Hermes provider route, for examplenvidia/nemotron-3-ultrathroughopenrouterorzai/glm-5.2throughbrev. When the provider returns a valid model ID, that terminal ID wins over the configured fallback.Hermes does not maintain a model catalog or calculate model family, locality, pricing, latency, token, retry, or outcome dimensions in this metric. Model and provider identifiers are lowercased and structurally bounded; malformed values become
unknown. Pricing and classification can be derived by the metrics backend.The metric and package transition is backward-compatible with local state already created from
main:hermes.model_call.countkeeps its original bounded-family contract and is retained only for draining pending legacy rows.hermes.model_route.countinstead.hermes.shared_metrics.v1remains unchanged for committed outbox payloads.hermes.shared_metrics.v2, which accepts both contracts so pending legacy and current counters can be packaged together.hermes.metrics.event.v2.The lifecycle remains correct across retries, provider fallback, and concurrent tasks: one logical request produces one model-route counter, and fallback records the terminal provider/model pair instead of the failed initial route.
Stack Order
Review and merge in this order. The cumulative follow-up branches need to be restacked onto this compatibility commit.
Related Issue
Follow-up to #67607.
Type of Change
Changes Made
hermes.model_route.countwith exactly two dimensions:modelandprovider.unknown.How to Test
HERMES_PYTHON=/path/to/python scripts/run_tests.sh -j 4 tests/hermes_cli/test_relay_shared_metrics.py tests/hermes_cli/test_relay_shared_metrics_runtime.py tests/agent/test_auxiliary_relay.py tests/run_agent/test_run_agent.py tests/scripts/test_smoke_nemo_relay_shared_metrics.py tests/plugins/test_nemo_relay_plugin.py -q.python -m ruff check hermes_cli/observability/shared_metrics.py hermes_cli/observability/shared_metrics_contract.py hermes_cli/observability/shared_metrics_subscriber.py hermes_cli/observability/relay_shared_metrics.py scripts/smoke_nemo_relay_shared_metrics.py tests/hermes_cli/test_relay_shared_metrics.py tests/hermes_cli/test_relay_shared_metrics_runtime.py tests/plugins/test_nemo_relay_plugin.py.ty check hermes_cli/observability/shared_metrics.py hermes_cli/observability/shared_metrics_contract.py hermes_cli/observability/shared_metrics_subscriber.py hermes_cli/observability/relay_shared_metrics.py.python scripts/smoke_nemo_relay_shared_metrics.py.Checklist
Code
fix(scope):,feat(scope):, etc.)Documentation & Housekeeping
cli-config.yaml.exampleif I added/changed config keys — N/A, no config keys changedCONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/AScreenshots / Logs
Validation on current head:
638 passed.73 passed, including pending-v1 aggregation and immutable-v1-outbox regressions.ty, both JSON schemas, andgit diff --check: passed.{"model":"gpt-relay-smoke-sensitive-model","provider":"custom"}ashermes.model_route.count; prompt and response canaries remained absent.