Skip to content

Conversation

elinacse
Copy link

@elinacse elinacse commented Sep 22, 2025

Fixes #1650

Changes

Please provide a brief description of the changes here.

Note: if the PR is touching an area that is not listed in the existing areas, or the area does not have sufficient domain experts coverage, the PR might be tagged as experts needed and move slowly until experts are identified.

Merge requirement checklist

  • CONTRIBUTING.md guidelines followed.
  • Change log entry added, according to the guidelines in When to add a changelog entry.
    • If your PR does not need a change log, start the PR title with [chore]
  • Links to the prototypes or existing instrumentations (when adding or changing conventions)

Copy link

linux-foundation-easycla bot commented Sep 22, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@github-actions github-actions bot added enhancement New feature or request area:gen-ai labels Sep 22, 2025

# 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: [123]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/123/1650

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ,

Comment on lines 23 to 28
Added specific semantic conventions for IBM WatsonX AI including:
- WatsonX-specific attributes like project_id, space_id, version, and trace_id
- WatsonX-specific LLM attributes like decoding_method, random_seed, max_new_tokens, min_new_tokens, and repetition_penalty
- WatsonX-specific metrics for completions duration, exceptions, responses, and tokens
- Dedicated span definition for WatsonX client operations
- Comprehensive documentation with examples
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may bring some confuse, can you remove it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done .


## GenAI Attributes

