You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add gen_ai.agent.invocation.duration and gen_ai.tool.execution.duration metrics
Adds two new GenAI semantic convention metrics for agent and tool latency,
modeled on the recently-added gen_ai.workflow.duration metric:
* gen_ai.agent.invocation.duration (histogram, seconds): end-to-end
duration of a single agent invocation, aligned with the existing
gen_ai.invoke_agent.{client,internal} spans.
* gen_ai.tool.execution.duration (histogram, seconds): duration of a
single tool execution, aligned with the existing
gen_ai.execute_tool.internal span.
Also adds the gen_ai.tool.version attribute, used as a dimension on
gen_ai.tool.execution.duration (mirrors the existing gen_ai.agent.version).
NOTE: docs/registry/ and schema-snapshot/ regeneration via 'make
generate-all' has NOT been run in this commit (no Docker available in
the authoring environment). Run it locally before pushing for review.
**[1]:** This metric measures the end-to-end duration of a single agent invocation, from the moment the agent is invoked to the moment it produces its final response (or terminates with an error).
983
+
When this metric is reported alongside a `gen_ai.invoke_agent` span, the metric value SHOULD be the same as the span duration.
984
+
985
+
**Attributes:**
986
+
987
+
| Key | Stability |[Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/)| Value Type | Description | Example Values |
988
+
| --- | --- | --- | --- | --- | --- |
989
+
|[`error.type`](https://github.com/open-telemetry/semantic-conventions/blob/v1.41.1/docs/registry/attributes/error.md)||`Conditionally Required` if the operation ended in an error | string | Describes a class of error the operation ended with. [1]|`timeout`; `java.net.UnknownHostException`; `server_certificate_invalid`; `500`|
990
+
|[`gen_ai.agent.name`](/docs/registry/attributes/gen-ai.md)||`Conditionally Required` when available | string | Human-readable name of the GenAI agent provided by the application. |`Math Tutor`; `Fiction Writer`|
991
+
|[`gen_ai.agent.version`](/docs/registry/attributes/gen-ai.md)||`Conditionally Required` when available | string | The version of the GenAI agent. |`1.0.0`; `2025-05-01`|
992
+
993
+
**[1]`error.type`:** The `error.type` SHOULD match the error code returned by the Generative AI provider or the client library,
994
+
the canonical name of exception that occurred, or another low-cardinality error identifier.
995
+
Instrumentations SHOULD document the list of errors they report.
996
+
997
+
---
998
+
999
+
`error.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
1000
+
1001
+
| Value | Description | Stability |
1002
+
| --- | --- | --- |
1003
+
|`_OTHER`| A fallback error value to be used when the instrumentation doesn't define a custom value. ||
1004
+
1005
+
<!-- prettier-ignore-end -->
1006
+
<!-- END AUTOGENERATED TEXT -->
1007
+
<!-- endweaver -->
1008
+
1009
+
## Generative AI tool metrics
1010
+
1011
+
Individual systems may include additional system-specific attributes.
1012
+
It is recommended to check system-specific documentation, if available.
1013
+
1014
+
`gen_ai.tool.execution.duration` represents the duration of a single tool
1015
+
execution performed by or on behalf of a GenAI agent. It is intended for
1016
+
instrumentations of agent frameworks (or of application code that executes
1017
+
tools on behalf of an agent) that can reliably bound a single tool call.
1018
+
1019
+
### Metric: `gen_ai.tool.execution.duration`
1020
+
1021
+
This metric is [recommended][MetricRecommended] for instrumentations that can
1022
+
observe tool executions performed by or on behalf of a GenAI agent.
1023
+
1024
+
When this metric is reported alongside a `gen_ai.execute_tool` span, the
1025
+
metric value SHOULD be the same as the span duration.
1026
+
1027
+
This metric SHOULD be specified with [ExplicitBucketBoundaries] of
**[1]:** This metric measures the duration of a single tool execution performed by or on behalf of a GenAI agent.
1040
+
When this metric is reported alongside a `gen_ai.execute_tool` span, the metric value SHOULD be the same as the span duration.
1041
+
1042
+
**Attributes:**
1043
+
1044
+
| Key | Stability |[Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/)| Value Type | Description | Example Values |
1045
+
| --- | --- | --- | --- | --- | --- |
1046
+
|[`gen_ai.tool.name`](/docs/registry/attributes/gen-ai.md)||`Required`| string | Name of the tool utilized by the agent. |`Flights`|
1047
+
|[`error.type`](https://github.com/open-telemetry/semantic-conventions/blob/v1.41.1/docs/registry/attributes/error.md)||`Conditionally Required` if the operation ended in an error | string | Describes a class of error the operation ended with. [1]|`timeout`; `java.net.UnknownHostException`; `server_certificate_invalid`; `500`|
1048
+
|[`gen_ai.agent.name`](/docs/registry/attributes/gen-ai.md)||`Conditionally Required` when available | string | Human-readable name of the GenAI agent provided by the application. |`Math Tutor`; `Fiction Writer`|
1049
+
|[`gen_ai.agent.version`](/docs/registry/attributes/gen-ai.md)||`Conditionally Required` when available | string | The version of the GenAI agent. |`1.0.0`; `2025-05-01`|
1050
+
|[`gen_ai.tool.version`](/docs/registry/attributes/gen-ai.md)||`Conditionally Required` when available | string | The version of the tool utilized by the agent. [2]|`1.0.0`; `2025-05-01`|
1051
+
1052
+
**[1]`error.type`:** The `error.type` SHOULD match the error code returned by the Generative AI provider or the client library,
1053
+
the canonical name of exception that occurred, or another low-cardinality error identifier.
1054
+
Instrumentations SHOULD document the list of errors they report.
1055
+
1056
+
**[2]`gen_ai.tool.version`:** The tool version is usually provided by the application that defines the
1057
+
tool. It is typically a static value (for example, a release tag of the
1058
+
tool's package) and is expected to have low cardinality.
1059
+
1060
+
`gen_ai.tool.version` MUST have low cardinality.
1061
+
1062
+
---
1063
+
1064
+
`error.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
1065
+
1066
+
| Value | Description | Stability |
1067
+
| --- | --- | --- |
1068
+
|`_OTHER`| A fallback error value to be used when the instrumentation doesn't define a custom value. ||
0 commit comments