diff --git a/instrumentation/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py b/instrumentation/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py index 40fad91cd9..e139a799cb 100644 --- a/instrumentation/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py +++ b/instrumentation/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py @@ -50,7 +50,9 @@ def traced_method(wrapped, instance, args, kwargs): span_attributes = {**get_llm_request_attributes(kwargs)} span_name = f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL]}" - span = tracer.start_span(name=span_name, kind=SpanKind.CLIENT) + span = tracer.start_span( + name=span_name, kind=SpanKind.CLIENT, attributes=span_attributes + ) if span.is_recording(): _set_input_attributes(span, span_attributes) set_event_prompt(span, json.dumps(llm_prompts))