@@ -592,7 +592,17 @@ impl TraceExporter {
592592 trace_chunks : Vec < Vec < Span < T > > > ,
593593 ) -> Result < AgentResponse , TraceExporterError > {
594594 self . check_agent_info ( ) ;
595- self . send_trace_chunks_inner ( trace_chunks)
595+ self . runtime ( ) ?. block_on ( async {
596+ self . send_trace_chunks_inner ( trace_chunks) . await
597+ } )
598+ }
599+
600+ pub async fn send_trace_chunks_async < T : SpanText > (
601+ & self ,
602+ trace_chunks : Vec < Vec < Span < T > > > ,
603+ ) -> Result < AgentResponse , TraceExporterError > {
604+ self . check_agent_info ( ) ;
605+ self . send_trace_chunks_inner ( trace_chunks) . await
596606 }
597607
598608 /// Deserializes, processes and sends trace chunks to the agent
@@ -622,7 +632,9 @@ impl TraceExporter {
622632 None ,
623633 ) ;
624634
625- self . send_trace_chunks_inner ( traces)
635+ self . runtime ( ) ?. block_on ( async {
636+ self . send_trace_chunks_inner ( traces) . await
637+ } )
626638 }
627639
628640 /// Send traces payload to agent with retry and telemetry reporting
@@ -669,7 +681,7 @@ impl TraceExporter {
669681 self . handle_send_result ( result, chunks, payload_len) . await
670682 }
671683
672- fn send_trace_chunks_inner < T : SpanText > (
684+ async fn send_trace_chunks_inner < T : SpanText > (
673685 & self ,
674686 mut traces : Vec < Vec < Span < T > > > ,
675687 ) -> Result < AgentResponse , TraceExporterError > {
@@ -694,15 +706,13 @@ impl TraceExporter {
694706 ..self . endpoint . clone ( )
695707 } ;
696708
697- self . runtime ( ) ?. block_on ( async {
698- self . send_traces_with_telemetry (
699- & endpoint,
700- prepared. data ,
701- prepared. headers ,
702- prepared. chunk_count ,
703- )
704- . await
705- } )
709+ self . send_traces_with_telemetry (
710+ & endpoint,
711+ prepared. data ,
712+ prepared. headers ,
713+ prepared. chunk_count ,
714+ ) . await
715+
706716 }
707717
708718 /// Handle the result of sending traces to the agent
0 commit comments