-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Improved data storage metrics (#10020)
This PR increases the level of telemetry around all of the node's data stores. For every LMDB instance it reports the size of the specified mapping, the actual DB size and the number of items. Additionally, for the world state we report the number of leaves for every tree along with the pending and proven chain heights. --------- Co-authored-by: ludamad <[email protected]>
- Loading branch information
1 parent
ece1d45
commit c6ab0c9
Showing
20 changed files
with
444 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { type Gauge, type Meter, type Metrics, ValueType } from './telemetry.js'; | ||
|
||
export type LmdbMetricDescriptor = { | ||
name: Metrics; | ||
description: string; | ||
}; | ||
|
||
export class LmdbMetrics { | ||
private dbMapSize: Gauge; | ||
private dbUsedSize: Gauge; | ||
private dbNumItems: Gauge; | ||
|
||
constructor( | ||
meter: Meter, | ||
dbMapSizeDescriptor: LmdbMetricDescriptor, | ||
dbUsedSizeDescriptor: LmdbMetricDescriptor, | ||
dbNumItemsDescriptor: LmdbMetricDescriptor, | ||
) { | ||
this.dbMapSize = meter.createGauge(dbMapSizeDescriptor.name, { | ||
description: dbMapSizeDescriptor.description, | ||
valueType: ValueType.INT, | ||
}); | ||
this.dbUsedSize = meter.createGauge(dbUsedSizeDescriptor.name, { | ||
description: dbUsedSizeDescriptor.description, | ||
valueType: ValueType.INT, | ||
}); | ||
this.dbNumItems = meter.createGauge(dbNumItemsDescriptor.name, { | ||
description: dbNumItemsDescriptor.description, | ||
valueType: ValueType.INT, | ||
}); | ||
} | ||
|
||
public recordDBMetrics(metrics: { mappingSize: number; numItems: number; actualSize: number }) { | ||
this.dbMapSize.record(metrics.mappingSize); | ||
this.dbNumItems.record(metrics.actualSize); | ||
this.dbUsedSize.record(metrics.actualSize); | ||
} | ||
} |
Oops, something went wrong.