@@ -97,15 +97,19 @@ pub struct ExportConfig {
97
97
pub timeout : Option < Duration > ,
98
98
99
99
/// Disable TLS
100
+ #[ cfg( feature = "tls" ) ]
100
101
pub insecure : Option < bool > ,
101
102
102
103
/// The certificate file to validate the OTLP server connection
104
+ #[ cfg( feature = "tls" ) ]
103
105
pub certificate : Option < String > ,
104
106
105
107
/// The path to the certificate file to use for client authentication (mTLS).
108
+ #[ cfg( feature = "tls" ) ]
106
109
pub client_certificate : Option < String > ,
107
110
108
111
/// The path to the key file to use for client authentication (mTLS).
112
+ #[ cfg( feature = "tls" ) ]
109
113
pub client_key : Option < String > ,
110
114
}
111
115
@@ -119,9 +123,13 @@ impl Default for ExportConfig {
119
123
// won't know if user provided a value
120
124
protocol,
121
125
timeout : None ,
126
+ #[ cfg( feature = "tls" ) ]
122
127
insecure : None ,
128
+ #[ cfg( feature = "tls" ) ]
123
129
certificate : None ,
130
+ #[ cfg( feature = "tls" ) ]
124
131
client_certificate : None ,
132
+ #[ cfg( feature = "tls" ) ]
125
133
client_key : None ,
126
134
}
127
135
}
@@ -277,15 +285,19 @@ pub trait WithExportConfig {
277
285
/// Note: Programmatically setting this will override any value set via environment variables.
278
286
fn with_export_config ( self , export_config : ExportConfig ) -> Self ;
279
287
/// Set insecure connection. Disable TLS
288
+ #[ cfg( feature = "tls" ) ]
280
289
fn with_insecure ( self ) -> Self ;
281
290
/// Set the certificate file to validate the OTLP server connection
282
291
/// This is only available when the `tls` feature is enabled.
292
+ #[ cfg( feature = "tls" ) ]
283
293
fn with_certificate < T : Into < String > > ( self , certificate : T ) -> Self ;
284
294
/// Set the path to the certificate file to use for client authentication (mTLS).
285
295
/// This is only available when the `tls` feature is enabled.
296
+ #[ cfg( feature = "tls" ) ]
286
297
fn with_client_certificate < T : Into < String > > ( self , client_certificate : T ) -> Self ;
287
298
/// Set the path to the key file to use for client authentication (mTLS).
288
299
/// This is only available when the `tls` feature is enabled.
300
+ #[ cfg( feature = "tls" ) ]
289
301
fn with_client_key < T : Into < String > > ( self , client_key : T ) -> Self ;
290
302
}
291
303
@@ -309,25 +321,32 @@ impl<B: HasExportConfig> WithExportConfig for B {
309
321
self . export_config ( ) . endpoint = exporter_config. endpoint ;
310
322
self . export_config ( ) . protocol = exporter_config. protocol ;
311
323
self . export_config ( ) . timeout = exporter_config. timeout ;
312
- self . export_config ( ) . insecure = Some ( true ) ;
324
+ #[ cfg( feature = "tls" ) ]
325
+ {
326
+ self . export_config ( ) . insecure = Some ( true ) ;
327
+ }
313
328
self
314
329
}
315
330
331
+ #[ cfg( feature = "tls" ) ]
316
332
fn with_insecure ( mut self ) -> Self {
317
333
self . export_config ( ) . insecure = Some ( true ) ;
318
334
self
319
335
}
320
336
337
+ #[ cfg( feature = "tls" ) ]
321
338
fn with_certificate < T : Into < String > > ( mut self , certificate : T ) -> Self {
322
339
self . export_config ( ) . certificate = Some ( certificate. into ( ) ) ;
323
340
self
324
341
}
325
342
343
+ #[ cfg( feature = "tls" ) ]
326
344
fn with_client_certificate < T : Into < String > > ( mut self , client_certificate : T ) -> Self {
327
345
self . export_config ( ) . client_certificate = Some ( client_certificate. into ( ) ) ;
328
346
self
329
347
}
330
348
349
+ #[ cfg( feature = "tls" ) ]
331
350
fn with_client_key < T : Into < String > > ( mut self , client_key : T ) -> Self {
332
351
self . export_config ( ) . client_key = Some ( client_key. into ( ) ) ;
333
352
self
0 commit comments