diff --git a/packages/db/src/controller/level.ts b/packages/db/src/controller/level.ts
index fe326ceb7d..98e0fba985 100644
--- a/packages/db/src/controller/level.ts
+++ b/packages/db/src/controller/level.ts
@@ -157,7 +157,10 @@ export class LevelDbController implements DatabaseController<Uint8Array, Uint8Ar
* The result might not include recently written data.
*/
approximateSize(start: Uint8Array, end: Uint8Array): Promise<number> {
- return (this.db as LevelNodeJS).approximateSize(start, end);
+ console.time("in approximateSize method");
+ const size = await (this.db as LevelNodeJS).approximateSize(start, end);
+ console.timeEnd("in approximateSize method");
+ return size;
}
/**
@@ -203,6 +206,7 @@ export class LevelDbController implements DatabaseController<Uint8Array, Uint8Ar
/** Capture metric for db size */
private dbSizeMetric(): void {
+ console.time("in dbSizeMetric method");
const timer = this.metrics?.dbApproximateSizeTime.startTimer();
const minKey = Buffer.from([0x00]);
const maxKey = Buffer.from([0xff]);
@@ -210,6 +214,7 @@ export class LevelDbController implements DatabaseController<Uint8Array, Uint8Ar
this.approximateSize(minKey, maxKey)
.then((dbSize) => {
this.metrics?.dbSizeTotal.set(dbSize);
+ console.timeEnd("in dbSizeMetric method");
})
.catch((e) => {
this.logger.debug("Error approximating db size", {}, e);
Last active
February 21, 2023 23:19
-
-
Save nflaig/c1727536fc2beb9f605e16403c7847fb to your computer and use it in GitHub Desktop.
Add console.time to measure approximate db size (git diff)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment