Skip to content

Commit b0e38ba

Browse files
committed
Change spacetime_worker_wasm_instance_errors_total metric's labels
There are two purpose for introducing the changes in this commit: 1. Decrease the cardinality of the metric, as caller id and connection id combination would result in way too many combinations 2. Add a database_identity label, which is much more useful for the metric
1 parent 08011a7 commit b0e38ba

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

crates/core/src/host/wasm_common/module_host_actor.rs

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -473,12 +473,7 @@ impl InstanceCommon {
473473

474474
WORKER_METRICS
475475
.wasm_instance_errors
476-
.with_label_values(
477-
&caller_identity,
478-
&self.info.module_hash,
479-
&caller_connection_id,
480-
procedure_name,
481-
)
476+
.with_label_values(&self.info.database_identity, &self.info.module_hash, procedure_name)
482477
.inc();
483478

484479
// TODO(procedure-energy):
@@ -655,18 +650,12 @@ impl InstanceCommon {
655650
fn handle_outer_error(
656651
&mut self,
657652
energy: &EnergyStats,
658-
caller_identity: &Identity,
659-
caller_connection_id: &Option<ConnectionId>,
653+
database_identity: Identity,
660654
reducer_name: &str,
661655
) -> EventStatus {
662656
WORKER_METRICS
663657
.wasm_instance_errors
664-
.with_label_values(
665-
caller_identity,
666-
&self.info.module_hash,
667-
&caller_connection_id.unwrap_or(ConnectionId::ZERO),
668-
reducer_name,
669-
)
658+
.with_label_values(&database_identity, &self.info.module_hash, reducer_name)
670659
.inc();
671660

672661
if energy.remaining.get() == 0 {
@@ -782,7 +771,7 @@ impl InstanceCommon {
782771
Err(ExecutionError::User(err)) => {
783772
inst.log_traceback("view", view_name, &anyhow::anyhow!(err));
784773

785-
self.handle_outer_error(&result.stats.energy, &caller_identity, &caller_connection_id, view_name)
774+
self.handle_outer_error(&result.stats.energy, replica_ctx.database_identity, view_name)
786775
.into()
787776
}
788777
Ok(res) => {

crates/core/src/worker_metrics/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ metrics_group!(
243243

244244
#[name = spacetime_worker_wasm_instance_errors_total]
245245
#[help = "The number of fatal WASM instance errors, such as reducer panics."]
246-
#[labels(caller_identity: Identity, module_hash: Hash, caller_connection_id: ConnectionId, reducer_symbol: str)]
246+
#[labels(database_identity: Identity, module_hash: Hash, reducer_symbol: str)]
247247
pub wasm_instance_errors: IntCounterVec,
248248

249249
#[name = spacetime_worker_wasm_memory_bytes]

0 commit comments

Comments
 (0)