Skip to content

Commit e5c8eb8

Browse files
committed
keep current reasoning impl
1 parent b576554 commit e5c8eb8

File tree

1 file changed

+18
-23
lines changed
  • packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/v1

1 file changed

+18
-23
lines changed

packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/v1/responses_wrappers.py

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -210,33 +210,28 @@ def set_data_attributes(traced_response: TracedData, span: Span):
210210
else getattr(tokens_details, "reasoning_tokens", None)
211211
)
212212

213-
if hasattr(SpanAttributes, 'LLM_USAGE_REASONING_TOKENS'):
214-
_set_span_attribute(
215-
span,
216-
SpanAttributes.LLM_USAGE_REASONING_TOKENS,
217-
reasoning_tokens or 0,
218-
)
219-
220-
# Reasoning attributes - only set if they exist in SpanAttributes
221-
if hasattr(SpanAttributes, 'LLM_REQUEST_REASONING_SUMMARY'):
222213
_set_span_attribute(
223214
span,
224-
f"{SpanAttributes.LLM_REQUEST_REASONING_SUMMARY}",
225-
traced_response.request_reasoning_summary or (),
226-
)
227-
if hasattr(SpanAttributes, 'LLM_REQUEST_REASONING_EFFORT'):
228-
_set_span_attribute(
229-
span,
230-
f"{SpanAttributes.LLM_REQUEST_REASONING_EFFORT}",
231-
traced_response.request_reasoning_effort or (),
232-
)
233-
if hasattr(SpanAttributes, 'LLM_RESPONSE_REASONING_EFFORT'):
234-
_set_span_attribute(
235-
span,
236-
f"{SpanAttributes.LLM_RESPONSE_REASONING_EFFORT}",
237-
traced_response.response_reasoning_effort or (),
215+
SpanAttributes.LLM_USAGE_REASONING_TOKENS,
216+
reasoning_tokens or 0,
238217
)
239218

219+
_set_span_attribute(
220+
span,
221+
f"{SpanAttributes.LLM_REQUEST_REASONING_SUMMARY}",
222+
traced_response.request_reasoning_summary or (),
223+
)
224+
_set_span_attribute(
225+
span,
226+
f"{SpanAttributes.LLM_REQUEST_REASONING_EFFORT}",
227+
traced_response.request_reasoning_effort or (),
228+
)
229+
_set_span_attribute(
230+
span,
231+
f"{SpanAttributes.LLM_RESPONSE_REASONING_EFFORT}",
232+
traced_response.response_reasoning_effort or (),
233+
)
234+
240235
if should_send_prompts():
241236
prompt_index = 0
242237
if traced_response.tools:

0 commit comments

Comments
 (0)