@@ -18,7 +18,7 @@ import { AttributeMap } from '../../attributes';
1818import { convertGenerationSpan } from './generation' ;
1919import { convertAgentSpan } from './agent' ;
2020import { convertFunctionSpan } from './function' ;
21- import { convertResponseSpan , convertEnhancedResponseSpan , AgentOpsResponseSpanData } from './response' ;
21+ import { convertResponseSpan } from './response' ;
2222import { convertHandoffSpan } from './handoff' ;
2323import { convertCustomSpan } from './custom' ;
2424import { convertGuardrailSpan } from './guardrail' ;
@@ -94,52 +94,46 @@ export function getSpanAttributes(item: OpenAISpan<any>): Record<string, any> {
9494 'openai_agents.trace_id' : item . traceId ,
9595 } ;
9696
97- let typeSpecificAttributes : Record < string , any > = { } ;
97+ let attributes : Record < string , any > = { } ;
9898 switch ( spanData . type ) {
9999 case 'generation' :
100- typeSpecificAttributes = convertGenerationSpan ( spanData as GenerationSpanData ) ;
100+ attributes = convertGenerationSpan ( spanData as GenerationSpanData ) ;
101101 break ;
102102 case 'agent' :
103- typeSpecificAttributes = convertAgentSpan ( spanData as AgentSpanData ) ;
103+ attributes = convertAgentSpan ( spanData as AgentSpanData ) ;
104104 break ;
105105 case 'function' :
106- typeSpecificAttributes = convertFunctionSpan ( spanData as FunctionSpanData ) ;
106+ attributes = convertFunctionSpan ( spanData as FunctionSpanData ) ;
107107 break ;
108108 case 'response' :
109- // Check if this is an enhanced AgentOps response span with generation data
110- // TODO check this more effectively that this...
111- if ( 'agentops_model' in spanData || 'agentops_input_messages' in spanData || 'agentops_output_messages' in spanData || 'agentops_usage' in spanData ) {
112- typeSpecificAttributes = convertEnhancedResponseSpan ( spanData as AgentOpsResponseSpanData ) ;
113- } else {
114- typeSpecificAttributes = convertResponseSpan ( spanData as ResponseSpanData ) ;
115- }
109+ attributes = convertResponseSpan ( spanData as ResponseSpanData ) ;
116110 break ;
117111 case 'handoff' :
118- typeSpecificAttributes = convertHandoffSpan ( spanData as HandoffSpanData ) ;
112+ attributes = convertHandoffSpan ( spanData as HandoffSpanData ) ;
119113 break ;
120114 case 'custom' :
121- typeSpecificAttributes = convertCustomSpan ( spanData as CustomSpanData ) ;
115+ attributes = convertCustomSpan ( spanData as CustomSpanData ) ;
122116 break ;
123117 case 'guardrail' :
124- typeSpecificAttributes = convertGuardrailSpan ( spanData as GuardrailSpanData ) ;
118+ attributes = convertGuardrailSpan ( spanData as GuardrailSpanData ) ;
125119 break ;
126120 case 'transcription' :
127- typeSpecificAttributes = convertTranscriptionSpan ( spanData as TranscriptionSpanData ) ;
121+ attributes = convertTranscriptionSpan ( spanData as TranscriptionSpanData ) ;
128122 break ;
129123 case 'speech' :
130- typeSpecificAttributes = convertSpeechSpan ( spanData as SpeechSpanData ) ;
124+ attributes = convertSpeechSpan ( spanData as SpeechSpanData ) ;
131125 break ;
132126 case 'speech_group' :
133- typeSpecificAttributes = convertSpeechGroupSpan ( spanData as SpeechGroupSpanData ) ;
127+ attributes = convertSpeechGroupSpan ( spanData as SpeechGroupSpanData ) ;
134128 break ;
135129 case 'mcp_tools' :
136- typeSpecificAttributes = convertMCPListToolsSpan ( spanData as MCPListToolsSpanData ) ;
130+ attributes = convertMCPListToolsSpan ( spanData as MCPListToolsSpanData ) ;
137131 break ;
138132 default :
139133 // For unknown span types, include the raw span data
140- typeSpecificAttributes = { 'span.raw_data' : spanData } ;
134+ attributes = { 'span.raw_data' : spanData } ;
141135 break ;
142136 }
143137
144- return { ...baseAttributes , ...typeSpecificAttributes } ;
145- }
138+ return { ...baseAttributes , ...attributes } ;
139+ }
0 commit comments