Skip to content

Commit 191f438

Browse files
authored
Add operation name and tool type attributes for Execute tool span. (#2526)
1 parent 6f99ae1 commit 191f438

File tree

3 files changed

+53
-2
lines changed

3 files changed

+53
-2
lines changed

.chloggen/2526.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Use this changelog template to create an entry for release notes.
2+
#
3+
# If your change doesn't affect end users you should instead start
4+
# your pull request title with [chore] or use the "Skip Changelog" label.
5+
6+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
7+
change_type: enhancement
8+
9+
# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db)
10+
component: gen-ai
11+
12+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
13+
note: Add operation name and tool type attributes for Execute tool span.
14+
15+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
16+
# The values here must be integers.
17+
issues: [2525, 2526]
18+
19+
# (Optional) One or more lines of additional information to render under the primary note.
20+
# These lines will be padded with 2 spaces and then inserted directly into the document.
21+
# Use pipe (|) for multiline entries.
22+
subtext:

docs/gen-ai/gen-ai-spans.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,15 +305,25 @@ by the application code.
305305

306306
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
307307
|---|---|---|---|---|---|
308-
| [`error.type`](/docs/registry/attributes/error.md) | string | Describes a class of error the operation ended with. [1] | `timeout`; `java.net.UnknownHostException`; `server_certificate_invalid`; `500` | `Conditionally Required` if the operation ended in an error | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
308+
| [`gen_ai.operation.name`](/docs/registry/attributes/gen-ai.md) | string | The name of the operation being performed. [1] | `chat`; `generate_content`; `text_completion` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
309+
| [`error.type`](/docs/registry/attributes/error.md) | string | Describes a class of error the operation ended with. [2] | `timeout`; `java.net.UnknownHostException`; `server_certificate_invalid`; `500` | `Conditionally Required` if the operation ended in an error | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
309310
| [`gen_ai.tool.call.id`](/docs/registry/attributes/gen-ai.md) | string | The tool call identifier. | `call_mszuSIzqtI65i1wAUOE8w5H4` | `Recommended` if available | ![Development](https://img.shields.io/badge/-development-blue) |
310311
| [`gen_ai.tool.description`](/docs/registry/attributes/gen-ai.md) | string | The tool description. | `Multiply two numbers` | `Recommended` if available | ![Development](https://img.shields.io/badge/-development-blue) |
311312
| [`gen_ai.tool.name`](/docs/registry/attributes/gen-ai.md) | string | Name of the tool utilized by the agent. | `Flights` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
313+
| [`gen_ai.tool.type`](/docs/registry/attributes/gen-ai.md) | string | Type of the tool utilized by the agent [3] | `function`; `extension`; `datastore` | `Recommended` if available | ![Development](https://img.shields.io/badge/-development-blue) |
312314

313-
**[1] `error.type`:** The `error.type` SHOULD match the error code returned by the Generative AI provider or the client library,
315+
**[1] `gen_ai.operation.name`:** If one of the predefined values applies, but specific system uses a different name it's RECOMMENDED to document it in the semantic conventions for specific GenAI system and use system-specific name in the instrumentation. If a different name is not documented, instrumentation libraries SHOULD use applicable predefined value.
316+
317+
**[2] `error.type`:** The `error.type` SHOULD match the error code returned by the Generative AI provider or the client library,
314318
the canonical name of exception that occurred, or another low-cardinality error identifier.
315319
Instrumentations SHOULD document the list of errors they report.
316320

321+
**[3] `gen_ai.tool.type`:** Extension: A tool executed on the agent-side to directly call external APIs, bridging the gap between the agent and real-world systems.
322+
Agent-side operations involve actions that are performed by the agent on the server or within the agent's controlled environment.
323+
Function: A tool executed on the client-side, where the agent generates parameters for a predefined function, and the client executes the logic.
324+
Client-side operations are actions taken on the user's end or within the client application.
325+
Datastore: A tool used by the agent to access and query structured or unstructured external data for retrieval-augmented tasks or knowledge updates.
326+
317327
---
318328

319329
`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.
@@ -322,6 +332,20 @@ Instrumentations SHOULD document the list of errors they report.
322332
|---|---|---|
323333
| `_OTHER` | A fallback error value to be used when the instrumentation doesn't define a custom value. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
324334

335+
---
336+
337+
`gen_ai.operation.name` 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.
338+
339+
| Value | Description | Stability |
340+
|---|---|---|
341+
| `chat` | Chat completion operation such as [OpenAI Chat API](https://platform.openai.com/docs/api-reference/chat) | ![Development](https://img.shields.io/badge/-development-blue) |
342+
| `create_agent` | Create GenAI agent | ![Development](https://img.shields.io/badge/-development-blue) |
343+
| `embeddings` | Embeddings operation such as [OpenAI Create embeddings API](https://platform.openai.com/docs/api-reference/embeddings/create) | ![Development](https://img.shields.io/badge/-development-blue) |
344+
| `execute_tool` | Execute a tool | ![Development](https://img.shields.io/badge/-development-blue) |
345+
| `generate_content` | Multimodal content generation operation such as [Gemini Generate Content](https://ai.google.dev/api/generate-content) | ![Development](https://img.shields.io/badge/-development-blue) |
346+
| `invoke_agent` | Invoke GenAI agent | ![Development](https://img.shields.io/badge/-development-blue) |
347+
| `text_completion` | Text completions operation such as [OpenAI Completions API (Legacy)](https://platform.openai.com/docs/api-reference/completions) | ![Development](https://img.shields.io/badge/-development-blue) |
348+
325349
<!-- markdownlint-restore -->
326350
<!-- prettier-ignore-end -->
327351
<!-- END AUTOGENERATED TEXT -->

model/gen-ai/spans.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ groups:
276276
for the application developers to follow this semantic convention for tools invoked
277277
by the application code.
278278
attributes:
279+
- ref: gen_ai.operation.name
280+
requirement_level: required
279281
- ref: gen_ai.tool.name
280282
requirement_level: recommended
281283
- ref: gen_ai.tool.call.id
@@ -284,6 +286,9 @@ groups:
284286
- ref: gen_ai.tool.description
285287
requirement_level:
286288
recommended: if available
289+
- ref: gen_ai.tool.type
290+
requirement_level:
291+
recommended: if available
287292
- ref: error.type
288293
requirement_level:
289294
conditionally_required: "if the operation ended in an error"

0 commit comments

Comments
 (0)