@@ -213,8 +213,8 @@ impl HttpExporterBuilder {
213213 #[ cfg( feature = "trace" ) ]
214214 pub fn build_span_exporter ( mut self ) -> Result < crate :: SpanExporter , ExporterBuildError > {
215215 use crate :: {
216- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT , OTEL_EXPORTER_OTLP_TRACES_HEADERS ,
217- OTEL_EXPORTER_OTLP_TRACES_TIMEOUT , OTEL_EXPORTER_OTLP_TRACES_COMPRESSION ,
216+ OTEL_EXPORTER_OTLP_TRACES_COMPRESSION , OTEL_EXPORTER_OTLP_TRACES_ENDPOINT ,
217+ OTEL_EXPORTER_OTLP_TRACES_HEADERS , OTEL_EXPORTER_OTLP_TRACES_TIMEOUT ,
218218 } ;
219219
220220 let client = self . build_client (
@@ -232,8 +232,8 @@ impl HttpExporterBuilder {
232232 #[ cfg( feature = "logs" ) ]
233233 pub fn build_log_exporter ( mut self ) -> Result < crate :: LogExporter , ExporterBuildError > {
234234 use crate :: {
235- OTEL_EXPORTER_OTLP_LOGS_ENDPOINT , OTEL_EXPORTER_OTLP_LOGS_HEADERS ,
236- OTEL_EXPORTER_OTLP_LOGS_TIMEOUT , OTEL_EXPORTER_OTLP_LOGS_COMPRESSION ,
235+ OTEL_EXPORTER_OTLP_LOGS_COMPRESSION , OTEL_EXPORTER_OTLP_LOGS_ENDPOINT ,
236+ OTEL_EXPORTER_OTLP_LOGS_HEADERS , OTEL_EXPORTER_OTLP_LOGS_TIMEOUT ,
237237 } ;
238238
239239 let client = self . build_client (
@@ -254,8 +254,8 @@ impl HttpExporterBuilder {
254254 temporality : opentelemetry_sdk:: metrics:: Temporality ,
255255 ) -> Result < crate :: MetricExporter , ExporterBuildError > {
256256 use crate :: {
257- OTEL_EXPORTER_OTLP_METRICS_ENDPOINT , OTEL_EXPORTER_OTLP_METRICS_HEADERS ,
258- OTEL_EXPORTER_OTLP_METRICS_TIMEOUT , OTEL_EXPORTER_OTLP_METRICS_COMPRESSION ,
257+ OTEL_EXPORTER_OTLP_METRICS_COMPRESSION , OTEL_EXPORTER_OTLP_METRICS_ENDPOINT ,
258+ OTEL_EXPORTER_OTLP_METRICS_HEADERS , OTEL_EXPORTER_OTLP_METRICS_TIMEOUT ,
259259 } ;
260260
261261 let client = self . build_client (
@@ -289,9 +289,9 @@ impl OtlpHttpClient {
289289 match self . compression {
290290 #[ cfg( feature = "gzip-http" ) ]
291291 Some ( crate :: Compression :: Gzip ) => {
292- use std:: io:: Write ;
293292 use flate2:: { write:: GzEncoder , Compression } ;
294-
293+ use std:: io:: Write ;
294+
295295 let mut encoder = GzEncoder :: new ( Vec :: new ( ) , Compression :: default ( ) ) ;
296296 encoder. write_all ( & body) . map_err ( |e| e. to_string ( ) ) ?;
297297 let compressed = encoder. finish ( ) . map_err ( |e| e. to_string ( ) ) ?;
@@ -351,7 +351,7 @@ impl OtlpHttpClient {
351351 } ,
352352 _ => ( req. encode_to_vec ( ) , "application/x-protobuf" ) ,
353353 } ;
354-
354+
355355 let ( compressed_body, content_encoding) = self . compress_body ( body) ?;
356356 Ok ( ( compressed_body, content_type, content_encoding) )
357357 }
@@ -373,7 +373,7 @@ impl OtlpHttpClient {
373373 } ,
374374 _ => ( req. encode_to_vec ( ) , "application/x-protobuf" ) ,
375375 } ;
376-
376+
377377 let ( compressed_body, content_encoding) = self . compress_body ( body) ?;
378378 Ok ( ( compressed_body, content_type, content_encoding) )
379379 }
@@ -398,9 +398,11 @@ impl OtlpHttpClient {
398398 } ,
399399 _ => ( req. encode_to_vec ( ) , "application/x-protobuf" ) ,
400400 } ;
401-
401+
402402 match self . compress_body ( body) {
403- Ok ( ( compressed_body, content_encoding) ) => Some ( ( compressed_body, content_type, content_encoding) ) ,
403+ Ok ( ( compressed_body, content_encoding) ) => {
404+ Some ( ( compressed_body, content_type, content_encoding) )
405+ }
404406 Err ( e) => {
405407 otel_debug ! ( name: "CompressionFailed" , error = e) ;
406408 None
@@ -821,8 +823,8 @@ mod tests {
821823 mod compression_tests {
822824 use super :: super :: OtlpHttpClient ;
823825 use flate2:: read:: GzDecoder ;
826+ use opentelemetry_http:: { Bytes , HttpClient } ;
824827 use std:: io:: Read ;
825- use opentelemetry_http:: { HttpClient , Bytes } ;
826828
827829 #[ test]
828830 fn test_gzip_compression_and_decompression ( ) {
@@ -847,7 +849,7 @@ mod tests {
847849 let mut decoder = GzDecoder :: new ( & compressed_body[ ..] ) ;
848850 let mut decompressed = Vec :: new ( ) ;
849851 decoder. read_to_end ( & mut decompressed) . unwrap ( ) ;
850-
852+
851853 // Verify decompressed data matches original
852854 assert_eq ! ( decompressed, test_data) ;
853855 // Verify compression actually happened (compressed should be different)
@@ -876,7 +878,7 @@ mod tests {
876878
877879 // Verify we can decompress the body
878880 let decompressed = zstd:: bulk:: decompress ( & compressed_body, test_data. len ( ) ) . unwrap ( ) ;
879-
881+
880882 // Verify decompressed data matches original
881883 assert_eq ! ( decompressed, test_data) ;
882884 // Verify compression actually happened (compressed should be different)
@@ -917,10 +919,12 @@ mod tests {
917919
918920 let body = vec ! [ 1 , 2 , 3 , 4 ] ;
919921 let result = client. compress_body ( body) ;
920-
922+
921923 // Should return error when gzip requested but feature not enabled
922924 assert ! ( result. is_err( ) ) ;
923- assert ! ( result. unwrap_err( ) . contains( "gzip-http feature not enabled" ) ) ;
925+ assert ! ( result
926+ . unwrap_err( )
927+ . contains( "gzip-http feature not enabled" ) ) ;
924928 }
925929
926930 #[ cfg( not( feature = "zstd-http" ) ) ]
@@ -937,10 +941,12 @@ mod tests {
937941
938942 let body = vec ! [ 1 , 2 , 3 , 4 ] ;
939943 let result = client. compress_body ( body) ;
940-
944+
941945 // Should return error when zstd requested but feature not enabled
942946 assert ! ( result. is_err( ) ) ;
943- assert ! ( result. unwrap_err( ) . contains( "zstd-http feature not enabled" ) ) ;
947+ assert ! ( result
948+ . unwrap_err( )
949+ . contains( "zstd-http feature not enabled" ) ) ;
944950 }
945951
946952 // Mock HTTP client for testing
0 commit comments