From f441fe57d47cade9454bc584f6b820c868d43272 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Tue, 6 Sep 2022 17:35:40 +0300 Subject: [PATCH] Register prometheus counters correctly. Commit f081419e68 moved all the prometheus counters to `metrics.rs`, but accidentally replaced a couple of `register_int_counter!(...)` calls with just `IntCounter::new(...)`. Because of that, the counters were not registered in the metrics registry, and were not exposed through the metrics HTTP endpoint. Fixes failures we're seeing in a bunch of 'performance' tests because of the missing metrics. --- pageserver/src/metrics.rs | 4 ++-- test_runner/fixtures/benchmark_fixture.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pageserver/src/metrics.rs b/pageserver/src/metrics.rs index 35fdeacce5..ada0bbd359 100644 --- a/pageserver/src/metrics.rs +++ b/pageserver/src/metrics.rs @@ -107,7 +107,7 @@ static CURRENT_LOGICAL_SIZE: Lazy = Lazy::new(|| { // Metrics for cloud upload. These metrics reflect data uploaded to cloud storage, // or in testing they estimate how much we would upload if we did. static NUM_PERSISTENT_FILES_CREATED: Lazy = Lazy::new(|| { - IntCounter::new( + register_int_counter!( "pageserver_created_persistent_files_total", "Number of files created that are meant to be uploaded to cloud storage", ) @@ -115,7 +115,7 @@ static NUM_PERSISTENT_FILES_CREATED: Lazy = Lazy::new(|| { }); static PERSISTENT_BYTES_WRITTEN: Lazy = Lazy::new(|| { - IntCounter::new( + register_int_counter!( "pageserver_written_persistent_bytes_total", "Total bytes written that are meant to be uploaded to cloud storage", ) diff --git a/test_runner/fixtures/benchmark_fixture.py b/test_runner/fixtures/benchmark_fixture.py index 338cc47ea2..b9cdfdebc4 100644 --- a/test_runner/fixtures/benchmark_fixture.py +++ b/test_runner/fixtures/benchmark_fixture.py @@ -362,7 +362,7 @@ class NeonBenchmarker: # and round to integer. all_metrics = pageserver.http_client().get_metrics() matches = re.search(rf"^{metric_name} (\S+)$", all_metrics, re.MULTILINE) - assert matches + assert matches, f"metric {metric_name} not found" return int(round(float(matches.group(1)))) def get_timeline_size(self, repo_dir: Path, tenantid: ZTenantId, timelineid: ZTimelineId):