Skip to content

Commit 2974373

Browse files
committed
reorder params
1 parent d9580ec commit 2974373

File tree

5 files changed

+22
-20
lines changed

5 files changed

+22
-20
lines changed

libdd-telemetry-ffi/src/builder/expanded.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,8 @@ mod macros {
324324
HostKernelVersion,
325325
RuntimeId,
326326
SessionId,
327-
RootSessionId,
328327
ParentSessionId,
328+
RootSessionId,
329329
}
330330
#[no_mangle]
331331
/**
@@ -357,10 +357,10 @@ mod macros {
357357
358358
* session_id
359359
360-
* root_session_id
361-
362360
* parent_session_id
363361
362+
* root_session_id
363+
364364
*/
365365
pub unsafe extern "C" fn ddog_telemetry_builder_with_property_str(
366366
telemetry_builder: &mut TelemetryWorkerBuilder,
@@ -571,8 +571,8 @@ mod macros {
571571
}
572572
};
573573
}
574-
RootSessionId => {
575-
telemetry_builder.config.root_session_id =
574+
ParentSessionId => {
575+
telemetry_builder.config.parent_session_id =
576576
match (|s: ffi::CharSlice| -> Result<_, String> {
577577
Ok(Some(s.to_utf8_lossy().into_owned()))
578578
})(param)
@@ -588,8 +588,8 @@ mod macros {
588588
}
589589
};
590590
}
591-
ParentSessionId => {
592-
telemetry_builder.config.parent_session_id =
591+
RootSessionId => {
592+
telemetry_builder.config.root_session_id =
593593
match (|s: ffi::CharSlice| -> Result<_, String> {
594594
Ok(Some(s.to_utf8_lossy().into_owned()))
595595
})(param)
@@ -638,10 +638,10 @@ mod macros {
638638
639639
* session_id
640640
641-
* root_session_id
642-
643641
* parent_session_id
644642
643+
* root_session_id
644+
645645
*/
646646
pub unsafe extern "C" fn ddog_telemetry_builder_with_str_named_property(
647647
telemetry_builder: &mut TelemetryWorkerBuilder,
@@ -862,8 +862,8 @@ mod macros {
862862
}
863863
};
864864
}
865-
"root_session_id" => {
866-
telemetry_builder.config.root_session_id =
865+
"parent_session_id" => {
866+
telemetry_builder.config.parent_session_id =
867867
match (|s: ffi::CharSlice| -> Result<_, String> {
868868
Ok(Some(s.to_utf8_lossy().into_owned()))
869869
})(param)
@@ -879,8 +879,8 @@ mod macros {
879879
}
880880
};
881881
}
882-
"parent_session_id" => {
883-
telemetry_builder.config.parent_session_id =
882+
"root_session_id" => {
883+
telemetry_builder.config.root_session_id =
884884
match (|s: ffi::CharSlice| -> Result<_, String> {
885885
Ok(Some(s.to_utf8_lossy().into_owned()))
886886
})(param)

libdd-telemetry-ffi/src/builder/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ crate::c_setters!(
3838

3939
runtime_id,
4040
session_id,
41-
root_session_id,
4241
parent_session_id,
42+
root_session_id,
4343
}
4444
);
4545

libdd-telemetry/src/config.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ pub struct Config {
3737
#[serde(default)]
3838
pub session_id: Option<String>,
3939
#[serde(default)]
40-
pub root_session_id: Option<String>,
41-
#[serde(default)]
4240
pub parent_session_id: Option<String>,
41+
#[serde(default)]
42+
pub root_session_id: Option<String>,
4343
}
4444

4545
fn endpoint_with_telemetry_path(
@@ -174,8 +174,8 @@ impl Default for Config {
174174
restartable: false,
175175
debug_enabled: false,
176176
session_id: None,
177-
root_session_id: None,
178177
parent_session_id: None,
178+
root_session_id: None,
179179
}
180180
}
181181
}
@@ -260,8 +260,8 @@ impl Config {
260260
restartable: false,
261261
debug_enabled: false,
262262
session_id: None,
263-
root_session_id: None,
264263
parent_session_id: None,
264+
root_session_id: None,
265265
};
266266
if let Ok(url) = parse_uri(&trace_agent_url) {
267267
let _res = this.set_endpoint(Endpoint {

libdd-telemetry/src/worker/http_client.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ pub mod header {
2929
pub const DD_PARENT_SESSION_ID: HeaderName = HeaderName::from_static("dd-parent-session-id");
3030
}
3131

32+
/// `session_id`, then `parent_session_id`, then `root_session_id` (must match call sites in
33+
/// `build_request`).
3234
pub(crate) fn add_instrumentation_session_headers(
3335
mut builder: HttpRequestBuilder,
3436
session_id: Option<&str>,
35-
root_session_id: Option<&str>,
3637
parent_session_id: Option<&str>,
38+
root_session_id: Option<&str>,
3739
) -> HttpRequestBuilder {
3840
let Some(s) = session_id.filter(|id| !id.is_empty()) else {
3941
return builder;

libdd-telemetry/src/worker/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,8 +767,8 @@ impl TelemetryWorker {
767767
let req = http_client::add_instrumentation_session_headers(
768768
req,
769769
self.config.session_id.as_deref(),
770-
self.config.root_session_id.as_deref(),
771770
self.config.parent_session_id.as_deref(),
771+
self.config.root_session_id.as_deref(),
772772
);
773773

774774
let body = http_common::Body::from(serialize::serialize(&tel)?);

0 commit comments

Comments
 (0)