Skip to content

Commit 67e6d3a

Browse files
committed
Actually reuse the exporter
Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
1 parent d4cde3e commit 67e6d3a

8 files changed

Lines changed: 133 additions & 364 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

datadog-ipc/src/platform/mem_handle.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::platform::{mmap_handle, munmap_handle, OwnedFileHandle, PlatformHandl
66
#[cfg(feature = "tiny-bytes")]
77
use libdd_tinybytes::UnderlyingBytes;
88
use serde::{Deserialize, Serialize};
9+
#[cfg(target_os = "linux")]
910
use std::os::fd::AsRawFd;
1011
use std::{ffi::CString, io, ptr::NonNull};
1112

datadog-sidecar/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ version = "1.49.0"
9191
[target.'cfg(not(target_arch = "x86"))'.dependencies]
9292
simd-json = "=0.14"
9393

94+
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
95+
libdd-capabilities-impl = { path = "../libdd-capabilities-impl" }
96+
9497
[target.'cfg(unix)'.dependencies]
9598
nix = { version = "0.29", features = ["socket", "mman"] }
9699
sendfd = { version = "0.4", features = ["tokio"] }

datadog-sidecar/src/service/session_info.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,15 @@ impl SessionInfo {
151151
}
152152
}
153153

154+
pub(crate) fn modify_stats_config<F>(&self, f: F)
155+
where
156+
F: FnOnce(&mut crate::service::stats_flusher::StatsConfig),
157+
{
158+
if let Some(cfg) = &mut *self.stats_config.lock_or_panic() {
159+
f(cfg)
160+
}
161+
}
162+
154163
pub(crate) fn get_trace_config(&self) -> MutexGuard<'_, tracer::Config> {
155164
self.tracer_config.lock_or_panic()
156165
}
@@ -166,12 +175,6 @@ impl SessionInfo {
166175
self.dogstatsd.lock_or_panic()
167176
}
168177

169-
/// Clone the Arc wrapping the DogStatsD client so it can be shared with long-lived tasks
170-
/// (e.g. the stats flush loop) without creating a new UDP socket.
171-
pub(crate) fn clone_dogstatsd(&self) -> Arc<Mutex<Option<libdd_dogstatsd_client::Client>>> {
172-
self.dogstatsd.clone()
173-
}
174-
175178
pub(crate) fn configure_dogstatsd<F>(&self, f: F)
176179
where
177180
F: FnOnce(&mut Option<libdd_dogstatsd_client::Client>),

datadog-sidecar/src/service/sidecar_server.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,10 @@ impl SidecarInterface for ConnectionSidecarHandler {
10401040
session.modify_trace_config(|trace_cfg| {
10411041
trace_cfg.set_endpoint_test_token(token.clone());
10421042
});
1043+
// Update the stats config so newly created concentrators carry the test token.
1044+
session.modify_stats_config(|cfg| {
1045+
cfg.endpoint.test_token = token.clone();
1046+
});
10431047
// TODO(APMSP-1377): the dogstatsd-client doesn't support test_session tokens yet
10441048
// session.configure_dogstatsd(|cfg| {
10451049
// update_cfg(cfg.endpoint.take(), |e| cfg.set_endpoint(e), &token);

0 commit comments

Comments
 (0)