This document defines the attributes used to describe telemetry in the context of Generative Artificial Intelligence (GenAI) Models requests and responses.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I have executed table generation command and it created watsonx.md file under registry folder .

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the file should be deleted as it is replaced by registry/attributes/*.md which is auto generated.

brief: >
This group defines attributes specific to IBM WatsonX AI.
attributes:
- id: gen_ai.watsonx.request.project_id
Copy link
Member

@gyliu513 gyliu513 Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/watsonx/watsonx.ai

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

schema-next.yaml Outdated
@@ -0,0 +1,586 @@
file_format: 1.1.0
schema_url: https://opentelemetry.io/schemas/next
versions:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this file?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed the file .

@gyliu513
Copy link
Member

Copy link
Contributor

@thompson-tomo thompson-tomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pr needs to be cleaned up to minimise unintended changes and removal of old auto generated files.

Comment on lines 89 to 126
- id: metric.gen_ai.watsonx.ai.completions.duration
type: metric
metric_name: llm.watsonx.ai.completions.duration
brief: 'Measures the duration of WatsonX completions operations'
instrument: histogram
unit: "s"
stability: experimental
extends: metric_attributes.gen_ai

- id: metric.gen_ai.watsonx.ai.completions.exceptions
type: metric
metric_name: llm.watsonx.ai.completions.exceptions
brief: 'Counts the number of exceptions that occurred during WatsonX completions operations'
instrument: counter
unit: "{exception}"
stability: experimental
extends: metric_attributes.gen_ai

- id: metric.gen_ai.watsonx.ai.completions.responses
type: metric
metric_name: llm.watsonx.ai.completions.responses
brief: 'Counts the number of responses received from WatsonX completions operations'
instrument: counter
unit: "{response}"
stability: experimental
extends: metric_attributes.gen_ai

- id: metric.gen_ai.watsonx.ai.completions.tokens
type: metric
metric_name: llm.watsonx.ai.completions.tokens
brief: 'Counts the number of tokens processed in WatsonX completions operations'
instrument: counter
unit: "{token}"
stability: experimental
extends: metric_attributes.gen_ai
attributes:
- ref: gen_ai.token.type
requirement_level: required
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason these are being restricted to watsonx? Could we not have these as general gen-ai metrics?

Comment on lines 54 to 87
- id: span.gen_ai.watsonx.ai.client
stability: experimental
span_kind: client
type: span
brief: >
Describes an IBM WatsonX AI operation span.
attributes:
- ref: gen_ai.request.model
requirement_level: required
- ref: gen_ai.watsonx.ai.request.project_id
requirement_level:
conditionally_required: if the request includes a project_id
- ref: gen_ai.watsonx.ai.request.space_id
requirement_level:
conditionally_required: if the request includes a space_id
- ref: gen_ai.watsonx.ai.request.version
requirement_level: recommended
- ref: gen_ai.watsonx.ai.response.trace_id
requirement_level:
conditionally_required: if the response was received and includes a trace_id
- ref: gen_ai.usage.input_tokens
brief: The number of tokens used in the prompt sent to IBM WatsonX AI.
- ref: gen_ai.usage.output_tokens
brief: The number of tokens used in the completions from IBM WatsonX AI.
- ref: llm.watsonx.ai.decoding_method
requirement_level: recommended
- ref: llm.watsonx.ai.random_seed
requirement_level: recommended
- ref: llm.watsonx.ai.max_new_tokens
requirement_level: recommended
- ref: llm.watsonx.ai.min_new_tokens
requirement_level: recommended
- ref: llm.watsonx.ai.repetition_penalty
requirement_level: recommended
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be in the gen-ai/spans.yaml file

Comment on lines 18 to 52
- id: watsonxai.request.version
stability: development
type: string
brief: The version of the model being used.
examples: ['1.0', '2.3.1']
- id: watsonxai.response.trace_id
stability: development
type: string
brief: The trace ID returned by IBM WatsonX AI.
examples: ['wxt-12345678-abcd-1234-efgh-1234567890ab']
- id: watsonxai.decoding_method
stability: development
type: string
brief: The decoding method used by WatsonX for generating responses.
examples: ['greedy', 'sample']
- id: watsonxai.random_seed
stability: development
type: int
brief: The random seed used by WatsonX for deterministic generation.
examples: [42]
- id: watsonxai.max_new_tokens
stability: development
type: int
brief: The maximum number of new tokens to generate in the response.
examples: [100]
- id: watsonxai.min_new_tokens
stability: development
type: int
brief: The minimum number of new tokens to generate in the response.
examples: [10]
- id: watsonxai.repetition_penalty
stability: development
type: double
brief: The penalty applied to repeated tokens in the generated response.
examples: [1.2]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be reviewed to see if any existing attributes could be used, any new general attributes could be added.

* [Azure AI Inference](./azure-ai-inference.md): Semantic Conventions for Azure AI Inference.
* [OpenAI](./openai.md): Semantic Conventions for OpenAI.
* [AWS Bedrock](./aws-bedrock.md): Semantic Conventions for AWS Bedrock.
* [IBM WatsonX AI](./watsonx.md): Semantic Conventions for IBM WatsonX AI.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/watsonx.md/ibm-watsonx-ai.md


### IBM WatsonX AI Client

**Span kind**: [Client](../../specification/trace/api.md#spankind)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You did not add following, how does this table is generated?

<!-- semconv new-group-id -->
<!-- endsemconv -->

@@ -0,0 +1,126 @@
groups:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we do not need this file

@@ -0,0 +1,53 @@
groups:
- id: registry.watsonxai
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/registry.watsonxai/registry.ibm.watsonx.ai

brief: >
This group defines attributes for IBM WatsonX AI.
attributes:
- id: watsonxai.request.project_id
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/watsonxai/ibm.watsonx.ai


# IBM WatsonX AI

**Status**: [Experimental](../document-status.md)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Status**: [Experimental](../document-status.md)
**Status**: [Development](https://opentelemetry.io/docs/specs/otel/document-status)


This document defines semantic conventions for IBM WatsonX AI.

## Attributes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please take a look at other semantic conventions for GenAI, databases or messaging. We don't document attributes specific to that system, but the full conventions.

| `gen_ai.watsonx.ai.request.version` | string | The version of the model being used | `1.0`, `2.3.1` | Recommended |
| `gen_ai.watsonx.ai.response.trace_id` | string | The trace ID returned by IBM WatsonX AI | `wxt-12345678-abcd-1234-efgh-1234567890ab` | Conditionally Required [2] |
| `llm.watsonx.ai.decoding_method` | string | The decoding method used by WatsonX for generating responses | `greedy`, `sample` | Recommended |
| `llm.watsonx.ai.random_seed` | int | The random seed used by WatsonX for deterministic generation | `42` | Recommended |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anything watson-specific should be in the ibm.watson* namespace


| Metric Name | Description | Unit | Instrument | Attribute Key | Attribute Values | Requirement Level |
| --- | --- | --- | --- | --- | --- | --- |
| `llm.watsonx.ai.completions.duration` | Measures the duration of WatsonX completions operations | s | Histogram | | | Recommended |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please unify this with generic GenAI metrics - they already capture everything you define here https://github.com/open-telemetry/semantic-conventions/blob/main/docs/gen-ai/gen-ai-metrics.md


tracer = trace.get_tracer("example-watsonx-client")

with tracer.start_as_current_span(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't usually add manual instrumentation code samples into semantic conventions.

@github-project-automation github-project-automation bot moved this from Untriaged to Blocked in Semantic Conventions Triage Sep 23, 2025
@elinacse elinacse changed the title Watsonx Semantic Conventions [INSTA-55630] Watsonx Semantic Conventions [INSTA-21674] Sep 24, 2025
Comment on lines +669 to +677
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
| `ibm.watsonx.ai.completions.tokens` | Counter | `{token}` | Number of tokens processed by IBM WatsonX.AI completions. | ![Development](https://img.shields.io/badge/-development-blue) | |

| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
| [`gen_ai.operation.name`](/docs/registry/attributes/gen-ai.md) | string | The name of the operation being performed. | `chat`; `text_completion` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
| [`gen_ai.token.type`](/docs/registry/attributes/gen-ai.md) | string | The type of token being counted. | `input`; `output` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
| [`gen_ai.request.model`](/docs/registry/attributes/gen-ai.md) | string | The name of the GenAI model a request is being made to. | `ibm/granite-13b-chat-v2` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this differ to the tables above?

Comment on lines +721 to +729
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
| `ibm.watsonx.ai.completions.responses` | Counter | `{response}` | Number of responses generated by IBM WatsonX.AI completions. | ![Development](https://img.shields.io/badge/-development-blue) | |

| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
| [`gen_ai.operation.name`](/docs/registry/attributes/gen-ai.md) | string | The name of the operation being performed. | `chat`; `text_completion` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
| [`gen_ai.request.model`](/docs/registry/attributes/gen-ai.md) | string | The name of the GenAI model a request is being made to. | `ibm/granite-13b-chat-v2` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
| [`gen_ai.response.finish_reasons`](/docs/registry/attributes/gen-ai.md) | string[] | Array of reasons the model stopped generating tokens. | `["stop"]`; `["length"]` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this differ to the tables above?

Comment on lines +801 to +809
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
| `ibm.watsonx.ai.completions.exceptions` | Counter | `{exception}` | Number of exceptions encountered during IBM WatsonX.AI completions. | ![Development](https://img.shields.io/badge/-development-blue) | |

| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
| [`gen_ai.operation.name`](/docs/registry/attributes/gen-ai.md) | string | The name of the operation being performed. | `chat`; `text_completion` | `Required` | ![Development](https://img.shields.io/badge/-development-blue) |
| [`gen_ai.request.model`](/docs/registry/attributes/gen-ai.md) | string | The name of the GenAI model a request is being made to. | `ibm/granite-13b-chat-v2` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
| [`error.type`](/docs/registry/attributes/error.md) | string | Describes a class of error the operation ended with. | `timeout`; `rate_limit_exceeded`; `invalid_request` | `Required` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this differ to the tables above?

Comment on lines +109 to +125
- id: metric.ibm.watsonx.ai.completions.tokens
type: metric
metric_name: ibm.watsonx.ai.completions.tokens
annotations:
code_generation:
metric_value_type: int
brief: 'Number of tokens processed by IBM WatsonX.AI completions.'
instrument: counter
unit: "{token}"
stability: development
attributes:
- ref: gen_ai.operation.name
requirement_level: required
- ref: gen_ai.token.type
requirement_level: required
- ref: gen_ai.request.model
requirement_level: recommended
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not be using gen_ai.client.token.usage?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:gen-ai enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

Add IBM Wastonx AI Semantic Convention
4 participants