Skip to content

Commit 9ee83f2

Browse files
Merge branch 'main' into vianney/fix-telemetry-stop
2 parents e776ab7 + 0b00c9c commit 9ee83f2

15 files changed

Lines changed: 96 additions & 23 deletions

File tree

.github/CODEOWNERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,6 @@ bin_tests/tests/test_the_tests.rs @DataDog/libdatadog-core
8686
bin_tests/src/bin/test_the_tests.rs @DataDog/libdatadog-core
8787
tools/cc_utils/ @DataDog/libdatadog-php
8888
tools/sidecar_mockgen/ @DataDog/libdatadog-php
89-
libdd-data-pipeline/src/otlp/ @DataDog/apm-sdk-capabilities
90-
libdd-data-pipeline/tests/test_trace_exporter_otlp_export.rs @DataDog/apm-sdk-capabilities
91-
libdd-trace-utils/src/otlp_encoder/ @DataDog/apm-sdk-capabilities
89+
libdd-data-pipeline/src/otlp/ @DataDog/apm-sdk-capabilities-rust
90+
libdd-data-pipeline/tests/test_trace_exporter_otlp_export.rs @DataDog/apm-sdk-capabilities-rust
91+
libdd-trace-utils/src/otlp_encoder/ @DataDog/apm-sdk-capabilities-rust

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

