Skip to content

Commit e38bc42

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 e38bc42

File tree

2 files changed

+7
-30
lines changed

2 files changed

+7
-30
lines changed

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

Lines changed: 6 additions & 29 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):
@@ -593,12 +588,7 @@ impl InstanceCommon {
593588
Err(ExecutionError::Recoverable(err) | ExecutionError::Trap(err)) => {
594589
inst.log_traceback("reducer", reducer_name, &err);
595590

596-
self.handle_outer_error(
597-
&result.stats.energy,
598-
&caller_identity,
599-
&Some(caller_connection_id),
600-
reducer_name,
601-
)
591+
self.handle_outer_error(&result.stats.energy, reducer_name)
602592
}
603593
Err(ExecutionError::User(err)) => {
604594
log_reducer_error(inst.replica_ctx(), timestamp, reducer_name, &err);
@@ -652,21 +642,10 @@ impl InstanceCommon {
652642
(res, trapped)
653643
}
654644

655-
fn handle_outer_error(
656-
&mut self,
657-
energy: &EnergyStats,
658-
caller_identity: &Identity,
659-
caller_connection_id: &Option<ConnectionId>,
660-
reducer_name: &str,
661-
) -> EventStatus {
645+
fn handle_outer_error(&mut self, energy: &EnergyStats, reducer_name: &str) -> EventStatus {
662646
WORKER_METRICS
663647
.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-
)
648+
.with_label_values(&self.info.database_identity, &self.info.module_hash, reducer_name)
670649
.inc();
671650

672651
if energy.remaining.get() == 0 {
@@ -775,15 +754,13 @@ impl InstanceCommon {
775754
Err(ExecutionError::Recoverable(err) | ExecutionError::Trap(err)) => {
776755
inst.log_traceback("view", view_name, &err);
777756

778-
self.handle_outer_error(&result.stats.energy, &caller_identity, &caller_connection_id, view_name)
779-
.into()
757+
self.handle_outer_error(&result.stats.energy, view_name).into()
780758
}
781759
// TODO: maybe do something else with user errors?
782760
Err(ExecutionError::User(err)) => {
783761
inst.log_traceback("view", view_name, &anyhow::anyhow!(err));
784762

785-
self.handle_outer_error(&result.stats.energy, &caller_identity, &caller_connection_id, view_name)
786-
.into()
763+
self.handle_outer_error(&result.stats.energy, view_name).into()
787764
}
788765
Ok(res) => {
789766
let db = &inst.replica_ctx().relational_db;

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)