chore!: remove ALL telemetry APIs

# What does this PR do?


## Test Plan
This commit is contained in:
Eric Huang 2025-10-10 10:39:28 -07:00
parent 548ccff368
commit bd759b868b
13 changed files with 2 additions and 6738 deletions

View file

@ -3526,343 +3526,6 @@
}, },
"deprecated": true "deprecated": true
} }
},
"/v1/telemetry/metrics/{metric_name}": {
"post": {
"responses": {
"200": {
"description": "A QueryMetricsResponse.",
"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"
],
"summary": "Query metrics.",
"description": "Query metrics.",
"parameters": [
{
"name": "metric_name",
"in": "path",
"description": "The name of the metric to query.",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/QueryMetricsRequest"
}
}
},
"required": true
},
"deprecated": true
}
},
"/v1/telemetry/spans": {
"post": {
"responses": {
"200": {
"description": "A QuerySpansResponse.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/QuerySpansResponse"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest400"
},
"429": {
"$ref": "#/components/responses/TooManyRequests429"
},
"500": {
"$ref": "#/components/responses/InternalServerError500"
},
"default": {
"$ref": "#/components/responses/DefaultError"
}
},
"tags": [
"Telemetry"
],
"summary": "Query spans.",
"description": "Query spans.",
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/QuerySpansRequest"
}
}
},
"required": true
},
"deprecated": true
}
},
"/v1/telemetry/spans/export": {
"post": {
"responses": {
"200": {
"description": "OK"
},
"400": {
"$ref": "#/components/responses/BadRequest400"
},
"429": {
"$ref": "#/components/responses/TooManyRequests429"
},
"500": {
"$ref": "#/components/responses/InternalServerError500"
},
"default": {
"$ref": "#/components/responses/DefaultError"
}
},
"tags": [
"Telemetry"
],
"summary": "Save spans to a dataset.",
"description": "Save spans to a dataset.",
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SaveSpansToDatasetRequest"
}
}
},
"required": true
},
"deprecated": true
}
},
"/v1/telemetry/spans/{span_id}/tree": {
"post": {
"responses": {
"200": {
"description": "A QuerySpanTreeResponse.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/QuerySpanTreeResponse"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest400"
},
"429": {
"$ref": "#/components/responses/TooManyRequests429"
},
"500": {
"$ref": "#/components/responses/InternalServerError500"
},
"default": {
"$ref": "#/components/responses/DefaultError"
}
},
"tags": [
"Telemetry"
],
"summary": "Get a span tree by its ID.",
"description": "Get a span tree by its ID.",
"parameters": [
{
"name": "span_id",
"in": "path",
"description": "The ID of the span to get the tree from.",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetSpanTreeRequest"
}
}
},
"required": true
},
"deprecated": true
}
},
"/v1/telemetry/traces": {
"post": {
"responses": {
"200": {
"description": "A QueryTracesResponse.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/QueryTracesResponse"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest400"
},
"429": {
"$ref": "#/components/responses/TooManyRequests429"
},
"500": {
"$ref": "#/components/responses/InternalServerError500"
},
"default": {
"$ref": "#/components/responses/DefaultError"
}
},
"tags": [
"Telemetry"
],
"summary": "Query traces.",
"description": "Query traces.",
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/QueryTracesRequest"
}
}
},
"required": true
},
"deprecated": true
}
},
"/v1/telemetry/traces/{trace_id}": {
"get": {
"responses": {
"200": {
"description": "A Trace.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Trace"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest400"
},
"429": {
"$ref": "#/components/responses/TooManyRequests429"
},
"500": {
"$ref": "#/components/responses/InternalServerError500"
},
"default": {
"$ref": "#/components/responses/DefaultError"
}
},
"tags": [
"Telemetry"
],
"summary": "Get a trace by its ID.",
"description": "Get a trace by its ID.",
"parameters": [
{
"name": "trace_id",
"in": "path",
"description": "The ID of the trace to get.",
"required": true,
"schema": {
"type": "string"
}
}
],
"deprecated": true
}
},
"/v1/telemetry/traces/{trace_id}/spans/{span_id}": {
"get": {
"responses": {
"200": {
"description": "A Span.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Span"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest400"
},
"429": {
"$ref": "#/components/responses/TooManyRequests429"
},
"500": {
"$ref": "#/components/responses/InternalServerError500"
},
"default": {
"$ref": "#/components/responses/DefaultError"
}
},
"tags": [
"Telemetry"
],
"summary": "Get a span by its ID.",
"description": "Get a span by its ID.",
"parameters": [
{
"name": "trace_id",
"in": "path",
"description": "The ID of the trace to get the span from.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "span_id",
"in": "path",
"description": "The ID of the span to get.",
"required": true,
"schema": {
"type": "string"
}
}
],
"deprecated": true
}
} }
}, },
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema", "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
@ -13109,561 +12772,6 @@
"logger_config" "logger_config"
], ],
"title": "SupervisedFineTuneRequest" "title": "SupervisedFineTuneRequest"
},
"QueryMetricsRequest": {
"type": "object",
"properties": {
"start_time": {
"type": "integer",
"description": "The start time of the metric to query."
},
"end_time": {
"type": "integer",
"description": "The end time of the metric to query."
},
"granularity": {
"type": "string",
"description": "The granularity of the metric to query."
},
"query_type": {
"type": "string",
"enum": [
"range",
"instant"
],
"description": "The type of query to perform."
},
"label_matchers": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the label to match"
},
"value": {
"type": "string",
"description": "The value to match against"
},
"operator": {
"type": "string",
"enum": [
"=",
"!=",
"=~",
"!~"
],
"description": "The comparison operator to use for matching",
"default": "="
}
},
"additionalProperties": false,
"required": [
"name",
"value",
"operator"
],
"title": "MetricLabelMatcher",
"description": "A matcher for filtering metrics by label values."
},
"description": "The label matchers to apply to the metric."
}
},
"additionalProperties": false,
"required": [
"start_time",
"query_type"
],
"title": "QueryMetricsRequest"
},
"MetricDataPoint": {
"type": "object",
"properties": {
"timestamp": {
"type": "integer",
"description": "Unix timestamp when the metric value was recorded"
},
"value": {
"type": "number",
"description": "The numeric value of the metric at this timestamp"
},
"unit": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"timestamp",
"value",
"unit"
],
"title": "MetricDataPoint",
"description": "A single data point in a metric time series."
},
"MetricLabel": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the label"
},
"value": {
"type": "string",
"description": "The value of the label"
}
},
"additionalProperties": false,
"required": [
"name",
"value"
],
"title": "MetricLabel",
"description": "A label associated with a metric."
},
"MetricSeries": {
"type": "object",
"properties": {
"metric": {
"type": "string",
"description": "The name of the metric"
},
"labels": {
"type": "array",
"items": {
"$ref": "#/components/schemas/MetricLabel"
},
"description": "List of labels associated with this metric series"
},
"values": {
"type": "array",
"items": {
"$ref": "#/components/schemas/MetricDataPoint"
},
"description": "List of data points in chronological order"
}
},
"additionalProperties": false,
"required": [
"metric",
"labels",
"values"
],
"title": "MetricSeries",
"description": "A time series of metric data points."
},
"QueryMetricsResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/MetricSeries"
},
"description": "List of metric series matching the query criteria"
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "QueryMetricsResponse",
"description": "Response containing metric time series data."
},
"QueryCondition": {
"type": "object",
"properties": {
"key": {
"type": "string",
"description": "The attribute key to filter on"
},
"op": {
"$ref": "#/components/schemas/QueryConditionOp",
"description": "The comparison operator to apply"
},
"value": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
],
"description": "The value to compare against"
}
},
"additionalProperties": false,
"required": [
"key",
"op",
"value"
],
"title": "QueryCondition",
"description": "A condition for filtering query results."
},
"QueryConditionOp": {
"type": "string",
"enum": [
"eq",
"ne",
"gt",
"lt"
],
"title": "QueryConditionOp",
"description": "Comparison operators for query conditions."
},
"QuerySpansRequest": {
"type": "object",
"properties": {
"attribute_filters": {
"type": "array",
"items": {
"$ref": "#/components/schemas/QueryCondition"
},
"description": "The attribute filters to apply to the spans."
},
"attributes_to_return": {
"type": "array",
"items": {
"type": "string"
},
"description": "The attributes to return in the spans."
},
"max_depth": {
"type": "integer",
"description": "The maximum depth of the tree."
}
},
"additionalProperties": false,
"required": [
"attribute_filters",
"attributes_to_return"
],
"title": "QuerySpansRequest"
},
"Span": {
"type": "object",
"properties": {
"span_id": {
"type": "string",
"description": "Unique identifier for the span"
},
"trace_id": {
"type": "string",
"description": "Unique identifier for the trace this span belongs to"
},
"parent_span_id": {
"type": "string",
"description": "(Optional) Unique identifier for the parent span, if this is a child span"
},
"name": {
"type": "string",
"description": "Human-readable name describing the operation this span represents"
},
"start_time": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the operation began"
},
"end_time": {
"type": "string",
"format": "date-time",
"description": "(Optional) Timestamp when the operation finished, if completed"
},
"attributes": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
},
"description": "(Optional) Key-value pairs containing additional metadata about the span"
}
},
"additionalProperties": false,
"required": [
"span_id",
"trace_id",
"name",
"start_time"
],
"title": "Span",
"description": "A span representing a single operation within a trace."
},
"QuerySpansResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Span"
},
"description": "List of spans matching the query criteria"
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "QuerySpansResponse",
"description": "Response containing a list of spans."
},
"SaveSpansToDatasetRequest": {
"type": "object",
"properties": {
"attribute_filters": {
"type": "array",
"items": {
"$ref": "#/components/schemas/QueryCondition"
},
"description": "The attribute filters to apply to the spans."
},
"attributes_to_save": {
"type": "array",
"items": {
"type": "string"
},
"description": "The attributes to save to the dataset."
},
"dataset_id": {
"type": "string",
"description": "The ID of the dataset to save the spans to."
},
"max_depth": {
"type": "integer",
"description": "The maximum depth of the tree."
}
},
"additionalProperties": false,
"required": [
"attribute_filters",
"attributes_to_save",
"dataset_id"
],
"title": "SaveSpansToDatasetRequest"
},
"GetSpanTreeRequest": {
"type": "object",
"properties": {
"attributes_to_return": {
"type": "array",
"items": {
"type": "string"
},
"description": "The attributes to return in the tree."
},
"max_depth": {
"type": "integer",
"description": "The maximum depth of the tree."
}
},
"additionalProperties": false,
"title": "GetSpanTreeRequest"
},
"SpanStatus": {
"type": "string",
"enum": [
"ok",
"error"
],
"title": "SpanStatus",
"description": "The status of a span indicating whether it completed successfully or with an error."
},
"SpanWithStatus": {
"type": "object",
"properties": {
"span_id": {
"type": "string",
"description": "Unique identifier for the span"
},
"trace_id": {
"type": "string",
"description": "Unique identifier for the trace this span belongs to"
},
"parent_span_id": {
"type": "string",
"description": "(Optional) Unique identifier for the parent span, if this is a child span"
},
"name": {
"type": "string",
"description": "Human-readable name describing the operation this span represents"
},
"start_time": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the operation began"
},
"end_time": {
"type": "string",
"format": "date-time",
"description": "(Optional) Timestamp when the operation finished, if completed"
},
"attributes": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
},
"description": "(Optional) Key-value pairs containing additional metadata about the span"
},
"status": {
"$ref": "#/components/schemas/SpanStatus",
"description": "(Optional) The current status of the span"
}
},
"additionalProperties": false,
"required": [
"span_id",
"trace_id",
"name",
"start_time"
],
"title": "SpanWithStatus",
"description": "A span that includes status information."
},
"QuerySpanTreeResponse": {
"type": "object",
"properties": {
"data": {
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/SpanWithStatus"
},
"description": "Dictionary mapping span IDs to spans with status information"
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "QuerySpanTreeResponse",
"description": "Response containing a tree structure of spans."
},
"QueryTracesRequest": {
"type": "object",
"properties": {
"attribute_filters": {
"type": "array",
"items": {
"$ref": "#/components/schemas/QueryCondition"
},
"description": "The attribute filters to apply to the traces."
},
"limit": {
"type": "integer",
"description": "The limit of traces to return."
},
"offset": {
"type": "integer",
"description": "The offset of the traces to return."
},
"order_by": {
"type": "array",
"items": {
"type": "string"
},
"description": "The order by of the traces to return."
}
},
"additionalProperties": false,
"title": "QueryTracesRequest"
},
"Trace": {
"type": "object",
"properties": {
"trace_id": {
"type": "string",
"description": "Unique identifier for the trace"
},
"root_span_id": {
"type": "string",
"description": "Unique identifier for the root span that started this trace"
},
"start_time": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the trace began"
},
"end_time": {
"type": "string",
"format": "date-time",
"description": "(Optional) Timestamp when the trace finished, if completed"
}
},
"additionalProperties": false,
"required": [
"trace_id",
"root_span_id",
"start_time"
],
"title": "Trace",
"description": "A trace representing the complete execution path of a request across multiple operations."
},
"QueryTracesResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Trace"
},
"description": "List of traces matching the query criteria"
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "QueryTracesResponse",
"description": "Response containing a list of traces."
} }
}, },
"responses": { "responses": {
@ -13780,10 +12888,6 @@
"description": "OpenAI-compatible Moderations API.", "description": "OpenAI-compatible Moderations API.",
"x-displayName": "Safety" "x-displayName": "Safety"
}, },
{
"name": "Telemetry",
"description": ""
},
{ {
"name": "VectorIO", "name": "VectorIO",
"description": "" "description": ""
@ -13803,7 +12907,6 @@
"Models", "Models",
"PostTraining (Coming Soon)", "PostTraining (Coming Soon)",
"Safety", "Safety",
"Telemetry",
"VectorIO" "VectorIO"
] ]
} }

