@@ -164,6 +164,12 @@ fn default_download_max_schedule_count() -> u32 {
164
164
5
165
165
}
166
166
167
+ /// default_tracing_path is the default tracing path for dfdaemon.
168
+ #[ inline]
169
+ fn default_tracing_path ( ) -> Option < PathBuf > {
170
+ Some ( PathBuf :: from ( "/v1/traces" ) )
171
+ }
172
+
167
173
/// default_scheduler_announce_interval is the default interval to announce peer to the scheduler.
168
174
#[ inline]
169
175
fn default_scheduler_announce_interval ( ) -> Duration {
@@ -1460,7 +1466,7 @@ pub struct Stats {
1460
1466
}
1461
1467
1462
1468
/// Tracing is the tracing configuration for dfdaemon.
1463
- #[ derive( Debug , Clone , Default , Validate , Deserialize ) ]
1469
+ #[ derive( Debug , Clone , Validate , Deserialize ) ]
1464
1470
#[ serde( default , rename_all = "camelCase" ) ]
1465
1471
pub struct Tracing {
1466
1472
/// Protocol specifies the communication protocol for the tracing server.
@@ -1471,11 +1477,28 @@ pub struct Tracing {
1471
1477
/// endpoint is the endpoint to report tracing log, example: "localhost:4317".
1472
1478
pub endpoint : Option < String > ,
1473
1479
1480
+ /// path is the path to report tracing log, example: "/v1/traces" if the protocol is "http" or
1481
+ /// "https".
1482
+ #[ serde( default = "default_tracing_path" ) ]
1483
+ pub path : Option < PathBuf > ,
1484
+
1474
1485
/// headers is the headers to report tracing log.
1475
1486
#[ serde( with = "http_serde::header_map" ) ]
1476
1487
pub headers : reqwest:: header:: HeaderMap ,
1477
1488
}
1478
1489
1490
+ /// Tracing implements Default.
1491
+ impl Default for Tracing {
1492
+ fn default ( ) -> Self {
1493
+ Self {
1494
+ protocol : None ,
1495
+ endpoint : None ,
1496
+ path : default_tracing_path ( ) ,
1497
+ headers : reqwest:: header:: HeaderMap :: new ( ) ,
1498
+ }
1499
+ }
1500
+ }
1501
+
1479
1502
/// Config is the configuration for dfdaemon.
1480
1503
#[ derive( Debug , Clone , Default , Validate , Deserialize ) ]
1481
1504
#[ serde( default , rename_all = "camelCase" ) ]
@@ -2189,12 +2212,18 @@ key: /etc/ssl/private/client.pem
2189
2212
let json_data = r#"
2190
2213
{
2191
2214
"protocol": "http",
2192
- "endpoint": "tracing.example.com"
2215
+ "endpoint": "tracing.example.com",
2216
+ "path": "/v1/traces",
2217
+ "headers": {
2218
+ "X-Custom-Header": "value"
2219
+ }
2193
2220
}"# ;
2194
2221
2195
2222
let tracing: Tracing = serde_json:: from_str ( json_data) . unwrap ( ) ;
2196
2223
assert_eq ! ( tracing. protocol, Some ( "http" . to_string( ) ) ) ;
2197
2224
assert_eq ! ( tracing. endpoint, Some ( "tracing.example.com" . to_string( ) ) ) ;
2225
+ assert_eq ! ( tracing. path, Some ( PathBuf :: from( "/v1/traces" ) ) ) ;
2226
+ assert ! ( tracing. headers. contains_key( "X-Custom-Header" ) ) ;
2198
2227
}
2199
2228
2200
2229
#[ test]
0 commit comments