Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 6 additions & 29 deletions crates/core/src/host/wasm_common/module_host_actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,12 +635,7 @@ impl InstanceCommon {

WORKER_METRICS
.wasm_instance_errors
.with_label_values(
&caller_identity,
&self.info.module_hash,
&caller_connection_id,
procedure_name,
)
.with_label_values(&self.info.database_identity, &self.info.module_hash, procedure_name)
.inc();

// TODO(procedure-energy):
Expand Down Expand Up @@ -747,12 +742,7 @@ impl InstanceCommon {
Err(ExecutionError::Recoverable(err) | ExecutionError::Trap(err)) => {
inst.log_traceback("reducer", reducer_name, &err);

self.handle_outer_error(
&result.stats.energy,
&caller_identity,
&Some(caller_connection_id),
reducer_name,
)
self.handle_outer_error(&result.stats.energy, reducer_name)
}
Err(ExecutionError::User(err)) => {
log_reducer_error(inst.replica_ctx(), timestamp, reducer_name, &err);
Expand Down Expand Up @@ -827,21 +817,10 @@ impl InstanceCommon {
(res, trapped)
}

fn handle_outer_error(
&mut self,
energy: &EnergyStats,
caller_identity: &Identity,
caller_connection_id: &Option<ConnectionId>,
reducer_name: &str,
) -> EventStatus {
fn handle_outer_error(&mut self, energy: &EnergyStats, reducer_name: &str) -> EventStatus {
WORKER_METRICS
.wasm_instance_errors
.with_label_values(
caller_identity,
&self.info.module_hash,
&caller_connection_id.unwrap_or(ConnectionId::ZERO),
reducer_name,
)
.with_label_values(&self.info.database_identity, &self.info.module_hash, reducer_name)
.inc();

if energy.remaining.get() == 0 {
Expand Down Expand Up @@ -964,14 +943,12 @@ impl InstanceCommon {
let outcome = match (result.call_result, sender) {
(Err(ExecutionError::Recoverable(err) | ExecutionError::Trap(err)), _) => {
inst.log_traceback("view", &view_name, &err);
self.handle_outer_error(&result.stats.energy, &caller, &None, &view_name)
.into()
self.handle_outer_error(&result.stats.energy, &view_name).into()
}
// TODO: maybe do something else with user errors?
(Err(ExecutionError::User(err)), _) => {
inst.log_traceback("view", &view_name, &anyhow::anyhow!(err));
self.handle_outer_error(&result.stats.energy, &caller, &None, &view_name)
.into()
self.handle_outer_error(&result.stats.energy, &view_name).into()
}
// Materialize anonymous view
(Ok(bytes), None) => {
Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/worker_metrics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::messages::control_db::HostType;
use once_cell::sync::Lazy;
use prometheus::{GaugeVec, HistogramVec, IntCounterVec, IntGaugeVec};
use spacetimedb_datastore::execution_context::WorkloadType;
use spacetimedb_lib::{ConnectionId, Identity};
use spacetimedb_lib::Identity;
use spacetimedb_metrics::metrics_group;
use spacetimedb_sats::memory_usage::MemoryUsage;
use spacetimedb_table::page_pool::PagePool;
Expand Down Expand Up @@ -243,7 +243,7 @@ metrics_group!(

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

#[name = spacetime_worker_wasm_memory_bytes]
Expand Down
Loading