@@ -259,7 +259,7 @@ impl<R: RuntimeChannel> BatchLogProcessor<R> {
259259 logs. split_off ( 0 ) ,
260260 )
261261 . await
262- . and ( exporter. as_mut ( ) . force_flush ( ) . await ) ;
262+ . and ( exporter. as_mut ( ) . force_flush ( ) ) ;
263263
264264 if let Some ( channel) = res_channel {
265265 if let Err ( send_error) = channel. send ( result) {
@@ -779,6 +779,25 @@ mod tests {
779779 let _ = provider. shutdown ( ) ;
780780 }
781781
782+ #[ tokio:: test( flavor = "multi_thread" ) ]
783+ async fn test_batch_forceflush ( ) {
784+ let exporter = InMemoryLogExporterBuilder :: default ( ) . build ( ) ;
785+ // TODO: Verify exporter.force_flush() is called
786+
787+ let processor = BatchLogProcessor :: new (
788+ Box :: new ( exporter. clone ( ) ) ,
789+ BatchConfig :: default ( ) ,
790+ runtime:: Tokio ,
791+ ) ;
792+
793+ let mut record = LogRecord :: default ( ) ;
794+ let instrumentation = InstrumentationScope :: default ( ) ;
795+
796+ processor. emit ( & mut record, & instrumentation) ;
797+ processor. force_flush ( ) . unwrap ( ) ;
798+ assert_eq ! ( 1 , exporter. get_emitted_logs( ) . unwrap( ) . len( ) ) ;
799+ }
800+
782801 #[ tokio:: test( flavor = "multi_thread" ) ]
783802 async fn test_batch_shutdown ( ) {
784803 // assert we will receive an error
@@ -796,7 +815,6 @@ mod tests {
796815 let instrumentation = InstrumentationScope :: default ( ) ;
797816
798817 processor. emit ( & mut record, & instrumentation) ;
799- processor. force_flush ( ) . unwrap ( ) ;
800818 processor. shutdown ( ) . unwrap ( ) ;
801819 // todo: expect to see errors here. How should we assert this?
802820 processor. emit ( & mut record, & instrumentation) ;
0 commit comments