Skip to content

Commit 1837fb9

Browse files
committed
fix compile
Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
1 parent 67e6d3a commit 1837fb9

7 files changed

Lines changed: 11 additions & 21 deletions

File tree

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/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ tokio = { version = "1.49.0", features = [
5959
tokio-util = { version = "0.7", features = ["codec"] }
6060

6161
prctl = "1.0.0"
62+
sys-info = { version = "0.9.0" }
6263
tracing = { version = "0.1", default-features = false }
6364
tracing-log = { version = "0.2.0", optional = true }
6465
tracing-subscriber = { version = "0.3.22", default-features = false, features = [

datadog-sidecar/src/service/sidecar_server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use crate::service::debugger_diagnostics_bookkeeper::{
3636
use crate::service::exception_hash_rate_limiter::EXCEPTION_HASH_LIMITER;
3737
use crate::service::remote_configs::{RemoteConfigNotifyTarget, RemoteConfigs};
3838
use crate::service::stats_flusher::{
39-
ensure_stats_concentrator, flush_all_stats_now, get_hostname, stats_endpoint, ConcentratorKey,
39+
ensure_stats_concentrator, flush_all_stats_now, stats_endpoint, ConcentratorKey,
4040
SpanConcentratorState, StatsConfig,
4141
};
4242
use crate::service::tracing::trace_flusher::TraceFlusherStats;
@@ -685,7 +685,7 @@ impl SidecarInterface for ConnectionSidecarHandler {
685685
endpoint: stats_endpoint(&config.endpoint).unwrap_or_else(|| config.endpoint.clone()),
686686
flush_interval: config.flush_interval,
687687
hostname: if config.hostname.is_empty() {
688-
get_hostname()
688+
sys_info::hostname().unwrap_or_default()
689689
} else {
690690
config.hostname.clone()
691691
},

datadog-sidecar/src/service/stats_flusher.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,6 @@ use std::time::{Duration, SystemTime, UNIX_EPOCH};
2727
use tracing::{error, info, warn};
2828
use zwohash::ZwoHasher;
2929

30-
/// Detect the current machine hostname via `gethostname(2)`. Returns an empty string on error.
31-
pub(crate) fn get_hostname() -> String {
32-
let mut buf = vec![0u8; 256];
33-
// SAFETY: buf is valid for the given length; gethostname writes a NUL-terminated string.
34-
let ret = unsafe { libc::gethostname(buf.as_mut_ptr() as *mut libc::c_char, buf.len()) };
35-
if ret != 0 {
36-
return String::new();
37-
}
38-
let len = buf.iter().position(|&b| b == 0).unwrap_or(buf.len());
39-
String::from_utf8_lossy(&buf[..len]).into_owned()
40-
}
41-
4230
/// After the last `SpanConcentratorGuard` is dropped, keep the concentrator alive for this long
4331
/// before removing it (to absorb late-arriving spans from the previous app version/env).
4432
const IDLE_REMOVE_SECS: u64 = 600;

libdd-data-pipeline/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ libdd-common = { version = "3.0.2", path = "../libdd-common", default-features =
3434
libdd-shared-runtime = { version = "1.0.0", path = "../libdd-shared-runtime" }
3535
libdd-telemetry = { version = "4.0.0", path = "../libdd-telemetry", default-features = false, optional = true}
3636
libdd-trace-protobuf = { version = "3.0.1", path = "../libdd-trace-protobuf" }
37-
libdd-trace-stats = { version = "2.0.0", path = "../libdd-trace-stats" }
37+
libdd-trace-stats = { version = "2.0.0", path = "../libdd-trace-stats", default-features = false }
3838
libdd-trace-utils = { version = "3.0.1", path = "../libdd-trace-utils", default-features = false }
39-
libdd-ddsketch = { version = "1.0.1", path = "../libdd-ddsketch" }
4039
libdd-dogstatsd-client = { version = "2.0.0", path = "../libdd-dogstatsd-client", default-features = false }
4140
libdd-tinybytes = { version = "1.1.0", path = "../libdd-tinybytes", features = [
4241
"bytes_string",

libdd-data-pipeline/src/trace_exporter/stats.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use libdd_common::Endpoint;
1616
use libdd_common::MutexExt;
1717
use libdd_shared_runtime::{SharedRuntime, WorkerHandle};
1818
use libdd_trace_stats::span_concentrator::SpanConcentrator;
19+
#[cfg(not(target_arch = "wasm32"))]
1920
use libdd_trace_stats::stats_exporter::{StatsExporter, StatsMetadata};
2021
use std::sync::{Arc, Mutex};
2122
use std::time::Duration;
@@ -256,6 +257,7 @@ pub(crate) fn is_stats_worker_active(client_side_stats: &ArcSwap<StatsComputatio
256257
)
257258
}
258259

260+
#[cfg(not(target_arch = "wasm32"))]
259261
impl From<TracerMetadata> for StatsMetadata {
260262
fn from(m: TracerMetadata) -> StatsMetadata {
261263
StatsMetadata {

libdd-trace-stats/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ autobenches = false
1111

1212
[dependencies]
1313
anyhow = "1.0"
14-
libdd-common = { version = "3.0.0", path = "../libdd-common", default-features = false }
14+
libdd-capabilities = { path = "../libdd-capabilities", version = "0.1.0" }
15+
libdd-common = { version = "3.0.2", path = "../libdd-common", default-features = false }
1516
libdd-ddsketch = { version = "1.0.1", path = "../libdd-ddsketch" }
17+
libdd-shared-runtime = { version = "1.0.0", path = "../libdd-shared-runtime" }
1618
libdd-trace-protobuf = { version = "3.0.1", path = "../libdd-trace-protobuf" }
1719
libdd-trace-utils = { version = "3.0.1", path = "../libdd-trace-utils", default-features = false }
1820
hashbrown = { version = "0.15" }
@@ -25,8 +27,6 @@ tracing = { version = "0.1", default-features = false }
2527
async-trait = "0.1.85"
2628

2729
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
28-
libdd-capabilities = { path = "../libdd-capabilities" }
29-
libdd-shared-runtime = { path = "../libdd-shared-runtime" }
3030
libdd-capabilities-impl = { version = "0.1.0", path = "../libdd-capabilities-impl" }
3131

3232
[lib]
@@ -42,7 +42,7 @@ criterion = "0.5.1"
4242
httpmock = "0.8.0-alpha.1"
4343
libdd-trace-utils = { path = "../libdd-trace-utils", features = ["test-utils"] }
4444
rand = "0.8.5"
45-
tokio = { version = "1.23", features = ["rt-multi-thread", "macros", "test-util", "time"] }
45+
tokio = { version = "1.23", features = ["rt-multi-thread", "macros", "test-util", "time"], default-features = false }
4646

4747
[features]
4848
default = ["https"]

0 commit comments

Comments
 (0)