Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove unused server metrics #1171

Merged
merged 1 commit into from
Apr 29, 2024
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
14 changes: 0 additions & 14 deletions crates/core/src/db/db_metrics/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::execution_context::WorkloadType;
use crate::host::AbiCall;
use once_cell::sync::Lazy;
use prometheus::{GaugeVec, HistogramVec, IntCounterVec, IntGaugeVec};
use spacetimedb_data_structures::map::HashMap;
Expand All @@ -11,11 +10,6 @@ use std::sync::Mutex;
metrics_group!(
#[non_exhaustive]
pub struct DbMetrics {
#[name = spacetime_rdb_drop_table_time]
#[help = "The time spent dropping a table"]
#[labels(table_id: u32)]
pub rdb_drop_table_time: HistogramVec,

#[name = spacetime_num_table_rows]
#[help = "The number of rows in a table"]
#[labels(db: Address, table_id: u32, table_name: str)]
Expand Down Expand Up @@ -72,14 +66,6 @@ metrics_group!(
#[labels(txn_type: WorkloadType, db: Address, reducer: str)]
pub rdb_txn_cpu_time_sec_max: GaugeVec,

#[name = spacetime_wasm_abi_call_duration_sec]
#[help = "The total duration of a spacetime wasm abi call (in seconds); includes row serialization and copying into wasm memory"]
#[labels(db: Address, reducer: str, call: AbiCall)]
#[buckets(
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
)]
pub wasm_abi_call_duration_sec: HistogramVec,

#[name = spacetime_message_log_size_bytes]
#[help = "For a given database, the number of bytes occupied by its message log"]
#[labels(db: Address)]
Expand Down
4 changes: 0 additions & 4 deletions crates/core/src/db/relational_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,10 +548,6 @@ impl RelationalDB {
}

pub fn drop_table(&self, ctx: &ExecutionContext, tx: &mut MutTx, table_id: TableId) -> Result<(), DBError> {
let _guard = DB_METRICS
.rdb_drop_table_time
.with_label_values(&table_id.0)
.start_timer();
let table_name = self
.table_name_from_id_mut(ctx, tx, table_id)?
.map(|name| name.to_string())
Expand Down
9 changes: 0 additions & 9 deletions crates/core/src/host/wasm_common/module_host_actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,6 @@ impl<T: WasmInstance> WasmModuleInstance<T> {
let stdb = &*dbic.relational_db.clone();
let address = dbic.address;
let reducer_name = &*self.info.reducers[reducer_id].name;
WORKER_METRICS
.reducer_count
.with_label_values(&address, reducer_name)
.inc();

let _outer_span = tracing::trace_span!("call_reducer",
reducer_name,
Expand Down Expand Up @@ -571,11 +567,6 @@ impl<T: WasmInstance> WasmModuleInstance<T> {
}
reducer_span.exit();

WORKER_METRICS
.reducer_compute_time
.with_label_values(&address, reducer_name)
.observe(timings.total_duration.as_secs_f64());

// Take a lock on our subscriptions now. Otherwise, we could have a race condition where we commit
// the tx, someone adds a subscription and receives this tx as an initial update, and then receives the
// update again when we broadcast_event.
Expand Down
33 changes: 0 additions & 33 deletions crates/core/src/host/wasmtime/wasm_instance_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::ops::DerefMut;
use std::time::Instant;

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

// TODO: make this part of cvt(), maybe?
/// Gather the appropriate metadata and log a wasm_abi_call_duration_ns with the given AbiCall & duration
#[allow(unused)]
fn start_abi_call_timer(&self, call: AbiCall) -> prometheus::HistogramTimer {
let db = self.instance_env().dbic.address;

DB_METRICS
.wasm_abi_call_duration_sec
.with_label_values(&db, &self.reducer_name, &call)
.start_timer()
}

/// Call the function `f` with the name `func`.
/// The function `f` is provided with the callers environment and the host's memory.
///
Expand Down Expand Up @@ -380,10 +367,6 @@ impl WasmInstanceEnv {
/// according to the `ProductType` that the table's schema specifies.
#[tracing::instrument(skip_all)]
pub fn insert(caller: Caller<'_, Self>, table_id: u32, row: WasmPtr<u8>, row_len: u32) -> RtResult<u32> {
// TODO: Instead of writing this metric on every insert call,
// we should aggregate and write at the end of the transaction.
// let _guard = caller.data().start_abi_call_timer(AbiCall::Insert);

Self::cvt(caller, AbiCall::Insert, |caller| {
let (mem, env) = Self::mem_env(caller);

Expand Down Expand Up @@ -425,10 +408,6 @@ impl WasmInstanceEnv {
value_len: u32,
out: WasmPtr<u32>,
) -> RtResult<u32> {
// TODO: Instead of writing this metric on every insert call,
// we should aggregate and write at the end of the transaction.
// let _guard = caller.data().start_abi_call_timer(AbiCall::DeleteByColEq);

Self::cvt_ret(caller, AbiCall::DeleteByColEq, out, |caller| {
let (mem, env) = Self::mem_env(caller);
let ctx = env.reducer_context()?;
Expand Down Expand Up @@ -565,10 +544,6 @@ impl WasmInstanceEnv {
val_len: u32,
out: WasmPtr<BufferIdx>,
) -> RtResult<u32> {
// TODO: Instead of writing this metric on every insert call,
// we should aggregate and write at the end of the transaction.
// let _guard = caller.data().start_abi_call_timer(AbiCall::IterByColEq);

Self::cvt_ret(caller, AbiCall::IterByColEq, out, |caller| {
let (mem, env) = Self::mem_env(caller);
// Read the test value from WASM memory.
Expand Down Expand Up @@ -599,10 +574,6 @@ impl WasmInstanceEnv {
/// - a table with the provided `table_id` doesn't exist
// #[tracing::instrument(skip_all)]
pub fn iter_start(caller: Caller<'_, Self>, table_id: u32, out: WasmPtr<BufferIterIdx>) -> RtResult<u32> {
// TODO: Instead of writing this metric on every insert call,
// we should aggregate and write at the end of the transaction.
// let _guard = caller.data().start_abi_call_timer(AbiCall::IterStart);

Self::cvt_ret(caller, AbiCall::IterStart, out, |caller| {
let env = caller.data_mut();
// Retrieve the execution context for the current reducer.
Expand Down Expand Up @@ -636,10 +607,6 @@ impl WasmInstanceEnv {
filter_len: u32,
out: WasmPtr<BufferIterIdx>,
) -> RtResult<u32> {
// TODO: Instead of writing this metric on every insert call,
// we should aggregate and write at the end of the transaction.
// let _guard = caller.data().start_abi_call_timer(AbiCall::IterStartFiltered);

Self::cvt_ret(caller, AbiCall::IterStartFiltered, out, |caller| {
let (mem, env) = Self::mem_env(caller);
// Retrieve the execution context for the current reducer.
Expand Down
15 changes: 0 additions & 15 deletions crates/core/src/worker_metrics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,6 @@ metrics_group!(
#[labels(identity: Identity)]
pub websocket_sent_msg_size: HistogramVec,

#[name = spacetime_worker_transactions]
#[help = "Number of reducer calls."]
#[labels(database_address: Address, reducer_symbol: str)]
pub reducer_count: IntCounterVec,

#[name = spacetime_worker_module_tx_compute_time]
#[help = "The time it takes to compute and commit after reducer execution."]
#[labels(database_address: Address, reducer_symbol: str)]
pub reducer_compute_time: HistogramVec,

#[name = spacetime_worker_tx_size]
#[help = "The size of committed bytes in the message log after reducer execution."]
#[labels(database_address: Address, reducer_symbol: str)]
pub reducer_write_size: HistogramVec,

#[name = spacetime_worker_instance_operation_queue_length]
#[help = "Length of the wait queue for access to a module instance."]
#[labels(database_address: Address)]
Expand Down
Loading