@@ -431,45 +431,58 @@ Koog also emits runtime metrics alongside traces to help you monitor agent behav
431431
432432### Available metrics
433433
434- - gen_ai.client.token.usage
434+ #### Standard GenAI metrics
435+
436+ These metrics follow the [ OpenTelemetry GenAI semantic conventions] ( https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-metrics/ ) :
437+
438+ - ** gen_ai.client.token.usage**
435439 - Instrument: Counter (LongCounter)
436- - Unit: ` token `
437- - Description: Total token count per operation and token type
440+ - Unit: ` { token} `
441+ - Description: Number of input and output tokens used
438442 - When emitted: after an LLM call finishes; recorded separately for input and output tokens
439443 - Key attributes:
440- - ` gen_ai.operation.name ` (required) - ` TEXT_COMPLETION `
444+ - ` gen_ai.operation.name ` (required) — ` text_completion `
441445 - ` gen_ai.provider.name ` (required)
446+ - ` gen_ai.token.type ` (required) — ` input ` or ` output `
447+ - ` gen_ai.request.model ` (conditionally required)
442448 - ` gen_ai.response.model ` (recommended)
443- - ` gen_ai.token.type ` (recommended) — ` INPUT ` or ` OUTPUT `
444- - Spec: see OpenTelemetry semantic
445- conventions, [ gen_ai.client.token.usage] ( https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-metrics/#metric-gen_aiclienttokenusage )
449+ - ` server.address ` (recommended)
450+ - ` server.port ` (conditionally required, if ` server.address ` is set)
451+ - Spec: [ gen_ai.client.token.usage] ( https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-metrics/#metric-gen_aiclienttokenusage )
446452
447- - gen_ai.client.operation.duration
453+ - ** gen_ai.client.operation.duration**
448454 - Instrument: Histogram (DoubleHistogram)
449455 - Unit: seconds (` s ` )
450- - Description: Operation duration distribution; in Koog it is recorded for tool calls
456+ - Description: GenAI operation duration
451457 - Recommended explicit bucket boundaries (seconds): 0.01, 0.02, 0.04, 0.08, 0.16, 0.32, 0.64, 1.28, 2.56, 5.12,
452458 10.24, 20.48, 40.96, 81.92
459+ - When emitted: after an LLM call or tool execution finishes
453460 - Key attributes:
454- - ` gen_ai.operation.name ` (required) - ` TEXT_COMPLETION ` or ` EXECUTE_TOOL `
455- - ` gen_ai.tool.name ` (recommended, if ` gen_ai.operation.name ` is ` EXECUTE_TOOL ` )
456- - ` gen_ai.tool.call.status ` (custom, if ` gen_ai.operation.name ` is ` EXECUTE_TOOL ` ) — ` SUCCESS ` , ` ERROR ` , or
457- ` VALIDATION_FAILED `
458- - ` gen_ai.provider.name ` (recommended, if ` gen_ai.operation.name ` is ` TEXT_COMPLETION ` )
459- - ` gen_ai.response.model ` (recommended, if ` gen_ai.operation.name ` is ` TEXT_COMPLETION ` )
460- - ` gen_ai.token.type ` (recommended, if ` gen_ai.operation.name ` is ` TEXT_COMPLETION ` )
461- - Spec: see OpenTelemetry semantic
462- conventions, [ gen_ai.client.operation.duration] ( https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-metrics/#metric-gen_aiclientoperationduration )
463-
464- - gen_ai.client.tool.count
461+ - ` gen_ai.operation.name ` (required) — ` text_completion ` or ` execute_tool `
462+ - ` gen_ai.provider.name ` (required, for LLM calls)
463+ - ` error.type ` (conditionally required, if operation ended in error)
464+ - ` gen_ai.request.model ` (conditionally required)
465+ - ` gen_ai.response.model ` (recommended)
466+ - ` gen_ai.tool.name ` (recommended, for tool executions)
467+ - ` koog.tool.call.status ` (Koog-specific, for tool executions) — ` success ` , ` error ` , or ` validation_failed `
468+ - ` server.address ` (recommended)
469+ - ` server.port ` (conditionally required, if ` server.address ` is set)
470+ - Spec: [ gen_ai.client.operation.duration] ( https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-metrics/#metric-gen_aiclientoperationduration )
471+
472+ #### Koog-specific metrics
473+
474+ These metrics are specific to the Koog framework and use the ` koog.gen_ai.* ` namespace to avoid conflicts
475+ with current or future OpenTelemetry semantic conventions:
476+
477+ - ** koog.gen_ai.client.tool.call.count**
465478 - Instrument: Counter (LongCounter)
466- - Unit: ` tool call`
467- - Description: Custom metric that counts tool calls and their statuses
479+ - Unit: ` { call} `
480+ - Description: Number of tool calls performed by the agent
468481 - When emitted: on tool completion, failure, or validation failure
469482 - Key attributes:
470- - ` gen_ai.operation.name ` (required) — ` EXECUTE_TOOL `
483+ - ` gen_ai.operation.name ` (required) — ` execute_tool `
471484 - ` gen_ai.tool.name ` (recommended)
472- - ` gen_ai .tool.call.status` (custom ) — ` SUCCESS ` , ` ERROR ` , or ` VALIDATION_FAILED `
485+ - ` koog .tool.call.status` (Koog-specific ) — ` success ` , ` error ` , or ` validation_failed `
473486
474487!!! note
475488
0 commit comments