@@ -584,7 +584,16 @@ impl TraceExporter {
584584 trace_chunks : Vec < Vec < Span < T > > > ,
585585 ) -> Result < AgentResponse , TraceExporterError > {
586586 self . check_agent_info ( ) ;
587- self . send_trace_chunks_inner ( trace_chunks)
587+ self . runtime ( ) ?
588+ . block_on ( async { self . send_trace_chunks_inner ( trace_chunks) . await } )
589+ }
590+
591+ pub async fn send_trace_chunks_async < T : SpanText > (
592+ & self ,
593+ trace_chunks : Vec < Vec < Span < T > > > ,
594+ ) -> Result < AgentResponse , TraceExporterError > {
595+ self . check_agent_info ( ) ;
596+ self . send_trace_chunks_inner ( trace_chunks) . await
588597 }
589598
590599 /// Deserializes, processes and sends trace chunks to the agent
@@ -614,7 +623,8 @@ impl TraceExporter {
614623 None ,
615624 ) ;
616625
617- self . send_trace_chunks_inner ( traces)
626+ self . runtime ( ) ?
627+ . block_on ( async { self . send_trace_chunks_inner ( traces) . await } )
618628 }
619629
620630 /// Send traces payload to agent with retry and telemetry reporting
@@ -661,7 +671,7 @@ impl TraceExporter {
661671 self . handle_send_result ( result, chunks, payload_len) . await
662672 }
663673
664- fn send_trace_chunks_inner < T : SpanText > (
674+ async fn send_trace_chunks_inner < T : SpanText > (
665675 & self ,
666676 mut traces : Vec < Vec < Span < T > > > ,
667677 ) -> Result < AgentResponse , TraceExporterError > {
@@ -686,15 +696,13 @@ impl TraceExporter {
686696 ..self . endpoint . clone ( )
687697 } ;
688698
689- self . runtime ( ) ?. block_on ( async {
690- self . send_traces_with_telemetry (
691- & endpoint,
692- prepared. data ,
693- prepared. headers ,
694- prepared. chunk_count ,
695- )
696- . await
697- } )
699+ self . send_traces_with_telemetry (
700+ & endpoint,
701+ prepared. data ,
702+ prepared. headers ,
703+ prepared. chunk_count ,
704+ )
705+ . await
698706 }
699707
700708 /// Handle the result of sending traces to the agent
0 commit comments