Skip to content

Commit

Permalink
feat(llm-observability): query runner for LLM traces (#27509)
Browse files Browse the repository at this point in the history
  • Loading branch information
skoob13 authored Jan 15, 2025
1 parent 73e86b0 commit b46f351
Show file tree
Hide file tree
Showing 8 changed files with 1,460 additions and 1 deletion.
339 changes: 338 additions & 1 deletion frontend/src/queries/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3397,6 +3397,89 @@
],
"type": "object"
},
"CachedTracesQueryResponse": {
"additionalProperties": false,
"properties": {
"cache_key": {
"type": "string"
},
"cache_target_age": {
"format": "date-time",
"type": "string"
},
"calculation_trigger": {
"description": "What triggered the calculation of the query, leave empty if user/immediate",
"type": "string"
},
"columns": {
"items": {
"type": "string"
},
"type": "array"
},
"error": {
"description": "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.",
"type": "string"
},
"hasMore": {
"type": "boolean"
},
"hogql": {
"description": "Generated HogQL query.",
"type": "string"
},
"is_cached": {
"type": "boolean"
},
"last_refresh": {
"format": "date-time",
"type": "string"
},
"limit": {
"$ref": "#/definitions/integer"
},
"modifiers": {
"$ref": "#/definitions/HogQLQueryModifiers",
"description": "Modifiers used when performing the query"
},
"next_allowed_client_refresh": {
"format": "date-time",
"type": "string"
},
"offset": {
"$ref": "#/definitions/integer"
},
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
},
"results": {
"items": {
"$ref": "#/definitions/LLMTrace"
},
"type": "array"
},
"timezone": {
"type": "string"
},
"timings": {
"description": "Measured timings for different parts of the query generation process",
"items": {
"$ref": "#/definitions/QueryTiming"
},
"type": "array"
}
},
"required": [
"cache_key",
"is_cached",
"last_refresh",
"next_allowed_client_refresh",
"results",
"timezone"
],
"type": "object"
},
"CachedTrendsQueryResponse": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -8480,6 +8563,124 @@
"enum": ["minute", "hour", "day", "week", "month"],
"type": "string"
},
"LLMGeneration": {
"additionalProperties": false,
"properties": {
"baseUrl": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"httpStatus": {
"type": "number"
},
"id": {
"type": "string"
},
"input": {
"items": {},
"type": "array"
},
"inputCost": {
"type": "number"
},
"inputTokens": {
"type": "number"
},
"latency": {
"type": "number"
},
"model": {
"type": "string"
},
"output": {},
"outputCost": {
"type": "number"
},
"outputTokens": {
"type": "number"
},
"provider": {
"type": "string"
},
"totalCost": {
"type": "number"
}
},
"required": ["id", "createdAt", "input", "latency"],
"type": "object"
},
"LLMTrace": {
"additionalProperties": false,
"properties": {
"createdAt": {
"type": "string"
},
"events": {
"items": {
"$ref": "#/definitions/LLMGeneration"
},
"type": "array"
},
"id": {
"type": "string"
},
"inputCost": {
"type": "number"
},
"inputTokens": {
"type": "number"
},
"outputCost": {
"type": "number"
},
"outputTokens": {
"type": "number"
},
"person": {
"$ref": "#/definitions/LLMTracePerson"
},
"totalCost": {
"type": "number"
},
"totalLatency": {
"type": "number"
}
},
"required": [
"id",
"createdAt",
"person",
"totalLatency",
"inputTokens",
"outputTokens",
"inputCost",
"outputCost",
"totalCost",
"events"
],
"type": "object"
},
"LLMTracePerson": {
"additionalProperties": false,
"properties": {
"createdAt": {
"type": "string"
},
"distinctId": {
"type": "string"
},
"properties": {
"type": "object"
},
"uuid": {
"type": "string"
}
},
"required": ["uuid", "createdAt", "properties", "distinctId"],
"type": "object"
},
"LifecycleFilter": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -8765,7 +8966,8 @@
"SuggestedQuestionsQuery",
"TeamTaxonomyQuery",
"EventTaxonomyQuery",
"ActorsPropertyTaxonomyQuery"
"ActorsPropertyTaxonomyQuery",
"TracesQuery"
],
"type": "string"
},
Expand Down Expand Up @@ -11184,6 +11386,57 @@
},
"required": ["results"],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"columns": {
"items": {
"type": "string"
},
"type": "array"
},
"error": {
"description": "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.",
"type": "string"
},
"hasMore": {
"type": "boolean"
},
"hogql": {
"description": "Generated HogQL query.",
"type": "string"
},
"limit": {
"$ref": "#/definitions/integer"
},
"modifiers": {
"$ref": "#/definitions/HogQLQueryModifiers",
"description": "Modifiers used when performing the query"
},
"offset": {
"$ref": "#/definitions/integer"
},
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
},
"results": {
"items": {
"$ref": "#/definitions/LLMTrace"
},
"type": "array"
},
"timings": {
"description": "Measured timings for different parts of the query generation process",
"items": {
"$ref": "#/definitions/QueryTiming"
},
"type": "array"
}
},
"required": ["results"],
"type": "object"
}
]
},
Expand Down Expand Up @@ -11302,6 +11555,9 @@
},
{
"$ref": "#/definitions/ActorsPropertyTaxonomyQuery"
},
{
"$ref": "#/definitions/TracesQuery"
}
],
"required": ["kind"],
Expand Down Expand Up @@ -12833,6 +13089,87 @@
"required": ["events"],
"type": "object"
},
"TracesQuery": {
"additionalProperties": false,
"properties": {
"dateRange": {
"$ref": "#/definitions/DateRange"
},
"kind": {
"const": "TracesQuery",
"type": "string"
},
"limit": {
"$ref": "#/definitions/integer"
},
"modifiers": {
"$ref": "#/definitions/HogQLQueryModifiers",
"description": "Modifiers used when performing the query"
},
"offset": {
"$ref": "#/definitions/integer"
},
"response": {
"$ref": "#/definitions/TracesQueryResponse"
},
"traceId": {
"type": "string"
}
},
"required": ["kind"],
"type": "object"
},
"TracesQueryResponse": {
"additionalProperties": false,
"properties": {
"columns": {
"items": {
"type": "string"
},
"type": "array"
},
"error": {
"description": "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.",
"type": "string"
},
"hasMore": {
"type": "boolean"
},
"hogql": {
"description": "Generated HogQL query.",
"type": "string"
},
"limit": {
"$ref": "#/definitions/integer"
},
"modifiers": {
"$ref": "#/definitions/HogQLQueryModifiers",
"description": "Modifiers used when performing the query"
},
"offset": {
"$ref": "#/definitions/integer"
},
"query_status": {
"$ref": "#/definitions/QueryStatus",
"description": "Query status indicates whether next to the provided data, a query is still running."
},
"results": {
"items": {
"$ref": "#/definitions/LLMTrace"
},
"type": "array"
},
"timings": {
"description": "Measured timings for different parts of the query generation process",
"items": {
"$ref": "#/definitions/QueryTiming"
},
"type": "array"
}
},
"required": ["results"],
"type": "object"
},
"TrendsAlertConfig": {
"additionalProperties": false,
"properties": {
Expand Down
Loading

0 comments on commit b46f351

Please sign in to comment.