View file

@ -2593,238 +2593,6 @@ paths:
$ref: '#/components/schemas/SupervisedFineTuneRequest' $ref: '#/components/schemas/SupervisedFineTuneRequest'
required: true required: true
deprecated: true deprecated: true
/v1/telemetry/metrics/{metric_name}:
post:
responses:
'200':
description: A QueryMetricsResponse.
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
summary: Query metrics.
description: Query metrics.
parameters:
- name: metric_name
in: path
description: The name of the metric to query.
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/QueryMetricsRequest'
required: true
deprecated: true
/v1/telemetry/spans:
post:
responses:
'200':
description: A QuerySpansResponse.
content:
application/json:
schema:
$ref: '#/components/schemas/QuerySpansResponse'
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- Telemetry
summary: Query spans.
description: Query spans.
parameters: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/QuerySpansRequest'
required: true
deprecated: true
/v1/telemetry/spans/export:
post:
responses:
'200':
description: OK
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- Telemetry
summary: Save spans to a dataset.
description: Save spans to a dataset.
parameters: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/SaveSpansToDatasetRequest'
required: true
deprecated: true
/v1/telemetry/spans/{span_id}/tree:
post:
responses:
'200':
description: A QuerySpanTreeResponse.
content:
application/json:
schema:
$ref: '#/components/schemas/QuerySpanTreeResponse'
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- Telemetry
summary: Get a span tree by its ID.
description: Get a span tree by its ID.
parameters:
- name: span_id
in: path
description: The ID of the span to get the tree from.
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/GetSpanTreeRequest'
required: true
deprecated: true
/v1/telemetry/traces:
post:
responses:
'200':
description: A QueryTracesResponse.
content:
application/json:
schema:
$ref: '#/components/schemas/QueryTracesResponse'
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- Telemetry
summary: Query traces.
description: Query traces.
parameters: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/QueryTracesRequest'
required: true
deprecated: true
/v1/telemetry/traces/{trace_id}:
get:
responses:
'200':
description: A Trace.
content:
application/json:
schema:
$ref: '#/components/schemas/Trace'
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- Telemetry
summary: Get a trace by its ID.
description: Get a trace by its ID.
parameters:
- name: trace_id
in: path
description: The ID of the trace to get.
required: true
schema:
type: string
deprecated: true
/v1/telemetry/traces/{trace_id}/spans/{span_id}:
get:
responses:
'200':
description: A Span.
content:
application/json:
schema:
$ref: '#/components/schemas/Span'
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- Telemetry
summary: Get a span by its ID.
description: Get a span by its ID.
parameters:
- name: trace_id
in: path
description: >-
The ID of the trace to get the span from.
required: true
schema:
type: string
- name: span_id
in: path
description: The ID of the span to get.
required: true
schema:
type: string
deprecated: true
jsonSchemaDialect: >- jsonSchemaDialect: >-
https://json-schema.org/draft/2020-12/schema https://json-schema.org/draft/2020-12/schema
components: components:
@ -9829,434 +9597,6 @@ components:
- hyperparam_search_config - hyperparam_search_config
- logger_config - logger_config
title: SupervisedFineTuneRequest title: SupervisedFineTuneRequest
QueryMetricsRequest:
type: object
properties:
start_time:
type: integer
description: The start time of the metric to query.
end_time:
type: integer
description: The end time of the metric to query.
granularity:
type: string
description: The granularity of the metric to query.
query_type:
type: string
enum:
- range
- instant
description: The type of query to perform.
label_matchers:
type: array
items:
type: object
properties:
name:
type: string
description: The name of the label to match
value:
type: string
description: The value to match against
operator:
type: string
enum:
- '='
- '!='
- =~
- '!~'
description: >-
The comparison operator to use for matching
default: '='
additionalProperties: false
required:
- name
- value
- operator
title: MetricLabelMatcher
description: >-
A matcher for filtering metrics by label values.
description: >-
The label matchers to apply to the metric.
additionalProperties: false
required:
- start_time
- query_type
title: QueryMetricsRequest
MetricDataPoint:
type: object
properties:
timestamp:
type: integer
description: >-
Unix timestamp when the metric value was recorded
value:
type: number
description: >-
The numeric value of the metric at this timestamp
unit:
type: string
additionalProperties: false
required:
- timestamp
- value
- unit
title: MetricDataPoint
description: >-
A single data point in a metric time series.
MetricLabel:
type: object
properties:
name:
type: string
description: The name of the label
value:
type: string
description: The value of the label
additionalProperties: false
required:
- name
- value
title: MetricLabel
description: A label associated with a metric.
MetricSeries:
type: object
properties:
metric:
type: string
description: The name of the metric
labels:
type: array
items:
$ref: '#/components/schemas/MetricLabel'
description: >-
List of labels associated with this metric series
values:
type: array
items:
$ref: '#/components/schemas/MetricDataPoint'
description: >-
List of data points in chronological order
additionalProperties: false
required:
- metric
- labels
- values
title: MetricSeries
description: A time series of metric data points.
QueryMetricsResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/MetricSeries'
description: >-
List of metric series matching the query criteria
additionalProperties: false
required:
- data
title: QueryMetricsResponse
description: >-
Response containing metric time series data.
QueryCondition:
type: object
properties:
key:
type: string
description: The attribute key to filter on
op:
$ref: '#/components/schemas/QueryConditionOp'
description: The comparison operator to apply
value:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
description: The value to compare against
additionalProperties: false
required:
- key
- op
- value
title: QueryCondition
description: A condition for filtering query results.
QueryConditionOp:
type: string
enum:
- eq
- ne
- gt
- lt
title: QueryConditionOp
description: >-
Comparison operators for query conditions.
QuerySpansRequest:
type: object
properties:
attribute_filters:
type: array
items:
$ref: '#/components/schemas/QueryCondition'
description: >-
The attribute filters to apply to the spans.
attributes_to_return:
type: array
items:
type: string
description: The attributes to return in the spans.
max_depth:
type: integer
description: The maximum depth of the tree.
additionalProperties: false
required:
- attribute_filters
- attributes_to_return
title: QuerySpansRequest
Span:
type: object
properties:
span_id:
type: string
description: Unique identifier for the span
trace_id:
type: string
description: >-
Unique identifier for the trace this span belongs to
parent_span_id:
type: string
description: >-
(Optional) Unique identifier for the parent span, if this is a child span
name:
type: string
description: >-
Human-readable name describing the operation this span represents
start_time:
type: string
format: date-time
description: Timestamp when the operation began
end_time:
type: string
format: date-time
description: >-
(Optional) Timestamp when the operation finished, if completed
attributes:
type: object
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
description: >-
(Optional) Key-value pairs containing additional metadata about the span
additionalProperties: false
required:
- span_id
- trace_id
- name
- start_time
title: Span
description: >-
A span representing a single operation within a trace.
QuerySpansResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Span'
description: >-
List of spans matching the query criteria
additionalProperties: false
required:
- data
title: QuerySpansResponse
description: Response containing a list of spans.
SaveSpansToDatasetRequest:
type: object
properties:
attribute_filters:
type: array
items:
$ref: '#/components/schemas/QueryCondition'
description: >-
The attribute filters to apply to the spans.
attributes_to_save:
type: array
items:
type: string
description: The attributes to save to the dataset.
dataset_id:
type: string
description: >-
The ID of the dataset to save the spans to.
max_depth:
type: integer
description: The maximum depth of the tree.
additionalProperties: false
required:
- attribute_filters
- attributes_to_save
- dataset_id
title: SaveSpansToDatasetRequest
GetSpanTreeRequest:
type: object
properties:
attributes_to_return:
type: array
items:
type: string
description: The attributes to return in the tree.
max_depth:
type: integer
description: The maximum depth of the tree.
additionalProperties: false
title: GetSpanTreeRequest
SpanStatus:
type: string
enum:
- ok
- error
title: SpanStatus
description: >-
The status of a span indicating whether it completed successfully or with
an error.
SpanWithStatus:
type: object
properties:
span_id:
type: string
description: Unique identifier for the span
trace_id:
type: string
description: >-
Unique identifier for the trace this span belongs to
parent_span_id:
type: string
description: >-
(Optional) Unique identifier for the parent span, if this is a child span
name:
type: string
description: >-
Human-readable name describing the operation this span represents
start_time:
type: string
format: date-time
description: Timestamp when the operation began
end_time:
type: string
format: date-time
description: >-
(Optional) Timestamp when the operation finished, if completed
attributes:
type: object
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
description: >-
(Optional) Key-value pairs containing additional metadata about the span
status:
$ref: '#/components/schemas/SpanStatus'
description: >-
(Optional) The current status of the span
additionalProperties: false
required:
- span_id
- trace_id
- name
- start_time
title: SpanWithStatus
description: A span that includes status information.
QuerySpanTreeResponse:
type: object
properties:
data:
type: object
additionalProperties:
$ref: '#/components/schemas/SpanWithStatus'
description: >-
Dictionary mapping span IDs to spans with status information
additionalProperties: false
required:
- data
title: QuerySpanTreeResponse
description: >-
Response containing a tree structure of spans.
QueryTracesRequest:
type: object
properties:
attribute_filters:
type: array
items:
$ref: '#/components/schemas/QueryCondition'
description: >-
The attribute filters to apply to the traces.
limit:
type: integer
description: The limit of traces to return.
offset:
type: integer
description: The offset of the traces to return.
order_by:
type: array
items:
type: string
description: The order by of the traces to return.
additionalProperties: false
title: QueryTracesRequest
Trace:
type: object
properties:
trace_id:
type: string
description: Unique identifier for the trace
root_span_id:
type: string
description: >-
Unique identifier for the root span that started this trace
start_time:
type: string
format: date-time
description: Timestamp when the trace began
end_time:
type: string
format: date-time
description: >-
(Optional) Timestamp when the trace finished, if completed
additionalProperties: false
required:
- trace_id
- root_span_id
- start_time
title: Trace
description: >-
A trace representing the complete execution path of a request across multiple
operations.
QueryTracesResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Trace'
description: >-
List of traces matching the query criteria
additionalProperties: false
required:
- data
title: QueryTracesResponse
description: Response containing a list of traces.
responses: responses:
BadRequest400: BadRequest400:
description: The request was invalid or malformed description: The request was invalid or malformed
@ -10362,8 +9702,6 @@ tags:
- name: Safety - name: Safety
description: OpenAI-compatible Moderations API. description: OpenAI-compatible Moderations API.
x-displayName: Safety x-displayName: Safety
- name: Telemetry
description: ''
- name: VectorIO - name: VectorIO
description: '' description: ''
x-tagGroups: x-tagGroups:
@ -10379,5 +9717,4 @@ x-tagGroups:
- Models - Models
- PostTraining (Coming Soon) - PostTraining (Coming Soon)
- Safety - Safety
- Telemetry
- VectorIO - VectorIO

View file

