Skip to content

Commit 486d78f

Browse files
committed
Observability: start + elapsed-ms logs on reset_replication
Paired 'reset_replication: starting for namespace X' and 'rebuilt replication log for namespace X in Yms' log lines. Lets ops correlate recovery events to client-side metrics and measure tail latency in prod. No performance impact (info! tracing is near-zero cost).
1 parent 113964f commit 486d78f

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

libsql-server/src/namespace/store.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@ impl NamespaceStore {
271271
return Err(Error::NamespaceDoesntExist(namespace.to_string()));
272272
}
273273

274+
let start = Instant::now();
275+
tracing::info!("reset_replication: starting for namespace {namespace}");
276+
274277
// Load the namespace first so we can resolve its on-disk path
275278
// cleanly. This is effectively a no-op if it's already hot.
276279
let db_config = self.inner.metadata.handle(namespace.clone()).await;
@@ -390,7 +393,10 @@ impl NamespaceStore {
390393
.await?;
391394
lock.replace(ns);
392395

393-
tracing::info!("reset_replication: rebuilt replication log for namespace {namespace}");
396+
let elapsed_ms = start.elapsed().as_millis();
397+
tracing::info!(
398+
"reset_replication: rebuilt replication log for namespace {namespace} in {elapsed_ms}ms"
399+
);
394400
Ok(())
395401
}
396402

0 commit comments

Comments
 (0)