Add streaming support for trlp metric tests#793
Merged
emmaaroche merged 1 commit intoKuadrant:mainfrom Oct 17, 2025
Merged
Conversation
Signed-off-by: emmaaroche <eroche@redhat.com>
trepel
approved these changes
Oct 16, 2025
Contributor
trepel
left a comment
There was a problem hiding this comment.
Nice work! LGTM, just two questions, but it's for me to explain rather than suggestions to change something.
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 adds a new module (
test_trlp_metrics_stream.py) to validate trlp metrics when using streaming (stream=True).The tests mirror the existing non-streaming ones and verify that metrics such as
authorized_hits,authorized_calls, andlimited_callsare correctly emitted and labeled for streaming requests.Why tests are in a separate module?
Although the logic is the same, streaming and non-streaming tests can’t be safely parameterized together because Prometheus counters are cumulative, and running both modes in parametrized tests caused inconsistent token counts and cross-test interference, leading to test failures.
Change Summary
test_trlp_metrics_stream.pywith streaming request handling (parse_streaming_usage,extract_usage_tokens)USERSandMODEL_NAMEvariables and theuser_datafixture to conftest as it is now shared across both testsCloses Kuadrant/kuadrant-operator#1627