From 520702f1557743fa05588999757106007fb21ba3 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Fri, 1 Nov 2024 04:00:09 +0100 Subject: [PATCH] genai: add system_fingerprint attribute (#1355) Co-authored-by: Liudmila Molkova --- .chloggen/add_genai_system_fingerprint.yaml | 22 +++++++++++++++++++++ docs/attributes-registry/gen-ai.md | 5 +++-- docs/gen-ai/openai.md | 11 +++++++---- model/gen-ai/metrics.yaml | 2 ++ model/gen-ai/registry.yaml | 9 +++++++-- model/gen-ai/spans.yaml | 2 ++ 6 files changed, 43 insertions(+), 8 deletions(-) create mode 100755 .chloggen/add_genai_system_fingerprint.yaml diff --git a/.chloggen/add_genai_system_fingerprint.yaml b/.chloggen/add_genai_system_fingerprint.yaml new file mode 100755 index 0000000000..807a4ac8ec --- /dev/null +++ b/.chloggen/add_genai_system_fingerprint.yaml @@ -0,0 +1,22 @@ +# Use this changelog template to create an entry for release notes. +# +# If your change doesn't affect end users you should instead start +# your pull request title with [chore] or use the "Skip Changelog" label. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db) +component: gen-ai + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add `gen_ai.openai.response.system_fingerprint` attribute + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +# The values here must be integers. +issues: [1355] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/docs/attributes-registry/gen-ai.md b/docs/attributes-registry/gen-ai.md index 814464f3f1..1381a437be 100644 --- a/docs/attributes-registry/gen-ai.md +++ b/docs/attributes-registry/gen-ai.md @@ -77,8 +77,9 @@ Thie group defines attributes for OpenAI. |---|---|---|---|---| | `gen_ai.openai.request.response_format` | string | The response format that is requested. | `json` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | `gen_ai.openai.request.seed` | int | Requests with same seed value more likely to return same result. | `100` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `gen_ai.openai.request.service_tier` | string | The service tier requested. May be a specific tier, detault, or auto. | `auto`; `default` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `gen_ai.openai.response.service_tier` | string | The service tier used for the response. | `scale`; `detault` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `gen_ai.openai.request.service_tier` | string | The service tier requested. May be a specific tier, default, or auto. | `auto`; `default` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `gen_ai.openai.response.service_tier` | string | The service tier used for the response. | `scale`; `default` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `gen_ai.openai.response.system_fingerprint` | string | A fingerprint to track any eventual change in the Generative AI environment. | `fp_44709d6fcb` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | `gen_ai.openai.request.response_format` 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. diff --git a/docs/gen-ai/openai.md b/docs/gen-ai/openai.md index 5acce4fb88..b72d4912d2 100644 --- a/docs/gen-ai/openai.md +++ b/docs/gen-ai/openai.md @@ -41,9 +41,10 @@ attributes and ones specific the OpenAI. | [`error.type`](/docs/attributes-registry/error.md) | string | Describes a class of error the operation ended with. [3] | `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) | | [`gen_ai.openai.request.response_format`](/docs/attributes-registry/gen-ai.md) | string | The response format that is requested. | `json` | `Conditionally Required` if the request includes a response_format | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | [`gen_ai.openai.request.seed`](/docs/attributes-registry/gen-ai.md) | int | Requests with same seed value more likely to return same result. | `100` | `Conditionally Required` if the request includes a seed | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| [`gen_ai.openai.request.service_tier`](/docs/attributes-registry/gen-ai.md) | string | The service tier requested. May be a specific tier, detault, or auto. | `auto`; `default` | `Conditionally Required` [4] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| [`gen_ai.openai.response.service_tier`](/docs/attributes-registry/gen-ai.md) | string | The service tier used for the response. | `scale`; `detault` | `Conditionally Required` [5] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`gen_ai.openai.request.service_tier`](/docs/attributes-registry/gen-ai.md) | string | The service tier requested. May be a specific tier, default, or auto. | `auto`; `default` | `Conditionally Required` [4] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`gen_ai.openai.response.service_tier`](/docs/attributes-registry/gen-ai.md) | string | The service tier used for the response. | `scale`; `default` | `Conditionally Required` [5] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | [`server.port`](/docs/attributes-registry/server.md) | int | GenAI server port. [6] | `80`; `8080`; `443` | `Conditionally Required` If `server.address` is set. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | +| [`gen_ai.openai.response.system_fingerprint`](/docs/attributes-registry/gen-ai.md) | string | A fingerprint to track any eventual change in the Generative AI environment. | `fp_44709d6fcb` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | [`gen_ai.request.frequency_penalty`](/docs/attributes-registry/gen-ai.md) | double | The frequency penalty setting for the GenAI request. | `0.1` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | [`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` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | [`gen_ai.request.presence_penalty`](/docs/attributes-registry/gen-ai.md) | double | The presence penalty setting for the GenAI request. | `0.1` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | @@ -128,7 +129,8 @@ Additional attributes: | Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | |---|---|---|---|---|---| -| [`gen_ai.openai.response.service_tier`](/docs/attributes-registry/gen-ai.md) | string | The service tier used for the response. | `scale`; `detault` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`gen_ai.openai.response.service_tier`](/docs/attributes-registry/gen-ai.md) | string | The service tier used for the response. | `scale`; `default` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`gen_ai.openai.response.system_fingerprint`](/docs/attributes-registry/gen-ai.md) | string | A fingerprint to track any eventual change in the Generative AI environment. | `fp_44709d6fcb` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | @@ -150,7 +152,8 @@ Additional attributes: | Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | |---|---|---|---|---|---| -| [`gen_ai.openai.response.service_tier`](/docs/attributes-registry/gen-ai.md) | string | The service tier used for the response. | `scale`; `detault` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`gen_ai.openai.response.service_tier`](/docs/attributes-registry/gen-ai.md) | string | The service tier used for the response. | `scale`; `default` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`gen_ai.openai.response.system_fingerprint`](/docs/attributes-registry/gen-ai.md) | string | A fingerprint to track any eventual change in the Generative AI environment. | `fp_44709d6fcb` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | diff --git a/model/gen-ai/metrics.yaml b/model/gen-ai/metrics.yaml index 35b5c979bc..e1a7254037 100644 --- a/model/gen-ai/metrics.yaml +++ b/model/gen-ai/metrics.yaml @@ -37,6 +37,8 @@ groups: attributes: - ref: gen_ai.openai.response.service_tier requirement_level: recommended + - ref: gen_ai.openai.response.system_fingerprint + requirement_level: recommended - id: metric.gen_ai.client.token.usage type: metric metric_name: gen_ai.client.token.usage diff --git a/model/gen-ai/registry.yaml b/model/gen-ai/registry.yaml index a1e86b75fc..2be38beb2b 100644 --- a/model/gen-ai/registry.yaml +++ b/model/gen-ai/registry.yaml @@ -181,10 +181,15 @@ groups: value: "default" brief: The system will utilize the default scale tier. stability: experimental - brief: The service tier requested. May be a specific tier, detault, or auto. + brief: The service tier requested. May be a specific tier, default, or auto. examples: ['auto', 'default'] - id: gen_ai.openai.response.service_tier stability: experimental type: string brief: The service tier used for the response. - examples: ['scale', 'detault'] + examples: ['scale', 'default'] + - id: gen_ai.openai.response.system_fingerprint + stability: experimental + type: string + brief: A fingerprint to track any eventual change in the Generative AI environment. + examples: ["fp_44709d6fcb"] diff --git a/model/gen-ai/spans.yaml b/model/gen-ai/spans.yaml index 79909f0f3c..a7c8a0ef5e 100644 --- a/model/gen-ai/spans.yaml +++ b/model/gen-ai/spans.yaml @@ -90,6 +90,8 @@ groups: - ref: gen_ai.openai.response.service_tier requirement_level: conditionally_required: if the response was received and includes a service_tier + - ref: gen_ai.openai.response.system_fingerprint + requirement_level: recommended - ref: gen_ai.usage.input_tokens brief: The number of tokens used in the prompt sent to OpenAI. - ref: gen_ai.usage.output_tokens