Add process metrics
continuous-integration/drone the build failed Details

This commit is contained in:
Olivier 'reivilibre' 2022-03-21 20:19:59 +00:00
parent 2d35298a2e
commit 05ebfc8998
3 changed files with 32 additions and 0 deletions

24
Cargo.lock generated
View File

@ -2347,6 +2347,14 @@ dependencies = [
"syn",
]
[[package]]
name = "metrics-process-promstyle"
version = "0.18.0"
dependencies = [
"metrics 0.18.1",
"procfs",
]
[[package]]
name = "metrics-util"
version = "0.12.0"
@ -2913,6 +2921,21 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "procfs"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0941606b9934e2d98a3677759a971756eb821f75764d0e0d26946d08e74d9104"
dependencies = [
"bitflags",
"byteorder",
"chrono",
"flate2",
"hex",
"lazy_static",
"libc",
]
[[package]]
name = "psl"
version = "2.0.81"
@ -3042,6 +3065,7 @@ dependencies = [
"mdbx-sys",
"metrics 0.18.1",
"metrics-exporter-prometheus",
"metrics-process-promstyle",
"ouroboros",
"publicsuffix",
"quickpeep_densedoc",

View File

@ -77,4 +77,5 @@ lingua = "1.3.3"
### Metrics
metrics = "0.18.1"
metrics-exporter-prometheus = { version = "0.9.0", default-features = false, features = ["http-listener"] }
metrics-process-promstyle = { path = "../../../libraries/metrics-process-promstyle" }
bare-metrics-recorder = "0.1.0"

View File

@ -124,6 +124,12 @@ pub async fn main() -> anyhow::Result<()> {
warn!("BARE Metrics not supported yet, sorry.");
}
let metrics_enabled = config.metrics.prometheus.is_some() || config.metrics.bare_metrics;
if metrics_enabled {
metrics_process_promstyle::describe();
}
let num_tasks = opts.concurrent_jobs + opts.concurrent_sleepers;
let semaphore = Arc::new(Semaphore::new(opts.concurrent_jobs as usize));
@ -214,6 +220,7 @@ pub async fn main() -> anyhow::Result<()> {
_ = interval.tick() => {
let txn = store.ro_txn()?;
txn.emit_datastore_metrics()?;
metrics_process_promstyle::emit_now()?;
}
_ = &mut dsmu_cancel_rx => {
break;