mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-28 01:21:59 +00:00
feat: add metrics query API
This commit is contained in:
parent
d27a0f276c
commit
ba6334475f
2 changed files with 64 additions and 0 deletions
|
|
@ -19,7 +19,10 @@ from opentelemetry.semconv.resource import ResourceAttributes
|
|||
|
||||
from llama_stack.apis.telemetry import (
|
||||
Event,
|
||||
GetMetricsResponse,
|
||||
MetricEvent,
|
||||
MetricLabelMatcher,
|
||||
MetricQueryType,
|
||||
QueryCondition,
|
||||
QuerySpanTreeResponse,
|
||||
QueryTracesResponse,
|
||||
|
|
@ -123,6 +126,17 @@ class TelemetryAdapter(TelemetryDatasetMixin, Telemetry):
|
|||
else:
|
||||
raise ValueError(f"Unknown event type: {event}")
|
||||
|
||||
async def get_metrics(
|
||||
self,
|
||||
metric_name: str,
|
||||
start_time: int,
|
||||
end_time: Optional[int] = None,
|
||||
step: Optional[str] = "1d",
|
||||
query_type: MetricQueryType = MetricQueryType.RANGE,
|
||||
label_matchers: Optional[List[MetricLabelMatcher]] = None,
|
||||
) -> GetMetricsResponse:
|
||||
pass
|
||||
|
||||
def _log_unstructured(self, event: UnstructuredLogEvent, ttl_seconds: int) -> None:
|
||||
with self._lock:
|
||||
# Use global storage instead of instance storage
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue