Skip to content

Commit 0fa8312

Browse files
chore: Remove unused server metrics (#1171)
1 parent 0c7530f commit 0fa8312

File tree

5 files changed

+0
-75
lines changed

5 files changed

+0
-75
lines changed

crates/core/src/db/db_metrics/mod.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::execution_context::WorkloadType;
2-
use crate::host::AbiCall;
32
use once_cell::sync::Lazy;
43
use prometheus::{GaugeVec, HistogramVec, IntCounterVec, IntGaugeVec};
54
use spacetimedb_data_structures::map::HashMap;
@@ -11,11 +10,6 @@ use std::sync::Mutex;
1110
metrics_group!(
1211
#[non_exhaustive]
1312
pub struct DbMetrics {
14-
#[name = spacetime_rdb_drop_table_time]
15-
#[help = "The time spent dropping a table"]
16-
#[labels(table_id: u32)]
17-
pub rdb_drop_table_time: HistogramVec,
18-
1913
#[name = spacetime_num_table_rows]
2014
#[help = "The number of rows in a table"]
2115
#[labels(db: Address, table_id: u32, table_name: str)]
@@ -72,14 +66,6 @@ metrics_group!(
7266
#[labels(txn_type: WorkloadType, db: Address, reducer: str)]
7367
pub rdb_txn_cpu_time_sec_max: GaugeVec,
7468

75-
#[name = spacetime_wasm_abi_call_duration_sec]
76-
#[help = "The total duration of a spacetime wasm abi call (in seconds); includes row serialization and copying into wasm memory"]
77-
#[labels(db: Address, reducer: str, call: AbiCall)]
78-
#[buckets(
79-
1e-6, 5e-6, 1e-5, 5e-5, 1e-4, 5e-4, 1e-3, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0
80-
)]
81-
pub wasm_abi_call_duration_sec: HistogramVec,
82-
8369
#[name = spacetime_message_log_size_bytes]
8470
#[help = "For a given database, the number of bytes occupied by its message log"]
8571
#[labels(db: Address)]

crates/core/src/db/relational_db.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -548,10 +548,6 @@ impl RelationalDB {
548548
}
549549

550550
pub fn drop_table(&self, ctx: &ExecutionContext, tx: &mut MutTx, table_id: TableId) -> Result<(), DBError> {
551-
let _guard = DB_METRICS
552-
.rdb_drop_table_time
553-
.with_label_values(&table_id.0)
554-
.start_timer();
555551
let table_name = self
556552
.table_name_from_id_mut(ctx, tx, table_id)?
557553
.map(|name| name.to_string())

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -509,10 +509,6 @@ impl<T: WasmInstance> WasmModuleInstance<T> {
509509
let stdb = &*dbic.relational_db.clone();
510510
let address = dbic.address;
511511
let reducer_name = &*self.info.reducers[reducer_id].name;
512-
WORKER_METRICS
513-
.reducer_count
514-
.with_label_values(&address, reducer_name)
515-
.inc();
516512

517513
let _outer_span = tracing::trace_span!("call_reducer",
518514
reducer_name,
@@ -577,11 +573,6 @@ impl<T: WasmInstance> WasmModuleInstance<T> {
577573
}
578574
reducer_span.exit();
579575

580-
WORKER_METRICS
581-
.reducer_compute_time
582-
.with_label_values(&address, reducer_name)
583-
.observe(timings.total_duration.as_secs_f64());
584-
585576
// Take a lock on our subscriptions now. Otherwise, we could have a race condition where we commit
586577
// the tx, someone adds a subscription and receives this tx as an initial update, and then receives the
587578
// update again when we broadcast_event.

crates/core/src/host/wasmtime/wasm_instance_env.rs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use std::ops::DerefMut;
44
use std::time::Instant;
55

66
use crate::database_logger::{BacktraceFrame, BacktraceProvider, ModuleBacktrace, Record};
7-
use crate::db::db_metrics::DB_METRICS;
87
use crate::execution_context::ExecutionContext;
98
use crate::host::scheduler::{ScheduleError, ScheduledReducerId};
109
use crate::host::timestamp::Timestamp;
@@ -158,18 +157,6 @@ impl WasmInstanceEnv {
158157
self.instance_env().get_ctx().map_err(|err| WasmError::Db(err.into()))
159158
}
160159

161-
// TODO: make this part of cvt(), maybe?
162-
/// Gather the appropriate metadata and log a wasm_abi_call_duration_ns with the given AbiCall & duration
163-
#[allow(unused)]
164-
fn start_abi_call_timer(&self, call: AbiCall) -> prometheus::HistogramTimer {
165-
let db = self.instance_env().dbic.address;
166-
167-
DB_METRICS
168-
.wasm_abi_call_duration_sec
169-
.with_label_values(&db, &self.reducer_name, &call)
170-
.start_timer()
171-
}
172-
173160
/// Call the function `f` with the name `func`.
174161
/// The function `f` is provided with the callers environment and the host's memory.
175162
///
@@ -380,10 +367,6 @@ impl WasmInstanceEnv {
380367
/// according to the `ProductType` that the table's schema specifies.
381368
#[tracing::instrument(skip_all)]
382369
pub fn insert(caller: Caller<'_, Self>, table_id: u32, row: WasmPtr<u8>, row_len: u32) -> RtResult<u32> {
383-
// TODO: Instead of writing this metric on every insert call,
384-
// we should aggregate and write at the end of the transaction.
385-
// let _guard = caller.data().start_abi_call_timer(AbiCall::Insert);
386-
387370
Self::cvt(caller, AbiCall::Insert, |caller| {
388371
let (mem, env) = Self::mem_env(caller);
389372

@@ -425,10 +408,6 @@ impl WasmInstanceEnv {
425408
value_len: u32,
426409
out: WasmPtr<u32>,
427410
) -> RtResult<u32> {
428-
// TODO: Instead of writing this metric on every insert call,
429-
// we should aggregate and write at the end of the transaction.
430-
// let _guard = caller.data().start_abi_call_timer(AbiCall::DeleteByColEq);
431-
432411
Self::cvt_ret(caller, AbiCall::DeleteByColEq, out, |caller| {
433412
let (mem, env) = Self::mem_env(caller);
434413
let ctx = env.reducer_context()?;
@@ -565,10 +544,6 @@ impl WasmInstanceEnv {
565544
val_len: u32,
566545
out: WasmPtr<BufferIdx>,
567546
) -> RtResult<u32> {
568-
// TODO: Instead of writing this metric on every insert call,
569-
// we should aggregate and write at the end of the transaction.
570-
// let _guard = caller.data().start_abi_call_timer(AbiCall::IterByColEq);
571-
572547
Self::cvt_ret(caller, AbiCall::IterByColEq, out, |caller| {
573548
let (mem, env) = Self::mem_env(caller);
574549
// Read the test value from WASM memory.
@@ -599,10 +574,6 @@ impl WasmInstanceEnv {
599574
/// - a table with the provided `table_id` doesn't exist
600575
// #[tracing::instrument(skip_all)]
601576
pub fn iter_start(caller: Caller<'_, Self>, table_id: u32, out: WasmPtr<BufferIterIdx>) -> RtResult<u32> {
602-
// TODO: Instead of writing this metric on every insert call,
603-
// we should aggregate and write at the end of the transaction.
604-
// let _guard = caller.data().start_abi_call_timer(AbiCall::IterStart);
605-
606577
Self::cvt_ret(caller, AbiCall::IterStart, out, |caller| {
607578
let env = caller.data_mut();
608579
// Retrieve the execution context for the current reducer.
@@ -636,10 +607,6 @@ impl WasmInstanceEnv {
636607
filter_len: u32,
637608
out: WasmPtr<BufferIterIdx>,
638609
) -> RtResult<u32> {
639-
// TODO: Instead of writing this metric on every insert call,
640-
// we should aggregate and write at the end of the transaction.
641-
// let _guard = caller.data().start_abi_call_timer(AbiCall::IterStartFiltered);
642-
643610
Self::cvt_ret(caller, AbiCall::IterStartFiltered, out, |caller| {
644611
let (mem, env) = Self::mem_env(caller);
645612
// Retrieve the execution context for the current reducer.

crates/core/src/worker_metrics/mod.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,6 @@ metrics_group!(
3434
#[labels(identity: Identity)]
3535
pub websocket_sent_msg_size: HistogramVec,
3636

37-
#[name = spacetime_worker_transactions]
38-
#[help = "Number of reducer calls."]
39-
#[labels(database_address: Address, reducer_symbol: str)]
40-
pub reducer_count: IntCounterVec,
41-
42-
#[name = spacetime_worker_module_tx_compute_time]
43-
#[help = "The time it takes to compute and commit after reducer execution."]
44-
#[labels(database_address: Address, reducer_symbol: str)]
45-
pub reducer_compute_time: HistogramVec,
46-
47-
#[name = spacetime_worker_tx_size]
48-
#[help = "The size of committed bytes in the message log after reducer execution."]
49-
#[labels(database_address: Address, reducer_symbol: str)]
50-
pub reducer_write_size: HistogramVec,
51-
5237
#[name = spacetime_worker_instance_operation_queue_length]
5338
#[help = "Length of the wait queue for access to a module instance."]
5439
#[labels(database_address: Address)]

0 commit comments

Comments
 (0)