@ -1711,343 +1711,6 @@
}, },
"deprecated": false "deprecated": false
} }
},
"/v1alpha/telemetry/metrics/{metric_name}": {
"post": {
"responses": {
"200": {
"description": "A QueryMetricsResponse.",
"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"
],
"summary": "Query metrics.",
"description": "Query metrics.",
"parameters": [
{
"name": "metric_name",
"in": "path",
"description": "The name of the metric to query.",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/QueryMetricsRequest"
}
}
},
"required": true
},
"deprecated": false
}
},
"/v1alpha/telemetry/spans": {
"post": {
"responses": {
"200": {
"description": "A QuerySpansResponse.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/QuerySpansResponse"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest400"
},
"429": {
"$ref": "#/components/responses/TooManyRequests429"
},
"500": {
"$ref": "#/components/responses/InternalServerError500"
},
"default": {
"$ref": "#/components/responses/DefaultError"
}
},
"tags": [
"Telemetry"
],
"summary": "Query spans.",
"description": "Query spans.",
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/QuerySpansRequest"
}
}
},
"required": true
},
"deprecated": false
}
},
"/v1alpha/telemetry/spans/export": {
"post": {
"responses": {
"200": {
"description": "OK"
},
"400": {
"$ref": "#/components/responses/BadRequest400"
},
"429": {
"$ref": "#/components/responses/TooManyRequests429"
},
"500": {
"$ref": "#/components/responses/InternalServerError500"
},
"default": {
"$ref": "#/components/responses/DefaultError"
}
},
"tags": [
"Telemetry"
],
"summary": "Save spans to a dataset.",
"description": "Save spans to a dataset.",
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SaveSpansToDatasetRequest"
}
}
},
"required": true
},
"deprecated": false
}
},
"/v1alpha/telemetry/spans/{span_id}/tree": {
"post": {
"responses": {
"200": {
"description": "A QuerySpanTreeResponse.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/QuerySpanTreeResponse"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest400"
},
"429": {
"$ref": "#/components/responses/TooManyRequests429"
},
"500": {
"$ref": "#/components/responses/InternalServerError500"
},
"default": {
"$ref": "#/components/responses/DefaultError"
}
},
"tags": [
"Telemetry"
],
"summary": "Get a span tree by its ID.",
"description": "Get a span tree by its ID.",
"parameters": [
{
"name": "span_id",
"in": "path",
"description": "The ID of the span to get the tree from.",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetSpanTreeRequest"
}
}
},
"required": true
},
"deprecated": false
}
},
"/v1alpha/telemetry/traces": {
"post": {
"responses": {
"200": {
"description": "A QueryTracesResponse.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/QueryTracesResponse"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest400"
},
"429": {
"$ref": "#/components/responses/TooManyRequests429"
},
"500": {
"$ref": "#/components/responses/InternalServerError500"
},
"default": {
"$ref": "#/components/responses/DefaultError"
}
},
"tags": [
"Telemetry"
],
"summary": "Query traces.",
"description": "Query traces.",
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/QueryTracesRequest"
}
}
},
"required": true
},
"deprecated": false
}
},
"/v1alpha/telemetry/traces/{trace_id}": {
"get": {
"responses": {
"200": {
"description": "A Trace.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Trace"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest400"
},
"429": {
"$ref": "#/components/responses/TooManyRequests429"
},
"500": {
"$ref": "#/components/responses/InternalServerError500"
},
"default": {
"$ref": "#/components/responses/DefaultError"
}
},
"tags": [
"Telemetry"
],
"summary": "Get a trace by its ID.",
"description": "Get a trace by its ID.",
"parameters": [
{
"name": "trace_id",
"in": "path",
"description": "The ID of the trace to get.",
"required": true,
"schema": {
"type": "string"
}
}
],
"deprecated": false
}
},
"/v1alpha/telemetry/traces/{trace_id}/spans/{span_id}": {
"get": {
"responses": {
"200": {
"description": "A Span.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Span"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest400"
},
"429": {
"$ref": "#/components/responses/TooManyRequests429"
},
"500": {
"$ref": "#/components/responses/InternalServerError500"
},
"default": {
"$ref": "#/components/responses/DefaultError"
}
},
"tags": [
"Telemetry"
],
"summary": "Get a span by its ID.",
"description": "Get a span by its ID.",
"parameters": [
{
"name": "trace_id",
"in": "path",
"description": "The ID of the trace to get the span from.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "span_id",
"in": "path",
"description": "The ID of the span to get.",
"required": true,
"schema": {
"type": "string"
}
}
],
"deprecated": false
}
} }
}, },
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema", "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
@ -5765,561 +5428,6 @@
"logger_config" "logger_config"
], ],
"title": "SupervisedFineTuneRequest" "title": "SupervisedFineTuneRequest"
},
"QueryMetricsRequest": {
"type": "object",
"properties": {
"start_time": {
"type": "integer",
"description": "The start time of the metric to query."
},
"end_time": {
"type": "integer",
"description": "The end time of the metric to query."
},
"granularity": {
"type": "string",
"description": "The granularity of the metric to query."
},
"query_type": {
"type": "string",
"enum": [
"range",
"instant"
],
"description": "The type of query to perform."
},
"label_matchers": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the label to match"
},
"value": {
"type": "string",
"description": "The value to match against"
},
"operator": {
"type": "string",
"enum": [
"=",
"!=",
"=~",
"!~"
],
"description": "The comparison operator to use for matching",
"default": "="
}
},
"additionalProperties": false,
"required": [
"name",
"value",
"operator"
],
"title": "MetricLabelMatcher",
"description": "A matcher for filtering metrics by label values."
},
"description": "The label matchers to apply to the metric."
}
},
"additionalProperties": false,
"required": [
"start_time",
"query_type"
],
"title": "QueryMetricsRequest"
},
"MetricDataPoint": {
"type": "object",
"properties": {
"timestamp": {
"type": "integer",
"description": "Unix timestamp when the metric value was recorded"
},
"value": {
"type": "number",
"description": "The numeric value of the metric at this timestamp"
},
"unit": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"timestamp",
"value",
"unit"
],
"title": "MetricDataPoint",
"description": "A single data point in a metric time series."
},
"MetricLabel": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the label"
},
"value": {
"type": "string",
"description": "The value of the label"
}
},
"additionalProperties": false,
"required": [
"name",
"value"
],
"title": "MetricLabel",
"description": "A label associated with a metric."
},
"MetricSeries": {
"type": "object",
"properties": {
"metric": {
"type": "string",
"description": "The name of the metric"
},
"labels": {
"type": "array",
"items": {
"$ref": "#/components/schemas/MetricLabel"
},
"description": "List of labels associated with this metric series"
},
"values": {
"type": "array",
"items": {
"$ref": "#/components/schemas/MetricDataPoint"
},
"description": "List of data points in chronological order"
}
},
"additionalProperties": false,
"required": [
"metric",
"labels",
"values"
],
"title": "MetricSeries",
"description": "A time series of metric data points."
},
"QueryMetricsResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/MetricSeries"
},
"description": "List of metric series matching the query criteria"
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "QueryMetricsResponse",
"description": "Response containing metric time series data."
},
"QueryCondition": {
"type": "object",
"properties": {
"key": {
"type": "string",
"description": "The attribute key to filter on"
},
"op": {
"$ref": "#/components/schemas/QueryConditionOp",
"description": "The comparison operator to apply"
},
"value": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
],
"description": "The value to compare against"
}
},
"additionalProperties": false,
"required": [
"key",
"op",
"value"
],
"title": "QueryCondition",
"description": "A condition for filtering query results."
},
"QueryConditionOp": {
"type": "string",
"enum": [
"eq",
"ne",
"gt",
"lt"
],
"title": "QueryConditionOp",
"description": "Comparison operators for query conditions."
},
"QuerySpansRequest": {
"type": "object",
"properties": {
"attribute_filters": {
"type": "array",
"items": {
"$ref": "#/components/schemas/QueryCondition"
},
"description": "The attribute filters to apply to the spans."
},
"attributes_to_return": {
"type": "array",
"items": {
"type": "string"
},
"description": "The attributes to return in the spans."
},
"max_depth": {
"type": "integer",
"description": "The maximum depth of the tree."
}
},
"additionalProperties": false,
"required": [
"attribute_filters",
"attributes_to_return"
],
"title": "QuerySpansRequest"
},
"Span": {
"type": "object",
"properties": {
"span_id": {
"type": "string",
"description": "Unique identifier for the span"
},
"trace_id": {
"type": "string",
"description": "Unique identifier for the trace this span belongs to"
},
"parent_span_id": {
"type": "string",
"description": "(Optional) Unique identifier for the parent span, if this is a child span"
},
"name": {
"type": "string",
"description": "Human-readable name describing the operation this span represents"
},
"start_time": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the operation began"
},
"end_time": {
"type": "string",
"format": "date-time",
"description": "(Optional) Timestamp when the operation finished, if completed"
},
"attributes": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
},
"description": "(Optional) Key-value pairs containing additional metadata about the span"
}
},
"additionalProperties": false,
"required": [
"span_id",
"trace_id",
"name",
"start_time"
],
"title": "Span",
"description": "A span representing a single operation within a trace."
},
"QuerySpansResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Span"
},
"description": "List of spans matching the query criteria"
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "QuerySpansResponse",
"description": "Response containing a list of spans."
},
"SaveSpansToDatasetRequest": {
"type": "object",
"properties": {
"attribute_filters": {
"type": "array",
"items": {
"$ref": "#/components/schemas/QueryCondition"
},
"description": "The attribute filters to apply to the spans."
},
"attributes_to_save": {
"type": "array",
"items": {
"type": "string"
},
"description": "The attributes to save to the dataset."
},
"dataset_id": {
"type": "string",
"description": "The ID of the dataset to save the spans to."
},
"max_depth": {
"type": "integer",
"description": "The maximum depth of the tree."
}
},
"additionalProperties": false,
"required": [
"attribute_filters",
"attributes_to_save",
"dataset_id"
],
"title": "SaveSpansToDatasetRequest"
},
"GetSpanTreeRequest": {
"type": "object",
"properties": {
"attributes_to_return": {
"type": "array",
"items": {
"type": "string"
},
"description": "The attributes to return in the tree."
},
"max_depth": {
"type": "integer",
"description": "The maximum depth of the tree."
}
},
"additionalProperties": false,
"title": "GetSpanTreeRequest"
},
"SpanStatus": {
"type": "string",
"enum": [
"ok",
"error"
],
"title": "SpanStatus",
"description": "The status of a span indicating whether it completed successfully or with an error."
},
"SpanWithStatus": {
"type": "object",
"properties": {
"span_id": {
"type": "string",
"description": "Unique identifier for the span"
},
"trace_id": {
"type": "string",
"description": "Unique identifier for the trace this span belongs to"
},
"parent_span_id": {
"type": "string",
"description": "(Optional) Unique identifier for the parent span, if this is a child span"
},
"name": {
"type": "string",
"description": "Human-readable name describing the operation this span represents"
},
"start_time": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the operation began"
},
"end_time": {
"type": "string",
"format": "date-time",
"description": "(Optional) Timestamp when the operation finished, if completed"
},
"attributes": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
},
"description": "(Optional) Key-value pairs containing additional metadata about the span"
},
"status": {
"$ref": "#/components/schemas/SpanStatus",
"description": "(Optional) The current status of the span"
}
},
"additionalProperties": false,
"required": [
"span_id",
"trace_id",
"name",
"start_time"
],
"title": "SpanWithStatus",
"description": "A span that includes status information."
},
"QuerySpanTreeResponse": {
"type": "object",
"properties": {
"data": {
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/SpanWithStatus"
},
"description": "Dictionary mapping span IDs to spans with status information"
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "QuerySpanTreeResponse",
"description": "Response containing a tree structure of spans."
},
"QueryTracesRequest": {
"type": "object",
"properties": {
"attribute_filters": {
"type": "array",
"items": {
"$ref": "#/components/schemas/QueryCondition"
},
"description": "The attribute filters to apply to the traces."
},
"limit": {
"type": "integer",
"description": "The limit of traces to return."
},
"offset": {
"type": "integer",
"description": "The offset of the traces to return."
},
"order_by": {
"type": "array",
"items": {
"type": "string"
},
"description": "The order by of the traces to return."
}
},
"additionalProperties": false,
"title": "QueryTracesRequest"
},
"Trace": {
"type": "object",
"properties": {
"trace_id": {
"type": "string",
"description": "Unique identifier for the trace"
},
"root_span_id": {
"type": "string",
"description": "Unique identifier for the root span that started this trace"
},
"start_time": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the trace began"
},
"end_time": {
"type": "string",
"format": "date-time",
"description": "(Optional) Timestamp when the trace finished, if completed"
}
},
"additionalProperties": false,
"required": [
"trace_id",
"root_span_id",
"start_time"
],
"title": "Trace",
"description": "A trace representing the complete execution path of a request across multiple operations."
},
"QueryTracesResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Trace"
},
"description": "List of traces matching the query criteria"
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "QueryTracesResponse",
"description": "Response containing a list of traces."
} }
}, },
"responses": { "responses": {
@ -6416,10 +5524,6 @@
{ {
"name": "PostTraining (Coming Soon)", "name": "PostTraining (Coming Soon)",
"description": "" "description": ""
},
{
"name": "Telemetry",
"description": ""
} }
], ],
"x-tagGroups": [ "x-tagGroups": [
@ -6431,8 +5535,7 @@
"DatasetIO", "DatasetIO",
"Datasets", "Datasets",
"Eval", "Eval",
"PostTraining (Coming Soon)", "PostTraining (Coming Soon)"
"Telemetry"
] ]
} }
] ]

View file

