Skip to content

Commit 2d05f4d

Browse files
gyliu513Liudmila Molkova
andauthored
Removed unnecessary GenAI agent span attributes when create agent (open-telemetry#2116)
Signed-off-by: Guangya Liu <[email protected]> Co-authored-by: Liudmila Molkova <[email protected]>
1 parent 29237f6 commit 2d05f4d

File tree

3 files changed

+55
-64
lines changed

3 files changed

+55
-64
lines changed

.chloggen/1924.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: bug_fix
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: Removed irrelevant attributes on GenAI create agent 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: [1924]
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-agent-spans.md

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -56,24 +56,18 @@ Semantic conventions for individual GenAI systems and frameworks MAY specify dif
5656
| [`gen_ai.agent.description`](/docs/attributes-registry/gen-ai.md) | string | Free-form description of the GenAI agent provided by the application. | `Helps with math problems`; `Generates fiction stories` | `Conditionally Required` If provided by the application. | ![Development](https://img.shields.io/badge/-development-blue) |
5757
| [`gen_ai.agent.id`](/docs/attributes-registry/gen-ai.md) | string | The unique identifier of the GenAI agent. | `asst_5j66UpCpwteGg4YSxUnt7lPY` | `Conditionally Required` if applicable. | ![Development](https://img.shields.io/badge/-development-blue) |
5858
| [`gen_ai.agent.name`](/docs/attributes-registry/gen-ai.md) | string | Human-readable name of the GenAI agent provided by the application. | `Math Tutor`; `Fiction Writer` | `Conditionally Required` If provided by the application. | ![Development](https://img.shields.io/badge/-development-blue) |
59-
| [`gen_ai.output.type`](/docs/attributes-registry/gen-ai.md) | string | Represents the content type requested by the client. [4] | `text`; `json`; `image` | `Conditionally Required` [5] | ![Development](https://img.shields.io/badge/-development-blue) |
6059
| [`gen_ai.request.choice.count`](/docs/attributes-registry/gen-ai.md) | int | The target number of candidate completions to return. | `3` | `Conditionally Required` if available, in the request, and !=1 | ![Development](https://img.shields.io/badge/-development-blue) |
61-
| [`gen_ai.request.model`](/docs/attributes-registry/gen-ai.md) | string | The name of the GenAI model a request is being made to. [6] | `gpt-4` | `Conditionally Required` If provided by the application. | ![Development](https://img.shields.io/badge/-development-blue) |
60+
| [`gen_ai.request.model`](/docs/attributes-registry/gen-ai.md) | string | The name of the GenAI model a request is being made to. [4] | `gpt-4` | `Conditionally Required` If available. | ![Development](https://img.shields.io/badge/-development-blue) |
6261
| [`gen_ai.request.seed`](/docs/attributes-registry/gen-ai.md) | int | Requests with same seed value more likely to return same result. | `100` | `Conditionally Required` if applicable and if the request includes a seed | ![Development](https://img.shields.io/badge/-development-blue) |
63-
| [`gen_ai.request.temperature`](/docs/attributes-registry/gen-ai.md) | double | The temperature setting for the GenAI request. | `0.0` | `Conditionally Required` If provided by the application. | ![Development](https://img.shields.io/badge/-development-blue) |
64-
| [`gen_ai.request.top_p`](/docs/attributes-registry/gen-ai.md) | double | The top_p sampling setting for the GenAI request. | `1.0` | `Conditionally Required` If provided by the application. | ![Development](https://img.shields.io/badge/-development-blue) |
65-
| [`server.port`](/docs/attributes-registry/server.md) | int | GenAI server port. [7] | `80`; `8080`; `443` | `Conditionally Required` If `server.address` is set. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
66-
| [`gen_ai.request.encoding_formats`](/docs/attributes-registry/gen-ai.md) | string[] | The encoding formats requested in an embeddings operation, if specified. [8] | `["base64"]`; `["float", "binary"]` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
62+
| [`server.port`](/docs/attributes-registry/server.md) | int | GenAI server port. [5] | `80`; `8080`; `443` | `Conditionally Required` If `server.address` is set. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
63+
| [`gen_ai.request.encoding_formats`](/docs/attributes-registry/gen-ai.md) | string[] | The encoding formats requested in an embeddings operation, if specified. [6] | `["base64"]`; `["float", "binary"]` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
6764
| [`gen_ai.request.frequency_penalty`](/docs/attributes-registry/gen-ai.md) | double | The frequency penalty setting for the GenAI request. | `0.1` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
6865
| [`gen_ai.request.max_tokens`](/docs/attributes-registry/gen-ai.md) | int | The maximum number of tokens the model generates for a request. | `100` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
6966
| [`gen_ai.request.presence_penalty`](/docs/attributes-registry/gen-ai.md) | double | The presence penalty setting for the GenAI request. | `0.1` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
7067
| [`gen_ai.request.stop_sequences`](/docs/attributes-registry/gen-ai.md) | string[] | List of sequences that the model will use to stop generating further tokens. | `["forest", "lived"]` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
71-
| [`gen_ai.response.finish_reasons`](/docs/attributes-registry/gen-ai.md) | string[] | Array of reasons the model stopped generating tokens, corresponding to each generation received. | `["stop"]`; `["stop", "length"]` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
72-
| [`gen_ai.response.id`](/docs/attributes-registry/gen-ai.md) | string | The unique identifier for the completion. | `chatcmpl-123` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
73-
| [`gen_ai.response.model`](/docs/attributes-registry/gen-ai.md) | string | The name of the model that generated the response. [9] | `gpt-4-0613` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
74-
| [`gen_ai.usage.input_tokens`](/docs/attributes-registry/gen-ai.md) | int | The number of tokens used in the GenAI input (prompt). | `100` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
75-
| [`gen_ai.usage.output_tokens`](/docs/attributes-registry/gen-ai.md) | int | The number of tokens used in the GenAI response (completion). | `180` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
76-
| [`server.address`](/docs/attributes-registry/server.md) | string | GenAI server address. [10] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
68+
| [`gen_ai.request.temperature`](/docs/attributes-registry/gen-ai.md) | double | The temperature setting for the GenAI request. | `0.0` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
69+
| [`gen_ai.request.top_p`](/docs/attributes-registry/gen-ai.md) | double | The top_p sampling setting for the GenAI request. | `1.0` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
70+
| [`server.address`](/docs/attributes-registry/server.md) | string | GenAI server address. [7] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
7771

7872
**[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.
7973

@@ -93,21 +87,13 @@ If none of these options apply, the `gen_ai.system` SHOULD be set to `_OTHER`.
9387
the canonical name of exception that occurred, or another low-cardinality error identifier.
9488
Instrumentations SHOULD document the list of errors they report.
9589

96-
**[4] `gen_ai.output.type`:** This attribute SHOULD be used when the client requests output of a specific type. The model may return zero or more outputs of this type.
97-
This attribute specifies the output modality and not the actual output format. For example, if an image is requested, the actual output could be a URL pointing to an image file.
98-
Additional output format details may be recorded in the future in the `gen_ai.output.{type}.*` attributes.
90+
**[4] `gen_ai.request.model`:** The name of the GenAI model a request is being made to. If the model is supplied by a vendor, then the value must be the exact name of the model requested. If the model is a fine-tuned custom model, the value should have a more specific name than the base model that's been fine-tuned.
9991

100-
**[5] `gen_ai.output.type`:** when applicable and if the request includes an output format.
92+
**[5] `server.port`:** When observed from the client side, and when communicating through an intermediary, `server.port` SHOULD represent the server port behind any intermediaries, for example proxies, if it's available.
10193

102-
**[6] `gen_ai.request.model`:** The name of the GenAI model a request is being made to. If the model is supplied by a vendor, then the value must be the exact name of the model requested. If the model is a fine-tuned custom model, the value should have a more specific name than the base model that's been fine-tuned.
94+
**[6] `gen_ai.request.encoding_formats`:** In some GenAI systems the encoding formats are called embedding types. Also, some GenAI systems only accept a single format per request.
10395

104-
**[7] `server.port`:** When observed from the client side, and when communicating through an intermediary, `server.port` SHOULD represent the server port behind any intermediaries, for example proxies, if it's available.
105-
106-
**[8] `gen_ai.request.encoding_formats`:** In some GenAI systems the encoding formats are called embedding types. Also, some GenAI systems only accept a single format per request.
107-
108-
**[9] `gen_ai.response.model`:** If available. The name of the GenAI model that provided the response. If the model is supplied by a vendor, then the value must be the exact name of the model actually used. If the model is a fine-tuned custom model, the value should have a more specific name than the base model that's been fine-tuned.
109-
110-
**[10] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
96+
**[7] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
11197

11298
---
11399

@@ -132,17 +118,6 @@ Additional output format details may be recorded in the future in the `gen_ai.ou
132118

133119
---
134120

135-
`gen_ai.output.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.
136-
137-
| Value | Description | Stability |
138-
|---|---|---|
139-
| `image` | Image | ![Development](https://img.shields.io/badge/-development-blue) |
140-
| `json` | JSON object with known or unknown schema | ![Development](https://img.shields.io/badge/-development-blue) |
141-
| `speech` | Speech | ![Development](https://img.shields.io/badge/-development-blue) |
142-
| `text` | Plain text | ![Development](https://img.shields.io/badge/-development-blue) |
143-
144-
---
145-
146121
`gen_ai.system` 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.
147122

148123
| Value | Description | Stability |

model/gen-ai/spans.yaml

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
groups:
2-
- id: trace.gen_ai.client.common_attributes
2+
- id: trace.gen_ai.client.common_request_attributes
33
type: attribute_group
44
stability: development
55
brief: >
@@ -34,6 +34,27 @@ groups:
3434
conditionally_required: if applicable and if the request includes a seed
3535
- ref: gen_ai.request.encoding_formats
3636
requirement_level: recommended
37+
- ref: server.address
38+
brief: GenAI server address.
39+
requirement_level: recommended
40+
- ref: server.port
41+
brief: GenAI server port.
42+
requirement_level:
43+
conditionally_required: If `server.address` is set.
44+
- ref: error.type
45+
requirement_level:
46+
conditionally_required: "if the operation ended in an error"
47+
note: |
48+
The `error.type` SHOULD match the error code returned by the Generative AI provider or the client library,
49+
the canonical name of exception that occurred, or another low-cardinality error identifier.
50+
Instrumentations SHOULD document the list of errors they report.
51+
- id: trace.gen_ai.client.common_attributes
52+
type: attribute_group
53+
stability: development
54+
brief: >
55+
Describes GenAI operation span.
56+
extends: trace.gen_ai.client.common_request_attributes
57+
attributes:
3758
- ref: gen_ai.output.type
3859
requirement_level:
3960
conditionally_required: when applicable and if the request includes an output format.
@@ -51,20 +72,6 @@ groups:
5172
requirement_level: recommended
5273
- ref: gen_ai.usage.output_tokens
5374
requirement_level: recommended
54-
- ref: server.address
55-
brief: GenAI server address.
56-
requirement_level: recommended
57-
- ref: server.port
58-
brief: GenAI server port.
59-
requirement_level:
60-
conditionally_required: If `server.address` is set.
61-
- ref: error.type
62-
requirement_level:
63-
conditionally_required: "if the operation ended in an error"
64-
note: |
65-
The `error.type` SHOULD match the error code returned by the Generative AI provider or the client library,
66-
the canonical name of exception that occurred, or another low-cardinality error identifier.
67-
Instrumentations SHOULD document the list of errors they report.
6875
- id: span.gen_ai.client
6976
type: span
7077
stability: development
@@ -182,7 +189,7 @@ groups:
182189
183190
**Span name** SHOULD be `create_agent {gen_ai.agent.name}`.
184191
Semantic conventions for individual GenAI systems and frameworks MAY specify different span name format.
185-
extends: trace.gen_ai.client.common_attributes
192+
extends: trace.gen_ai.client.common_request_attributes
186193
attributes:
187194
- ref: gen_ai.system
188195
requirement_level: required
@@ -195,19 +202,6 @@ groups:
195202
- ref: gen_ai.agent.description
196203
requirement_level:
197204
conditionally_required: If provided by the application.
198-
- ref: gen_ai.request.model
199-
requirement_level:
200-
conditionally_required: If provided by the application.
201-
note: >
202-
The name of the GenAI model a request is being made to. If the model is supplied by a vendor,
203-
then the value must be the exact name of the model requested. If the model is a fine-tuned
204-
custom model, the value should have a more specific name than the base model that's been fine-tuned.
205-
- ref: gen_ai.request.temperature
206-
requirement_level:
207-
conditionally_required: If provided by the application.
208-
- ref: gen_ai.request.top_p
209-
requirement_level:
210-
conditionally_required: If provided by the application.
211205

212206
- id: span.gen_ai.execute_tool.internal
213207
type: span

0 commit comments

Comments
 (0)