@@ -53,7 +53,7 @@ pub(crate) mod tonic;
5353
5454/// Configuration for the OTLP exporter.
5555#[ derive( Debug ) ]
56- pub struct ExportConfig {
56+ pub ( crate ) struct ExportConfig {
5757 /// The address of the OTLP collector.
5858 /// Default address will be used based on the protocol.
5959 ///
@@ -228,7 +228,7 @@ fn default_headers() -> std::collections::HashMap<String, String> {
228228}
229229
230230/// Provide access to the [ExportConfig] field within the exporter builders.
231- pub trait HasExportConfig {
231+ pub ( crate ) trait HasExportConfig {
232232 /// Return a mutable reference to the [ExportConfig] within the exporter builders.
233233 fn export_config ( & mut self ) -> & mut ExportConfig ;
234234}
@@ -249,9 +249,7 @@ impl HasExportConfig for HttpExporterBuilder {
249249 }
250250}
251251
252- /// Expose methods to override [ExportConfig].
253- ///
254- /// This trait will be implemented for every struct that implemented [`HasExportConfig`] trait.
252+ /// Expose methods to set export configuration on exporter builders.
255253///
256254/// ## Examples
257255/// ```
@@ -280,10 +278,6 @@ pub trait WithExportConfig {
280278 ///
281279 /// Note: Programmatically setting this will override any value set via the environment variable.
282280 fn with_timeout ( self , timeout : Duration ) -> Self ;
283- /// Set export config. This will override all previous configurations.
284- ///
285- /// Note: Programmatically setting this will override any value set via environment variables.
286- fn with_export_config ( self , export_config : ExportConfig ) -> Self ;
287281}
288282
289283impl < B : HasExportConfig > WithExportConfig for B {
@@ -301,13 +295,6 @@ impl<B: HasExportConfig> WithExportConfig for B {
301295 self . export_config ( ) . timeout = Some ( timeout) ;
302296 self
303297 }
304-
305- fn with_export_config ( mut self , exporter_config : ExportConfig ) -> Self {
306- self . export_config ( ) . endpoint = exporter_config. endpoint ;
307- self . export_config ( ) . protocol = exporter_config. protocol ;
308- self . export_config ( ) . timeout = exporter_config. timeout ;
309- self
310- }
311298}
312299
313300#[ cfg( any( feature = "grpc-tonic" , feature = "http-proto" , feature = "http-json" ) ) ]
@@ -413,19 +400,12 @@ mod tests {
413400 #[ cfg( any( feature = "http-proto" , feature = "http-json" ) ) ]
414401 #[ test]
415402 fn export_builder_error_invalid_http_endpoint ( ) {
416- use std:: time:: Duration ;
417-
418- use crate :: { ExportConfig , LogExporter , Protocol , WithExportConfig } ;
419-
420- let ex_config = ExportConfig {
421- endpoint : Some ( "invalid_uri/something" . to_string ( ) ) ,
422- protocol : Protocol :: HttpBinary ,
423- timeout : Some ( Duration :: from_secs ( 10 ) ) ,
424- } ;
403+ use crate :: { LogExporter , WithExportConfig } ;
425404
426405 let exporter_result = LogExporter :: builder ( )
427406 . with_http ( )
428- . with_export_config ( ex_config)
407+ . with_endpoint ( "invalid_uri/something" )
408+ . with_timeout ( std:: time:: Duration :: from_secs ( 10 ) )
429409 . build ( ) ;
430410
431411 assert ! (
@@ -440,19 +420,12 @@ mod tests {
440420 #[ cfg( feature = "grpc-tonic" ) ]
441421 #[ tokio:: test]
442422 async fn export_builder_error_invalid_grpc_endpoint ( ) {
443- use std:: time:: Duration ;
444-
445- use crate :: { ExportConfig , LogExporter , Protocol , WithExportConfig } ;
446-
447- let ex_config = ExportConfig {
448- endpoint : Some ( "invalid_uri/something" . to_string ( ) ) ,
449- protocol : Protocol :: Grpc ,
450- timeout : Some ( Duration :: from_secs ( 10 ) ) ,
451- } ;
423+ use crate :: { LogExporter , WithExportConfig } ;
452424
453425 let exporter_result = LogExporter :: builder ( )
454426 . with_tonic ( )
455- . with_export_config ( ex_config)
427+ . with_endpoint ( "invalid_uri/something" )
428+ . with_timeout ( std:: time:: Duration :: from_secs ( 10 ) )
456429 . build ( ) ;
457430
458431 assert ! ( matches!(
0 commit comments