feat: (WIP) implement query_metrics #3074
Draft
+161
−4
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?
query_metrics currently has no implementation, meaning once a metric is emitted there is no way in llama stack to query it from the store.
implement query_metrics for the meta_reference provider which follows a similar style to
query_traces
, using the trace_store to format an SQL query and execute itin this case the parameters for the query are
metric.METRIC_NAME, start_time, and end_time
and any other matchers if they are provided.this required client side changes since the client had no
query_metrics
or any associated resources, so any tests here will fail but I will provide manual execution logs for the new tests I am addingorder the metrics by timestamp.
Additionally add
unit
to theMetricDataPoint
class since this adds much more context to the metric being queried.depends on llamastack/llama-stack-client-python#19
Test Plan
adding tests for each currently documented metric in llama stack using this new function. attached is also some manual testing