-
Notifications
You must be signed in to change notification settings - Fork 818
openai-v2: Fix service tier attribute names #3952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
openai-v2: Fix service tier attribute names #3952
Conversation
xrmx
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to update tests and add a changelog entry
In OpenAI SDK 1.26.0, service_tier is passed via extra_body. Update get_llm_request_attributes to check both kwargs and extra_body for service_tier to support both ways of passing it.
Fix open-telemetry#3920: Add changelog entry documenting the fix for service tier attribute names.
…s://github.com/vasantteja/opentelemetry-python-contrib into fix/openai-v2-fix-service-tier-attribute-names
@xrmx sorry, fixed it. |
xrmx
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't checked if the service_tier should be made optional but I think we are missing something like the following:
diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_utils.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_utils.py
index eb66eb7c7..1f635305d 100644
--- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_utils.py
+++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_utils.py
@@ -35,6 +35,7 @@ def assert_all_attributes(
operation_name: str = "chat",
server_address: str = "api.openai.com",
server_port: int = 443,
+ service_tier: str = "auto",
):
assert span.name == f"{operation_name} {request_model}"
assert (
@@ -87,6 +88,8 @@ def assert_all_attributes(
if server_port != 443 and server_port > 0:
assert server_port == span.attributes[ServerAttributes.SERVER_PORT]
+ assert service_tier == span.attributes[GenAIAttributes.GEN_AI_OPENAI_RESPONSE_SERVICE_TIER]
+
def assert_log_parent(log, span):
"""Assert that the log record has the correct parent span context"""
|
@xrmx I pushed the changes you suggested. can you please take a look? |
Description
swaps service_tier attributes for request and response objects and fixes #3920
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
ran all the unit tests.
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.