Skip to content

Commit 078e4bf

Browse files
committed
refacto: rename metrics
1 parent 65399a4 commit 078e4bf

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

mithril-aggregator/src/http_server/routes/statistics_routes.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ mod handlers {
120120
metrics_service: Arc<MetricsService>,
121121
) -> Result<impl warp::Reply, Infallible> {
122122
metrics_service
123-
.get_cardano_database_immutable_files_restored()
123+
.get_cardano_database_immutable_files_restored_since_startup()
124124
.increment_by(message.nb_immutable_files);
125125

126126
Ok(reply::empty(StatusCode::CREATED))
@@ -131,7 +131,7 @@ mod handlers {
131131
metrics_service: Arc<MetricsService>,
132132
) -> Result<impl warp::Reply, Infallible> {
133133
metrics_service
134-
.get_cardano_database_ancillary_files_restored()
134+
.get_cardano_database_ancillary_files_restored_since_startup()
135135
.increment();
136136

137137
Ok(reply::empty(StatusCode::CREATED))
@@ -143,14 +143,14 @@ mod handlers {
143143
metrics_service: Arc<MetricsService>,
144144
) -> Result<impl warp::Reply, Infallible> {
145145
metrics_service
146-
.get_cardano_database_complete_restoration()
146+
.get_cardano_database_complete_restoration_since_startup()
147147
.increment();
148148

149149
let headers: Vec<(&str, &str)> = Vec::new();
150150
let message = EventMessage::new(
151151
"HTTP::statistics",
152152
"cardano_database_restoration",
153-
&"full".to_string(),
153+
&"complete".to_string(),
154154
headers,
155155
);
156156

@@ -168,7 +168,7 @@ mod handlers {
168168
metrics_service: Arc<MetricsService>,
169169
) -> Result<impl warp::Reply, Infallible> {
170170
metrics_service
171-
.get_cardano_database_partial_restoration()
171+
.get_cardano_database_partial_restoration_since_startup()
172172
.increment();
173173

174174
let headers: Vec<(&str, &str)> = Vec::new();
@@ -323,7 +323,7 @@ mod tests {
323323
let dependency_manager = Arc::new(initialize_dependencies().await);
324324
let metric_counter = dependency_manager
325325
.metrics_service
326-
.get_cardano_database_immutable_files_restored();
326+
.get_cardano_database_immutable_files_restored_since_startup();
327327
let message = CardanoDatabaseImmutableFilesRestoredMessage {
328328
nb_immutable_files: 3,
329329
};
@@ -379,7 +379,7 @@ mod tests {
379379
let dependency_manager = Arc::new(initialize_dependencies().await);
380380
let metric_counter = dependency_manager
381381
.metrics_service
382-
.get_cardano_database_ancillary_files_restored();
382+
.get_cardano_database_ancillary_files_restored_since_startup();
383383

384384
let initial_counter_value = metric_counter.get();
385385

@@ -478,15 +478,15 @@ mod tests {
478478
let message = rx.try_recv().unwrap();
479479
assert_eq!("HTTP::statistics", message.source);
480480
assert_eq!("cardano_database_restoration", message.action);
481-
assert_eq!("full", message.content);
481+
assert_eq!("complete", message.content);
482482
}
483483

484484
#[tokio::test]
485485
async fn increments_metric() {
486486
let (dependency_manager, _rx) = setup_dependencies().await;
487487
let metric_counter = dependency_manager
488488
.metrics_service
489-
.get_cardano_database_complete_restoration();
489+
.get_cardano_database_complete_restoration_since_startup();
490490

491491
let initial_counter_value = metric_counter.get();
492492

@@ -584,7 +584,7 @@ mod tests {
584584
let (dependency_manager, _rx) = setup_dependencies().await;
585585
let metric_counter = dependency_manager
586586
.metrics_service
587-
.get_cardano_database_partial_restoration();
587+
.get_cardano_database_partial_restoration_since_startup();
588588

589589
let initial_counter_value = metric_counter.get();
590590

mithril-aggregator/src/metrics/service.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ build_metrics_service!(
1818
"mithril_aggregator_cardano_db_total_restoration_since_startup",
1919
"Number of Cardano immutable files full restorations since startup on a Mithril aggregator node"
2020
),
21-
cardano_database_immutable_files_restored:MetricCounter(
22-
"mithril_aggregator_cardano_db_immutable_files_restored",
23-
"Number of Cardano immutable files restored on a Mithril aggregator node"
21+
cardano_database_immutable_files_restored_since_startup:MetricCounter(
22+
"mithril_aggregator_cardano_db_immutable_files_restored_since_startup",
23+
"Number of Cardano immutable files restored since startup on a Mithril aggregator node"
2424
),
25-
cardano_database_ancillary_files_restored:MetricCounter(
26-
"mithril_aggregator_cardano_db_ancillary_files_restored",
27-
"Number of Cardano ancillary files restored on a Mithril aggregator node"
25+
cardano_database_ancillary_files_restored_since_startup:MetricCounter(
26+
"mithril_aggregator_cardano_db_ancillary_files_restored_since_startup",
27+
"Number of Cardano ancillary files restored since startup on a Mithril aggregator node"
2828
),
29-
cardano_database_complete_restoration:MetricCounter(
30-
"mithril_aggregator_cardano_db_complete_restoration",
31-
"Number of complete Cardano database restoration on a Mithril aggregator node"
29+
cardano_database_complete_restoration_since_startup:MetricCounter(
30+
"mithril_aggregator_cardano_db_complete_restoration_since_startup",
31+
"Number of complete Cardano database restoration since startup on a Mithril aggregator node"
3232
),
33-
cardano_database_partial_restoration:MetricCounter(
34-
"mithril_aggregator_cardano_db_partial_restoration",
35-
"Number of partial Cardano database restoration on a Mithril aggregator node"
33+
cardano_database_partial_restoration_since_startup:MetricCounter(
34+
"mithril_aggregator_cardano_db_partial_restoration_since_startup",
35+
"Number of partial Cardano database restoration since startup on a Mithril aggregator node"
3636
),
3737
artifact_detail_cardano_database_total_served_since_startup:MetricCounter(
3838
"mithril_aggregator_artifact_detail_cardano_database_total_served_since_startup",

0 commit comments

Comments
 (0)