fixup and fully migrate to metrics 0.22

Commit 12fe5e3b61 updated the
metrics related crates, but not in every one of our crates,
which meant that we were running with a mixture of 0.20
and 0.22.

The result of this was that the memory related metrics
were no long visible to the published prometheus data
because it was only looking at the other version of
the metrics crate!

This commit switches over to using a workspace dep
for metrics so that we update all related crates
together.
This commit is contained in:
Wez Furlong
2024-04-10 10:02:29 -07:00
parent e0326e4c39
commit f0fdec1eb0
8 changed files with 21 additions and 62 deletions
Generated
+10 -52
View File
@@ -17,17 +17,6 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "ahash"
version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9"
dependencies = [
"getrandom",
"once_cell",
"version_check",
]
[[package]]
name = "ahash"
version = "0.8.11"
@@ -930,7 +919,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"lazy_static",
"metrics 0.20.1",
"metrics",
"mlua",
"serde",
"serde_json",
@@ -1952,7 +1941,7 @@ version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
dependencies = [
"ahash 0.8.11",
"ahash",
]
[[package]]
@@ -2679,7 +2668,7 @@ dependencies = [
"kumo-server-runtime",
"libc",
"mac_address",
"metrics 0.22.3",
"metrics",
"metrics-prometheus",
"metrics-tracing-context",
"mlua",
@@ -2734,7 +2723,7 @@ dependencies = [
"cgroups-rs",
"humansize",
"lazy_static",
"metrics 0.20.1",
"metrics",
"nix 0.28.0",
"tikv-jemalloc-sys",
"tikv-jemallocator",
@@ -2794,7 +2783,7 @@ dependencies = [
"maplit",
"memchr",
"message",
"metrics 0.22.3",
"metrics",
"minijinja",
"minijinja-contrib",
"mlua",
@@ -3227,36 +3216,14 @@ dependencies = [
"tokio",
]
[[package]]
name = "metrics"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b9b8653cec6897f73b519a43fba5ee3d50f62fe9af80b428accdcc093b4a849"
dependencies = [
"ahash 0.7.8",
"metrics-macros",
"portable-atomic 0.3.20",
]
[[package]]
name = "metrics"
version = "0.22.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2be3cbd384d4e955b231c895ce10685e3d8260c5ccffae898c96c723b0772835"
dependencies = [
"ahash 0.8.11",
"portable-atomic 1.6.0",
]
[[package]]
name = "metrics-macros"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "731f8ecebd9f3a4aa847dfe75455e4757a45da40a7793d2f0b1f9b6ed18b23f3"
dependencies = [
"proc-macro2 1.0.79",
"quote 1.0.35",
"syn 1.0.109",
"ahash",
"portable-atomic",
]
[[package]]
@@ -3266,7 +3233,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3e1316f9ef05b91f4d0e0a0da5b620ba919d336280b83b36be096b86c030fdd"
dependencies = [
"arc-swap",
"metrics 0.22.3",
"metrics",
"metrics-util",
"once_cell",
"prometheus",
@@ -3284,7 +3251,7 @@ dependencies = [
"indexmap 2.2.6",
"itoa",
"lockfree-object-pool",
"metrics 0.22.3",
"metrics",
"metrics-util",
"once_cell",
"tracing",
@@ -3303,7 +3270,7 @@ dependencies = [
"crossbeam-utils",
"hashbrown 0.14.3",
"indexmap 2.2.6",
"metrics 0.22.3",
"metrics",
"num_cpus",
"ordered-float 4.2.0",
"quanta",
@@ -4221,15 +4188,6 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "portable-atomic"
version = "0.3.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e30165d31df606f5726b090ec7592c308a0eaf61721ff64c9a3018e344a8753e"
dependencies = [
"portable-atomic 1.6.0",
]
[[package]]
name = "portable-atomic"
version = "1.6.0"
+1
View File
@@ -34,6 +34,7 @@ data-encoding = "2.4"
ed25519-dalek = "2.0"
futures = "0.3.28"
libunbound = {git="https://github.com/KumoCorp/libunbound-rs.git", rev="1f629e81919d8aae7e95fff82dc1390912b4ba53"}
metrics = "0.22"
mlua = "0.8"
once_cell = "1.17"
openssl = { version="=0.10.60" } # pinned; see patch below
+1 -1
View File
@@ -8,7 +8,7 @@ edition = "2021"
[dependencies]
anyhow = "1.0"
lazy_static= "1.4"
metrics = "0.20"
metrics = {workspace=true}
mlua = {workspace=true, features=["vendored", "lua54", "async", "send", "serialize"]}
serde = "1.0"
serde_json = "1.0"
+3 -3
View File
@@ -17,18 +17,18 @@ lazy_static::lazy_static! {
"lua_load_count",
"how many times the policy lua script has been \
loaded into a new context");
metrics::register_counter!("lua_load_count")
metrics::counter!("lua_load_count")
};
static ref LUA_COUNT: metrics::Gauge = {
metrics::describe_gauge!(
"lua_count", "the number of lua contexts currently alive");
metrics::register_gauge!("lua_count")
metrics::gauge!("lua_count")
};
static ref LUA_SPARE_COUNT: metrics::Gauge = {
metrics::describe_gauge!(
"lua_spare_count",
"the number of lua contexts available for reuse in the pool");
metrics::register_gauge!("lua_spare_count")
metrics::gauge!("lua_spare_count")
};
static ref CALLBACK_ALLOWS_MULTIPLE: Mutex<HashSet<String>> = Mutex::new(HashSet::new());
}
+1 -1
View File
@@ -26,7 +26,7 @@ kumo-server-memory = {path="../kumo-server-memory"}
kumo-server-runtime = {path="../kumo-server-runtime"}
libc = "0.2.139"
mac_address = "1.1"
metrics = "0.22"
metrics = {workspace=true}
metrics-prometheus = "0.6"
metrics-tracing-context = "0.15"
mlua = {workspace=true, features=["vendored", "lua54", "async", "send", "serialize"]}
+1 -1
View File
@@ -9,7 +9,7 @@ edition = "2021"
anyhow = "1.0"
humansize = "2.1" # for printing
lazy_static = "1.4"
metrics = "0.20"
metrics = {workspace=true}
nix = {version="0.28", features=["resource", "feature"]}
tikv-jemallocator = "0.5"
tikv-jemalloc-sys = {version="0.5", features=["profiling", "unprefixed_malloc_on_supported_platforms"]}
+3 -3
View File
@@ -27,17 +27,17 @@ lazy_static::lazy_static! {
metrics::describe_counter!(
"memory_over_limit_count",
"how many times the soft memory limit was exceeded");
metrics::register_counter!("memory_over_limit_count")
metrics::counter!("memory_over_limit_count")
};
static ref MEM_USAGE: metrics::Gauge = {
metrics::describe_gauge!(
"memory_usage", "number of bytes of used memory");
metrics::register_gauge!("memory_usage")
metrics::gauge!("memory_usage")
};
static ref MEM_LIMIT: metrics::Gauge = {
metrics::describe_gauge!(
"memory_limit", "soft memory limit measured in bytes");
metrics::register_gauge!("memory_limit")
metrics::gauge!("memory_limit")
};
static ref SUBSCRIBER: Mutex<Option<Receiver<()>>> = Mutex::new(None);
}
+1 -1
View File
@@ -39,7 +39,7 @@ maildir = {path="../maildir"}
mailparsing = {path="../mailparsing"}
memchr = "2.5"
message = {path="../message"}
metrics = "0.22"
metrics = {workspace=true}
minijinja-contrib = {version="1.0.9",features=["datetime", "timezone"]}
minijinja = {version="1.0.9",features=["loader", "builtins", "json"]}
mlua = {workspace=true, features=["vendored", "lua54", "async", "send", "serialize"]}