@@ -36,13 +36,13 @@ namespace Benchmarks.Exporter;
3636
3737public class OtlpTraceExporterBenchmarks
3838{
39- private OtlpTraceExporter exporter ;
40- private Activity activity ;
41- private CircularBuffer < Activity > activityBatch ;
39+ private OtlpTraceExporter ? exporter ;
40+ private Activity ? activity ;
41+ private CircularBuffer < Activity > ? activityBatch ;
4242
43- private IHost host ;
44- private IDisposable server ;
45- private string serverHost ;
43+ private IHost ? host ;
44+ private IDisposable ? server ;
45+ private string ? serverHost ;
4646 private int serverPort ;
4747
4848 [ GlobalSetup ( Target = nameof ( OtlpTraceExporter_Grpc ) ) ]
@@ -103,31 +103,31 @@ public void GlobalSetupHttp()
103103 [ GlobalCleanup ( Target = nameof ( OtlpTraceExporter_Grpc ) ) ]
104104 public void GlobalCleanupGrpc ( )
105105 {
106- this . exporter . Shutdown ( ) ;
107- this . exporter . Dispose ( ) ;
108- this . activity . Dispose ( ) ;
109- this . host . Dispose ( ) ;
106+ this . exporter ? . Shutdown ( ) ;
107+ this . exporter ? . Dispose ( ) ;
108+ this . activity ? . Dispose ( ) ;
109+ this . host ? . Dispose ( ) ;
110110 }
111111
112112 [ GlobalCleanup ( Target = nameof ( OtlpTraceExporter_Http ) ) ]
113113 public void GlobalCleanupHttp ( )
114114 {
115- this . exporter . Shutdown ( ) ;
116- this . exporter . Dispose ( ) ;
117- this . server . Dispose ( ) ;
118- this . activity . Dispose ( ) ;
115+ this . exporter ? . Shutdown ( ) ;
116+ this . exporter ? . Dispose ( ) ;
117+ this . server ? . Dispose ( ) ;
118+ this . activity ? . Dispose ( ) ;
119119 }
120120
121121 [ Benchmark ]
122122 public void OtlpTraceExporter_Http ( )
123123 {
124- this . exporter . Export ( new Batch < Activity > ( this . activityBatch , 1 ) ) ;
124+ this . exporter ! . Export ( new Batch < Activity > ( this . activityBatch ! , 1 ) ) ;
125125 }
126126
127127 [ Benchmark ]
128128 public void OtlpTraceExporter_Grpc ( )
129129 {
130- this . exporter . Export ( new Batch < Activity > ( this . activityBatch , 1 ) ) ;
130+ this . exporter ! . Export ( new Batch < Activity > ( this . activityBatch ! , 1 ) ) ;
131131 }
132132
133133 private sealed class MockTraceService : OtlpCollector . TraceService . TraceServiceBase
0 commit comments