@aztec/telemetry-client 0.0.1-commit.6d3c34e → 0.0.1-commit.7ac86ea28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/attributes.d.ts +5 -1
- package/dest/attributes.d.ts.map +1 -1
- package/dest/attributes.js +2 -0
- package/dest/lmdb_metrics.d.ts +2 -2
- package/dest/lmdb_metrics.d.ts.map +1 -1
- package/dest/metric-utils.d.ts +21 -2
- package/dest/metric-utils.d.ts.map +1 -1
- package/dest/metric-utils.js +52 -0
- package/dest/metrics.d.ts +32 -4
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +162 -12
- package/dest/nodejs_metrics_monitor.d.ts +1 -1
- package/dest/nodejs_metrics_monitor.d.ts.map +1 -1
- package/dest/nodejs_metrics_monitor.js +7 -1
- package/dest/otel_resource.d.ts +1 -1
- package/dest/otel_resource.d.ts.map +1 -1
- package/dest/otel_resource.js +14 -2
- package/dest/prom_otel_adapter.d.ts +4 -4
- package/dest/prom_otel_adapter.d.ts.map +1 -1
- package/dest/prom_otel_adapter.js +4 -3
- package/dest/start.d.ts +3 -2
- package/dest/start.d.ts.map +1 -1
- package/dest/start.js +2 -2
- package/dest/telemetry.d.ts +4 -3
- package/dest/telemetry.d.ts.map +1 -1
- package/dest/telemetry.js +1 -1
- package/dest/wrappers/l2_block_stream.d.ts +2 -2
- package/dest/wrappers/l2_block_stream.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/attributes.ts +6 -0
- package/src/metric-utils.ts +64 -1
- package/src/metrics.ts +166 -12
- package/src/nodejs_metrics_monitor.ts +4 -1
- package/src/otel_resource.ts +19 -2
- package/src/prom_otel_adapter.ts +4 -5
- package/src/start.ts +6 -3
- package/src/telemetry.ts +4 -2
- package/src/wrappers/l2_block_stream.ts +1 -1
package/src/metrics.ts
CHANGED
|
@@ -167,6 +167,55 @@ export const MEMPOOL_TX_MINED_DELAY: MetricDefinition = {
|
|
|
167
167
|
valueType: ValueType.INT,
|
|
168
168
|
};
|
|
169
169
|
|
|
170
|
+
export const MEMPOOL_TX_POOL_V2_EVICTED_COUNT: MetricDefinition = {
|
|
171
|
+
name: 'aztec.mempool.tx_pool_v2.evicted_count',
|
|
172
|
+
description: 'The number of transactions evicted from the tx pool',
|
|
173
|
+
valueType: ValueType.INT,
|
|
174
|
+
};
|
|
175
|
+
export const MEMPOOL_TX_POOL_V2_IGNORED_COUNT: MetricDefinition = {
|
|
176
|
+
name: 'aztec.mempool.tx_pool_v2.ignored_count',
|
|
177
|
+
description: 'The number of transactions ignored in addPendingTxs',
|
|
178
|
+
valueType: ValueType.INT,
|
|
179
|
+
};
|
|
180
|
+
export const MEMPOOL_TX_POOL_V2_REJECTED_COUNT: MetricDefinition = {
|
|
181
|
+
name: 'aztec.mempool.tx_pool_v2.rejected_count',
|
|
182
|
+
description: 'The number of transactions rejected in addPendingTxs',
|
|
183
|
+
valueType: ValueType.INT,
|
|
184
|
+
};
|
|
185
|
+
export const MEMPOOL_TX_POOL_V2_SOFT_DELETED_HITS: MetricDefinition = {
|
|
186
|
+
name: 'aztec.mempool.tx_pool_v2.soft_deleted_hits',
|
|
187
|
+
description: 'The number of transactions found in the soft-deleted pool',
|
|
188
|
+
valueType: ValueType.INT,
|
|
189
|
+
};
|
|
190
|
+
export const MEMPOOL_TX_POOL_V2_MISSING_ON_PROTECT: MetricDefinition = {
|
|
191
|
+
name: 'aztec.mempool.tx_pool_v2.missing_on_protect',
|
|
192
|
+
description: 'The number of truly missing transactions in protectTxs',
|
|
193
|
+
valueType: ValueType.INT,
|
|
194
|
+
};
|
|
195
|
+
export const MEMPOOL_TX_POOL_V2_MISSING_PREVIOUSLY_EVICTED: MetricDefinition = {
|
|
196
|
+
name: 'aztec.mempool.tx_pool_v2.missing_previously_evicted',
|
|
197
|
+
description: 'The number of truly missing transactions in protectTxs that were previously evicted',
|
|
198
|
+
valueType: ValueType.INT,
|
|
199
|
+
};
|
|
200
|
+
export const MEMPOOL_TX_POOL_V2_METADATA_MEMORY: MetricDefinition = {
|
|
201
|
+
name: 'aztec.mempool.tx_pool_v2.metadata_memory',
|
|
202
|
+
description: 'Estimated total memory consumed by in-memory transaction metadata',
|
|
203
|
+
unit: 'By',
|
|
204
|
+
valueType: ValueType.INT,
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export const MEMPOOL_TX_POOL_V2_DUPLICATE_ADD: MetricDefinition = {
|
|
208
|
+
name: 'aztec.mempool.tx_pool_v2.duplicate_add',
|
|
209
|
+
description: 'Transactions received via addPendingTxs that were already in the pool',
|
|
210
|
+
valueType: ValueType.INT,
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export const MEMPOOL_TX_POOL_V2_ALREADY_PROTECTED_ADD: MetricDefinition = {
|
|
214
|
+
name: 'aztec.mempool.tx_pool_v2.already_protected_add',
|
|
215
|
+
description: 'Transactions received via addPendingTxs that were already pre-protected',
|
|
216
|
+
valueType: ValueType.INT,
|
|
217
|
+
};
|
|
218
|
+
|
|
170
219
|
export const DB_NUM_ITEMS: MetricDefinition = {
|
|
171
220
|
name: 'aztec.db.num_items',
|
|
172
221
|
description: 'LMDB Num Items',
|
|
@@ -224,6 +273,11 @@ export const ARCHIVER_BLOCK_HEIGHT: MetricDefinition = {
|
|
|
224
273
|
description: 'The height of the latest block processed by the archiver',
|
|
225
274
|
valueType: ValueType.INT,
|
|
226
275
|
};
|
|
276
|
+
export const ARCHIVER_CHECKPOINT_HEIGHT: MetricDefinition = {
|
|
277
|
+
name: 'aztec.archiver.checkpoint_height',
|
|
278
|
+
description: 'The height of the latest checkpoint processed by the archiver',
|
|
279
|
+
valueType: ValueType.INT,
|
|
280
|
+
};
|
|
227
281
|
export const ARCHIVER_ROLLUP_PROOF_DELAY: MetricDefinition = {
|
|
228
282
|
name: 'aztec.archiver.rollup_proof_delay',
|
|
229
283
|
description: 'Time after a block is submitted until its proof is published',
|
|
@@ -344,9 +398,9 @@ export const SEQUENCER_BLOCK_COUNT: MetricDefinition = {
|
|
|
344
398
|
description: 'Number of blocks built by this sequencer',
|
|
345
399
|
valueType: ValueType.INT,
|
|
346
400
|
};
|
|
347
|
-
export const
|
|
348
|
-
name: 'aztec.sequencer.
|
|
349
|
-
description: 'The rewards earned',
|
|
401
|
+
export const SEQUENCER_CURRENT_SLOT_REWARDS: MetricDefinition = {
|
|
402
|
+
name: 'aztec.sequencer.current_slot_rewards',
|
|
403
|
+
description: 'The rewards earned per filled slot',
|
|
350
404
|
valueType: ValueType.DOUBLE,
|
|
351
405
|
};
|
|
352
406
|
export const SEQUENCER_SLOT_COUNT: MetricDefinition = {
|
|
@@ -369,12 +423,12 @@ export const SEQUENCER_CHECKPOINT_ATTESTATION_DELAY: MetricDefinition = {
|
|
|
369
423
|
|
|
370
424
|
export const SEQUENCER_COLLECTED_ATTESTATIONS_COUNT: MetricDefinition = {
|
|
371
425
|
name: 'aztec.sequencer.attestations.collected_count',
|
|
372
|
-
description: 'The number of attestations collected for a
|
|
426
|
+
description: 'The number of attestations collected for a checkpoint proposal',
|
|
373
427
|
valueType: ValueType.INT,
|
|
374
428
|
};
|
|
375
429
|
export const SEQUENCER_REQUIRED_ATTESTATIONS_COUNT: MetricDefinition = {
|
|
376
430
|
name: 'aztec.sequencer.attestations.required_count',
|
|
377
|
-
description: 'The minimum number of attestations required to publish a
|
|
431
|
+
description: 'The minimum number of attestations required to publish a checkpoint',
|
|
378
432
|
valueType: ValueType.INT,
|
|
379
433
|
};
|
|
380
434
|
export const SEQUENCER_COLLECT_ATTESTATIONS_DURATION: MetricDefinition = {
|
|
@@ -395,14 +449,42 @@ export const SEQUENCER_BLOCK_PROPOSAL_FAILED_COUNT: MetricDefinition = {
|
|
|
395
449
|
description: 'The number of times block proposal failed (including validation builds)',
|
|
396
450
|
valueType: ValueType.INT,
|
|
397
451
|
};
|
|
398
|
-
export const
|
|
399
|
-
name: 'aztec.sequencer.
|
|
400
|
-
description: 'The number of times
|
|
452
|
+
export const SEQUENCER_CHECKPOINT_PROPOSAL_SUCCESS_COUNT: MetricDefinition = {
|
|
453
|
+
name: 'aztec.sequencer.checkpoint.proposal_success_count',
|
|
454
|
+
description: 'The number of times checkpoint proposal succeeded',
|
|
455
|
+
valueType: ValueType.INT,
|
|
456
|
+
};
|
|
457
|
+
export const SEQUENCER_CHECKPOINT_PRECHECK_FAILED_COUNT: MetricDefinition = {
|
|
458
|
+
name: 'aztec.sequencer.checkpoint.precheck_failed_count',
|
|
459
|
+
description: 'The number of times checkpoint pre-build checks failed',
|
|
460
|
+
valueType: ValueType.INT,
|
|
461
|
+
};
|
|
462
|
+
export const SEQUENCER_CHECKPOINT_PROPOSAL_FAILED_COUNT: MetricDefinition = {
|
|
463
|
+
name: 'aztec.sequencer.checkpoint.proposal_failed_count',
|
|
464
|
+
description: 'The number of times checkpoint proposal failed',
|
|
401
465
|
valueType: ValueType.INT,
|
|
402
466
|
};
|
|
403
|
-
export const
|
|
404
|
-
name: 'aztec.sequencer.
|
|
405
|
-
description: '
|
|
467
|
+
export const SEQUENCER_CHECKPOINT_BUILD_DURATION: MetricDefinition = {
|
|
468
|
+
name: 'aztec.sequencer.checkpoint.build_duration',
|
|
469
|
+
description: 'Total duration to build all blocks in a checkpoint',
|
|
470
|
+
unit: 'ms',
|
|
471
|
+
valueType: ValueType.INT,
|
|
472
|
+
};
|
|
473
|
+
export const SEQUENCER_CHECKPOINT_BLOCK_COUNT: MetricDefinition = {
|
|
474
|
+
name: 'aztec.sequencer.checkpoint.block_count',
|
|
475
|
+
description: 'Number of blocks built in a checkpoint',
|
|
476
|
+
valueType: ValueType.INT,
|
|
477
|
+
};
|
|
478
|
+
export const SEQUENCER_CHECKPOINT_TX_COUNT: MetricDefinition = {
|
|
479
|
+
name: 'aztec.sequencer.checkpoint.tx_count',
|
|
480
|
+
description: 'Total number of transactions across all blocks in a checkpoint',
|
|
481
|
+
unit: 'tx',
|
|
482
|
+
valueType: ValueType.INT,
|
|
483
|
+
};
|
|
484
|
+
export const SEQUENCER_CHECKPOINT_TOTAL_MANA: MetricDefinition = {
|
|
485
|
+
name: 'aztec.sequencer.checkpoint.total_mana',
|
|
486
|
+
description: 'Total L2 mana used across all blocks in a checkpoint',
|
|
487
|
+
unit: 'mana',
|
|
406
488
|
valueType: ValueType.INT,
|
|
407
489
|
};
|
|
408
490
|
export const SEQUENCER_SLASHING_ATTEMPTS_COUNT: MetricDefinition = {
|
|
@@ -474,6 +556,29 @@ export const FISHERMAN_FEE_ANALYSIS_MINED_BLOB_TX_TOTAL_COST: MetricDefinition =
|
|
|
474
556
|
unit: 'eth',
|
|
475
557
|
valueType: ValueType.DOUBLE,
|
|
476
558
|
};
|
|
559
|
+
export const FISHERMAN_FEE_ANALYSIS_PENDING_BLOB_COUNT: MetricDefinition = {
|
|
560
|
+
name: 'aztec.fisherman.fee_analysis.pending_blob_count',
|
|
561
|
+
description: 'Total number of blobs in pending blob transactions',
|
|
562
|
+
unit: 'blobs',
|
|
563
|
+
valueType: ValueType.INT,
|
|
564
|
+
};
|
|
565
|
+
export const FISHERMAN_FEE_ANALYSIS_INCLUDED_BLOB_COUNT: MetricDefinition = {
|
|
566
|
+
name: 'aztec.fisherman.fee_analysis.included_blob_count',
|
|
567
|
+
description: 'Total number of blobs included in the mined block',
|
|
568
|
+
unit: 'blobs',
|
|
569
|
+
valueType: ValueType.INT,
|
|
570
|
+
};
|
|
571
|
+
export const FISHERMAN_FEE_ANALYSIS_BLOCK_BLOBS_FULL: MetricDefinition = {
|
|
572
|
+
name: 'aztec.fisherman.fee_analysis.block_blobs_full',
|
|
573
|
+
description: 'Whether the mined block reached 100% blob capacity',
|
|
574
|
+
valueType: ValueType.INT,
|
|
575
|
+
};
|
|
576
|
+
export const FISHERMAN_FEE_ANALYSIS_MAX_BLOB_CAPACITY: MetricDefinition = {
|
|
577
|
+
name: 'aztec.fisherman.fee_analysis.max_blob_capacity',
|
|
578
|
+
description: 'Maximum blob capacity for the analyzed block based on L1 upgrade schedule',
|
|
579
|
+
unit: 'blobs',
|
|
580
|
+
valueType: ValueType.INT,
|
|
581
|
+
};
|
|
477
582
|
|
|
478
583
|
export const VALIDATOR_INVALID_ATTESTATION_RECEIVED_COUNT: MetricDefinition = {
|
|
479
584
|
name: 'aztec.validator.invalid_attestation_received_count',
|
|
@@ -836,7 +941,7 @@ export const PUBLIC_PROCESSOR_GAS_RATE: MetricDefinition = {
|
|
|
836
941
|
name: 'aztec.public_processor.gas_rate',
|
|
837
942
|
description: 'Gas rate in public processor',
|
|
838
943
|
unit: 'gas/s',
|
|
839
|
-
valueType: ValueType.
|
|
944
|
+
valueType: ValueType.DOUBLE,
|
|
840
945
|
};
|
|
841
946
|
export const PUBLIC_PROCESSOR_TREE_INSERTION: MetricDefinition = {
|
|
842
947
|
name: 'aztec.public_processor.tree_insertion',
|
|
@@ -1271,6 +1376,55 @@ export const TX_COLLECTOR_DURATION_PER_TX: MetricDefinition = {
|
|
|
1271
1376
|
valueType: ValueType.INT,
|
|
1272
1377
|
};
|
|
1273
1378
|
|
|
1379
|
+
export const TX_FILE_STORE_UPLOADS_SUCCESS: MetricDefinition = {
|
|
1380
|
+
name: 'aztec.p2p.tx_file_store.uploads_success',
|
|
1381
|
+
description: 'Number of successful tx uploads to file storage',
|
|
1382
|
+
valueType: ValueType.INT,
|
|
1383
|
+
};
|
|
1384
|
+
export const TX_FILE_STORE_UPLOADS_FAILED: MetricDefinition = {
|
|
1385
|
+
name: 'aztec.p2p.tx_file_store.uploads_failed',
|
|
1386
|
+
description: 'Number of failed tx uploads to file storage',
|
|
1387
|
+
valueType: ValueType.INT,
|
|
1388
|
+
};
|
|
1389
|
+
export const TX_FILE_STORE_UPLOADS_SKIPPED: MetricDefinition = {
|
|
1390
|
+
name: 'aztec.p2p.tx_file_store.uploads_skipped',
|
|
1391
|
+
description: 'Number of tx uploads skipped (duplicates)',
|
|
1392
|
+
valueType: ValueType.INT,
|
|
1393
|
+
};
|
|
1394
|
+
export const TX_FILE_STORE_UPLOAD_DURATION: MetricDefinition = {
|
|
1395
|
+
name: 'aztec.p2p.tx_file_store.upload_duration',
|
|
1396
|
+
description: 'Duration to upload a tx to file storage',
|
|
1397
|
+
unit: 'ms',
|
|
1398
|
+
valueType: ValueType.INT,
|
|
1399
|
+
};
|
|
1400
|
+
export const TX_FILE_STORE_QUEUE_SIZE: MetricDefinition = {
|
|
1401
|
+
name: 'aztec.p2p.tx_file_store.queue_size',
|
|
1402
|
+
description: 'Number of txs pending upload',
|
|
1403
|
+
valueType: ValueType.INT,
|
|
1404
|
+
};
|
|
1405
|
+
export const TX_FILE_STORE_DOWNLOADS_SUCCESS: MetricDefinition = {
|
|
1406
|
+
name: 'aztec.p2p.tx_file_store.downloads_success',
|
|
1407
|
+
description: 'Number of successful tx downloads from file storage',
|
|
1408
|
+
valueType: ValueType.INT,
|
|
1409
|
+
};
|
|
1410
|
+
export const TX_FILE_STORE_DOWNLOADS_FAILED: MetricDefinition = {
|
|
1411
|
+
name: 'aztec.p2p.tx_file_store.downloads_failed',
|
|
1412
|
+
description: 'Number of failed tx downloads from file storage',
|
|
1413
|
+
valueType: ValueType.INT,
|
|
1414
|
+
};
|
|
1415
|
+
export const TX_FILE_STORE_DOWNLOAD_DURATION: MetricDefinition = {
|
|
1416
|
+
name: 'aztec.p2p.tx_file_store.download_duration',
|
|
1417
|
+
description: 'Duration to download a tx from file storage',
|
|
1418
|
+
unit: 'ms',
|
|
1419
|
+
valueType: ValueType.INT,
|
|
1420
|
+
};
|
|
1421
|
+
export const TX_FILE_STORE_DOWNLOAD_SIZE: MetricDefinition = {
|
|
1422
|
+
name: 'aztec.p2p.tx_file_store.download_size',
|
|
1423
|
+
description: 'Size of a downloaded tx from file storage',
|
|
1424
|
+
unit: 'By',
|
|
1425
|
+
valueType: ValueType.INT,
|
|
1426
|
+
};
|
|
1427
|
+
|
|
1274
1428
|
export const IVC_VERIFIER_TIME: MetricDefinition = {
|
|
1275
1429
|
name: 'aztec.ivc_verifier.time',
|
|
1276
1430
|
description: 'Duration to verify chonk proofs',
|
|
@@ -2,6 +2,7 @@ import type { Observable } from '@opentelemetry/api';
|
|
|
2
2
|
import { type EventLoopUtilization, type IntervalHistogram, monitorEventLoopDelay, performance } from 'node:perf_hooks';
|
|
3
3
|
|
|
4
4
|
import * as Attributes from './attributes.js';
|
|
5
|
+
import { createUpDownCounterWithDefault } from './metric-utils.js';
|
|
5
6
|
import * as Metrics from './metrics.js';
|
|
6
7
|
import type { BatchObservableResult, Meter, ObservableGauge, UpDownCounter } from './telemetry.js';
|
|
7
8
|
|
|
@@ -41,7 +42,9 @@ export class NodejsMetricsMonitor {
|
|
|
41
42
|
};
|
|
42
43
|
|
|
43
44
|
this.eventLoopUilization = meter.createObservableGauge(Metrics.NODEJS_EVENT_LOOP_UTILIZATION);
|
|
44
|
-
this.eventLoopTime = meter
|
|
45
|
+
this.eventLoopTime = createUpDownCounterWithDefault(meter, Metrics.NODEJS_EVENT_LOOP_TIME, {
|
|
46
|
+
[Attributes.NODEJS_EVENT_LOOP_STATE]: ['idle', 'active'],
|
|
47
|
+
});
|
|
45
48
|
this.eventLoopDelay = monitorEventLoopDelay();
|
|
46
49
|
|
|
47
50
|
this.memoryGauges = {
|
package/src/otel_resource.ts
CHANGED
|
@@ -7,10 +7,26 @@ import {
|
|
|
7
7
|
osDetectorSync,
|
|
8
8
|
serviceInstanceIdDetectorSync,
|
|
9
9
|
} from '@opentelemetry/resources';
|
|
10
|
-
import {
|
|
10
|
+
import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from '@opentelemetry/semantic-conventions';
|
|
11
|
+
import { readFileSync } from 'fs';
|
|
12
|
+
import { dirname, resolve } from 'path';
|
|
13
|
+
import { fileURLToPath } from 'url';
|
|
11
14
|
|
|
12
15
|
import { AZTEC_NODE_ROLE, AZTEC_REGISTRY_ADDRESS, AZTEC_ROLLUP_ADDRESS, AZTEC_ROLLUP_VERSION } from './attributes.js';
|
|
13
16
|
|
|
17
|
+
/** Reads the Aztec client version from the release manifest. */
|
|
18
|
+
function getAztecVersion(): string | undefined {
|
|
19
|
+
try {
|
|
20
|
+
const releasePleasePath = resolve(
|
|
21
|
+
dirname(fileURLToPath(import.meta.url)),
|
|
22
|
+
'../../../.release-please-manifest.json',
|
|
23
|
+
);
|
|
24
|
+
return JSON.parse(readFileSync(releasePleasePath, 'utf-8'))['.'];
|
|
25
|
+
} catch {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
14
30
|
export function getOtelResource(): IResource {
|
|
15
31
|
const resource = detectResourcesSync({
|
|
16
32
|
detectors: [
|
|
@@ -42,7 +58,8 @@ const aztecNetworkDetectorSync: DetectorSync = {
|
|
|
42
58
|
}
|
|
43
59
|
const aztecAttributes = {
|
|
44
60
|
// this gets overwritten by OTEL_RESOURCE_ATTRIBUTES (if set)
|
|
45
|
-
[
|
|
61
|
+
[ATTR_SERVICE_NAME]: role ? `aztec-${role}` : undefined,
|
|
62
|
+
[ATTR_SERVICE_VERSION]: getAztecVersion(),
|
|
46
63
|
[AZTEC_NODE_ROLE]: role,
|
|
47
64
|
[AZTEC_ROLLUP_VERSION]: process.env.ROLLUP_VERSION ?? 'canonical',
|
|
48
65
|
[AZTEC_ROLLUP_ADDRESS]: process.env.ROLLUP_CONTRACT_ADDRESS,
|
package/src/prom_otel_adapter.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
1
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import { Timer } from '@aztec/foundation/timer';
|
|
3
3
|
|
|
4
4
|
import { Registry } from 'prom-client';
|
|
@@ -410,12 +410,11 @@ function parseLabelsSafely<Labels extends LabelsGeneric>(labelStr: string, logge
|
|
|
410
410
|
*/
|
|
411
411
|
export class OtelMetricsAdapter extends Registry implements MetricsRegister {
|
|
412
412
|
private readonly meter: Meter;
|
|
413
|
+
private logger: Logger;
|
|
413
414
|
|
|
414
|
-
constructor(
|
|
415
|
-
telemetryClient: TelemetryClient,
|
|
416
|
-
private logger: Logger = createLogger('telemetry:otel-metrics-adapter'),
|
|
417
|
-
) {
|
|
415
|
+
constructor(telemetryClient: TelemetryClient, bindings?: LoggerBindings) {
|
|
418
416
|
super();
|
|
417
|
+
this.logger = createLogger('telemetry:otel-metrics-adapter', bindings);
|
|
419
418
|
this.meter = telemetryClient.getMeter('metrics-adapter');
|
|
420
419
|
}
|
|
421
420
|
|
package/src/start.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
1
|
+
import { type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
2
2
|
|
|
3
3
|
import type { TelemetryClientConfig } from './config.js';
|
|
4
4
|
import { NoopTelemetryClient } from './noop.js';
|
|
@@ -9,8 +9,11 @@ export * from './config.js';
|
|
|
9
9
|
let initialized = false;
|
|
10
10
|
let telemetry: TelemetryClient = new NoopTelemetryClient();
|
|
11
11
|
|
|
12
|
-
export async function initTelemetryClient(
|
|
13
|
-
|
|
12
|
+
export async function initTelemetryClient(
|
|
13
|
+
config: TelemetryClientConfig,
|
|
14
|
+
bindings?: LoggerBindings,
|
|
15
|
+
): Promise<TelemetryClient> {
|
|
16
|
+
const log = createLogger('telemetry:client', bindings);
|
|
14
17
|
if (initialized) {
|
|
15
18
|
log.warn('Telemetry client has already been initialized once');
|
|
16
19
|
return telemetry;
|
package/src/telemetry.ts
CHANGED
|
@@ -20,7 +20,7 @@ import type * as Attributes from './attributes.js';
|
|
|
20
20
|
import type { MetricDefinition } from './metrics.js';
|
|
21
21
|
import { getTelemetryClient } from './start.js';
|
|
22
22
|
|
|
23
|
-
export { toMetricOptions } from './metric-utils.js';
|
|
23
|
+
export { toMetricOptions, createUpDownCounterWithDefault } from './metric-utils.js';
|
|
24
24
|
|
|
25
25
|
export { type Span, SpanStatusCode, ValueType, type Context } from '@opentelemetry/api';
|
|
26
26
|
|
|
@@ -56,8 +56,10 @@ type BannedMetricAttributeNames = (typeof Attributes)[
|
|
|
56
56
|
/** Global registry of attributes */
|
|
57
57
|
export type AttributesType = Partial<Record<AttributeNames, AttributeValue>>;
|
|
58
58
|
|
|
59
|
+
export type AllowedAttributeNames = Exclude<AttributeNames, BannedMetricAttributeNames>;
|
|
60
|
+
|
|
59
61
|
/** Subset of attributes allowed to be added to metrics */
|
|
60
|
-
export type MetricAttributesType = Partial<Record<
|
|
62
|
+
export type MetricAttributesType = Partial<Record<AllowedAttributeNames, AttributeValue>>;
|
|
61
63
|
|
|
62
64
|
/** Re-export MetricDefinition for convenience */
|
|
63
65
|
export type { MetricDefinition } from './metrics.js';
|
|
@@ -13,7 +13,7 @@ export class TraceableL2BlockStream extends L2BlockStream implements Traceable {
|
|
|
13
13
|
constructor(
|
|
14
14
|
l2BlockSource: Pick<
|
|
15
15
|
L2BlockSource,
|
|
16
|
-
'
|
|
16
|
+
'getBlocks' | 'getBlockHeader' | 'getL2Tips' | 'getCheckpoints' | 'getCheckpointedBlocks'
|
|
17
17
|
>,
|
|
18
18
|
localData: L2BlockStreamLocalDataProvider,
|
|
19
19
|
handler: L2BlockStreamEventHandler,
|