@@ -22,18 +22,18 @@ use std::str::FromStr;
22
22
use std:: sync:: { Arc , Mutex } ;
23
23
use std:: time:: Duration ;
24
24
25
- #[ cfg( feature = "http-retry" ) ]
25
+ #[ cfg( feature = "experimental- http-retry" ) ]
26
26
use crate :: retry_classification:: http:: classify_http_error;
27
- #[ cfg( feature = "http-retry" ) ]
27
+ #[ cfg( feature = "experimental- http-retry" ) ]
28
28
use opentelemetry_sdk:: retry:: { RetryErrorType , RetryPolicy } ;
29
29
30
30
// Shared HTTP retry functionality
31
31
/// HTTP-specific error wrapper for retry classification
32
32
#[ derive( Debug ) ]
33
33
pub ( crate ) struct HttpExportError {
34
- #[ cfg( feature = "http-retry" ) ]
34
+ #[ cfg( feature = "experimental- http-retry" ) ]
35
35
pub status_code : u16 ,
36
- #[ cfg( feature = "http-retry" ) ]
36
+ #[ cfg( feature = "experimental- http-retry" ) ]
37
37
pub retry_after : Option < String > ,
38
38
pub message : String ,
39
39
}
@@ -42,9 +42,9 @@ impl HttpExportError {
42
42
/// Create a new HttpExportError without retry-after header
43
43
pub ( crate ) fn new ( _status_code : u16 , message : String ) -> Self {
44
44
Self {
45
- #[ cfg( feature = "http-retry" ) ]
45
+ #[ cfg( feature = "experimental- http-retry" ) ]
46
46
status_code : _status_code,
47
- #[ cfg( feature = "http-retry" ) ]
47
+ #[ cfg( feature = "experimental- http-retry" ) ]
48
48
retry_after : None ,
49
49
message,
50
50
}
@@ -57,16 +57,16 @@ impl HttpExportError {
57
57
message : String ,
58
58
) -> Self {
59
59
Self {
60
- #[ cfg( feature = "http-retry" ) ]
60
+ #[ cfg( feature = "experimental- http-retry" ) ]
61
61
status_code : _status_code,
62
- #[ cfg( feature = "http-retry" ) ]
62
+ #[ cfg( feature = "experimental- http-retry" ) ]
63
63
retry_after : Some ( _retry_after) ,
64
64
message,
65
65
}
66
66
}
67
67
}
68
68
69
- #[ cfg( feature = "http-retry" ) ]
69
+ #[ cfg( feature = "experimental- http-retry" ) ]
70
70
/// Classify HTTP export errors for retry decisions
71
71
pub ( crate ) fn classify_http_export_error ( error : & HttpExportError ) -> RetryErrorType {
72
72
classify_http_error ( error. status_code , error. retry_after . as_deref ( ) )
@@ -113,7 +113,7 @@ pub struct HttpConfig {
113
113
compression : Option < crate :: Compression > ,
114
114
115
115
/// The retry policy to use for HTTP requests.
116
- #[ cfg( feature = "http-retry" ) ]
116
+ #[ cfg( feature = "experimental- http-retry" ) ]
117
117
retry_policy : Option < RetryPolicy > ,
118
118
}
119
119
@@ -286,7 +286,7 @@ impl HttpExporterBuilder {
286
286
self . exporter_config . protocol ,
287
287
timeout,
288
288
compression,
289
- #[ cfg( feature = "http-retry" ) ]
289
+ #[ cfg( feature = "experimental- http-retry" ) ]
290
290
self . http_config . retry_policy . take ( ) ,
291
291
) )
292
292
}
@@ -367,7 +367,7 @@ pub(crate) struct OtlpHttpClient {
367
367
protocol : Protocol ,
368
368
_timeout : Duration ,
369
369
compression : Option < crate :: Compression > ,
370
- #[ cfg( feature = "http-retry" ) ]
370
+ #[ cfg( feature = "experimental- http-retry" ) ]
371
371
retry_policy : RetryPolicy ,
372
372
#[ allow( dead_code) ]
373
373
// <allow dead> would be removed once we support set_resource for metrics and traces.
@@ -385,7 +385,7 @@ impl OtlpHttpClient {
385
385
where
386
386
F : Fn ( & Self , T ) -> Result < ( Vec < u8 > , & ' static str , Option < & ' static str > ) , String > ,
387
387
{
388
- #[ cfg( feature = "http-retry" ) ]
388
+ #[ cfg( feature = "experimental- http-retry" ) ]
389
389
{
390
390
use opentelemetry_sdk:: retry:: retry_with_backoff;
391
391
use opentelemetry_sdk:: runtime:: Tokio ;
@@ -419,7 +419,7 @@ impl OtlpHttpClient {
419
419
. map_err ( |e| opentelemetry_sdk:: error:: OTelSdkError :: InternalFailure ( e. message ) )
420
420
}
421
421
422
- #[ cfg( not( feature = "http-retry" ) ) ]
422
+ #[ cfg( not( feature = "experimental- http-retry" ) ) ]
423
423
{
424
424
let ( body, content_type, content_encoding) = build_body_fn ( self , data)
425
425
. map_err ( opentelemetry_sdk:: error:: OTelSdkError :: InternalFailure ) ?;
@@ -545,7 +545,7 @@ impl OtlpHttpClient {
545
545
protocol : Protocol ,
546
546
timeout : Duration ,
547
547
compression : Option < crate :: Compression > ,
548
- #[ cfg( feature = "http-retry" ) ] retry_policy : Option < RetryPolicy > ,
548
+ #[ cfg( feature = "experimental- http-retry" ) ] retry_policy : Option < RetryPolicy > ,
549
549
) -> Self {
550
550
OtlpHttpClient {
551
551
client : Mutex :: new ( Some ( client) ) ,
@@ -554,7 +554,7 @@ impl OtlpHttpClient {
554
554
protocol,
555
555
_timeout : timeout,
556
556
compression,
557
- #[ cfg( feature = "http-retry" ) ]
557
+ #[ cfg( feature = "experimental- http-retry" ) ]
558
558
retry_policy : retry_policy. unwrap_or ( RetryPolicy {
559
559
max_retries : 3 ,
560
560
initial_delay_ms : 100 ,
@@ -733,7 +733,7 @@ pub trait WithHttpConfig {
733
733
fn with_compression ( self , compression : crate :: Compression ) -> Self ;
734
734
735
735
/// Set the retry policy for HTTP requests.
736
- #[ cfg( feature = "http-retry" ) ]
736
+ #[ cfg( feature = "experimental- http-retry" ) ]
737
737
fn with_retry_policy ( self , policy : RetryPolicy ) -> Self ;
738
738
}
739
739
@@ -760,7 +760,7 @@ impl<B: HasHttpConfig> WithHttpConfig for B {
760
760
self
761
761
}
762
762
763
- #[ cfg( feature = "http-retry" ) ]
763
+ #[ cfg( feature = "experimental- http-retry" ) ]
764
764
fn with_retry_policy ( mut self , policy : RetryPolicy ) -> Self {
765
765
self . http_client_config ( ) . retry_policy = Some ( policy) ;
766
766
self
@@ -1010,7 +1010,7 @@ mod tests {
1010
1010
client : None ,
1011
1011
headers : Some ( initial_headers) ,
1012
1012
compression : None ,
1013
- #[ cfg( feature = "http-retry" ) ]
1013
+ #[ cfg( feature = "experimental- http-retry" ) ]
1014
1014
retry_policy : None ,
1015
1015
} ,
1016
1016
exporter_config : crate :: ExportConfig :: default ( ) ,
@@ -1078,7 +1078,7 @@ mod tests {
1078
1078
crate :: Protocol :: HttpBinary ,
1079
1079
std:: time:: Duration :: from_secs ( 10 ) ,
1080
1080
Some ( crate :: Compression :: Gzip ) ,
1081
- #[ cfg( feature = "http-retry" ) ]
1081
+ #[ cfg( feature = "experimental- http-retry" ) ]
1082
1082
None ,
1083
1083
) ;
1084
1084
@@ -1111,7 +1111,7 @@ mod tests {
1111
1111
crate :: Protocol :: HttpBinary ,
1112
1112
std:: time:: Duration :: from_secs ( 10 ) ,
1113
1113
Some ( crate :: Compression :: Zstd ) ,
1114
- #[ cfg( feature = "http-retry" ) ]
1114
+ #[ cfg( feature = "experimental- http-retry" ) ]
1115
1115
None ,
1116
1116
) ;
1117
1117
@@ -1141,7 +1141,7 @@ mod tests {
1141
1141
crate :: Protocol :: HttpBinary ,
1142
1142
std:: time:: Duration :: from_secs ( 10 ) ,
1143
1143
None , // No compression
1144
- #[ cfg( feature = "http-retry" ) ]
1144
+ #[ cfg( feature = "experimental- http-retry" ) ]
1145
1145
None ,
1146
1146
) ;
1147
1147
@@ -1164,7 +1164,7 @@ mod tests {
1164
1164
crate :: Protocol :: HttpBinary ,
1165
1165
std:: time:: Duration :: from_secs ( 10 ) ,
1166
1166
Some ( crate :: Compression :: Gzip ) ,
1167
- #[ cfg( feature = "http-retry" ) ]
1167
+ #[ cfg( feature = "experimental- http-retry" ) ]
1168
1168
None ,
1169
1169
) ;
1170
1170
@@ -1188,7 +1188,7 @@ mod tests {
1188
1188
crate :: Protocol :: HttpBinary ,
1189
1189
std:: time:: Duration :: from_secs ( 10 ) ,
1190
1190
Some ( crate :: Compression :: Zstd ) ,
1191
- #[ cfg( feature = "http-retry" ) ]
1191
+ #[ cfg( feature = "experimental- http-retry" ) ]
1192
1192
None ,
1193
1193
) ;
1194
1194
@@ -1252,7 +1252,7 @@ mod tests {
1252
1252
protocol,
1253
1253
std:: time:: Duration :: from_secs ( 10 ) ,
1254
1254
compression,
1255
- #[ cfg( feature = "http-retry" ) ]
1255
+ #[ cfg( feature = "experimental- http-retry" ) ]
1256
1256
None ,
1257
1257
)
1258
1258
}
@@ -1487,7 +1487,7 @@ mod tests {
1487
1487
) ) ;
1488
1488
}
1489
1489
1490
- #[ cfg( feature = "http-retry" ) ]
1490
+ #[ cfg( feature = "experimental- http-retry" ) ]
1491
1491
#[ test]
1492
1492
fn test_with_retry_policy ( ) {
1493
1493
use super :: super :: HttpExporterBuilder ;
@@ -1511,23 +1511,23 @@ mod tests {
1511
1511
assert_eq ! ( retry_policy. jitter_ms, 50 ) ;
1512
1512
}
1513
1513
1514
- #[ cfg( feature = "http-retry" ) ]
1514
+ #[ cfg( feature = "experimental- http-retry" ) ]
1515
1515
#[ test]
1516
1516
fn test_default_retry_policy_when_none_configured ( ) {
1517
1517
let client = create_test_client ( crate :: Protocol :: HttpBinary , None ) ;
1518
-
1518
+
1519
1519
// Verify default values are used
1520
1520
assert_eq ! ( client. retry_policy. max_retries, 3 ) ;
1521
1521
assert_eq ! ( client. retry_policy. initial_delay_ms, 100 ) ;
1522
1522
assert_eq ! ( client. retry_policy. max_delay_ms, 1600 ) ;
1523
1523
assert_eq ! ( client. retry_policy. jitter_ms, 100 ) ;
1524
1524
}
1525
1525
1526
- #[ cfg( feature = "http-retry" ) ]
1526
+ #[ cfg( feature = "experimental- http-retry" ) ]
1527
1527
#[ test]
1528
1528
fn test_custom_retry_policy_used ( ) {
1529
1529
use opentelemetry_sdk:: retry:: RetryPolicy ;
1530
-
1530
+
1531
1531
let custom_policy = RetryPolicy {
1532
1532
max_retries : 7 ,
1533
1533
initial_delay_ms : 500 ,
@@ -1544,7 +1544,7 @@ mod tests {
1544
1544
None ,
1545
1545
Some ( custom_policy) ,
1546
1546
) ;
1547
-
1547
+
1548
1548
// Verify custom values are used
1549
1549
assert_eq ! ( client. retry_policy. max_retries, 7 ) ;
1550
1550
assert_eq ! ( client. retry_policy. initial_delay_ms, 500 ) ;
0 commit comments