forked from phoenix-oss/llama-stack-mirror
feat: add metrics query API (#1394)
# What does this PR do? Adds the API to query metrics from telemetry. ## Test Plan llama stack run ~/.llama/distributions/fireworks/fireworks-run.yaml --------- Co-authored-by: Ashwin Bharambe <ashwin.bharambe@gmail.com>
This commit is contained in:
parent
6371bb1b33
commit
fe5f5e530c
4 changed files with 387 additions and 0 deletions
189
docs/_static/llama-stack-spec.html
vendored
189
docs/_static/llama-stack-spec.html
vendored
|
@ -3475,6 +3475,58 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/v1/telemetry/metrics/{metric_name}": {
|
||||
"post": {
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/QueryMetricsResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"$ref": "#/components/responses/BadRequest400"
|
||||
},
|
||||
"429": {
|
||||
"$ref": "#/components/responses/TooManyRequests429"
|
||||
},
|
||||
"500": {
|
||||
"$ref": "#/components/responses/InternalServerError500"
|
||||
},
|
||||
"default": {
|
||||
"$ref": "#/components/responses/DefaultError"
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Telemetry"
|
||||
],
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "metric_name",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/QueryMetricsRequest"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/telemetry/spans": {
|
||||
"post": {
|
||||
"responses": {
|
||||
|
@ -11270,6 +11322,143 @@
|
|||
],
|
||||
"title": "QueryChunksResponse"
|
||||
},
|
||||
"QueryMetricsRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"start_time": {
|
||||
"type": "integer"
|
||||
},
|
||||
"end_time": {
|
||||
"type": "integer"
|
||||
},
|
||||
"granularity": {
|
||||
"type": "string"
|
||||
},
|
||||
"query_type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"range",
|
||||
"instant"
|
||||
],
|
||||
"title": "MetricQueryType"
|
||||
},
|
||||
"label_matchers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
},
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"=",
|
||||
"!=",
|
||||
"=~",
|
||||
"!~"
|
||||
],
|
||||
"title": "MetricLabelOperator",
|
||||
"default": "="
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"name",
|
||||
"value",
|
||||
"operator"
|
||||
],
|
||||
"title": "MetricLabelMatcher"
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"start_time",
|
||||
"query_type"
|
||||
],
|
||||
"title": "QueryMetricsRequest"
|
||||
},
|
||||
"MetricDataPoint": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"timestamp": {
|
||||
"type": "integer"
|
||||
},
|
||||
"value": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"timestamp",
|
||||
"value"
|
||||
],
|
||||
"title": "MetricDataPoint"
|
||||
},
|
||||
"MetricLabel": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"name",
|
||||
"value"
|
||||
],
|
||||
"title": "MetricLabel"
|
||||
},
|
||||
"MetricSeries": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"metric": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/MetricLabel"
|
||||
}
|
||||
},
|
||||
"values": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/MetricDataPoint"
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"metric",
|
||||
"labels",
|
||||
"values"
|
||||
],
|
||||
"title": "MetricSeries"
|
||||
},
|
||||
"QueryMetricsResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/MetricSeries"
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"data"
|
||||
],
|
||||
"title": "QueryMetricsResponse"
|
||||
},
|
||||
"QueryCondition": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
132
docs/_static/llama-stack-spec.yaml
vendored
132
docs/_static/llama-stack-spec.yaml
vendored
|
@ -2397,6 +2397,40 @@ paths:
|
|||
schema:
|
||||
$ref: '#/components/schemas/QueryChunksRequest'
|
||||
required: true
|
||||
/v1/telemetry/metrics/{metric_name}:
|
||||
post:
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/QueryMetricsResponse'
|
||||
'400':
|
||||
$ref: '#/components/responses/BadRequest400'
|
||||
'429':
|
||||
$ref: >-
|
||||
#/components/responses/TooManyRequests429
|
||||
'500':
|
||||
$ref: >-
|
||||
#/components/responses/InternalServerError500
|
||||
default:
|
||||
$ref: '#/components/responses/DefaultError'
|
||||
tags:
|
||||
- Telemetry
|
||||
description: ''
|
||||
parameters:
|
||||
- name: metric_name
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/QueryMetricsRequest'
|
||||
required: true
|
||||
/v1/telemetry/spans:
|
||||
post:
|
||||
responses:
|
||||
|
@ -7762,6 +7796,104 @@ components:
|
|||
- chunks
|
||||
- scores
|
||||
title: QueryChunksResponse
|
||||
QueryMetricsRequest:
|
||||
type: object
|
||||
properties:
|
||||
start_time:
|
||||
type: integer
|
||||
end_time:
|
||||
type: integer
|
||||
granularity:
|
||||
type: string
|
||||
query_type:
|
||||
type: string
|
||||
enum:
|
||||
- range
|
||||
- instant
|
||||
title: MetricQueryType
|
||||
label_matchers:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
value:
|
||||
type: string
|
||||
operator:
|
||||
type: string
|
||||
enum:
|
||||
- '='
|
||||
- '!='
|
||||
- =~
|
||||
- '!~'
|
||||
title: MetricLabelOperator
|
||||
default: '='
|
||||
additionalProperties: false
|
||||
required:
|
||||
- name
|
||||
- value
|
||||
- operator
|
||||
title: MetricLabelMatcher
|
||||
additionalProperties: false
|
||||
required:
|
||||
- start_time
|
||||
- query_type
|
||||
title: QueryMetricsRequest
|
||||
MetricDataPoint:
|
||||
type: object
|
||||
properties:
|
||||
timestamp:
|
||||
type: integer
|
||||
value:
|
||||
type: number
|
||||
additionalProperties: false
|
||||
required:
|
||||
- timestamp
|
||||
- value
|
||||
title: MetricDataPoint
|
||||
MetricLabel:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
value:
|
||||
type: string
|
||||
additionalProperties: false
|
||||
required:
|
||||
- name
|
||||
- value
|
||||
title: MetricLabel
|
||||
MetricSeries:
|
||||
type: object
|
||||
properties:
|
||||
metric:
|
||||
type: string
|
||||
labels:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/MetricLabel'
|
||||
values:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/MetricDataPoint'
|
||||
additionalProperties: false
|
||||
required:
|
||||
- metric
|
||||
- labels
|
||||
- values
|
||||
title: MetricSeries
|
||||
QueryMetricsResponse:
|
||||
type: object
|
||||
properties:
|
||||
data:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/MetricSeries'
|
||||
additionalProperties: false
|
||||
required:
|
||||
- data
|
||||
title: QueryMetricsResponse
|
||||
QueryCondition:
|
||||
type: object
|
||||
properties:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue