Skip to content

GenAI utils: Add server address, port and additional metric attributes to LLM invocation#4069

Merged
xrmx merged 12 commits intoopen-telemetry:mainfrom
lmolkova:gen-ai-utils-server-and-metrics
Jan 23, 2026
Merged

GenAI utils: Add server address, port and additional metric attributes to LLM invocation#4069
xrmx merged 12 commits intoopen-telemetry:mainfrom
lmolkova:gen-ai-utils-server-and-metrics

Conversation

@lmolkova
Copy link
Copy Markdown
Member

Adding server.address and server.port (recommended attributes) and ability to provide additional attributes for metrics (needed for OpenAI)

@lmolkova lmolkova requested a review from a team as a code owner December 30, 2025 18:12
Comment thread util/opentelemetry-util-genai/src/opentelemetry/util/genai/metrics.py Outdated
Comment thread util/opentelemetry-util-genai/src/opentelemetry/util/genai/metrics.py Outdated
Comment thread util/opentelemetry-util-genai/src/opentelemetry/util/genai/metrics.py Outdated
Copy link
Copy Markdown

@JWinermaSplunk JWinermaSplunk left a comment

Choose a reason for hiding this comment

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

Looks good to me! I will admit the first docstring in types.py is a little confusing i.e. saying metric_attributes won't be set on metrics, though I understand it. Also, do we not intend to set server_address or server_port for spans or events based on the second docstring?

Edit: SIG, yes, no address or port for spans, only metrics

Comment thread util/opentelemetry-util-genai/src/opentelemetry/util/genai/types.py
Copy link
Copy Markdown
Contributor

@keith-decker keith-decker left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread util/opentelemetry-util-genai/tests/test_utils.py Outdated
@xrmx xrmx enabled auto-merge (squash) January 23, 2026 12:20
@xrmx xrmx merged commit e3e7e0c into open-telemetry:main Jan 23, 2026
663 checks passed
wikaaaaa pushed a commit to wikaaaaa/opentelemetry-python-contrib that referenced this pull request Feb 5, 2026
…s to LLM invocation (open-telemetry#4069)

* Add server address, port and additional metric attributes to LLM invocation

* changelog

* harden tests

* lint

* review

* up

* comments
sightseeker added a commit to sightseeker/opentelemetry-python-contrib that referenced this pull request Mar 11, 2026
…s to LLM invocation (open-telemetry#4069)

* Add server address, port and additional metric attributes to LLM invocation

* changelog

* harden tests

* lint

* review

* up

* comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants