Skip to content

Commit

Permalink
fix: Ensure LMDB store metrics have hard coded descriptions (#10642)
Browse files Browse the repository at this point in the history
This PR is to fix some of the metrics.
  • Loading branch information
PhilWindle authored Dec 11, 2024
1 parent c75fee0 commit 043e2c2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 40 deletions.
9 changes: 0 additions & 9 deletions yarn-project/archiver/src/archiver/instrumentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,6 @@ export class ArchiverInstrumentation {

this.dbMetrics = new LmdbMetrics(
meter,
{
description: 'Database map size for the archiver',
},
{
description: 'Database used size for the archiver',
},
{
description: 'Num items in the archiver database',
},
{
[Attributes.DB_DATA_TYPE]: 'archiver',
},
Expand Down
9 changes: 0 additions & 9 deletions yarn-project/p2p/src/mem_pools/instrumentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,6 @@ export class PoolInstrumentation<PoolObject extends Gossipable> {

this.dbMetrics = new LmdbMetrics(
meter,
{
description: 'Database map size for the Tx mempool',
},
{
description: 'Database used size for the Tx mempool',
},
{
description: 'Num items in database for the Tx mempool',
},
{
[Attributes.DB_DATA_TYPE]: 'tx-pool',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ export class KVBrokerDatabase implements ProvingBrokerDatabase {
constructor(private store: AztecKVStore, client: TelemetryClient) {
this.metrics = new LmdbMetrics(
client.getMeter('KVBrokerDatabase'),
{
description: 'Database map size for the proving broker',
},
{
description: 'Database used size for the proving broker',
},
{ description: 'Number of items in the broker database' },
{
[Attributes.DB_DATA_TYPE]: 'prover-broker',
},
Expand Down
19 changes: 4 additions & 15 deletions yarn-project/telemetry-client/src/lmdb_metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,24 @@ import {
ValueType,
} from './telemetry.js';

export type LmdbMetricDescriptor = {
description: string;
};

export type LmdbStatsCallback = () => { mappingSize: number; numItems: number; actualSize: number };

export class LmdbMetrics {
private dbMapSize: ObservableGauge;
private dbUsedSize: ObservableGauge;
private dbNumItems: ObservableGauge;

constructor(
meter: Meter,
dbMapSizeDescriptor: LmdbMetricDescriptor,
dbUsedSizeDescriptor: LmdbMetricDescriptor,
dbNumItemsDescriptor: LmdbMetricDescriptor,
private attributes?: Attributes,
private getStats?: LmdbStatsCallback,
) {
constructor(meter: Meter, private attributes?: Attributes, private getStats?: LmdbStatsCallback) {
this.dbMapSize = meter.createObservableGauge(DB_MAP_SIZE, {
description: dbMapSizeDescriptor.description,
description: 'LMDB Map Size',
valueType: ValueType.INT,
});
this.dbUsedSize = meter.createObservableGauge(DB_USED_SIZE, {
description: dbUsedSizeDescriptor.description,
description: 'LMDB Used Size',
valueType: ValueType.INT,
});
this.dbNumItems = meter.createObservableGauge(DB_NUM_ITEMS, {
description: dbNumItemsDescriptor.description,
description: 'LMDB Num Items',
valueType: ValueType.INT,
});

Expand Down

0 comments on commit 043e2c2

Please sign in to comment.