Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ libdd-data-pipeline = { path = "../libdatadog/libdd-data-pipeline" }
libdd-tinybytes = { path = "../libdatadog/libdd-tinybytes" }
libdd-trace-utils = { path = "../libdatadog/libdd-trace-utils" }
libdd-trace-stats = { path = "../libdatadog/libdd-trace-stats" }
libdd-trace-protobuf = { path = "../libdatadog/libdd-trace-protobuf" }
libdd-crashtracker-ffi = { path = "../libdatadog/libdd-crashtracker-ffi", default-features = false, features = ["collector"] }
libdd-library-config-ffi = { path = "../libdatadog/libdd-library-config-ffi", default-features = false }
spawn_worker = { path = "../libdatadog/spawn_worker" }
Expand Down
38 changes: 25 additions & 13 deletions components-rs/remote_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ pub struct RemoteConfigState {
manager: RemoteConfigManager,
live_debugger: LiveDebuggerState,
dynamic_config: DynamicConfig,
// Service name of the currently tracked target. libdd-remote-config's `Target` no longer
// exposes its inner fields (they were hidden in libdatadog #2182), so we keep our own copy of
// the service — set whenever we track a target — for building debugger diagnostics payloads.
current_service: String,
}

#[repr(C)]
Expand Down Expand Up @@ -223,6 +227,7 @@ pub unsafe extern "C" fn ddog_init_remote_config_state(
..Default::default()
},
dynamic_config: Default::default(),
current_service: String::new(),
})
}

