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

fix: Ensure LMDB store metrics have hard coded descriptions #10642

Merged
merged 1 commit into from
Dec 11, 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
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
Loading