mirror of
https://github.com/Kaelio/ktx.git
synced 2026-07-25 12:01:03 +02:00
feat(telemetry): add mongo_query_completed event
Adds the strict mongo_query_completed schema (driver, isDemoConnection, stageCount, durationMs, outcome, errorClass) for the upcoming ktx mongo-query command, registered in both the catalog object and the name/description/fields catalog list, and mirrors it to the Python daemon schema copy.
This commit is contained in:
parent
89b8729950
commit
cd9a6f5dc2
5 changed files with 185 additions and 0 deletions
|
|
@ -144,6 +144,18 @@
|
|||
"errorClass"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "mongo_query_completed",
|
||||
"description": "Emitted after ktx mongo-query completes validation and execution.",
|
||||
"fields": [
|
||||
"driver",
|
||||
"isDemoConnection",
|
||||
"stageCount",
|
||||
"durationMs",
|
||||
"outcome",
|
||||
"errorClass"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "wiki_query_completed",
|
||||
"description": "Emitted after a wiki query completes.",
|
||||
|
|
@ -1056,6 +1068,77 @@
|
|||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"mongo_query_completed": {
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"cliVersion": {
|
||||
"type": "string"
|
||||
},
|
||||
"nodeVersion": {
|
||||
"type": "string"
|
||||
},
|
||||
"osPlatform": {
|
||||
"type": "string"
|
||||
},
|
||||
"osRelease": {
|
||||
"type": "string"
|
||||
},
|
||||
"arch": {
|
||||
"type": "string"
|
||||
},
|
||||
"runtime": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"node",
|
||||
"daemon-py"
|
||||
]
|
||||
},
|
||||
"isCi": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"driver": {
|
||||
"type": "string"
|
||||
},
|
||||
"isDemoConnection": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"stageCount": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 9007199254740991
|
||||
},
|
||||
"durationMs": {
|
||||
"type": "number",
|
||||
"minimum": 0
|
||||
},
|
||||
"outcome": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"ok",
|
||||
"error"
|
||||
]
|
||||
},
|
||||
"errorClass": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"cliVersion",
|
||||
"nodeVersion",
|
||||
"osPlatform",
|
||||
"osRelease",
|
||||
"arch",
|
||||
"runtime",
|
||||
"isCi",
|
||||
"driver",
|
||||
"isDemoConnection",
|
||||
"stageCount",
|
||||
"durationMs",
|
||||
"outcome"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"wiki_query_completed": {
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"type": "object",
|
||||
|
|
|
|||
|
|
@ -146,6 +146,17 @@ const sqlCompletedSchema = telemetryCommonEnvelopeSchema
|
|||
})
|
||||
.strict();
|
||||
|
||||
const mongoQueryCompletedSchema = telemetryCommonEnvelopeSchema
|
||||
.extend({
|
||||
driver: z.string(),
|
||||
isDemoConnection: z.boolean(),
|
||||
stageCount: z.number().int().nonnegative(),
|
||||
durationMs: z.number().nonnegative(),
|
||||
outcome: outcomeSchema,
|
||||
errorClass: z.string().optional(),
|
||||
})
|
||||
.strict();
|
||||
|
||||
const wikiQueryCompletedSchema = telemetryCommonEnvelopeSchema
|
||||
.extend({
|
||||
queryLength: z.number().int().nonnegative(),
|
||||
|
|
@ -230,6 +241,7 @@ export const telemetryEventSchemas = {
|
|||
sl_validate_completed: slValidateCompletedSchema,
|
||||
sl_query_completed: slQueryCompletedSchema,
|
||||
sql_completed: sqlCompletedSchema,
|
||||
mongo_query_completed: mongoQueryCompletedSchema,
|
||||
wiki_query_completed: wikiQueryCompletedSchema,
|
||||
mcp_request_completed: mcpRequestCompletedSchema,
|
||||
daemon_started: daemonStartedSchema,
|
||||
|
|
@ -342,6 +354,11 @@ export const telemetryEventCatalog = [
|
|||
'errorClass',
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'mongo_query_completed',
|
||||
description: 'Emitted after ktx mongo-query completes validation and execution.',
|
||||
fields: ['driver', 'isDemoConnection', 'stageCount', 'durationMs', 'outcome', 'errorClass'],
|
||||
},
|
||||
{
|
||||
name: 'wiki_query_completed',
|
||||
description: 'Emitted after a wiki query completes.',
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ describe('telemetry event schemas', () => {
|
|||
'sl_validate_completed',
|
||||
'sl_query_completed',
|
||||
'sql_completed',
|
||||
'mongo_query_completed',
|
||||
'wiki_query_completed',
|
||||
'mcp_request_completed',
|
||||
'daemon_started',
|
||||
|
|
|
|||
|
|
@ -144,6 +144,18 @@
|
|||
"errorClass"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "mongo_query_completed",
|
||||
"description": "Emitted after ktx mongo-query completes validation and execution.",
|
||||
"fields": [
|
||||
"driver",
|
||||
"isDemoConnection",
|
||||
"stageCount",
|
||||
"durationMs",
|
||||
"outcome",
|
||||
"errorClass"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "wiki_query_completed",
|
||||
"description": "Emitted after a wiki query completes.",
|
||||
|
|
@ -1056,6 +1068,77 @@
|
|||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"mongo_query_completed": {
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"cliVersion": {
|
||||
"type": "string"
|
||||
},
|
||||
"nodeVersion": {
|
||||
"type": "string"
|
||||
},
|
||||
"osPlatform": {
|
||||
"type": "string"
|
||||
},
|
||||
"osRelease": {
|
||||
"type": "string"
|
||||
},
|
||||
"arch": {
|
||||
"type": "string"
|
||||
},
|
||||
"runtime": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"node",
|
||||
"daemon-py"
|
||||
]
|
||||
},
|
||||
"isCi": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"driver": {
|
||||
"type": "string"
|
||||
},
|
||||
"isDemoConnection": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"stageCount": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 9007199254740991
|
||||
},
|
||||
"durationMs": {
|
||||
"type": "number",
|
||||
"minimum": 0
|
||||
},
|
||||
"outcome": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"ok",
|
||||
"error"
|
||||
]
|
||||
},
|
||||
"errorClass": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"cliVersion",
|
||||
"nodeVersion",
|
||||
"osPlatform",
|
||||
"osRelease",
|
||||
"arch",
|
||||
"runtime",
|
||||
"isCi",
|
||||
"driver",
|
||||
"isDemoConnection",
|
||||
"stageCount",
|
||||
"durationMs",
|
||||
"outcome"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"wiki_query_completed": {
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"type": "object",
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ def test_python_schema_copy_matches_node_schema() -> None:
|
|||
"sl_validate_completed",
|
||||
"sl_query_completed",
|
||||
"sql_completed",
|
||||
"mongo_query_completed",
|
||||
"wiki_query_completed",
|
||||
"mcp_request_completed",
|
||||
"daemon_started",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue