Skip to content

Commit 46babf0

Browse files
authored
chore(metrics): use kubert-prometheus-process metrics (#3742)
kubert-prometheus-process is a new crate that includes all of Linkerd's system metrics and more. This also helps avoid annoying compilation build issues on non-Linux systems.
1 parent 575ba00 commit 46babf0

File tree

9 files changed

+24
-344
lines changed

9 files changed

+24
-344
lines changed

Cargo.lock

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,6 +1231,18 @@ dependencies = [
12311231
"wasm-bindgen",
12321232
]
12331233

1234+
[[package]]
1235+
name = "kubert-prometheus-process"
1236+
version = "0.2.3"
1237+
source = "registry+https://github.com/rust-lang/crates.io-index"
1238+
checksum = "5b89e2a641a3f74c2e7366eb050282ac4a6194b63dae5294084215c457237e47"
1239+
dependencies = [
1240+
"libc",
1241+
"procfs",
1242+
"prometheus-client",
1243+
"tracing",
1244+
]
1245+
12341246
[[package]]
12351247
name = "kubert-prometheus-tokio"
12361248
version = "0.2.0"
@@ -1272,7 +1284,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
12721284
checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
12731285
dependencies = [
12741286
"cfg-if",
1275-
"windows-targets 0.52.0",
1287+
"windows-targets 0.48.5",
12761288
]
12771289

12781290
[[package]]
@@ -2029,9 +2041,9 @@ dependencies = [
20292041
"http",
20302042
"http-body",
20312043
"hyper",
2044+
"kubert-prometheus-process",
20322045
"linkerd-http-box",
20332046
"linkerd-stack",
2034-
"linkerd-system",
20352047
"parking_lot",
20362048
"prometheus-client",
20372049
"quickcheck",
@@ -2549,15 +2561,6 @@ dependencies = [
25492561
"tracing",
25502562
]
25512563

2552-
[[package]]
2553-
name = "linkerd-system"
2554-
version = "0.1.0"
2555-
dependencies = [
2556-
"libc",
2557-
"procfs",
2558-
"tracing",
2559-
]
2560-
25612564
[[package]]
25622565
name = "linkerd-tls"
25632566
version = "0.1.0"

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ members = [
7878
"linkerd/stack",
7979
"linkerd/stack/metrics",
8080
"linkerd/stack/tracing",
81-
"linkerd/system",
8281
"linkerd/tonic-stream",
8382
"linkerd/tonic-watch",
8483
"linkerd/tls",

linkerd/app/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use tokio::{
3535
sync::mpsc,
3636
time::{self, Duration},
3737
};
38-
use tracing::{debug, info, info_span, Instrument};
38+
use tracing::{debug, error, info, info_span, Instrument};
3939

4040
/// Spawns a sidecar proxy.
4141
///
@@ -293,7 +293,10 @@ impl Config {
293293
})
294294
};
295295

296-
metrics::process::register(registry.sub_registry_with_prefix("process"));
296+
if let Err(error) = metrics::process::register(registry.sub_registry_with_prefix("process"))
297+
{
298+
error!(%error, "Failed to register process metrics");
299+
}
297300
registry.register("proxy_build_info", "Proxy build info", BUILD_INFO.metric());
298301

299302
let admin = {

linkerd/metrics/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ publish = false
88

99
[features]
1010
default = []
11-
process = ["dep:linkerd-system"]
11+
process = ["dep:kubert-prometheus-process"]
1212
stack = ["dep:linkerd-stack"]
1313
test_util = []
1414

@@ -17,14 +17,14 @@ deflate = { version = "1", features = ["gzip"] }
1717
http = { workspace = true }
1818
http-body = { workspace = true }
1919
hyper = { workspace = true, features = ["deprecated", "http1", "http2"] }
20+
kubert-prometheus-process = { version = "0.2", optional = true }
2021
parking_lot = "0.12"
2122
prometheus-client = "0.23"
2223
tokio = { version = "1", features = ["time"] }
2324
tracing = "0.1"
2425

2526
linkerd-http-box = { path = "../http/box" }
2627
linkerd-stack = { path = "../stack", optional = true }
27-
linkerd-system = { path = "../system", optional = true }
2828

2929
[dev-dependencies]
3030
quickcheck = { version = "1", default-features = false }

linkerd/metrics/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ mod histogram;
1010
pub mod latency;
1111
#[cfg(feature = "stack")]
1212
mod new_metrics;
13-
#[cfg(feature = "process")]
14-
pub mod process;
1513
mod serve;
1614
mod store;
1715

16+
#[cfg(feature = "process")]
17+
pub use kubert_prometheus_process as process;
18+
1819
#[cfg(feature = "stack")]
1920
pub use self::new_metrics::NewMetrics;
2021
pub use self::{

linkerd/metrics/src/process.rs

Lines changed: 0 additions & 232 deletions
This file was deleted.

linkerd/system/Cargo.toml

Lines changed: 0 additions & 17 deletions
This file was deleted.

linkerd/system/src/lib.rs

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)