@ -1224,238 +1224,6 @@ paths:
$ref: '#/components/schemas/SupervisedFineTuneRequest' $ref: '#/components/schemas/SupervisedFineTuneRequest'
required: true required: true
deprecated: false deprecated: false
/v1alpha/telemetry/metrics/{metric_name}:
post:
responses:
'200':
description: A QueryMetricsResponse.
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
summary: Query metrics.
description: Query metrics.
parameters:
- name: metric_name
in: path
description: The name of the metric to query.
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/QueryMetricsRequest'
required: true
deprecated: false
/v1alpha/telemetry/spans:
post:
responses:
'200':
description: A QuerySpansResponse.
content:
application/json:
schema:
$ref: '#/components/schemas/QuerySpansResponse'
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- Telemetry
summary: Query spans.
description: Query spans.
parameters: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/QuerySpansRequest'
required: true
deprecated: false
/v1alpha/telemetry/spans/export:
post:
responses:
'200':
description: OK
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- Telemetry
summary: Save spans to a dataset.
description: Save spans to a dataset.
parameters: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/SaveSpansToDatasetRequest'
required: true
deprecated: false
/v1alpha/telemetry/spans/{span_id}/tree:
post:
responses:
'200':
description: A QuerySpanTreeResponse.
content:
application/json:
schema:
$ref: '#/components/schemas/QuerySpanTreeResponse'
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- Telemetry
summary: Get a span tree by its ID.
description: Get a span tree by its ID.
parameters:
- name: span_id
in: path
description: The ID of the span to get the tree from.
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/GetSpanTreeRequest'
required: true
deprecated: false
/v1alpha/telemetry/traces:
post:
responses:
'200':
description: A QueryTracesResponse.
content:
application/json:
schema:
$ref: '#/components/schemas/QueryTracesResponse'
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- Telemetry
summary: Query traces.
description: Query traces.
parameters: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/QueryTracesRequest'
required: true
deprecated: false
/v1alpha/telemetry/traces/{trace_id}:
get:
responses:
'200':
description: A Trace.
content:
application/json:
schema:
$ref: '#/components/schemas/Trace'
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- Telemetry
summary: Get a trace by its ID.
description: Get a trace by its ID.
parameters:
- name: trace_id
in: path
description: The ID of the trace to get.
required: true
schema:
type: string
deprecated: false
/v1alpha/telemetry/traces/{trace_id}/spans/{span_id}:
get:
responses:
'200':
description: A Span.
content:
application/json:
schema:
$ref: '#/components/schemas/Span'
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- Telemetry
summary: Get a span by its ID.
description: Get a span by its ID.
parameters:
- name: trace_id
in: path
description: >-
The ID of the trace to get the span from.
required: true
schema:
type: string
- name: span_id
in: path
description: The ID of the span to get.
required: true
schema:
type: string
deprecated: false
jsonSchemaDialect: >- jsonSchemaDialect: >-
https://json-schema.org/draft/2020-12/schema https://json-schema.org/draft/2020-12/schema
components: components:
@ -4249,434 +4017,6 @@ components:
- hyperparam_search_config - hyperparam_search_config
- logger_config - logger_config
title: SupervisedFineTuneRequest title: SupervisedFineTuneRequest
QueryMetricsRequest:
type: object
properties:
start_time:
type: integer
description: The start time of the metric to query.
end_time:
type: integer
description: The end time of the metric to query.
granularity:
type: string
description: The granularity of the metric to query.
query_type:
type: string
enum:
- range
- instant
description: The type of query to perform.
label_matchers:
type: array
items:
type: object
properties:
name:
type: string
description: The name of the label to match
value:
type: string
description: The value to match against
operator:
type: string
enum:
- '='
- '!='
- =~
- '!~'
description: >-
The comparison operator to use for matching
default: '='
additionalProperties: false
required:
- name
- value
- operator
title: MetricLabelMatcher
description: >-
A matcher for filtering metrics by label values.
description: >-
The label matchers to apply to the metric.
additionalProperties: false
required:
- start_time
- query_type
title: QueryMetricsRequest
MetricDataPoint:
type: object
properties:
timestamp:
type: integer
description: >-
Unix timestamp when the metric value was recorded
value:
type: number
description: >-
The numeric value of the metric at this timestamp
unit:
type: string
additionalProperties: false
required:
- timestamp
- value
- unit
title: MetricDataPoint
description: >-
A single data point in a metric time series.
MetricLabel:
type: object
properties:
name:
type: string
description: The name of the label
value:
type: string
description: The value of the label
additionalProperties: false
required:
- name
- value
title: MetricLabel
description: A label associated with a metric.
MetricSeries:
type: object
properties:
metric:
type: string
description: The name of the metric
labels:
type: array
items:
$ref: '#/components/schemas/MetricLabel'
description: >-
List of labels associated with this metric series
values:
type: array
items:
$ref: '#/components/schemas/MetricDataPoint'
description: >-
List of data points in chronological order
additionalProperties: false
required:
- metric
- labels
- values
title: MetricSeries
description: A time series of metric data points.
QueryMetricsResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/MetricSeries'
description: >-
List of metric series matching the query criteria
additionalProperties: false
required:
- data
title: QueryMetricsResponse
description: >-
Response containing metric time series data.
QueryCondition:
type: object
properties:
key:
type: string
description: The attribute key to filter on
op:
$ref: '#/components/schemas/QueryConditionOp'
description: The comparison operator to apply
value:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
description: The value to compare against
additionalProperties: false
required:
- key
- op
- value
title: QueryCondition
description: A condition for filtering query results.
QueryConditionOp:
type: string
enum:
- eq
- ne
- gt
- lt
title: QueryConditionOp
description: >-
Comparison operators for query conditions.
QuerySpansRequest:
type: object
properties:
attribute_filters:
type: array
items:
$ref: '#/components/schemas/QueryCondition'
description: >-
The attribute filters to apply to the spans.
attributes_to_return:
type: array
items:
type: string
description: The attributes to return in the spans.
max_depth:
type: integer
description: The maximum depth of the tree.
additionalProperties: false
required:
- attribute_filters
- attributes_to_return
title: QuerySpansRequest
Span:
type: object
properties:
span_id:
type: string
description: Unique identifier for the span
trace_id:
type: string
description: >-
Unique identifier for the trace this span belongs to
parent_span_id:
type: string
description: >-
(Optional) Unique identifier for the parent span, if this is a child span
name:
type: string
description: >-
Human-readable name describing the operation this span represents
start_time:
type: string
format: date-time
description: Timestamp when the operation began
end_time:
type: string
format: date-time
description: >-
(Optional) Timestamp when the operation finished, if completed
attributes:
type: object
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
description: >-
(Optional) Key-value pairs containing additional metadata about the span
additionalProperties: false
required:
- span_id
- trace_id
- name
- start_time
title: Span
description: >-
A span representing a single operation within a trace.
QuerySpansResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Span'
description: >-
List of spans matching the query criteria
additionalProperties: false
required:
- data
title: QuerySpansResponse
description: Response containing a list of spans.
SaveSpansToDatasetRequest:
type: object
properties:
attribute_filters:
type: array
items:
$ref: '#/components/schemas/QueryCondition'
description: >-
The attribute filters to apply to the spans.
attributes_to_save:
type: array
items:
type: string
description: The attributes to save to the dataset.
dataset_id:
type: string
description: >-
The ID of the dataset to save the spans to.
max_depth:
type: integer
description: The maximum depth of the tree.
additionalProperties: false
required:
- attribute_filters
- attributes_to_save
- dataset_id
title: SaveSpansToDatasetRequest
GetSpanTreeRequest:
type: object
properties:
attributes_to_return:
type: array
items:
type: string
description: The attributes to return in the tree.
max_depth:
type: integer
description: The maximum depth of the tree.
additionalProperties: false
title: GetSpanTreeRequest
SpanStatus:
type: string
enum:
- ok
- error
title: SpanStatus
description: >-
The status of a span indicating whether it completed successfully or with
an error.
SpanWithStatus:
type: object
properties:
span_id:
type: string
description: Unique identifier for the span
trace_id:
type: string
description: >-
Unique identifier for the trace this span belongs to
parent_span_id:
type: string
description: >-
(Optional) Unique identifier for the parent span, if this is a child span
name:
type: string
description: >-
Human-readable name describing the operation this span represents
start_time:
type: string
format: date-time
description: Timestamp when the operation began
end_time:
type: string
format: date-time
description: >-
(Optional) Timestamp when the operation finished, if completed
attributes:
type: object
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
description: >-
(Optional) Key-value pairs containing additional metadata about the span
status:
$ref: '#/components/schemas/SpanStatus'
description: >-
(Optional) The current status of the span
additionalProperties: false
required:
- span_id
- trace_id
- name
- start_time
title: SpanWithStatus
description: A span that includes status information.
QuerySpanTreeResponse:
type: object
properties:
data:
type: object
additionalProperties:
$ref: '#/components/schemas/SpanWithStatus'
description: >-
Dictionary mapping span IDs to spans with status information
additionalProperties: false
required:
- data
title: QuerySpanTreeResponse
description: >-
Response containing a tree structure of spans.
QueryTracesRequest:
type: object
properties:
attribute_filters:
type: array
items:
$ref: '#/components/schemas/QueryCondition'
description: >-
The attribute filters to apply to the traces.
limit:
type: integer
description: The limit of traces to return.
offset:
type: integer
description: The offset of the traces to return.
order_by:
type: array
items:
type: string
description: The order by of the traces to return.
additionalProperties: false
title: QueryTracesRequest
Trace:
type: object
properties:
trace_id:
type: string
description: Unique identifier for the trace
root_span_id:
type: string
description: >-
Unique identifier for the root span that started this trace
start_time:
type: string
format: date-time
description: Timestamp when the trace began
end_time:
type: string
format: date-time
description: >-
(Optional) Timestamp when the trace finished, if completed
additionalProperties: false
required:
- trace_id
- root_span_id
- start_time
title: Trace
description: >-
A trace representing the complete execution path of a request across multiple
operations.
QueryTracesResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Trace'
description: >-
List of traces matching the query criteria
additionalProperties: false
required:
- data
title: QueryTracesResponse
description: Response containing a list of traces.
responses: responses:
BadRequest400: BadRequest400:
description: The request was invalid or malformed description: The request was invalid or malformed
@ -4784,8 +4124,6 @@ tags:
Llama Stack Evaluation API for running evaluations on model and agent candidates. Llama Stack Evaluation API for running evaluations on model and agent candidates.
- name: PostTraining (Coming Soon) - name: PostTraining (Coming Soon)
description: '' description: ''
- name: Telemetry
description: ''
x-tagGroups: x-tagGroups:
- name: Operations - name: Operations
tags: tags:
@ -4795,4 +4133,3 @@ x-tagGroups:
- Datasets - Datasets
- Eval - Eval
- PostTraining (Coming Soon) - PostTraining (Coming Soon)
- Telemetry

View file

