build(obs): restrict pyroscope dependency to unix targets (#2064)

This commit is contained in:
houseme
2026-03-03 20:41:37 +08:00
committed by GitHub
parent ac4b13def1
commit 5e7495a042
2 changed files with 4 additions and 6 deletions
+3 -1
View File
@@ -56,9 +56,11 @@ tracing-subscriber = { workspace = true, features = ["registry", "std", "fmt", "
tokio = { workspace = true, features = ["sync", "fs", "rt-multi-thread", "rt", "time", "macros"] }
sysinfo = { workspace = true }
thiserror = { workspace = true }
pyroscope = { workspace = true, features= ["backend-pprof-rs"]}
walkdir = { workspace = true }
[target.'cfg(unix)'.dependencies]
pyroscope = { workspace = true, features = ["backend-pprof-rs"] }
[dev-dependencies]
tokio = { workspace = true, features = ["full"] }
+1 -5
View File
@@ -49,10 +49,6 @@ use opentelemetry_sdk::{
metrics::{PeriodicReader, SdkMeterProvider},
trace::{RandomIdGenerator, Sampler, SdkTracerProvider},
};
#[cfg(unix)]
use pyroscope::PyroscopeAgent;
#[cfg(unix)]
use pyroscope::pyroscope::PyroscopeAgentRunning;
use rustfs_config::{
APP_NAME, DEFAULT_OBS_LOG_STDOUT_ENABLED, DEFAULT_OBS_LOGS_EXPORT_ENABLED, DEFAULT_OBS_METRICS_EXPORT_ENABLED,
DEFAULT_OBS_PROFILING_EXPORT_ENABLED, DEFAULT_OBS_TRACES_EXPORT_ENABLED, METER_INTERVAL, SAMPLE_RATIO,
@@ -321,7 +317,7 @@ fn build_logger_provider(
/// Starts the Pyroscope continuous profiling agent if `ENV_OBS_PROFILING_ENDPOINT` is set.
/// No-op and returns None on non-unix platforms.
#[cfg(unix)]
fn init_profiler(config: &OtelConfig) -> Option<PyroscopeAgent<PyroscopeAgentRunning>> {
fn init_profiler(config: &OtelConfig) -> Option<pyroscope::PyroscopeAgent<pyroscope::pyroscope::PyroscopeAgentRunning>> {
use pyroscope::backend::{BackendConfig, PprofConfig, pprof_backend};
use pyroscope::pyroscope::PyroscopeAgentBuilder;
use rustfs_config::VERSION;