Expand Down Expand Up @@ -639,20 +644,26 @@ pub extern "C" fn ddog_remote_configs_service_env_change(
tags: &libdd_common_ffi::Vec<Tag>,
process_tags: &libdd_common_ffi::Vec<Tag>,
) -> bool {
let new_target = Target {
service: service.to_utf8_lossy().to_string(),
env: env.to_utf8_lossy().to_string(),
app_version: version.to_utf8_lossy().to_string(),
tags: tags.as_slice().to_vec(),
process_tags: process_tags.as_slice().to_vec(),
};
let service = service.to_utf8_lossy().to_string();
// `Target`'s fields are private since libdatadog #2182; construct via the public constructor.
// `tags`/`process_tags` are now `Vec<String>` of already-formatted `"key:value"` entries, so
// render each `Tag` (whose `Display`/`to_string` yields `"key:value"`) to a String.
let new_target = Target::new(
service.clone(),
env.to_utf8_lossy().to_string(),
version.to_utf8_lossy().to_string(),
tags.as_slice().iter().map(|t| t.to_string()).collect(),
process_tags.as_slice().iter().map(|t| t.to_string()).collect(),
);

if let Some(target) = remote_config.manager.get_target() {
if **target == new_target {
return false;
}
}

// Keep our own copy of the service name; `Target` no longer exposes it.
remote_config.current_service = service;
remote_config.manager.track_target(&Arc::new(new_target));
// Caller must call ddog_process_remote_configs if true.
// We don't call it here to allow the caller delaying the call as necessary.
Expand Down Expand Up @@ -777,12 +788,13 @@ pub unsafe extern "C" fn ddog_send_debugger_diagnostics<'a>(
probe: &'a Probe,
timestamp: u64,
) -> MaybeError {
let service = Cow::Borrowed(
remote_config_state
.manager
.get_target()
.map_or("", |t| t.service.as_str()),
);
// `Target` no longer exposes its service field (libdatadog #2182); use the copy we tracked
// when the target was set. Fall back to empty when no target is currently tracked.
let service = Cow::Borrowed(if remote_config_state.manager.get_target().is_some() {
remote_config_state.current_service.as_str()
} else {
""
});
let mut payload = ddog_debugger_diagnostics_create_unboxed(
probe,
service,
Expand Down
9 changes: 8 additions & 1 deletion components-rs/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use crate::trace_filter;
use datadog_ipc::shm_stats::{OwnedShmSpanInput, ShmSpanConcentrator, ShmSpanInput, MAX_PEER_TAGS};
use datadog_sidecar::service::blocking::{add_span_to_concentrator, SidecarTransport};
use libdd_trace_protobuf::pb;
use libdd_trace_stats::span_concentrator::FixedAggregationKey;
use libdd_common_ffi::slice::{AsBytes, CharSlice};
use std::collections::HashMap;
Expand Down Expand Up @@ -148,7 +149,13 @@ fn build_fixed_key<'a>(span: &'a PhpSpanStats<'a>) -> FixedAggregationKey<&'a st
http_endpoint: extract_http_endpoint(span),
http_status_code: extract_http_status_code(span),
is_synthetics_request: is_synthetics_request(span),
is_trace_root: span.is_trace_root,
// `is_trace_root` became a `Trilean` in libdatadog #2180; map our bool onto it. The PHP
// side always knows whether a span is a trace root, so we never emit `NotSet`.
is_trace_root: if span.is_trace_root {
pb::Trilean::True
} else {
pb::Trilean::False
},
grpc_status_code: extract_grpc_status_code(span),
service_source: char_slice_str(span.service_source),
}
Expand Down
2 changes: 1 addition & 1 deletion libdatadog
Submodule libdatadog updated 97 files
+2 −2 .github/actions/Cargo.lock
+1 −1 .github/workflows/verify-proto-files.yml
+3 −0 .gitlab/benchmarks.yml
+1 −1 .gitlab/fuzz.yml
+40 −19 Cargo.lock
+1 −1 Cargo.toml
+2 −0 LICENSE-3rdparty.csv
+165 −1 bin_tests/tests/crashtracker_bin_test.rs
+1 −1 datadog-ffe-ffi/Cargo.toml
+6 −9 datadog-ipc/src/shm_stats.rs
+7 −7 datadog-sidecar-ffi/src/lib.rs
+1 −1 datadog-sidecar/Cargo.toml
+1 −0 datadog-sidecar/src/service/ffe_exposures_flusher.rs
+1 −0 datadog-sidecar/src/service/ffe_metrics_flusher.rs
+9 −2 datadog-sidecar/src/service/sidecar_server.rs
+2 −0 datadog-sidecar/src/service/stats_flusher.rs
+21 −21 datadog-sidecar/src/shm_remote_config.rs
+2 −3 examples/ffi/telemetry.c
+2 −3 examples/ffi/telemetry_metrics.c
+1 −0 libdd-agent-client/src/builder.rs
+3 −0 libdd-agent-client/src/client.rs
+13 −1 libdd-capabilities-impl/src/lib.rs
+2 −0 libdd-capabilities/src/lib.rs
+19 −0 libdd-capabilities/src/log_output.rs
+4 −1 libdd-common/Cargo.toml
+1 −0 libdd-common/src/lib.rs
+129 −0 libdd-common/src/machine_id/linux.rs
+43 −0 libdd-common/src/machine_id/macos.rs
+135 −0 libdd-common/src/machine_id/mod.rs
+89 −0 libdd-common/src/machine_id/windows.rs
+40 −12 libdd-crashtracker/src/crash_info/telemetry.rs
+118 −31 libdd-data-pipeline-ffi/src/trace_exporter.rs
+2 −2 libdd-data-pipeline/Cargo.toml
+118 −0 libdd-data-pipeline/examples/send-traces-agentless.rs
+30 −0 libdd-data-pipeline/src/agentless/config.rs
+102 −0 libdd-data-pipeline/src/agentless/exporter.rs
+30 −0 libdd-data-pipeline/src/agentless/mod.rs
+1 −0 libdd-data-pipeline/src/lib.rs
+64 −19 libdd-data-pipeline/src/otlp/metrics.rs
+9 −1 libdd-data-pipeline/src/telemetry/mod.rs
+4 −4 libdd-data-pipeline/src/trace_buffer/mod.rs
+372 −42 libdd-data-pipeline/src/trace_exporter/builder.rs
+94 −0 libdd-data-pipeline/src/trace_exporter/log_writer.rs
+368 −12 libdd-data-pipeline/src/trace_exporter/mod.rs
+11 −0 libdd-data-pipeline/src/trace_exporter/stats.rs
+2 −0 libdd-http-client/src/client.rs
+5 −0 libdd-http-client/src/config.rs
+136 −38 libdd-library-config/src/tracer_metadata.rs
+5 −1 libdd-otel-thread-ctx-ffi/Cargo.toml
+4 −0 libdd-otel-thread-ctx-ffi/cbindgen.toml
+14 −0 libdd-otel-thread-ctx-ffi/src/lib.rs
+10 −60 libdd-otel-thread-ctx-ffi/tests/elf_properties.rs
+7 −0 libdd-otel-thread-ctx/Cargo.toml
+3 −0 libdd-otel-thread-ctx/src/lib.rs
+153 −0 libdd-otel-thread-ctx/src/sanity_check.rs
+7 −8 libdd-remote-config/examples/remote_config_fetch.rs
+20 −18 libdd-remote-config/src/fetch/fetcher.rs
+7 −7 libdd-remote-config/src/fetch/shared.rs
+1 −0 libdd-remote-config/src/fetch/test_server.rs
+25 −7 libdd-remote-config/src/lib.rs
+101 −16 libdd-telemetry-ffi/src/builder.rs
+18 −10 libdd-telemetry-ffi/src/lib.rs
+4 −3 libdd-telemetry/examples/tm-metrics-worker-test.rs
+5 −6 libdd-telemetry/examples/tm-send-sketch.rs
+2 −2 libdd-telemetry/examples/tm-worker-test.rs
+84 −38 libdd-telemetry/src/config.rs
+23 −5 libdd-telemetry/src/worker/mod.rs
+1 −1 libdd-trace-obfuscation/src/replacer.rs
+1 −0 libdd-trace-obfuscation/src/sql.rs
+1 −0 libdd-trace-obfuscation/tests/test_span_obfuscation.rs
+28 −0 libdd-trace-protobuf/build.rs
+28 −0 libdd-trace-protobuf/src/pb.idx.rs
+41 −2 libdd-trace-protobuf/src/pb.rs
+16 −0 libdd-trace-protobuf/src/pb/idx/tracer_payload.proto
+210 −0 libdd-trace-protobuf/src/pb/remoteconfig.proto
+3 −2 libdd-trace-protobuf/src/pb/stats.proto
+22 −0 libdd-trace-protobuf/src/pb/tracer_payload.proto
+35 −0 libdd-trace-protobuf/src/pb_test.rs
+401 −0 libdd-trace-protobuf/src/remoteconfig.rs
+6 −2 libdd-trace-stats/Cargo.toml
+1 −0 libdd-trace-stats/benches/span_concentrator_bench.rs
+93 −65 libdd-trace-stats/src/span_concentrator/aggregation.rs
+50 −10 libdd-trace-stats/src/span_concentrator/mod.rs
+293 −19 libdd-trace-stats/src/span_concentrator/tests.rs
+297 −9 libdd-trace-stats/src/stats_exporter.rs
+1 −0 libdd-trace-utils/Cargo.toml
+461 −0 libdd-trace-utils/src/agentless_encoder/mod.rs
+354 −0 libdd-trace-utils/src/agentless_encoder/tests.rs
+502 −0 libdd-trace-utils/src/json_log_encoder/mod.rs
+200 −0 libdd-trace-utils/src/json_log_encoder/span.rs
+2 −0 libdd-trace-utils/src/lib.rs
+1 −0 libdd-trace-utils/src/stats_utils.rs
+1 −0 libdd-trace-utils/src/test_utils/mod.rs
+2 −0 libdd-trace-utils/src/trace_filter.rs
+3 −0 libdd-trace-utils/src/trace_utils.rs
+1 −0 libdd-trace-utils/src/tracer_payload.rs
+1 −7 libdd-tracer-flare/src/lib.rs
Loading