@ -2525,44 +2525,6 @@
"deprecated": false "deprecated": false
} }
}, },
"/v1/telemetry/events": {
"post": {
"responses": {
"200": {
"description": "OK"
},
"400": {
"$ref": "#/components/responses/BadRequest400"
},
"429": {
"$ref": "#/components/responses/TooManyRequests429"
},
"500": {
"$ref": "#/components/responses/InternalServerError500"
},
"default": {
"$ref": "#/components/responses/DefaultError"
}
},
"tags": [
"Telemetry"
],
"summary": "Log an event.",
"description": "Log an event.",
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LogEventRequest"
}
}
},
"required": true
},
"deprecated": false
}
},
"/v1/tool-runtime/invoke": { "/v1/tool-runtime/invoke": {
"post": { "post": {
"responses": { "responses": {
@ -10757,354 +10719,6 @@
"title": "SyntheticDataGenerationResponse", "title": "SyntheticDataGenerationResponse",
"description": "Response from the synthetic data generation. Batch of (prompt, response, score) tuples that pass the threshold." "description": "Response from the synthetic data generation. Batch of (prompt, response, score) tuples that pass the threshold."
}, },
"Event": {
"oneOf": [
{
"$ref": "#/components/schemas/UnstructuredLogEvent"
},
{
"$ref": "#/components/schemas/MetricEvent"
},
{
"$ref": "#/components/schemas/StructuredLogEvent"
}
],
"discriminator": {
"propertyName": "type",
"mapping": {
"unstructured_log": "#/components/schemas/UnstructuredLogEvent",
"metric": "#/components/schemas/MetricEvent",
"structured_log": "#/components/schemas/StructuredLogEvent"
}
}
},
"EventType": {
"type": "string",
"enum": [
"unstructured_log",
"structured_log",
"metric"
],
"title": "EventType",
"description": "The type of telemetry event being logged."
},
"LogSeverity": {
"type": "string",
"enum": [
"verbose",
"debug",
"info",
"warn",
"error",
"critical"
],
"title": "LogSeverity",
"description": "The severity level of a log message."
},
"MetricEvent": {
"type": "object",
"properties": {
"trace_id": {
"type": "string",
"description": "Unique identifier for the trace this event belongs to"
},
"span_id": {
"type": "string",
"description": "Unique identifier for the span this event belongs to"
},
"timestamp": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the event occurred"
},
"attributes": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"description": "(Optional) Key-value pairs containing additional metadata about the event"
},
"type": {
"$ref": "#/components/schemas/EventType",
"const": "metric",
"default": "metric",
"description": "Event type identifier set to METRIC"
},
"metric": {
"type": "string",
"description": "The name of the metric being measured"
},
"value": {
"oneOf": [
{
"type": "integer"
},
{
"type": "number"
}
],
"description": "The numeric value of the metric measurement"
},
"unit": {
"type": "string",
"description": "The unit of measurement for the metric value"
}
},
"additionalProperties": false,
"required": [
"trace_id",
"span_id",
"timestamp",
"type",
"metric",
"value",
"unit"
],
"title": "MetricEvent",
"description": "A metric event containing a measured value."
},
"SpanEndPayload": {
"type": "object",
"properties": {
"type": {
"$ref": "#/components/schemas/StructuredLogType",
"const": "span_end",
"default": "span_end",
"description": "Payload type identifier set to SPAN_END"
},
"status": {
"$ref": "#/components/schemas/SpanStatus",
"description": "The final status of the span indicating success or failure"
}
},
"additionalProperties": false,
"required": [
"type",
"status"
],
"title": "SpanEndPayload",
"description": "Payload for a span end event."
},
"SpanStartPayload": {
"type": "object",
"properties": {
"type": {
"$ref": "#/components/schemas/StructuredLogType",
"const": "span_start",
"default": "span_start",
"description": "Payload type identifier set to SPAN_START"
},
"name": {
"type": "string",
"description": "Human-readable name describing the operation this span represents"
},
"parent_span_id": {
"type": "string",
"description": "(Optional) Unique identifier for the parent span, if this is a child span"
}
},
"additionalProperties": false,
"required": [
"type",
"name"
],
"title": "SpanStartPayload",
"description": "Payload for a span start event."
},
"SpanStatus": {
"type": "string",
"enum": [
"ok",
"error"
],
"title": "SpanStatus",
"description": "The status of a span indicating whether it completed successfully or with an error."
},
"StructuredLogEvent": {
"type": "object",
"properties": {
"trace_id": {
"type": "string",
"description": "Unique identifier for the trace this event belongs to"
},
"span_id": {
"type": "string",
"description": "Unique identifier for the span this event belongs to"
},
"timestamp": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the event occurred"
},
"attributes": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"description": "(Optional) Key-value pairs containing additional metadata about the event"
},
"type": {
"$ref": "#/components/schemas/EventType",
"const": "structured_log",
"default": "structured_log",
"description": "Event type identifier set to STRUCTURED_LOG"
},
"payload": {
"oneOf": [
{
"$ref": "#/components/schemas/SpanStartPayload"
},
{
"$ref": "#/components/schemas/SpanEndPayload"
}
],
"discriminator": {
"propertyName": "type",
"mapping": {
"span_start": "#/components/schemas/SpanStartPayload",
"span_end": "#/components/schemas/SpanEndPayload"
}
},
"description": "The structured payload data for the log event"
}
},
"additionalProperties": false,
"required": [
"trace_id",
"span_id",
"timestamp",
"type",
"payload"
],
"title": "StructuredLogEvent",
"description": "A structured log event containing typed payload data."
},
"StructuredLogType": {
"type": "string",
"enum": [
"span_start",
"span_end"
],
"title": "StructuredLogType",
"description": "The type of structured log event payload."
},
"UnstructuredLogEvent": {
"type": "object",
"properties": {
"trace_id": {
"type": "string",
"description": "Unique identifier for the trace this event belongs to"
},
"span_id": {
"type": "string",
"description": "Unique identifier for the span this event belongs to"
},
"timestamp": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the event occurred"
},
"attributes": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"description": "(Optional) Key-value pairs containing additional metadata about the event"
},
"type": {
"$ref": "#/components/schemas/EventType",
"const": "unstructured_log",
"default": "unstructured_log",
"description": "Event type identifier set to UNSTRUCTURED_LOG"
},
"message": {
"type": "string",
"description": "The log message text"
},
"severity": {
"$ref": "#/components/schemas/LogSeverity",
"description": "The severity level of the log message"
}
},
"additionalProperties": false,
"required": [
"trace_id",
"span_id",
"timestamp",
"type",
"message",
"severity"
],
"title": "UnstructuredLogEvent",
"description": "An unstructured log event containing a simple text message."
},
"LogEventRequest": {
"type": "object",
"properties": {
"event": {
"$ref": "#/components/schemas/Event",
"description": "The event to log."
},
"ttl_seconds": {
"type": "integer",
"description": "The time to live of the event."
}
},
"additionalProperties": false,
"required": [
"event",
"ttl_seconds"
],
"title": "LogEventRequest"
},
"InvokeToolRequest": { "InvokeToolRequest": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -13355,10 +12969,6 @@
"name": "SyntheticDataGeneration (Coming Soon)", "name": "SyntheticDataGeneration (Coming Soon)",
"description": "" "description": ""
}, },
{
"name": "Telemetry",
"description": ""
},
{ {
"name": "ToolGroups", "name": "ToolGroups",
"description": "" "description": ""
@ -13393,7 +13003,6 @@
"ScoringFunctions", "ScoringFunctions",
"Shields", "Shields",
"SyntheticDataGeneration (Coming Soon)", "SyntheticDataGeneration (Coming Soon)",
"Telemetry",
"ToolGroups", "ToolGroups",
"ToolRuntime", "ToolRuntime",
"VectorDBs", "VectorDBs",

View file

@ -1944,33 +1944,6 @@ paths:
$ref: '#/components/schemas/SyntheticDataGenerateRequest' $ref: '#/components/schemas/SyntheticDataGenerateRequest'
required: true required: true
deprecated: false deprecated: false
/v1/telemetry/events:
post:
responses:
'200':
description: OK
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- Telemetry
summary: Log an event.
description: Log an event.
parameters: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/LogEventRequest'
required: true
deprecated: false
/v1/tool-runtime/invoke: /v1/tool-runtime/invoke:
post: post:
responses: responses:
@ -8159,267 +8132,6 @@ components:
description: >- description: >-
Response from the synthetic data generation. Batch of (prompt, response, score) Response from the synthetic data generation. Batch of (prompt, response, score)
tuples that pass the threshold. tuples that pass the threshold.
Event:
oneOf:
- $ref: '#/components/schemas/UnstructuredLogEvent'
- $ref: '#/components/schemas/MetricEvent'
- $ref: '#/components/schemas/StructuredLogEvent'
discriminator:
propertyName: type
mapping:
unstructured_log: '#/components/schemas/UnstructuredLogEvent'
metric: '#/components/schemas/MetricEvent'
structured_log: '#/components/schemas/StructuredLogEvent'
EventType:
type: string
enum:
- unstructured_log
- structured_log
- metric
title: EventType
description: >-
The type of telemetry event being logged.
LogSeverity:
type: string
enum:
- verbose
- debug
- info
- warn
- error
- critical
title: LogSeverity
description: The severity level of a log message.
MetricEvent:
type: object
properties:
trace_id:
type: string
description: >-
Unique identifier for the trace this event belongs to
span_id:
type: string
description: >-
Unique identifier for the span this event belongs to
timestamp:
type: string
format: date-time
description: Timestamp when the event occurred
attributes:
type: object
additionalProperties:
oneOf:
- type: string
- type: integer
- type: number
- type: boolean
- type: 'null'
description: >-
(Optional) Key-value pairs containing additional metadata about the event
type:
$ref: '#/components/schemas/EventType'
const: metric
default: metric
description: Event type identifier set to METRIC
metric:
type: string
description: The name of the metric being measured
value:
oneOf:
- type: integer
- type: number
description: >-
The numeric value of the metric measurement
unit:
type: string
description: >-
The unit of measurement for the metric value
additionalProperties: false
required:
- trace_id
- span_id
- timestamp
- type
- metric
- value
- unit
title: MetricEvent
description: >-
A metric event containing a measured value.
SpanEndPayload:
type: object
properties:
type:
$ref: '#/components/schemas/StructuredLogType'
const: span_end
default: span_end
description: Payload type identifier set to SPAN_END
status:
$ref: '#/components/schemas/SpanStatus'
description: >-
The final status of the span indicating success or failure
additionalProperties: false
required:
- type
- status
title: SpanEndPayload
description: Payload for a span end event.
SpanStartPayload:
type: object
properties:
type:
$ref: '#/components/schemas/StructuredLogType'
const: span_start
default: span_start
description: >-
Payload type identifier set to SPAN_START
name:
type: string
description: >-
Human-readable name describing the operation this span represents
parent_span_id:
type: string
description: >-
(Optional) Unique identifier for the parent span, if this is a child span
additionalProperties: false
required:
- type
- name
title: SpanStartPayload
description: Payload for a span start event.
SpanStatus:
type: string
enum:
- ok
- error
title: SpanStatus
description: >-
The status of a span indicating whether it completed successfully or with
an error.
StructuredLogEvent:
type: object
properties:
trace_id:
type: string
description: >-
Unique identifier for the trace this event belongs to
span_id:
type: string
description: >-
Unique identifier for the span this event belongs to
timestamp:
type: string
format: date-time
description: Timestamp when the event occurred
attributes:
type: object
additionalProperties:
oneOf:
- type: string
- type: integer
- type: number
- type: boolean
- type: 'null'
description: >-
(Optional) Key-value pairs containing additional metadata about the event
type:
$ref: '#/components/schemas/EventType'
const: structured_log
default: structured_log
description: >-
Event type identifier set to STRUCTURED_LOG
payload:
oneOf:
- $ref: '#/components/schemas/SpanStartPayload'
- $ref: '#/components/schemas/SpanEndPayload'
discriminator:
propertyName: type
mapping:
span_start: '#/components/schemas/SpanStartPayload'
span_end: '#/components/schemas/SpanEndPayload'
description: >-
The structured payload data for the log event
additionalProperties: false
required:
- trace_id
- span_id
- timestamp
- type
- payload
title: StructuredLogEvent
description: >-
A structured log event containing typed payload data.
StructuredLogType:
type: string
enum:
- span_start
- span_end
title: StructuredLogType
description: >-
The type of structured log event payload.
UnstructuredLogEvent:
type: object
properties:
trace_id:
type: string
description: >-
Unique identifier for the trace this event belongs to
span_id:
type: string
description: >-
Unique identifier for the span this event belongs to
timestamp:
type: string
format: date-time
description: Timestamp when the event occurred
attributes:
type: object
additionalProperties:
oneOf:
- type: string
- type: integer
- type: number
- type: boolean
- type: 'null'
description: >-
(Optional) Key-value pairs containing additional metadata about the event
type:
$ref: '#/components/schemas/EventType'
const: unstructured_log
default: unstructured_log
description: >-
Event type identifier set to UNSTRUCTURED_LOG
message:
type: string
description: The log message text
severity:
$ref: '#/components/schemas/LogSeverity'
description: The severity level of the log message
additionalProperties: false
required:
- trace_id
- span_id
- timestamp
- type
- message
- severity
title: UnstructuredLogEvent
description: >-
An unstructured log event containing a simple text message.
LogEventRequest:
type: object
properties:
event:
$ref: '#/components/schemas/Event'
description: The event to log.
ttl_seconds:
type: integer
description: The time to live of the event.
additionalProperties: false
required:
- event
- ttl_seconds
title: LogEventRequest
InvokeToolRequest: InvokeToolRequest:
type: object type: object
properties: properties:
@ -10152,8 +9864,6 @@ tags:
description: '' description: ''
- name: SyntheticDataGeneration (Coming Soon) - name: SyntheticDataGeneration (Coming Soon)
description: '' description: ''
- name: Telemetry
description: ''
- name: ToolGroups - name: ToolGroups
description: '' description: ''
- name: ToolRuntime - name: ToolRuntime
@ -10178,7 +9888,6 @@ x-tagGroups:
- ScoringFunctions - ScoringFunctions
- Shields - Shields
- SyntheticDataGeneration (Coming Soon) - SyntheticDataGeneration (Coming Soon)
- Telemetry
- ToolGroups - ToolGroups
- ToolRuntime - ToolRuntime
- VectorDBs - VectorDBs

File diff suppressed because it is too large Load diff

View file

@ -1947,33 +1947,6 @@ paths:
$ref: '#/components/schemas/SyntheticDataGenerateRequest' $ref: '#/components/schemas/SyntheticDataGenerateRequest'
required: true required: true
deprecated: false deprecated: false
/v1/telemetry/events:
post:
responses:
'200':
description: OK
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- Telemetry
summary: Log an event.
description: Log an event.
parameters: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/LogEventRequest'
required: true
deprecated: false
/v1/tool-runtime/invoke: /v1/tool-runtime/invoke:
post: post:
responses: responses:
@ -4392,238 +4365,6 @@ paths:
$ref: '#/components/schemas/SupervisedFineTuneRequest' $ref: '#/components/schemas/SupervisedFineTuneRequest'
required: true required: true
deprecated: false deprecated: false
/v1alpha/telemetry/metrics/{metric_name}:
post:
responses:
'200':
description: A QueryMetricsResponse.
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
summary: Query metrics.
description: Query metrics.
parameters:
- name: metric_name
in: path
description: The name of the metric to query.
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/QueryMetricsRequest'
required: true
deprecated: false
/v1alpha/telemetry/spans:
post:
responses:
'200':
description: A QuerySpansResponse.
content:
application/json:
schema:
$ref: '#/components/schemas/QuerySpansResponse'
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- Telemetry
summary: Query spans.
description: Query spans.
parameters: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/QuerySpansRequest'
required: true
deprecated: false
/v1alpha/telemetry/spans/export:
post:
responses:
'200':
description: OK
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- Telemetry
summary: Save spans to a dataset.
description: Save spans to a dataset.
parameters: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/SaveSpansToDatasetRequest'
required: true
deprecated: false
/v1alpha/telemetry/spans/{span_id}/tree:
post:
responses:
'200':
description: A QuerySpanTreeResponse.
content:
application/json:
schema:
$ref: '#/components/schemas/QuerySpanTreeResponse'
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- Telemetry
summary: Get a span tree by its ID.
description: Get a span tree by its ID.
parameters:
- name: span_id
in: path
description: The ID of the span to get the tree from.
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/GetSpanTreeRequest'
required: true
deprecated: false
/v1alpha/telemetry/traces:
post:
responses:
'200':
description: A QueryTracesResponse.
content:
application/json:
schema:
$ref: '#/components/schemas/QueryTracesResponse'
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- Telemetry
summary: Query traces.
description: Query traces.
parameters: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/QueryTracesRequest'
required: true
deprecated: false
/v1alpha/telemetry/traces/{trace_id}:
get:
responses:
'200':
description: A Trace.
content:
application/json:
schema:
$ref: '#/components/schemas/Trace'
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- Telemetry
summary: Get a trace by its ID.
description: Get a trace by its ID.
parameters:
- name: trace_id
in: path
description: The ID of the trace to get.
required: true
schema:
type: string
deprecated: false
/v1alpha/telemetry/traces/{trace_id}/spans/{span_id}:
get:
responses:
'200':
description: A Span.
content:
application/json:
schema:
$ref: '#/components/schemas/Span'
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- Telemetry
summary: Get a span by its ID.
description: Get a span by its ID.
parameters:
- name: trace_id
in: path
description: >-
The ID of the trace to get the span from.
required: true
schema:
type: string
- name: span_id
in: path
description: The ID of the span to get.
required: true
schema:
type: string
deprecated: false
jsonSchemaDialect: >- jsonSchemaDialect: >-
https://json-schema.org/draft/2020-12/schema https://json-schema.org/draft/2020-12/schema
components: components:
@ -9604,267 +9345,6 @@ components:
description: >- description: >-
Response from the synthetic data generation. Batch of (prompt, response, score) Response from the synthetic data generation. Batch of (prompt, response, score)
tuples that pass the threshold. tuples that pass the threshold.
Event:
oneOf:
- $ref: '#/components/schemas/UnstructuredLogEvent'
- $ref: '#/components/schemas/MetricEvent'
- $ref: '#/components/schemas/StructuredLogEvent'
discriminator:
propertyName: type
mapping:
unstructured_log: '#/components/schemas/UnstructuredLogEvent'
metric: '#/components/schemas/MetricEvent'
structured_log: '#/components/schemas/StructuredLogEvent'
EventType:
type: string
enum:
- unstructured_log
- structured_log
- metric
title: EventType
description: >-
The type of telemetry event being logged.
LogSeverity:
type: string
enum:
- verbose
- debug
- info
- warn
- error
- critical
title: LogSeverity
description: The severity level of a log message.
MetricEvent:
type: object
properties:
trace_id:
type: string
description: >-
Unique identifier for the trace this event belongs to
span_id:
type: string
description: >-
Unique identifier for the span this event belongs to
timestamp:
type: string
format: date-time
description: Timestamp when the event occurred
attributes:
type: object
additionalProperties:
oneOf:
- type: string
- type: integer
- type: number
- type: boolean
- type: 'null'
description: >-
(Optional) Key-value pairs containing additional metadata about the event
type:
$ref: '#/components/schemas/EventType'
const: metric
default: metric
description: Event type identifier set to METRIC
metric:
type: string
description: The name of the metric being measured
value:
oneOf:
- type: integer
- type: number
description: >-
The numeric value of the metric measurement
unit:
type: string
description: >-
The unit of measurement for the metric value
additionalProperties: false
required:
- trace_id
- span_id
- timestamp
- type
- metric
- value
- unit
title: MetricEvent
description: >-
A metric event containing a measured value.
SpanEndPayload:
type: object
properties:
type:
$ref: '#/components/schemas/StructuredLogType'
const: span_end
default: span_end
description: Payload type identifier set to SPAN_END
status:
$ref: '#/components/schemas/SpanStatus'
description: >-
The final status of the span indicating success or failure
additionalProperties: false
required:
- type
- status
title: SpanEndPayload
description: Payload for a span end event.
SpanStartPayload:
type: object
properties:
type:
$ref: '#/components/schemas/StructuredLogType'
const: span_start
default: span_start
description: >-
Payload type identifier set to SPAN_START
name:
type: string
description: >-
Human-readable name describing the operation this span represents
parent_span_id:
type: string
description: >-
(Optional) Unique identifier for the parent span, if this is a child span
additionalProperties: false
required:
- type
- name
title: SpanStartPayload
description: Payload for a span start event.
SpanStatus:
type: string
enum:
- ok
- error
title: SpanStatus
description: >-
The status of a span indicating whether it completed successfully or with
an error.
StructuredLogEvent:
type: object
properties:
trace_id:
type: string
description: >-
Unique identifier for the trace this event belongs to
span_id:
type: string
description: >-
Unique identifier for the span this event belongs to
timestamp:
type: string
format: date-time
description: Timestamp when the event occurred
attributes:
type: object
additionalProperties:
oneOf:
- type: string
- type: integer
- type: number
- type: boolean
- type: 'null'
description: >-
(Optional) Key-value pairs containing additional metadata about the event
type:
$ref: '#/components/schemas/EventType'
const: structured_log
default: structured_log
description: >-
Event type identifier set to STRUCTURED_LOG
payload:
oneOf:
- $ref: '#/components/schemas/SpanStartPayload'
- $ref: '#/components/schemas/SpanEndPayload'
discriminator:
propertyName: type
mapping:
span_start: '#/components/schemas/SpanStartPayload'
span_end: '#/components/schemas/SpanEndPayload'
description: >-
The structured payload data for the log event
additionalProperties: false
required:
- trace_id
- span_id
- timestamp
- type
- payload
title: StructuredLogEvent
description: >-
A structured log event containing typed payload data.
StructuredLogType:
type: string
enum:
- span_start
- span_end
title: StructuredLogType
description: >-
The type of structured log event payload.
UnstructuredLogEvent:
type: object
properties:
trace_id:
type: string
description: >-
Unique identifier for the trace this event belongs to
span_id:
type: string
description: >-
Unique identifier for the span this event belongs to
timestamp:
type: string
format: date-time
description: Timestamp when the event occurred
attributes:
type: object
additionalProperties:
oneOf:
- type: string
- type: integer
- type: number
- type: boolean
- type: 'null'
description: >-
(Optional) Key-value pairs containing additional metadata about the event
type:
$ref: '#/components/schemas/EventType'
const: unstructured_log
default: unstructured_log
description: >-
Event type identifier set to UNSTRUCTURED_LOG
message:
type: string
description: The log message text
severity:
$ref: '#/components/schemas/LogSeverity'
description: The severity level of the log message
additionalProperties: false
required:
- trace_id
- span_id
- timestamp
- type
- message
- severity
title: UnstructuredLogEvent
description: >-
An unstructured log event containing a simple text message.
LogEventRequest:
type: object
properties:
event:
$ref: '#/components/schemas/Event'
description: The event to log.
ttl_seconds:
type: integer
description: The time to live of the event.
additionalProperties: false
required:
- event
- ttl_seconds
title: LogEventRequest
InvokeToolRequest: InvokeToolRequest:
type: object type: object
properties: properties:
@ -13668,425 +13148,6 @@ components:
- hyperparam_search_config - hyperparam_search_config
- logger_config - logger_config
title: SupervisedFineTuneRequest title: SupervisedFineTuneRequest
QueryMetricsRequest:
type: object
properties:
start_time:
type: integer
description: The start time of the metric to query.
end_time:
type: integer
description: The end time of the metric to query.
granularity:
type: string
description: The granularity of the metric to query.
query_type:
type: string
enum:
- range
- instant
description: The type of query to perform.
label_matchers:
type: array
items:
type: object
properties:
name:
type: string
description: The name of the label to match
value:
type: string
description: The value to match against
operator:
type: string
enum:
- '='
- '!='
- =~
- '!~'
description: >-
The comparison operator to use for matching
default: '='
additionalProperties: false
required:
- name
- value
- operator
title: MetricLabelMatcher
description: >-
A matcher for filtering metrics by label values.
description: >-
The label matchers to apply to the metric.
additionalProperties: false
required:
- start_time
- query_type
title: QueryMetricsRequest
MetricDataPoint:
type: object
properties:
timestamp:
type: integer
description: >-
Unix timestamp when the metric value was recorded
value:
type: number
description: >-
The numeric value of the metric at this timestamp
unit:
type: string
additionalProperties: false
required:
- timestamp
- value
- unit
title: MetricDataPoint
description: >-
A single data point in a metric time series.
MetricLabel:
type: object
properties:
name:
type: string
description: The name of the label
value:
type: string
description: The value of the label
additionalProperties: false
required:
- name
- value
title: MetricLabel
description: A label associated with a metric.
MetricSeries:
type: object
properties:
metric:
type: string
description: The name of the metric
labels:
type: array
items:
$ref: '#/components/schemas/MetricLabel'
description: >-
List of labels associated with this metric series
values:
type: array
items:
$ref: '#/components/schemas/MetricDataPoint'
description: >-
List of data points in chronological order
additionalProperties: false
required:
- metric
- labels
- values
title: MetricSeries
description: A time series of metric data points.
QueryMetricsResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/MetricSeries'
description: >-
List of metric series matching the query criteria
additionalProperties: false
required:
- data
title: QueryMetricsResponse
description: >-
Response containing metric time series data.
QueryCondition:
type: object
properties:
key:
type: string
description: The attribute key to filter on
op:
$ref: '#/components/schemas/QueryConditionOp'
description: The comparison operator to apply
value:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
description: The value to compare against
additionalProperties: false
required:
- key
- op
- value
title: QueryCondition
description: A condition for filtering query results.
QueryConditionOp:
type: string
enum:
- eq
- ne
- gt
- lt
title: QueryConditionOp
description: >-
Comparison operators for query conditions.
QuerySpansRequest:
type: object
properties:
attribute_filters:
type: array
items:
$ref: '#/components/schemas/QueryCondition'
description: >-
The attribute filters to apply to the spans.
attributes_to_return:
type: array
items:
type: string
description: The attributes to return in the spans.
max_depth:
type: integer
description: The maximum depth of the tree.
additionalProperties: false
required:
- attribute_filters
- attributes_to_return
title: QuerySpansRequest
Span:
type: object
properties:
span_id:
type: string
description: Unique identifier for the span
trace_id:
type: string
description: >-
Unique identifier for the trace this span belongs to
parent_span_id:
type: string
description: >-
(Optional) Unique identifier for the parent span, if this is a child span
name:
type: string
description: >-
Human-readable name describing the operation this span represents
start_time:
type: string
format: date-time
description: Timestamp when the operation began
end_time:
type: string
format: date-time
description: >-
(Optional) Timestamp when the operation finished, if completed
attributes:
type: object
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
description: >-
(Optional) Key-value pairs containing additional metadata about the span
additionalProperties: false
required:
- span_id
- trace_id
- name
- start_time
title: Span
description: >-
A span representing a single operation within a trace.
QuerySpansResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Span'
description: >-
List of spans matching the query criteria
additionalProperties: false
required:
- data
title: QuerySpansResponse
description: Response containing a list of spans.
SaveSpansToDatasetRequest:
type: object
properties:
attribute_filters:
type: array
items:
$ref: '#/components/schemas/QueryCondition'
description: >-
The attribute filters to apply to the spans.
attributes_to_save:
type: array
items:
type: string
description: The attributes to save to the dataset.
dataset_id:
type: string
description: >-
The ID of the dataset to save the spans to.
max_depth:
type: integer
description: The maximum depth of the tree.
additionalProperties: false
required:
- attribute_filters
- attributes_to_save
- dataset_id
title: SaveSpansToDatasetRequest
GetSpanTreeRequest:
type: object
properties:
attributes_to_return:
type: array
items:
type: string
description: The attributes to return in the tree.
max_depth:
type: integer
description: The maximum depth of the tree.
additionalProperties: false
title: GetSpanTreeRequest
SpanWithStatus:
type: object
properties:
span_id:
type: string
description: Unique identifier for the span
trace_id:
type: string
description: >-
Unique identifier for the trace this span belongs to
parent_span_id:
type: string
description: >-
(Optional) Unique identifier for the parent span, if this is a child span
name:
type: string
description: >-
Human-readable name describing the operation this span represents
start_time:
type: string
format: date-time
description: Timestamp when the operation began
end_time:
type: string
format: date-time
description: >-
(Optional) Timestamp when the operation finished, if completed
attributes:
type: object
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
description: >-
(Optional) Key-value pairs containing additional metadata about the span
status:
$ref: '#/components/schemas/SpanStatus'
description: >-
(Optional) The current status of the span
additionalProperties: false
required:
- span_id
- trace_id
- name
- start_time
title: SpanWithStatus
description: A span that includes status information.
QuerySpanTreeResponse:
type: object
properties:
data:
type: object
additionalProperties:
$ref: '#/components/schemas/SpanWithStatus'
description: >-
Dictionary mapping span IDs to spans with status information
additionalProperties: false
required:
- data
title: QuerySpanTreeResponse
description: >-
Response containing a tree structure of spans.
QueryTracesRequest:
type: object
properties:
attribute_filters:
type: array
items:
$ref: '#/components/schemas/QueryCondition'
description: >-
The attribute filters to apply to the traces.
limit:
type: integer
description: The limit of traces to return.
offset:
type: integer
description: The offset of the traces to return.
order_by:
type: array
items:
type: string
description: The order by of the traces to return.
additionalProperties: false
title: QueryTracesRequest
Trace:
type: object
properties:
trace_id:
type: string
description: Unique identifier for the trace
root_span_id:
type: string
description: >-
Unique identifier for the root span that started this trace
start_time:
type: string
format: date-time
description: Timestamp when the trace began
end_time:
type: string
format: date-time
description: >-
(Optional) Timestamp when the trace finished, if completed
additionalProperties: false
required:
- trace_id
- root_span_id
- start_time
title: Trace
description: >-
A trace representing the complete execution path of a request across multiple
operations.
QueryTracesResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Trace'
description: >-
List of traces matching the query criteria
additionalProperties: false
required:
- data
title: QueryTracesResponse
description: Response containing a list of traces.
responses: responses:
BadRequest400: BadRequest400:
description: The request was invalid or malformed description: The request was invalid or malformed
@ -14200,8 +13261,6 @@ tags:
description: '' description: ''
- name: SyntheticDataGeneration (Coming Soon) - name: SyntheticDataGeneration (Coming Soon)
description: '' description: ''
- name: Telemetry
description: ''
- name: ToolGroups - name: ToolGroups
description: '' description: ''
- name: ToolRuntime - name: ToolRuntime
@ -14231,7 +13290,6 @@ x-tagGroups:
- ScoringFunctions - ScoringFunctions
- Shields - Shields
- SyntheticDataGeneration (Coming Soon) - SyntheticDataGeneration (Coming Soon)
- Telemetry
- ToolGroups - ToolGroups
- ToolRuntime - ToolRuntime
- VectorDBs - VectorDBs

View file

@ -16,15 +16,12 @@ from typing import (
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
from llama_stack.apis.version import LLAMA_STACK_API_V1, LLAMA_STACK_API_V1ALPHA
from llama_stack.models.llama.datatypes import Primitive from llama_stack.models.llama.datatypes import Primitive
from llama_stack.schema_utils import json_schema_type, register_schema, webmethod from llama_stack.schema_utils import json_schema_type, register_schema
# Add this constant near the top of the file, after the imports # Add this constant near the top of the file, after the imports
DEFAULT_TTL_DAYS = 7 DEFAULT_TTL_DAYS = 7
REQUIRED_SCOPE = "telemetry.read"
@json_schema_type @json_schema_type
class SpanStatus(Enum): class SpanStatus(Enum):
@ -413,7 +410,6 @@ class QueryMetricsResponse(BaseModel):
@runtime_checkable @runtime_checkable
class Telemetry(Protocol): class Telemetry(Protocol):
@webmethod(route="/telemetry/events", method="POST", level=LLAMA_STACK_API_V1)
async def log_event( async def log_event(
self, self,
event: Event, event: Event,
@ -426,14 +422,6 @@ class Telemetry(Protocol):
""" """
... ...
@webmethod(
route="/telemetry/traces",
method="POST",
required_scope=REQUIRED_SCOPE,
deprecated=True,
level=LLAMA_STACK_API_V1,
)
@webmethod(route="/telemetry/traces", method="POST", required_scope=REQUIRED_SCOPE, level=LLAMA_STACK_API_V1ALPHA)
async def query_traces( async def query_traces(
self, self,
attribute_filters: list[QueryCondition] | None = None, attribute_filters: list[QueryCondition] | None = None,
@ -451,19 +439,6 @@ class Telemetry(Protocol):
""" """
... ...
@webmethod(
route="/telemetry/traces/{trace_id:path}",
method="GET",
required_scope=REQUIRED_SCOPE,
deprecated=True,
level=LLAMA_STACK_API_V1,
)
@webmethod(
route="/telemetry/traces/{trace_id:path}",
method="GET",
required_scope=REQUIRED_SCOPE,
level=LLAMA_STACK_API_V1ALPHA,
)
async def get_trace(self, trace_id: str) -> Trace: async def get_trace(self, trace_id: str) -> Trace:
"""Get a trace by its ID. """Get a trace by its ID.
@ -472,19 +447,6 @@ class Telemetry(Protocol):
""" """
... ...
@webmethod(
route="/telemetry/traces/{trace_id:path}/spans/{span_id:path}",
method="GET",
required_scope=REQUIRED_SCOPE,
deprecated=True,
level=LLAMA_STACK_API_V1,
)
@webmethod(
route="/telemetry/traces/{trace_id:path}/spans/{span_id:path}",
method="GET",
required_scope=REQUIRED_SCOPE,
level=LLAMA_STACK_API_V1ALPHA,
)
async def get_span(self, trace_id: str, span_id: str) -> Span: async def get_span(self, trace_id: str, span_id: str) -> Span:
"""Get a span by its ID. """Get a span by its ID.
@ -494,19 +456,6 @@ class Telemetry(Protocol):
""" """
... ...
@webmethod(
route="/telemetry/spans/{span_id:path}/tree",
method="POST",
deprecated=True,
required_scope=REQUIRED_SCOPE,
level=LLAMA_STACK_API_V1,
)
@webmethod(
route="/telemetry/spans/{span_id:path}/tree",
method="POST",
required_scope=REQUIRED_SCOPE,
level=LLAMA_STACK_API_V1ALPHA,
)
async def get_span_tree( async def get_span_tree(
self, self,
span_id: str, span_id: str,
@ -522,14 +471,6 @@ class Telemetry(Protocol):
""" """
... ...
@webmethod(
route="/telemetry/spans",
method="POST",
required_scope=REQUIRED_SCOPE,
deprecated=True,
level=LLAMA_STACK_API_V1,
)
@webmethod(route="/telemetry/spans", method="POST", required_scope=REQUIRED_SCOPE, level=LLAMA_STACK_API_V1ALPHA)
async def query_spans( async def query_spans(
self, self,
attribute_filters: list[QueryCondition], attribute_filters: list[QueryCondition],
@ -545,8 +486,6 @@ class Telemetry(Protocol):
""" """
... ...
@webmethod(route="/telemetry/spans/export", method="POST", deprecated=True, level=LLAMA_STACK_API_V1)
@webmethod(route="/telemetry/spans/export", method="POST", level=LLAMA_STACK_API_V1ALPHA)
async def save_spans_to_dataset( async def save_spans_to_dataset(
self, self,
attribute_filters: list[QueryCondition], attribute_filters: list[QueryCondition],
@ -563,19 +502,6 @@ class Telemetry(Protocol):
""" """
... ...
@webmethod(
route="/telemetry/metrics/{metric_name}",
method="POST",
required_scope=REQUIRED_SCOPE,
deprecated=True,
level=LLAMA_STACK_API_V1,
)
@webmethod(
route="/telemetry/metrics/{metric_name}",
method="POST",
required_scope=REQUIRED_SCOPE,
level=LLAMA_STACK_API_V1ALPHA,
)
async def query_metrics( async def query_metrics(
self, self,
metric_name: str, metric_name: str,

View file

@ -1,57 +0,0 @@
{
"test_id": "tests/integration/telemetry/test_openai_telemetry.py::test_openai_completion_creates_telemetry[txt=ollama/llama3.2:3b-instruct-fp16]",
"request": {
"method": "POST",
"url": "http://0.0.0.0:11434/v1/v1/chat/completions",
"headers": {},
"body": {
"model": "llama3.2:3b-instruct-fp16",
"messages": [
{
"role": "user",
"content": "Test OpenAI telemetry creation"
}
],
"stream": false
},
"endpoint": "/v1/chat/completions",
"model": "llama3.2:3b-instruct-fp16"
},
"response": {
"body": {
"__type__": "openai.types.chat.chat_completion.ChatCompletion",
"__data__": {
"id": "rec-0de60cd6a6ec",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "I'm happy to help you test this! This type of model is designed to provide information and answer questions, rather than engage in conversation or generate creative content. Feel free to ask me anything or test out any features you'd like. I'll do my best to assist you.\r\n\r\nIf you're looking for a way to engage with the model more creatively, there are several things you could try:\r\n\r\n1. Ask me a question on a topic unrelated to the ones I was trained on. This can give me a chance to demonstrate my ability to learn and generalize.\r\n2. Ask me to generate a piece of content - such as a short story or poem - on a specific topic. I can use patterns in the data I was trained on to generate text that is similar in style and structure to what you might find in a published book or article.\r\n3. Play a game with me. We could play games like \"20 Questions\" (where you think of an object, and I try to guess what it is by asking yes-or-no questions), or \"Hangman\". Let me know if there's something else you'd like to do!",
"refusal": null,
"role": "assistant",
"annotations": null,
"audio": null,
"function_call": null,
"tool_calls": null
}
}
],
"created": 0,
"model": "llama3.2:3b-instruct-fp16",
"object": "chat.completion",
"service_tier": null,
"system_fingerprint": "fp_ollama",
"usage": {
"completion_tokens": 229,
"prompt_tokens": 30,
"total_tokens": 259,
"completion_tokens_details": null,
"prompt_tokens_details": null
}
}
},
"is_streaming": false
}
}

View file

@ -1,194 +0,0 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import time
from datetime import UTC, datetime
import pytest
@pytest.fixture(scope="module", autouse=True)
def setup_openai_telemetry_data(llama_stack_client, text_model_id):
"""Setup fixture that creates telemetry data specifically for OpenAI completions testing."""
# Create OpenAI completion traces
for i in range(3):
llama_stack_client.chat.completions.create(
model=text_model_id,
messages=[
{
"role": "user",
"content": f"Test trace openai {i}",
}
],
# stream=False to always capture Metrics.
stream=False,
)
# Create additional OpenAI completion traces with different parameters
for i in range(2):
llama_stack_client.chat.completions.create(
model=text_model_id,
messages=[
{
"role": "user",
"content": f"Test trace openai with temperature {i}",
}
],
temperature=0.7,
max_tokens=100,
stream=False,
)
start_time = time.time()
while time.time() - start_time < 30:
traces = llama_stack_client.telemetry.query_traces(limit=10)
if len(traces) >= 5: # 5 OpenAI completion traces
break
time.sleep(0.1)
if len(traces) < 5:
pytest.fail(
f"Failed to create sufficient OpenAI completion telemetry data after 30s. Got {len(traces)} traces."
)
yield
def test_openai_traces_basic(llama_stack_client):
"""Test basic trace querying functionality for OpenAI completions."""
all_traces = llama_stack_client.telemetry.query_traces(limit=10)
assert isinstance(all_traces, list), "Should return a list of traces"
assert len(all_traces) >= 5, "Should have at least 5 traces from OpenAI setup"
# Verify trace structure and data quality
first_trace = all_traces[0]
assert hasattr(first_trace, "trace_id"), "Trace should have trace_id"
assert hasattr(first_trace, "start_time"), "Trace should have start_time"
assert hasattr(first_trace, "root_span_id"), "Trace should have root_span_id"
# Validate trace_id is a valid UUID format
assert isinstance(first_trace.trace_id, str) and len(first_trace.trace_id) > 0, (
"trace_id should be non-empty string"
)
# Validate start_time format and not in the future
now = datetime.now(UTC)
if isinstance(first_trace.start_time, str):
trace_time = datetime.fromisoformat(first_trace.start_time.replace("Z", "+00:00"))
else:
# start_time is already a datetime object
trace_time = first_trace.start_time
if trace_time.tzinfo is None:
trace_time = trace_time.replace(tzinfo=UTC)
# Ensure trace time is not in the future
time_diff = (now - trace_time).total_seconds()
assert time_diff >= 0, f"Trace start_time should not be in the future, got {time_diff}s"
# Validate root_span_id exists and is non-empty
assert isinstance(first_trace.root_span_id, str) and len(first_trace.root_span_id) > 0, (
"root_span_id should be non-empty string"
)
# Test querying specific trace by ID
specific_trace = llama_stack_client.telemetry.get_trace(trace_id=first_trace.trace_id)
assert specific_trace.trace_id == first_trace.trace_id, "Retrieved trace should match requested ID"
assert specific_trace.start_time == first_trace.start_time, "Retrieved trace should have same start_time"
assert specific_trace.root_span_id == first_trace.root_span_id, "Retrieved trace should have same root_span_id"
# Test pagination with proper validation
recent_traces = llama_stack_client.telemetry.query_traces(limit=3, offset=0)
assert len(recent_traces) <= 3, "Should return at most 3 traces when limit=3"
assert len(recent_traces) >= 1, "Should return at least 1 trace"
# Verify all traces have required fields
for trace in recent_traces:
assert hasattr(trace, "trace_id") and trace.trace_id, "Each trace should have non-empty trace_id"
assert hasattr(trace, "start_time") and trace.start_time, "Each trace should have non-empty start_time"
assert hasattr(trace, "root_span_id") and trace.root_span_id, "Each trace should have non-empty root_span_id"
def test_openai_spans_basic(llama_stack_client):
"""Test basic span querying functionality for OpenAI completions."""
spans = llama_stack_client.telemetry.query_spans(attribute_filters=[], attributes_to_return=[])
assert isinstance(spans, list), "Should return a list of spans"
assert len(spans) >= 1, "Should have at least one span from OpenAI setup"
# Verify span structure and data quality
first_span = spans[0]
required_attrs = ["span_id", "name", "trace_id"]
for attr in required_attrs:
assert hasattr(first_span, attr), f"Span should have {attr} attribute"
assert getattr(first_span, attr), f"Span {attr} should not be empty"
# Validate span data types and content
assert isinstance(first_span.span_id, str) and len(first_span.span_id) > 0, "span_id should be non-empty string"
assert isinstance(first_span.name, str) and len(first_span.name) > 0, "span name should be non-empty string"
assert isinstance(first_span.trace_id, str) and len(first_span.trace_id) > 0, "trace_id should be non-empty string"
# Verify span belongs to a valid trace
all_traces = llama_stack_client.telemetry.query_traces(limit=10)
trace_ids = {t.trace_id for t in all_traces}
if first_span.trace_id in trace_ids:
trace = llama_stack_client.telemetry.get_trace(trace_id=first_span.trace_id)
assert trace is not None, "Should be able to retrieve trace for valid trace_id"
assert trace.trace_id == first_span.trace_id, "Trace ID should match span's trace_id"
# Test with span filtering and validate results
filtered_spans = llama_stack_client.telemetry.query_spans(
attribute_filters=[{"key": "name", "op": "eq", "value": first_span.name}],
attributes_to_return=["name", "span_id"],
)
assert isinstance(filtered_spans, list), "Should return a list with span name filter"
# Validate filtered spans if filtering works
if len(filtered_spans) > 0:
for span in filtered_spans:
assert hasattr(span, "name"), "Filtered spans should have name attribute"
assert hasattr(span, "span_id"), "Filtered spans should have span_id attribute"
assert span.name == first_span.name, "Filtered spans should match the filter criteria"
assert isinstance(span.span_id, str) and len(span.span_id) > 0, "Filtered span_id should be valid"
# Test that all spans have consistent structure
for span in spans:
for attr in required_attrs:
assert hasattr(span, attr) and getattr(span, attr), f"All spans should have non-empty {attr}"
def test_openai_completion_creates_telemetry(llama_stack_client, text_model_id):
"""Test that making OpenAI completion calls actually creates telemetry data."""
# Get initial trace count
initial_traces = llama_stack_client.telemetry.query_traces(limit=20)
initial_count = len(initial_traces)
# Make a new OpenAI completion call
response = llama_stack_client.chat.completions.create(
model=text_model_id,
messages=[{"role": "user", "content": "Test OpenAI telemetry creation"}],
stream=False,
)
# Verify we got a response
assert response is not None, "Should get a response from OpenAI completion"
assert hasattr(response, "choices"), "Response should have choices"
assert len(response.choices) > 0, "Response should have at least one choice"
# Wait for telemetry to be recorded
start_time = time.time()
while time.time() - start_time < 30:
final_traces = llama_stack_client.telemetry.query_traces(limit=20)
final_count = len(final_traces)
if final_count > initial_count:
break
time.sleep(0.1)
# Should have at least as many traces as before (might have more due to other activity)
assert final_count >= initial_count, "Should have at least as many traces after OpenAI call"

View file

@ -1,187 +0,0 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import time
from datetime import UTC, datetime
from uuid import uuid4
import pytest
from llama_stack_client import Agent
@pytest.fixture(scope="module", autouse=True)
def setup_telemetry_data(llama_stack_client, text_model_id):
"""Setup fixture that creates telemetry data before tests run."""
agent = Agent(llama_stack_client, model=text_model_id, instructions="You are a helpful assistant")
session_id = agent.create_session(f"test-setup-session-{uuid4()}")
messages = [
"What is 2 + 2?",
"Tell me a short joke",
]
for msg in messages:
agent.create_turn(
messages=[{"role": "user", "content": msg}],
session_id=session_id,
stream=False,
)
for i in range(2):
llama_stack_client.chat.completions.create(
model=text_model_id, messages=[{"role": "user", "content": f"Test trace {i}"}]
)
start_time = time.time()
while time.time() - start_time < 30:
traces = llama_stack_client.telemetry.query_traces(limit=10)
if len(traces) >= 4:
break
time.sleep(0.1)
if len(traces) < 4:
pytest.fail(f"Failed to create sufficient telemetry data after 30s. Got {len(traces)} traces.")
yield
def test_query_traces_basic(llama_stack_client):
"""Test basic trace querying functionality with proper data validation."""
all_traces = llama_stack_client.telemetry.query_traces(limit=5)
assert isinstance(all_traces, list), "Should return a list of traces"
assert len(all_traces) >= 4, "Should have at least 4 traces from setup"
# Verify trace structure and data quality
first_trace = all_traces[0]
assert hasattr(first_trace, "trace_id"), "Trace should have trace_id"
assert hasattr(first_trace, "start_time"), "Trace should have start_time"
assert hasattr(first_trace, "root_span_id"), "Trace should have root_span_id"
# Validate trace_id is a valid UUID format
assert isinstance(first_trace.trace_id, str) and len(first_trace.trace_id) > 0, (
"trace_id should be non-empty string"
)
# Validate start_time format and not in the future
now = datetime.now(UTC)
if isinstance(first_trace.start_time, str):
trace_time = datetime.fromisoformat(first_trace.start_time.replace("Z", "+00:00"))
else:
# start_time is already a datetime object
trace_time = first_trace.start_time
if trace_time.tzinfo is None:
trace_time = trace_time.replace(tzinfo=UTC)
# Ensure trace time is not in the future (but allow any age in the past for persistent test data)
time_diff = (now - trace_time).total_seconds()
assert time_diff >= 0, f"Trace start_time should not be in the future, got {time_diff}s"
# Validate root_span_id exists and is non-empty
assert isinstance(first_trace.root_span_id, str) and len(first_trace.root_span_id) > 0, (
"root_span_id should be non-empty string"
)
# Test querying specific trace by ID
specific_trace = llama_stack_client.telemetry.get_trace(trace_id=first_trace.trace_id)
assert specific_trace.trace_id == first_trace.trace_id, "Retrieved trace should match requested ID"
assert specific_trace.start_time == first_trace.start_time, "Retrieved trace should have same start_time"
assert specific_trace.root_span_id == first_trace.root_span_id, "Retrieved trace should have same root_span_id"
# Test pagination with proper validation
recent_traces = llama_stack_client.telemetry.query_traces(limit=3, offset=0)
assert len(recent_traces) <= 3, "Should return at most 3 traces when limit=3"
assert len(recent_traces) >= 1, "Should return at least 1 trace"
# Verify all traces have required fields
for trace in recent_traces:
assert hasattr(trace, "trace_id") and trace.trace_id, "Each trace should have non-empty trace_id"
assert hasattr(trace, "start_time") and trace.start_time, "Each trace should have non-empty start_time"
assert hasattr(trace, "root_span_id") and trace.root_span_id, "Each trace should have non-empty root_span_id"
def test_query_spans_basic(llama_stack_client):
"""Test basic span querying functionality with proper validation."""
spans = llama_stack_client.telemetry.query_spans(attribute_filters=[], attributes_to_return=[])
assert isinstance(spans, list), "Should return a list of spans"
assert len(spans) >= 1, "Should have at least one span from setup"
# Verify span structure and data quality
first_span = spans[0]
required_attrs = ["span_id", "name", "trace_id"]
for attr in required_attrs:
assert hasattr(first_span, attr), f"Span should have {attr} attribute"
assert getattr(first_span, attr), f"Span {attr} should not be empty"
# Validate span data types and content
assert isinstance(first_span.span_id, str) and len(first_span.span_id) > 0, "span_id should be non-empty string"
assert isinstance(first_span.name, str) and len(first_span.name) > 0, "span name should be non-empty string"
assert isinstance(first_span.trace_id, str) and len(first_span.trace_id) > 0, "trace_id should be non-empty string"
# Verify span belongs to a valid trace (test with traces we know exist)
all_traces = llama_stack_client.telemetry.query_traces(limit=10)
trace_ids = {t.trace_id for t in all_traces}
if first_span.trace_id in trace_ids:
trace = llama_stack_client.telemetry.get_trace(trace_id=first_span.trace_id)
assert trace is not None, "Should be able to retrieve trace for valid trace_id"
assert trace.trace_id == first_span.trace_id, "Trace ID should match span's trace_id"
# Test with span filtering and validate results
filtered_spans = llama_stack_client.telemetry.query_spans(
attribute_filters=[{"key": "name", "op": "eq", "value": first_span.name}],
attributes_to_return=["name", "span_id"],
)
assert isinstance(filtered_spans, list), "Should return a list with span name filter"
# Validate filtered spans if filtering works
if len(filtered_spans) > 0:
for span in filtered_spans:
assert hasattr(span, "name"), "Filtered spans should have name attribute"
assert hasattr(span, "span_id"), "Filtered spans should have span_id attribute"
assert span.name == first_span.name, "Filtered spans should match the filter criteria"
assert isinstance(span.span_id, str) and len(span.span_id) > 0, "Filtered span_id should be valid"
# Test that all spans have consistent structure
for span in spans:
for attr in required_attrs:
assert hasattr(span, attr) and getattr(span, attr), f"All spans should have non-empty {attr}"
def test_telemetry_pagination(llama_stack_client):
"""Test pagination in telemetry queries."""
# Get total count of traces
all_traces = llama_stack_client.telemetry.query_traces(limit=20)
total_count = len(all_traces)
assert total_count >= 4, "Should have at least 4 traces from setup"
# Test trace pagination
page1 = llama_stack_client.telemetry.query_traces(limit=2, offset=0)
page2 = llama_stack_client.telemetry.query_traces(limit=2, offset=2)
assert len(page1) == 2, "First page should have exactly 2 traces"
assert len(page2) >= 1, "Second page should have at least 1 trace"
# Verify no overlap between pages
page1_ids = {t.trace_id for t in page1}
page2_ids = {t.trace_id for t in page2}
assert len(page1_ids.intersection(page2_ids)) == 0, "Pages should contain different traces"
# Test ordering
ordered_traces = llama_stack_client.telemetry.query_traces(limit=5, order_by=["start_time"])
assert len(ordered_traces) >= 4, "Should have at least 4 traces for ordering test"
# Verify ordering by start_time
for i in range(len(ordered_traces) - 1):
current_time = ordered_traces[i].start_time
next_time = ordered_traces[i + 1].start_time
assert current_time <= next_time, f"Traces should be ordered by start_time: {current_time} > {next_time}"
# Test limit behavior
limited = llama_stack_client.telemetry.query_traces(limit=3)
assert len(limited) == 3, "Should return exactly 3 traces when limit=3"

View file

@ -1,206 +0,0 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import time
from datetime import UTC, datetime, timedelta
import pytest
@pytest.fixture(scope="module", autouse=True)
def setup_telemetry_metrics_data(openai_client, client_with_models, text_model_id):
"""Setup fixture that creates telemetry metrics data before tests run."""
# Skip OpenAI tests if running in library mode
if not hasattr(client_with_models, "base_url"):
pytest.skip("OpenAI client tests not supported with library client")
prompt_tokens = []
completion_tokens = []
total_tokens = []
# Create OpenAI completions to generate metrics using the proper OpenAI client
for i in range(5):
response = openai_client.chat.completions.create(
model=text_model_id,
messages=[{"role": "user", "content": f"OpenAI test {i}"}],
stream=False,
)
prompt_tokens.append(response.usage.prompt_tokens)
completion_tokens.append(response.usage.completion_tokens)
total_tokens.append(response.usage.total_tokens)
# Wait for metrics to be logged
start_time = time.time()
while time.time() - start_time < 30:
try:
# Try to query metrics to see if they're available
metrics_response = client_with_models.telemetry.query_metrics(
metric_name="completion_tokens",
start_time=int((datetime.now(UTC) - timedelta(minutes=5)).timestamp()),
)
if len(metrics_response[0].values) > 0:
break
except Exception:
pass
time.sleep(0.1)
# Return the token lists for use in tests
return {"prompt_tokens": prompt_tokens, "completion_tokens": completion_tokens, "total_tokens": total_tokens}
@pytest.mark.skip(reason="Skipping this test until client is regenerated")
def test_query_metrics_prompt_tokens(client_with_models, text_model_id, setup_telemetry_metrics_data):
"""Test that prompt_tokens metrics are queryable."""
start_time = int((datetime.now(UTC) - timedelta(minutes=10)).timestamp())
response = client_with_models.telemetry.query_metrics(
metric_name="prompt_tokens",
start_time=start_time,
)
assert isinstance(response, list)
assert isinstance(response[0].values, list), "Should return a list of metric series"
assert response[0].metric == "prompt_tokens"
# Use the actual values from setup instead of hardcoded values
expected_values = setup_telemetry_metrics_data["prompt_tokens"]
assert response[0].values[-1].value in expected_values, (
f"Expected one of {expected_values}, got {response[0].values[-1].value}"
)
@pytest.mark.skip(reason="Skipping this test until client is regenerated")
def test_query_metrics_completion_tokens(client_with_models, text_model_id, setup_telemetry_metrics_data):
"""Test that completion_tokens metrics are queryable."""
start_time = int((datetime.now(UTC) - timedelta(minutes=10)).timestamp())
response = client_with_models.telemetry.query_metrics(
metric_name="completion_tokens",
start_time=start_time,
)
assert isinstance(response, list)
assert isinstance(response[0].values, list), "Should return a list of metric series"
assert response[0].metric == "completion_tokens"
# Use the actual values from setup instead of hardcoded values
expected_values = setup_telemetry_metrics_data["completion_tokens"]
assert response[0].values[-1].value in expected_values, (
f"Expected one of {expected_values}, got {response[0].values[-1].value}"
)
@pytest.mark.skip(reason="Skipping this test until client is regenerated")
def test_query_metrics_total_tokens(client_with_models, text_model_id, setup_telemetry_metrics_data):
"""Test that total_tokens metrics are queryable."""
start_time = int((datetime.now(UTC) - timedelta(minutes=10)).timestamp())
response = client_with_models.telemetry.query_metrics(
metric_name="total_tokens",
start_time=start_time,
)
assert isinstance(response, list)
assert isinstance(response[0].values, list), "Should return a list of metric series"
assert response[0].metric == "total_tokens"
# Use the actual values from setup instead of hardcoded values
expected_values = setup_telemetry_metrics_data["total_tokens"]
assert response[0].values[-1].value in expected_values, (
f"Expected one of {expected_values}, got {response[0].values[-1].value}"
)
@pytest.mark.skip(reason="Skipping this test until client is regenerated")
def test_query_metrics_with_time_range(llama_stack_client, text_model_id):
"""Test that metrics are queryable with time range."""
end_time = int(datetime.now(UTC).timestamp())
start_time = end_time - 600 # 10 minutes ago
response = llama_stack_client.telemetry.query_metrics(
metric_name="prompt_tokens",
start_time=start_time,
end_time=end_time,
)
assert isinstance(response, list)
assert isinstance(response[0].values, list), "Should return a list of metric series"
assert response[0].metric == "prompt_tokens"
@pytest.mark.skip(reason="Skipping this test until client is regenerated")
def test_query_metrics_with_label_matchers(llama_stack_client, text_model_id):
"""Test that metrics are queryable with label matchers."""
start_time = int((datetime.now(UTC) - timedelta(minutes=10)).timestamp())
response = llama_stack_client.telemetry.query_metrics(
metric_name="prompt_tokens",
start_time=start_time,
label_matchers=[{"name": "model_id", "value": text_model_id, "operator": "="}],
)
assert isinstance(response[0].values, list), "Should return a list of metric series"
@pytest.mark.skip(reason="Skipping this test until client is regenerated")
def test_query_metrics_nonexistent_metric(llama_stack_client):
"""Test that querying a nonexistent metric returns empty data."""
start_time = int((datetime.now(UTC) - timedelta(minutes=10)).timestamp())
response = llama_stack_client.telemetry.query_metrics(
metric_name="nonexistent_metric",
start_time=start_time,
)
assert isinstance(response, list), "Should return an empty list for nonexistent metric"
assert len(response) == 0
@pytest.mark.skip(reason="Skipping this test until client is regenerated")
def test_query_metrics_with_granularity(llama_stack_client, text_model_id):
"""Test that metrics are queryable with different granularity levels."""
start_time = int((datetime.now(UTC) - timedelta(minutes=10)).timestamp())
# Test hourly granularity
hourly_response = llama_stack_client.telemetry.query_metrics(
metric_name="total_tokens",
start_time=start_time,
granularity="1h",
)
# Test daily granularity
daily_response = llama_stack_client.telemetry.query_metrics(
metric_name="total_tokens",
start_time=start_time,
granularity="1d",
)
# Test no granularity (raw data points)
raw_response = llama_stack_client.telemetry.query_metrics(
metric_name="total_tokens",
start_time=start_time,
granularity=None,
)
# All should return valid data
assert isinstance(hourly_response[0].values, list), "Hourly granularity should return data"
assert isinstance(daily_response[0].values, list), "Daily granularity should return data"
assert isinstance(raw_response[0].values, list), "No granularity should return data"
# Verify that different granularities produce different aggregation levels
# (The exact number depends on data distribution, but they should be queryable)
assert len(hourly_response[0].values) >= 0, "Hourly granularity should be queryable"
assert len(daily_response[0].values) >= 0, "Daily granularity should be queryable"
assert len(raw_response[0].values) >= 0, "No granularity should be queryable"