Skip to content

Commit 7e46a6b

Browse files
gautamg795Convex, Inc.
authored andcommitted
bump prometheus fork (#37184)
our prometheus fork had fallen a bit behind upstream and they've made a few minor perf changes since; this rebases on top of those GitOrigin-RevId: 5281fa95cf1623539d8cb945f4c1622b42dd9e4c
1 parent c9fe8b7 commit 7e46a6b

File tree

5 files changed

+48
-20
lines changed

5 files changed

+48
-20
lines changed

Cargo.lock

Lines changed: 22 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ exclude = [ "crates/py_client", "crates/python_client_tests" ]
55

66
[workspace.dependencies]
77
aes = { version = "0.8.4" }
8+
ahash = "0.8"
89
anyhow = "1"
910
async-broadcast = "0.7.0"
1011
async-channel = "2.3.1"
@@ -110,7 +111,7 @@ portpicker = "0.1"
110111
const-oid = "0.9.6"
111112
postgres-native-tls = "^0.5"
112113
pretty_assertions = "1"
113-
prometheus = { git = "https://github.com/get-convex/rust-prometheus", rev = "061619b6e44ca7f3b94d97346152cab319895929" }
114+
prometheus = { git = "https://github.com/get-convex/rust-prometheus", rev = "8794d2bbf2a5a9adc501067ee4440dde6b5e6e25" }
114115
proptest = "1"
115116
proptest-derive = "0.5.0"
116117
proptest-http = { git = "https://github.com/nipunn1313/proptest-http", rev = "0e658bd4f6dbb73bdd3be66f0d2c34c00cc3a446" }
@@ -157,7 +158,7 @@ thousands = "0.2.0"
157158
tld = "2.36.0"
158159
tokio = { version = "1", features = [ "full" ] }
159160
tokio-metrics = { version = "0.4.0" }
160-
tokio-metrics-collector = { version = "0.3.0" }
161+
tokio-metrics-collector = { version = "0.3.1" }
161162
tokio-postgres = { version = "0.7.10", features = [ "with-serde_json-1" ] }
162163
tokio-stream = { version = "0.1", features = [ "io-util", "sync", "signal" ] }
163164
tokio-tungstenite = { version = "0.26.2", features = [ "native-tls-vendored" ] }
@@ -191,7 +192,7 @@ inherits = "release"
191192
strip = "debuginfo"
192193

193194
[patch.crates-io]
194-
prometheus = { git = "https://github.com/get-convex/rust-prometheus", rev = "061619b6e44ca7f3b94d97346152cab319895929" }
195+
prometheus = { git = "https://github.com/get-convex/rust-prometheus", rev = "8794d2bbf2a5a9adc501067ee4440dde6b5e6e25" }
195196

196197
[workspace.lints.rust]
197198
unused_extern_crates = "warn"

crates/metrics/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ license = "LicenseRef-FSL-1.1-Apache-2.0"
99
doctest = false
1010

1111
[dependencies]
12+
ahash = { workspace = true }
1213
anyhow = { workspace = true }
1314
derive_more = { workspace = true }
1415
parking_lot = { workspace = true }

crates/metrics/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fn initialize_server_version() -> String {
6060
.unwrap_or_else(|| "unknown".to_owned());
6161
INIT_VERSION_GAUGE.call_once(|| {
6262
CONVEX_BINARY_VERSIONS_TOTAL
63-
.with_label_values(&[&SERVICE_NAME, &version_str])
63+
.with_label_values(&[&*SERVICE_NAME, &version_str])
6464
.set(1.0);
6565
});
6666
version_str

crates/metrics/src/reporting.rs

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::collections::HashMap;
2+
13
use prometheus::{
24
core::Collector,
35
Gauge,
@@ -23,9 +25,12 @@ pub fn log_counter_with_labels(
2325
increment: u64,
2426
labels: Labels<'_>,
2527
) {
26-
match prometheus_counter
27-
.get_metric_with(&labels.iter().map(MetricLabel::split_key_value).collect())
28-
{
28+
match prometheus_counter.get_metric_with(
29+
&labels
30+
.iter()
31+
.map(MetricLabel::split_key_value)
32+
.collect::<HashMap<_, _, ahash::RandomState>>(),
33+
) {
2934
Ok(metric) => metric.inc_by(increment),
3035
Err(e) => {
3136
log_invalid_metric(get_desc(prometheus_counter), e);
@@ -38,9 +43,12 @@ pub fn log_gauge(prometheus_gauge: &Gauge, value: f64) {
3843
}
3944

4045
pub fn log_gauge_with_labels(prometheus_gauge: &GaugeVec, value: f64, labels: Labels<'_>) {
41-
match prometheus_gauge
42-
.get_metric_with(&labels.iter().map(MetricLabel::split_key_value).collect())
43-
{
46+
match prometheus_gauge.get_metric_with(
47+
&labels
48+
.iter()
49+
.map(MetricLabel::split_key_value)
50+
.collect::<HashMap<_, _, ahash::RandomState>>(),
51+
) {
4452
Ok(metric) => metric.set(value),
4553
Err(e) => {
4654
log_invalid_metric(get_desc(prometheus_gauge), e);
@@ -57,9 +65,12 @@ pub fn log_distribution_with_labels(
5765
value: f64,
5866
labels: Labels<'_>,
5967
) {
60-
match prometheus_histogram
61-
.get_metric_with(&labels.iter().map(MetricLabel::split_key_value).collect())
62-
{
68+
match prometheus_histogram.get_metric_with(
69+
&labels
70+
.iter()
71+
.map(MetricLabel::split_key_value)
72+
.collect::<HashMap<_, _, ahash::RandomState>>(),
73+
) {
6374
Ok(metric) => metric.observe(value),
6475
Err(e) => {
6576
log_invalid_metric(get_desc(prometheus_histogram), e);

0 commit comments

Comments
 (0)