Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

- Fix service tier attribute names: use `GEN_AI_OPENAI_REQUEST_SERVICE_TIER` for request
attributes and `GEN_AI_OPENAI_RESPONSE_SERVICE_TIER` for response attributes.
([#3920](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/3920))
- Added support for OpenAI embeddings instrumentation
([#3461](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3461))
- Record prompt and completion events regardless of span sampling decision.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def _set_response_attributes(
if getattr(result, "service_tier", None):
set_span_attribute(
span,
GenAIAttributes.GEN_AI_OPENAI_REQUEST_SERVICE_TIER,
GenAIAttributes.GEN_AI_OPENAI_RESPONSE_SERVICE_TIER,
result.service_tier,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,13 @@ def get_llm_request_attributes(
GenAIAttributes.GEN_AI_OPENAI_REQUEST_RESPONSE_FORMAT
] = response_format

# service_tier can be passed directly or in extra_body (in SDK 1.26.0 it's via extra_body)
service_tier = kwargs.get("service_tier")
attributes[GenAIAttributes.GEN_AI_OPENAI_RESPONSE_SERVICE_TIER] = (
if service_tier is None:
extra_body = kwargs.get("extra_body")
if isinstance(extra_body, Mapping):
service_tier = extra_body.get("service_tier")
attributes[GenAIAttributes.GEN_AI_OPENAI_REQUEST_SERVICE_TIER] = (
service_tier if service_tier != "auto" else None
)

Expand Down