Skip to content

Commit 6818667

Browse files
committed
feat: add the network origin HTTP to the register-signatures endpoint of the API
1 parent 4d382b9 commit 6818667

File tree

2 files changed

+23
-22
lines changed

2 files changed

+23
-22
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ mod handlers {
5353

5454
metrics_service
5555
.get_signature_registration_total_received_since_startup()
56-
.increment(&[origin_tag.as_deref().unwrap_or_default()]);
56+
.increment(&["HTTP"]);
5757

5858
let signed_entity_type = message.signed_entity_type.clone();
5959
let signed_message = message.signed_message.clone();
@@ -158,16 +158,14 @@ mod tests {
158158
let initial_counter_value = dependency_manager
159159
.metrics_service
160160
.get_signature_registration_total_received_since_startup()
161-
.get(&["TEST"]);
161+
.get(&["HTTP"]);
162162

163163
request()
164164
.method(method)
165165
.path(path)
166166
.json(&RegisterSignatureMessage::dummy())
167-
.header(MITHRIL_ORIGIN_TAG_HEADER, "TEST")
168-
.reply(&setup_router(RouterState::new_with_origin_tag_white_list(
167+
.reply(&setup_router(RouterState::new_with_dummy_config(
169168
dependency_manager.clone(),
170-
&["TEST"],
171169
)))
172170
.await;
173171

@@ -176,7 +174,7 @@ mod tests {
176174
dependency_manager
177175
.metrics_service
178176
.get_signature_registration_total_received_since_startup()
179-
.get(&["TEST"])
177+
.get(&["HTTP"])
180178
);
181179
}
182180

mithril-aggregator/src/metrics/service.rs

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,85 +5,88 @@ use mithril_metric::{build_metrics_service, MetricCounterWithLabels, MetricsServ
55
use mithril_metric::metric::{MetricCollector, MetricCounter};
66
use prometheus::proto::{LabelPair, MetricFamily};
77

8-
static ORIGIN_TAG_LABEL: &str = "origin_tag";
8+
// Those are three differents dimensions, they use the same value to simplify usage in Grafana
9+
static CLIENT_ORIGIN_TAG_LABEL: &str = "origin_tag";
10+
static SIGNER_REGISTRATION_ORIGIN_TAG_LABEL: &str = "origin_tag";
11+
static SIGNER_SIGNATURE_ORIGIN_TAG_LABEL: &str = "origin_tag";
912

1013
build_metrics_service!(
1114
MetricsService,
1215

1316
certificate_detail_total_served_since_startup:MetricCounterWithLabels(
1417
"certificate_detail_total_served_since_startup",
1518
"Number of certificate details served since startup on a Mithril aggregator node",
16-
&[ORIGIN_TAG_LABEL]
19+
&[CLIENT_ORIGIN_TAG_LABEL]
1720
),
1821
artifact_detail_cardano_immutable_files_full_total_served_since_startup:MetricCounterWithLabels(
1922
"mithril_aggregator_artifact_detail_cardano_db_total_served_since_startup",
2023
"Number of Cardano immutable files full artifact details served since startup on a Mithril aggregator node",
21-
&[ORIGIN_TAG_LABEL]
24+
&[CLIENT_ORIGIN_TAG_LABEL]
2225
),
2326
cardano_immutable_files_full_total_restoration_since_startup:MetricCounterWithLabels(
2427
"mithril_aggregator_cardano_db_total_restoration_since_startup",
2528
"Number of Cardano immutable files full restorations since startup on a Mithril aggregator node",
26-
&[ORIGIN_TAG_LABEL]
29+
&[CLIENT_ORIGIN_TAG_LABEL]
2730
),
2831
cardano_database_immutable_files_restored_since_startup:MetricCounterWithLabels(
2932
"mithril_aggregator_cardano_db_immutable_files_restored_since_startup",
3033
"Number of Cardano immutable files restored since startup on a Mithril aggregator node",
31-
&[ORIGIN_TAG_LABEL]
34+
&[CLIENT_ORIGIN_TAG_LABEL]
3235
),
3336
cardano_database_ancillary_files_restored_since_startup:MetricCounterWithLabels(
3437
"mithril_aggregator_cardano_db_ancillary_files_restored_since_startup",
3538
"Number of Cardano ancillary files restored since startup on a Mithril aggregator node",
36-
&[ORIGIN_TAG_LABEL]
39+
&[CLIENT_ORIGIN_TAG_LABEL]
3740
),
3841
cardano_database_complete_restoration_since_startup:MetricCounterWithLabels(
3942
"mithril_aggregator_cardano_db_complete_restoration_since_startup",
4043
"Number of complete Cardano database restoration since startup on a Mithril aggregator node",
41-
&[ORIGIN_TAG_LABEL]
44+
&[CLIENT_ORIGIN_TAG_LABEL]
4245
),
4346
cardano_database_partial_restoration_since_startup:MetricCounterWithLabels(
4447
"mithril_aggregator_cardano_db_partial_restoration_since_startup",
4548
"Number of partial Cardano database restoration since startup on a Mithril aggregator node",
46-
&[ORIGIN_TAG_LABEL]
49+
&[CLIENT_ORIGIN_TAG_LABEL]
4750
),
4851
artifact_detail_cardano_database_total_served_since_startup:MetricCounterWithLabels(
4952
"mithril_aggregator_artifact_detail_cardano_database_total_served_since_startup",
5053
"Number of Cardano database artifact details served since startup on a Mithril aggregator node",
51-
&[ORIGIN_TAG_LABEL]
54+
&[CLIENT_ORIGIN_TAG_LABEL]
5255
),
5356
artifact_detail_mithril_stake_distribution_total_served_since_startup:MetricCounterWithLabels(
5457
"mithril_aggregator_artifact_detail_mithril_stake_distribution_total_served_since_startup",
5558
"Number of Mithril stake distribution artifact details served since startup on a Mithril aggregator node",
56-
&[ORIGIN_TAG_LABEL]
59+
&[CLIENT_ORIGIN_TAG_LABEL]
5760
),
5861
artifact_detail_cardano_stake_distribution_total_served_since_startup:MetricCounterWithLabels(
5962
"mithril_aggregator_artifact_detail_cardano_stake_distribution_total_served_since_startup",
6063
"Number of Cardano stake distribution artifact details served since startup on a Mithril aggregator node",
61-
&[ORIGIN_TAG_LABEL]
64+
&[CLIENT_ORIGIN_TAG_LABEL]
6265
),
6366
artifact_detail_cardano_transaction_total_served_since_startup:MetricCounterWithLabels(
6467
"mithril_aggregator_artifact_detail_cardano_transaction_total_served_since_startup",
6568
"Number of Cardano transaction artifact details served since startup on a Mithril aggregator node",
66-
&[ORIGIN_TAG_LABEL]
69+
&[CLIENT_ORIGIN_TAG_LABEL]
6770
),
6871
proof_cardano_transaction_total_proofs_served_since_startup:MetricCounterWithLabels(
6972
"mithril_aggregator_proof_cardano_transaction_total_proofs_served_since_startup",
7073
"Number of Cardano transaction proofs served since startup on a Mithril aggregator node",
71-
&[ORIGIN_TAG_LABEL]
74+
&[CLIENT_ORIGIN_TAG_LABEL]
7275
),
7376
proof_cardano_transaction_total_transactions_served_since_startup:MetricCounterWithLabels(
7477
"mithril_aggregator_proof_cardano_transaction_total_transactions_served_since_startup",
7578
"Number of Cardano transaction hashes requested for proof since startup on a Mithril aggregator node",
76-
&[ORIGIN_TAG_LABEL]
79+
&[CLIENT_ORIGIN_TAG_LABEL]
7780
),
7881
signer_registration_total_received_since_startup:MetricCounterWithLabels(
7982
"mithril_aggregator_signer_registration_total_received_since_startup",
8083
"Number of signer registrations received since startup on a Mithril aggregator node",
81-
&[ORIGIN_TAG_LABEL]
84+
&[SIGNER_REGISTRATION_ORIGIN_TAG_LABEL]
8285
),
8386
signature_registration_total_received_since_startup:MetricCounterWithLabels(
8487
"mithril_aggregator_signature_registration_total_received_since_startup",
8588
"Number of signature registrations received since startup on a Mithril aggregator node",
86-
&[ORIGIN_TAG_LABEL]
89+
&[SIGNER_SIGNATURE_ORIGIN_TAG_LABEL]
8790
),
8891
certificate_total_produced_since_startup:MetricCounter(
8992
"mithril_aggregator_certificate_total_produced_since_startup",

0 commit comments

Comments
 (0)