FR: add request model to LLM metric attributes - #24
Merged
Conversation
sayonfortify
force-pushed
the
fr-metrics-request-model-labels
branch
from
May 22, 2026 14:12
9e41c1a to
491c305
Compare
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.
Description
This PR fixes a Metrics-tab consistency issue found during the Dashboard Provider Cost / GroupBy RCA validation.
After PR-A2 backend enrichment, Metrics Provider group-by correctly uses canonical
fortifyroot.provider, but Metrics Model group-by can only canonicalize to the same model values as Events/Traces if metric datapoints include the request model. Several instrumentors only emittedgen_ai.response.modelon metric datapoints. For routed/provider-backed calls, response model can be dated or provider-specific, while Events/Traces use request-model normalization.Adds gen_ai.request.model to direct LLM metric emitters currently found in the fork: OpenAI, Anthropic, Google GenAI, Bedrock, and LangChain/LangGraph. LiteLLM/LlamaIndex are covered through underlying provider instrumentation when they do not emit native LLM metrics themselves.
What changed
gen_ai.request.modelto LLM token/duration metric attributes for MVP metric emitters:gen_ai.response.modelattributes unchanged.billing_provider; that remains PR-C scope.Why
This lets backend metric enrichment use the same request-model semantics as LLM Events/Traces/Dashboard, so Metrics tab Provider/Model group-by does not drift into raw response-model labels like dated model IDs.
Validation
git diff --checkpy_compileon all touched files5 passed4 passed1 passed1 passed1 passedNext
After merge, tag fork release
fr-v0.52.6.14, then vendor that tag intofortifyroot-sdk-py.