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
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -114,6 +114,15 @@ Instrumentations SHOULD document the list of errors they report.
114
114
115
115
**[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.
116
116
117
+
The following attributes can be important for making sampling decisions
118
+
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.
@@ -354,6 +363,14 @@ Since this attribute could be large, it's NOT RECOMMENDED to populate
354
363
it by default. Instrumentations MAY provide a way to enable
355
364
populating this attribute.
356
365
366
+
The following attributes can be important for making sampling decisions
367
+
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.50.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.
@@ -307,27 +316,56 @@ The `gen_ai.operation.name` SHOULD be `embeddings`.
307
316
| Key | Stability |[Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/)| Value Type | Description | Example Values |
308
317
|---|---|---|---|---|---|
309
318
|[`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`|
310
-
|[`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`|
311
-
|[`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`|
312
-
|[`server.port`](/docs/registry/attributes/server.md)||`Conditionally Required` If `server.address` is set. | int | GenAI server port. [4]|`80`; `8080`; `443`|
319
+
|[`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`|
320
+
|[`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`|
321
+
|[`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`|
322
+
|[`server.port`](/docs/registry/attributes/server.md)||`Conditionally Required` If `server.address` is set. | int | GenAI server port. [5]|`80`; `8080`; `443`|
313
323
|[`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`|
314
-
|[`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"]`|
324
+
|[`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"]`|
315
325
|[`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md)||`Recommended`| int | The number of tokens used in the GenAI input (prompt). |`100`|
316
-
|[`server.address`](/docs/registry/attributes/server.md)||`Recommended`| string | GenAI server address. [6]|`example.com`; `10.1.2.80`; `/tmp/my.sock`|
326
+
|[`server.address`](/docs/registry/attributes/server.md)||`Recommended`| string | GenAI server address. [7]|`example.com`; `10.1.2.80`; `/tmp/my.sock`|
317
327
318
328
**[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.
319
329
320
-
**[2]`error.type`:** The `error.type` SHOULD match the error code returned by the Generative AI provider or the client library,
330
+
**[2]`gen_ai.provider.name`:** The attribute SHOULD be set based on the instrumentation's best
331
+
knowledge and may differ from the actual model provider.
332
+
333
+
Multiple providers, including Azure OpenAI, Gemini, and AI hosting platforms
334
+
are accessible using the OpenAI REST API and corresponding client libraries,
335
+
but may proxy or host models from different providers.
336
+
337
+
The `gen_ai.request.model`, `gen_ai.response.model`, and `server.address`
338
+
attributes may help identify the actual system in use.
339
+
340
+
The `gen_ai.provider.name` attribute acts as a discriminator that
341
+
identifies the GenAI telemetry format flavor specific to that provider
342
+
within GenAI semantic conventions.
343
+
It SHOULD be set consistently with provider-specific attributes and signals.
344
+
For example, GenAI spans, metrics, and events related to AWS Bedrock
345
+
should have the `gen_ai.provider.name` set to `aws.bedrock` and include
346
+
applicable `aws.bedrock.*` attributes and are not expected to include
347
+
`openai.*` attributes.
348
+
349
+
**[3]`error.type`:** The `error.type` SHOULD match the error code returned by the Generative AI provider or the client library,
321
350
the canonical name of exception that occurred, or another low-cardinality error identifier.
322
351
Instrumentations SHOULD document the list of errors they report.
323
352
324
-
**[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.
353
+
**[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.
325
354
326
-
**[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.
355
+
**[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.
327
356
328
-
**[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.
357
+
**[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.
329
358
330
-
**[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.
359
+
**[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.
360
+
361
+
The following attributes can be important for making sampling decisions
362
+
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)||
353
391
392
+
---
393
+
394
+
`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.
415
+
416
+
**[9]:** May be used when specific backend is unknown.
417
+
418
+
**[10]:** Used when accessing the 'aiplatform.googleapis.com' endpoint.
419
+
354
420
<!-- markdownlint-restore -->
355
421
<!-- prettier-ignore-end -->
356
422
<!-- END AUTOGENERATED TEXT -->
@@ -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