datadog-sidecar-ffi/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,7 @@ pub unsafe extern "C" fn ddog_sidecar_session_set_config(
614614
flush_interval_milliseconds: u32,
615615
remote_config_poll_interval_millis: u32,
616616
telemetry_heartbeat_interval_millis: u32,
617+
telemetry_extended_heartbeat_interval_millis: u64,
617618
force_flush_size: usize,
618619
force_drop_size: usize,
619620
log_level: ffi::CharSlice,
@@ -643,6 +644,9 @@ pub unsafe extern "C" fn ddog_sidecar_session_set_config(
643644
telemetry_heartbeat_interval: Duration::from_millis(
644645
telemetry_heartbeat_interval_millis as u64,
645646
),
647+
telemetry_extended_heartbeat_interval: Duration::from_millis(
648+
telemetry_extended_heartbeat_interval_millis,
649+
),
646650
force_flush_size,
647651
force_drop_size,
648652
log_level: log_level.to_utf8_lossy().into(),

datadog-sidecar-ffi/tests/sidecar.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ fn test_ddog_sidecar_register_app() {
9898
1000,
9999
1000000,
100100
1,
101+
86400000,
101102
10000000,
102103
10000000,
103104
"".into(),
@@ -151,6 +152,7 @@ fn test_ddog_sidecar_register_app() {
151152
1000,
152153
1000000,
153154
1,
155+
86400000,
154156
10000000,
155157
10000000,
156158
"".into(),

datadog-sidecar/src/service/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ pub struct SessionConfig {
5858
pub flush_interval: Duration,
5959
pub remote_config_poll_interval: Duration,
6060
pub telemetry_heartbeat_interval: Duration,
61+
pub telemetry_extended_heartbeat_interval: Duration,
6162
pub force_flush_size: usize,
6263
pub force_drop_size: usize,
6364
pub log_level: String,

datadog-sidecar/src/service/sidecar_server.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,12 +640,16 @@ impl SidecarInterface for ConnectionSidecarHandler {
640640
*session.process_tags.lock_or_panic() = config.process_tags.clone();
641641
session.modify_telemetry_config(|cfg| {
642642
cfg.telemetry_heartbeat_interval = config.telemetry_heartbeat_interval;
643+
cfg.telemetry_extended_heartbeat_interval =
644+
config.telemetry_extended_heartbeat_interval;
643645
let endpoint = get_product_endpoint(
644646
libdd_telemetry::config::PROD_INTAKE_SUBDOMAIN,
645647
&config.endpoint,
646648
);
647649
cfg.set_endpoint(endpoint).ok();
648650
cfg.telemetry_heartbeat_interval = config.telemetry_heartbeat_interval;
651+
cfg.telemetry_extended_heartbeat_interval =
652+
config.telemetry_extended_heartbeat_interval;
649653
});
650654
session.modify_trace_config(|cfg| {
651655
let endpoint = get_product_endpoint(

examples/ffi/exporter.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,18 @@ int main(int argc, char *argv[]) {
146146
auto cancel = ddog_CancellationToken_new();
147147
auto cancel_for_background_thread = ddog_CancellationToken_clone(&cancel);
148148

149+
// Eagerly initialize the tokio runtime. This is optional, but required
150+
// to avoid race conditions if another thread might be using the
151+
// the cancellation token at the same time as the profile is being sent
152+
// (as is the case here).
153+
ddog_VoidResult init_result = ddog_prof_Exporter_init_runtime(exporter);
154+
if (init_result.tag != DDOG_VOID_RESULT_OK) {
155+
print_error("Failed to initialize exporter runtime: ", init_result.err);
156+
ddog_Error_drop(&init_result.err);
157+
ddog_prof_Exporter_drop(exporter);
158+
return 1;
159+
}
160+
149161
// As an example of CancellationToken usage, here we create a background
150162
// thread that sleeps for some time and then cancels a request early (e.g.
151163
// before the timeout in ddog_prof_Exporter_send_blocking is hit).

libdd-common-ffi/src/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ mod tests {
181181
let vec = vec![0, 2, 4, 6];
182182
let ffi_vec: Vec<u8> = Vec::from(vec.clone());
183183

184-
for (a, b) in vec.iter().zip(ffi_vec.into_iter()) {
184+
for (a, b) in vec.iter().zip(&ffi_vec) {
185185
assert_eq!(a, b)
186186
}
187187
}

libdd-profiling-ffi/src/exporter.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,38 @@ unsafe fn parse_json(
222222
}
223223
}
224224

225+
/// Initializes the tokio runtime for the exporter.
226+
///
227+
/// This function creates the tokio runtime used by `ddog_prof_Exporter_send_blocking`.
228+
/// It can be called ahead of time to ensure the runtime is ready before sending.
229+
///
230+
/// # Thread Affinity
231+
///
232+
/// **Important**: The runtime has thread affinity. This function should be called from
233+
/// the same thread that will later call `ddog_prof_Exporter_send_blocking`.
234+
///
235+
/// # Arguments
236+
/// * `exporter` - Borrows the exporter.
237+
///
238+
/// # Safety
239+
/// The `exporter` must point to a valid ProfileExporter that has not been dropped.
240+
#[no_mangle]
241+
#[must_use]
242+
#[named]
243+
pub unsafe extern "C" fn ddog_prof_Exporter_init_runtime(
244+
mut exporter: *mut Handle<ProfileExporter>,
245+
) -> VoidResult {
246+
wrap_with_void_ffi_result!({
247+
let exporter = exporter.to_inner_mut()?;
248+
exporter.init_runtime()?
249+
})
250+
}
251+
225252
/// Builds a request and sends it, returning the HttpStatus.
226253
///
254+
/// Note: If the runtime has not been initialized via `ddog_prof_Exporter_init_runtime`,
255+
/// it will be lazily initialized on first call.
256+
///
227257
/// # Arguments
228258
/// * `exporter` - Borrows the exporter.
229259
/// * `profile` - Takes ownership of the profile.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
4+
5+
## [2.0.0](https://github.com/datadog/libdatadog/compare/libdd-profiling-protobuf-v1.0.0..libdd-profiling-protobuf-v2.0.0) - 2026-04-15
6+
7+
### Changed
8+
9+
- bumped prost dependency from 0.13 to 0.14 ([#1426](https://github.com/datadog/libdatadog/issues/1700)) - ([14bab865c](https://github.com/datadog/libdatadog/commit/14bab865c))
10+
11+
12+
313
## 1.0.0 - 2025-11-17
414

515
Initial release.

0 commit comments

Comments
 (0)