Skip to content

Commit 353f6e2

Browse files
committed
chore(core): reuse existing metric names
1 parent 3ebfc27 commit 353f6e2

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

core/src/amp_subgraph/metrics.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ impl Metrics {
4040
store.shard().to_string(),
4141
);
4242

43-
let const_labels = [("deployment", &deployment)];
43+
let const_labels = [
44+
("deployment", deployment.to_string()),
45+
("shard", store.shard().to_string()),
46+
];
4447

4548
Self {
4649
deployment_status: DeploymentStatus::new(&metrics_registry, const_labels.clone()),
@@ -69,7 +72,7 @@ impl DeploymentStatus {
6972
) -> Self {
7073
let int_gauge = metrics_registry
7174
.new_int_gauge(
72-
"amp_deployment_status",
75+
"deployment_status",
7376
indoc!(
7477
"
7578
Indicates the current indexing status of a deployment.
@@ -82,7 +85,7 @@ impl DeploymentStatus {
8285
),
8386
const_labels,
8487
)
85-
.expect("failed to register `amp_deployment_status` gauge");
88+
.expect("failed to register `deployment_status` gauge");
8689

8790
Self(int_gauge)
8891
}
@@ -118,11 +121,11 @@ impl DeploymentHead {
118121
) -> Self {
119122
let int_gauge = metrics_registry
120123
.new_int_gauge(
121-
"amp_deployment_head",
124+
"deployment_head",
122125
"Tracks the most recent block number processed by a deployment",
123126
const_labels,
124127
)
125-
.expect("failed to register `amp_deployment_head` gauge");
128+
.expect("failed to register `deployment_head` gauge");
126129

127130
Self(int_gauge)
128131
}
@@ -177,7 +180,7 @@ impl DeploymentSynced {
177180
) -> Self {
178181
let int_gauge = metrics_registry
179182
.new_int_gauge(
180-
"amp_deployment_synced",
183+
"deployment_synced",
181184
indoc!(
182185
"
183186
Indicates whether a deployment has reached the chain head or the end block since it was deployed.
@@ -188,7 +191,7 @@ impl DeploymentSynced {
188191
),
189192
const_labels,
190193
)
191-
.expect("failed to register `amp_deployment_synced` gauge");
194+
.expect("failed to register `deployment_synced` gauge");
192195

193196
Self(int_gauge)
194197
}
@@ -239,11 +242,11 @@ impl BlocksProcessed {
239242
) -> Self {
240243
let int_counter = metrics_registry
241244
.new_int_counter(
242-
"amp_deployment_blocks_processed_count",
245+
"deployment_blocks_processed_count",
243246
"Tracks the total number of blocks processed by a deployment",
244247
const_labels,
245248
)
246-
.expect("failed to register `amp_deployment_blocks_processed_count` counter");
249+
.expect("failed to register `deployment_blocks_processed_count` counter");
247250

248251
Self(int_counter)
249252
}

0 commit comments

Comments
 (0)