Skip to content

Commit 2549f25

Browse files
committed
pass span_attributes when creating span inside start_span
1 parent 9ac90f9 commit 2549f25

File tree

1 file changed

+3
-1
lines changed
  • instrumentation/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2

1 file changed

+3
-1
lines changed

Diff for: instrumentation/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ def traced_method(wrapped, instance, args, kwargs):
5050
span_attributes = {**get_llm_request_attributes(kwargs)}
5151
span_name = f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL]}"
5252

53-
span = tracer.start_span(name=span_name, kind=SpanKind.CLIENT)
53+
span = tracer.start_span(
54+
name=span_name, kind=SpanKind.CLIENT, attributes=span_attributes
55+
)
5456
if span.is_recording():
5557
_set_input_attributes(span, span_attributes)
5658
set_event_prompt(span, json.dumps(llm_prompts))

0 commit comments

Comments
 (0)