From fae5989eda61f20c247e80a86c36ecbbb573f268 Mon Sep 17 00:00:00 2001 From: Drew Robbins Date: Tue, 26 Aug 2025 15:31:07 +0900 Subject: [PATCH] Gen ai.embeddings.dimension.count (#2362) Co-authored-by: Liudmila Molkova --- .chloggen/gen_ai_dimension_count.yaml | 7 +++++++ docs/gen-ai/gen-ai-spans.md | 1 + docs/registry/attributes/gen-ai.md | 1 + model/gen-ai/registry.yaml | 5 +++++ model/gen-ai/spans.yaml | 2 ++ 5 files changed, 16 insertions(+) create mode 100644 .chloggen/gen_ai_dimension_count.yaml diff --git a/.chloggen/gen_ai_dimension_count.yaml b/.chloggen/gen_ai_dimension_count.yaml new file mode 100644 index 000000000..d52e27418 --- /dev/null +++ b/.chloggen/gen_ai_dimension_count.yaml @@ -0,0 +1,7 @@ +change_type: enhancement +component: gen_ai +note: Add `gen_ai.embeddings.dimension.count` attribute to capture the dimension count of embeddings. +issues: [2361] +subtext: | + The `gen_ai.embeddings.dimension.count` is added to the `span.gen_ai.embeddings.client` span + and `gen_ai.client.operation.duration` metric. diff --git a/docs/gen-ai/gen-ai-spans.md b/docs/gen-ai/gen-ai-spans.md index 329601e1e..b8f737b67 100644 --- a/docs/gen-ai/gen-ai-spans.md +++ b/docs/gen-ai/gen-ai-spans.md @@ -295,6 +295,7 @@ The `gen_ai.operation.name` SHOULD be `embeddings`. | [`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) | | [`gen_ai.request.model`](/docs/registry/attributes/gen-ai.md) | string | The name of the GenAI model a request is being made to. [3] | `gpt-4` | `Conditionally Required` If available. | ![Development](https://img.shields.io/badge/-development-blue) | | [`server.port`](/docs/registry/attributes/server.md) | int | GenAI server port. [4] | `80`; `8080`; `443` | `Conditionally Required` If `server.address` is set. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | +| [`gen_ai.embeddings.dimension.count`](/docs/registry/attributes/gen-ai.md) | int | The number of dimensions the resulting output embeddings should have. | `512`; `1024` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | | [`gen_ai.request.encoding_formats`](/docs/registry/attributes/gen-ai.md) | string[] | The encoding formats requested in an embeddings operation, if specified. [5] | `["base64"]`; `["float", "binary"]` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | | [`gen_ai.usage.input_tokens`](/docs/registry/attributes/gen-ai.md) | int | The number of tokens used in the GenAI input (prompt). | `100` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | | [`server.address`](/docs/registry/attributes/server.md) | string | GenAI server address. [6] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | diff --git a/docs/registry/attributes/gen-ai.md b/docs/registry/attributes/gen-ai.md index b02050ac2..b62a376cb 100644 --- a/docs/registry/attributes/gen-ai.md +++ b/docs/registry/attributes/gen-ai.md @@ -18,6 +18,7 @@ This document defines the attributes used to describe telemetry in the context o | `gen_ai.agent.name` | string | Human-readable name of the GenAI agent provided by the application. | `Math Tutor`; `Fiction Writer` | ![Development](https://img.shields.io/badge/-development-blue) | | `gen_ai.conversation.id` | string | The unique identifier for a conversation (session, thread), used to store and correlate messages within this conversation. | `conv_5j66UpCpwteGg4YSxUnt7lPY` | ![Development](https://img.shields.io/badge/-development-blue) | | `gen_ai.data_source.id` | string | The data source identifier. [1] | `H7STPQYOND` | ![Development](https://img.shields.io/badge/-development-blue) | +| `gen_ai.embeddings.dimension.count` | int | The number of dimensions the resulting output embeddings should have. | `512`; `1024` | ![Development](https://img.shields.io/badge/-development-blue) | | `gen_ai.input.messages` | any | The chat history provided to the model as an input. [2] | [
  {
    "role": "user",
    "parts": [
      {
        "type": "text",
        "content": "Weather in Paris?"
      }
    ]
  },
  {
    "role": "assistant",
    "parts": [
      {
        "type": "tool_call",
        "id": "call_VSPygqKTWdrhaFErNvMV18Yl",
        "name": "get_weather",
        "arguments": {
          "location": "Paris"
        }
      }
    ]
  },
  {
    "role": "tool",
    "parts": [
      {
        "type": "tool_call_response",
        "id": " call_VSPygqKTWdrhaFErNvMV18Yl",
        "result": "rainy, 57°F"
      }
    ]
  }
] | ![Development](https://img.shields.io/badge/-development-blue) | | `gen_ai.operation.name` | string | The name of the operation being performed. [3] | `chat`; `generate_content`; `text_completion` | ![Development](https://img.shields.io/badge/-development-blue) | | `gen_ai.output.messages` | any | Messages returned by the model where each message represents a specific model response (choice, candidate). [4] | [
  {
    "role": "assistant",
    "parts": [
      {
        "type": "text",
        "content": "The weather in Paris is currently rainy with a temperature of 57°F."
      }
    ],
    "finish_reason": "stop"
  }
] | ![Development](https://img.shields.io/badge/-development-blue) | diff --git a/model/gen-ai/registry.yaml b/model/gen-ai/registry.yaml index aadd8417e..4d6fd74e2 100644 --- a/model/gen-ai/registry.yaml +++ b/model/gen-ai/registry.yaml @@ -334,6 +334,11 @@ groups: Additional output format details may be recorded in the future in the `gen_ai.output.{type}.*` attributes. + - id: gen_ai.embeddings.dimension.count + stability: development + type: int + brief: The number of dimensions the resulting output embeddings should have. + examples: [512, 1024] - id: gen_ai.system_instructions stability: development type: any diff --git a/model/gen-ai/spans.yaml b/model/gen-ai/spans.yaml index 07bcf43ec..fb26d2a0c 100644 --- a/model/gen-ai/spans.yaml +++ b/model/gen-ai/spans.yaml @@ -212,6 +212,8 @@ groups: requirement_level: recommended - ref: gen_ai.usage.input_tokens requirement_level: recommended + - ref: gen_ai.embeddings.dimension.count + requirement_level: recommended - id: span.gen_ai.create_agent.client type: span