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
`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.
`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.
Copy file name to clipboardExpand all lines: docs/gen-ai/gen-ai-agent-spans.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,6 +112,15 @@ Instrumentations SHOULD document the list of errors they report.
112
112
113
113
**[6]`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.
114
114
115
+
The following attributes can be important for making sampling decisions
116
+
and SHOULD be provided **at span creation time** (if provided at all):
`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.
@@ -350,6 +359,15 @@ Since this attribute could be large, it's NOT RECOMMENDED to populate
350
359
it by default. Instrumentations MAY provide a way to enable
351
360
populating this attribute.
352
361
362
+
The following attributes can be important for making sampling decisions
363
+
and SHOULD be provided **at span creation time** (if provided at all):
`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.
@@ -39,7 +39,7 @@ GenAI instrumentations MAY capture user inputs sent to the model and responses r
39
39
> [!Note]
40
40
> Events are in-development and not yet available in some languages. Check [spec-compliance matrix](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.53.0/spec-compliance-matrix.md#logs) to see the implementation status in corresponding language.
`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.
@@ -301,27 +310,56 @@ The `gen_ai.operation.name` SHOULD be `embeddings`.
301
310
| Key | Stability |[Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/)| Value Type | Description | Example Values |
302
311
| --- | --- | --- | --- | --- | --- |
303
312
|[`gen_ai.operation.name`](/docs/registry/attributes/gen-ai.md)||`Required`| string | The name of the operation being performed. [1]|`chat`; `generate_content`; `text_completion`|
304
-
|[`error.type`](/docs/registry/attributes/error.md)||`Conditionally Required` if the operation ended in an error | string | Describes a class of error the operation ended with. [2]|`timeout`; `java.net.UnknownHostException`; `server_certificate_invalid`; `500`|
305
-
|[`gen_ai.request.model`](/docs/registry/attributes/gen-ai.md)||`Conditionally Required` If available. | string | The name of the GenAI model a request is being made to. [3]|`gpt-4`|
306
-
|[`server.port`](/docs/registry/attributes/server.md)||`Conditionally Required` If `server.address` is set. | int | GenAI server port. [4]|`80`; `8080`; `443`|
313
+
|[`gen_ai.provider.name`](/docs/registry/attributes/gen-ai.md)||`Required`| string | The Generative AI provider as identified by the client or server instrumentation. [2]|`openai`; `gcp.gen_ai`; `gcp.vertex_ai`|
314
+
|[`error.type`](/docs/registry/attributes/error.md)||`Conditionally Required` if the operation ended in an error | string | Describes a class of error the operation ended with. [3]|`timeout`; `java.net.UnknownHostException`; `server_certificate_invalid`; `500`|
315
+
|[`gen_ai.request.model`](/docs/registry/attributes/gen-ai.md)||`Conditionally Required` If available. | string | The name of the GenAI model a request is being made to. [4]|`gpt-4`|
316
+
|[`server.port`](/docs/registry/attributes/server.md)||`Conditionally Required` If `server.address` is set. | int | GenAI server port. [5]|`80`; `8080`; `443`|
307
317
|[`gen_ai.embeddings.dimension.count`](/docs/registry/attributes/gen-ai.md)||`Recommended`| int | The number of dimensions the resulting output embeddings should have. |`512`; `1024`|
308
-
|[`gen_ai.request.encoding_formats`](/docs/registry/attributes/gen-ai.md)||`Recommended`| string[]| The encoding formats requested in an embeddings operation, if specified. [5]|`["base64"]`; `["float", "binary"]`|
318
+
|[`gen_ai.request.encoding_formats`](/docs/registry/attributes/gen-ai.md)||`Recommended`| string[]| The encoding formats requested in an embeddings operation, if specified. [6]|`["base64"]`; `["float", "binary"]`|
309
319
|[`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md)||`Recommended`| int | The number of tokens used in the GenAI input (prompt). |`100`|
310
-
|[`server.address`](/docs/registry/attributes/server.md)||`Recommended`| string | GenAI server address. [6]|`example.com`; `10.1.2.80`; `/tmp/my.sock`|
320
+
|[`server.address`](/docs/registry/attributes/server.md)||`Recommended`| string | GenAI server address. [7]|`example.com`; `10.1.2.80`; `/tmp/my.sock`|
311
321
312
322
**[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.
313
323
314
-
**[2]`error.type`:** The `error.type` SHOULD match the error code returned by the Generative AI provider or the client library,
324
+
**[2]`gen_ai.provider.name`:** The attribute SHOULD be set based on the instrumentation's best
325
+
knowledge and may differ from the actual model provider.
326
+
327
+
Multiple providers, including Azure OpenAI, Gemini, and AI hosting platforms
328
+
are accessible using the OpenAI REST API and corresponding client libraries,
329
+
but may proxy or host models from different providers.
330
+
331
+
The `gen_ai.request.model`, `gen_ai.response.model`, and `server.address`
332
+
attributes may help identify the actual system in use.
333
+
334
+
The `gen_ai.provider.name` attribute acts as a discriminator that
335
+
identifies the GenAI telemetry format flavor specific to that provider
336
+
within GenAI semantic conventions.
337
+
It SHOULD be set consistently with provider-specific attributes and signals.
338
+
For example, GenAI spans, metrics, and events related to AWS Bedrock
339
+
should have the `gen_ai.provider.name` set to `aws.bedrock` and include
340
+
applicable `aws.bedrock.*` attributes and are not expected to include
341
+
`openai.*` attributes.
342
+
343
+
**[3]`error.type`:** The `error.type` SHOULD match the error code returned by the Generative AI provider or the client library,
315
344
the canonical name of exception that occurred, or another low-cardinality error identifier.
316
345
Instrumentations SHOULD document the list of errors they report.
317
346
318
-
**[3]`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.
347
+
**[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.
319
348
320
-
**[4]`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.
349
+
**[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.
321
350
322
-
**[5]`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.
351
+
**[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.
323
352
324
-
**[6]`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.
353
+
**[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.
354
+
355
+
The following attributes can be important for making sampling decisions
356
+
and SHOULD be provided **at span creation time** (if provided at all):
|`text_completion`| Text completions operation such as [OpenAI Completions API (Legacy)](https://platform.openai.com/docs/api-reference/completions)||
347
385
386
+
---
387
+
388
+
`gen_ai.provider.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.
**[8]:** Used when accessing the 'generativelanguage.googleapis.com' endpoint. Also known as the AI Studio API.
409
+
410
+
**[9]:** May be used when specific backend is unknown.
411
+
412
+
**[10]:** Used when accessing the 'aiplatform.googleapis.com' endpoint.
413
+
348
414
<!-- prettier-ignore-end -->
349
415
<!-- END AUTOGENERATED TEXT -->
350
416
<!-- endsemconv -->
@@ -421,6 +487,11 @@ It's expected to be an object - in case a serialized string is available
421
487
to the instrumentation, the instrumentation SHOULD do the best effort to
422
488
deserialize it to an object. When recorded on spans, it MAY be recorded as a JSON string if structured format is not supported and SHOULD be recorded in structured form otherwise.
423
489
490
+
The following attributes can be important for making sampling decisions
491
+
and SHOULD be provided **at span creation time** (if provided at all):
`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.
`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.
0 commit comments