proxy: add measured-tokio

This commit is contained in:
Conrad Ludgate
2024-05-11 11:33:24 +01:00
parent 6351313ae9
commit 2aa74d1aab
6 changed files with 26 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
# This is only present for local builds, as it will be overridden
# by the RUSTDOCFLAGS env var in CI.
rustdocflags = ["-Arustdoc::private_intra_doc_links"]
rustflags = ["--cfg=tokio_unstable"]
[alias]
build_testing = ["build", "--features", "testing"]

12
Cargo.lock generated
View File

@@ -3038,6 +3038,17 @@ dependencies = [
"procfs 0.16.0",
]
[[package]]
name = "measured-tokio"
version = "0.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b4ed0773ddbda3a85e39d0e094934549c410ca686a5095bcd72fb62100252a0"
dependencies = [
"itoa",
"measured",
"tokio",
]
[[package]]
name = "memchr"
version = "2.6.4"
@@ -3079,6 +3090,7 @@ dependencies = [
"libc",
"measured",
"measured-process",
"measured-tokio",
"once_cell",
"procfs 0.14.2",
"prometheus",

View File

@@ -109,6 +109,7 @@ leaky-bucket = "1.0.1"
libc = "0.2"
md5 = "0.7.0"
measured = { version = "0.0.21", features=["lasso"] }
measured-tokio = { version = "0.0.21" }
measured-process = { version = "0.0.21" }
memoffset = "0.8"
native-tls = "0.2"

View File

@@ -18,6 +18,9 @@ workspace_hack.workspace = true
procfs.workspace = true
measured-process.workspace = true
[target.'cfg(tokio_unstable)'.dependencies]
measured-tokio.workspace = true
[dev-dependencies]
rand = "0.8"
rand_distr = "0.4.3"

View File

@@ -148,6 +148,11 @@ pub struct NeonMetrics {
#[metric(init = measured_process::ProcessCollector::for_self())]
process: measured_process::ProcessCollector,
#[cfg(tokio_unstable)]
#[metric(namespace = "tokio")]
#[metric(init = measured_tokio::NamedRuntimesCollector::new())]
pub tokio: measured_tokio::NamedRuntimesCollector,
#[metric(namespace = "libmetrics")]
#[metric(init = LibMetrics::new(build_info))]
libmetrics: LibMetrics,

View File

@@ -268,6 +268,10 @@ async fn main() -> anyhow::Result<()> {
build_tag: BUILD_TAG,
});
// add the current runtime to the collector
#[cfg(tokio_unstable)]
neon_metrics.tokio.add_current("proxy");
let jemalloc = match proxy::jemalloc::MetricRecorder::new() {
Ok(t) => Some(t),
Err(e) => {