@@ -102,14 +102,11 @@ public void AppendPathIfNotPresent_TracesPath_AppendsCorrectly(string input, str
102102#pragma warning disable CS0618 // Suppressing gRPC obsolete warning
103103 [ InlineData ( OtlpExportProtocol . Grpc , typeof ( OtlpGrpcExportClient ) , false , 10000 , null ) ]
104104 [ InlineData ( OtlpExportProtocol . Grpc , typeof ( OtlpGrpcExportClient ) , false , 10000 , "in_memory" ) ]
105- [ InlineData ( OtlpExportProtocol . Grpc , typeof ( OtlpGrpcExportClient ) , false , 10000 , "disk" ) ]
106105#pragma warning restore CS0618 // Suppressing gRPC obsolete warning
107106 [ InlineData ( OtlpExportProtocol . HttpProtobuf , typeof ( OtlpHttpExportClient ) , false , 10000 , null ) ]
108107 [ InlineData ( OtlpExportProtocol . HttpProtobuf , typeof ( OtlpHttpExportClient ) , true , 8000 , null ) ]
109108 [ InlineData ( OtlpExportProtocol . HttpProtobuf , typeof ( OtlpHttpExportClient ) , false , 10000 , "in_memory" ) ]
110109 [ InlineData ( OtlpExportProtocol . HttpProtobuf , typeof ( OtlpHttpExportClient ) , true , 8000 , "in_memory" ) ]
111- [ InlineData ( OtlpExportProtocol . HttpProtobuf , typeof ( OtlpHttpExportClient ) , false , 10000 , "disk" ) ]
112- [ InlineData ( OtlpExportProtocol . HttpProtobuf , typeof ( OtlpHttpExportClient ) , true , 8000 , "disk" ) ]
113110 public void GetTransmissionHandler_InitializesCorrectHandlerExportClientAndTimeoutValue ( OtlpExportProtocol protocol , Type exportClientType , bool customHttpClient , int expectedTimeoutMilliseconds , string ? retryStrategy )
114111 {
115112 var exporterOptions = new OtlpExporterOptions ( ) { Protocol = protocol } ;
@@ -129,6 +126,47 @@ public void GetTransmissionHandler_InitializesCorrectHandlerExportClientAndTimeo
129126 AssertTransmissionHandler ( transmissionHandler , exportClientType , expectedTimeoutMilliseconds , retryStrategy ) ;
130127 }
131128
129+ [ Theory ]
130+ #pragma warning disable CS0618 // Suppressing gRPC obsolete warning
131+ [ InlineData ( OtlpExportProtocol . Grpc , typeof ( OtlpGrpcExportClient ) , false , 10000 ) ]
132+ #pragma warning restore CS0618 // Suppressing gRPC obsolete warning
133+ [ InlineData ( OtlpExportProtocol . HttpProtobuf , typeof ( OtlpHttpExportClient ) , false , 10000 ) ]
134+ [ InlineData ( OtlpExportProtocol . HttpProtobuf , typeof ( OtlpHttpExportClient ) , true , 8000 ) ]
135+ public void GetTransmissionHandler_DiskRetryWithDirectory_InitializesCorrectHandlerExportClientAndTimeoutValue ( OtlpExportProtocol protocol , Type exportClientType , bool customHttpClient , int expectedTimeoutMilliseconds )
136+ {
137+ var exporterOptions = new OtlpExporterOptions ( ) { Protocol = protocol } ;
138+ if ( customHttpClient )
139+ {
140+ exporterOptions . HttpClientFactory = ( ) =>
141+ {
142+ return new HttpClient { Timeout = TimeSpan . FromMilliseconds ( expectedTimeoutMilliseconds ) } ;
143+ } ;
144+ }
145+
146+ var configuration = new ConfigurationBuilder ( )
147+ . AddInMemoryCollection (
148+ new Dictionary < string , string ? >
149+ {
150+ [ ExperimentalOptions . OtlpRetryEnvVar ] = "disk" ,
151+ [ ExperimentalOptions . OtlpDiskRetryDirectoryPathEnvVar ] = Path . GetTempPath ( ) ,
152+ } )
153+ . Build ( ) ;
154+
155+ var transmissionHandler = exporterOptions . GetExportTransmissionHandler ( new ExperimentalOptions ( configuration ) , OtlpSignalType . Traces ) ;
156+ AssertTransmissionHandler ( transmissionHandler , exportClientType , expectedTimeoutMilliseconds , "disk" ) ;
157+ }
158+
159+ [ Fact ]
160+ public void GetTransmissionHandler_DiskRetryWithoutDirectory_Throws ( )
161+ {
162+ var configuration = new ConfigurationBuilder ( )
163+ . AddInMemoryCollection ( new Dictionary < string , string ? > { [ ExperimentalOptions . OtlpRetryEnvVar ] = "disk" } )
164+ . Build ( ) ;
165+
166+ var exception = Assert . Throws < NotSupportedException > ( ( ) => new ExperimentalOptions ( configuration ) ) ;
167+ Assert . Contains ( ExperimentalOptions . OtlpDiskRetryDirectoryPathEnvVar , exception . Message , StringComparison . Ordinal ) ;
168+ }
169+
132170 [ Theory ]
133171 [ InlineData ( "Traces" , "traces" ) ]
134172 [ InlineData ( "Logs" , "logs" ) ]
0 commit comments