@aztec/telemetry-client 0.0.1-commit.e61ad554 → 0.0.1-commit.ec5f612
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 +9 -1
- package/dest/attributes.d.ts.map +1 -1
- package/dest/attributes.js +4 -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 +43 -4
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +219 -11
- 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/package.json +3 -3
- package/src/attributes.ts +12 -0
- package/src/metric-utils.ts +64 -1
- package/src/metrics.ts +225 -11
- 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/attributes.ts
CHANGED
|
@@ -128,6 +128,9 @@ export const NODEJS_EVENT_LOOP_STATE = 'nodejs.eventloop.state';
|
|
|
128
128
|
|
|
129
129
|
export const TOPIC_NAME = 'aztec.gossip.topic_name';
|
|
130
130
|
|
|
131
|
+
/** The reason a transaction was evicted from the tx pool */
|
|
132
|
+
export const TX_POOL_EVICTION_REASON = 'aztec.mempool.eviction_reason';
|
|
133
|
+
|
|
131
134
|
export const TX_COLLECTION_METHOD = 'aztec.tx_collection.method';
|
|
132
135
|
|
|
133
136
|
/** Scope of L1 transaction (sequencer, prover, or other) */
|
|
@@ -139,8 +142,17 @@ export const IS_COMMITTEE_MEMBER = 'aztec.is_committee_member';
|
|
|
139
142
|
/** Fisherman fee analysis strategy identifier */
|
|
140
143
|
export const FISHERMAN_FEE_STRATEGY_ID = 'aztec.fisherman.strategy_id';
|
|
141
144
|
|
|
145
|
+
/** Whether the analyzed block reached 100% blob capacity */
|
|
146
|
+
export const BLOCK_FULL = 'aztec.block_full';
|
|
147
|
+
|
|
142
148
|
/** The L1 transaction target for block proposal */
|
|
143
149
|
export const L1_BLOCK_PROPOSAL_TX_TARGET = 'aztec.l1.block_proposal_tx_target';
|
|
144
150
|
|
|
145
151
|
/** Whether tracing methods were used to extract block proposal data */
|
|
146
152
|
export const L1_BLOCK_PROPOSAL_USED_TRACE = 'aztec.l1.block_proposal_used_trace';
|
|
153
|
+
|
|
154
|
+
/** HA signer duty type (e.g., BLOCK_PROPOSAL, CHECKPOINT_ATTESTATION) */
|
|
155
|
+
export const HA_DUTY_TYPE = 'aztec.ha_signer.duty_type';
|
|
156
|
+
|
|
157
|
+
/** HA signer node identifier */
|
|
158
|
+
export const HA_NODE_ID = 'aztec.ha_signer.node_id';
|
package/src/metric-utils.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { MetricOptions } from '@opentelemetry/api';
|
|
1
|
+
import type { AttributeValue, MetricOptions } from '@opentelemetry/api';
|
|
2
2
|
|
|
3
3
|
import type { MetricDefinition } from './metrics.js';
|
|
4
|
+
import type { AllowedAttributeNames, Meter, MetricAttributesType, UpDownCounter } from './telemetry.js';
|
|
4
5
|
|
|
5
6
|
/** Extracts OpenTelemetry MetricOptions from a MetricDefinition */
|
|
6
7
|
export function toMetricOptions(def: MetricDefinition): MetricOptions {
|
|
@@ -10,3 +11,65 @@ export function toMetricOptions(def: MetricDefinition): MetricOptions {
|
|
|
10
11
|
valueType: def.valueType,
|
|
11
12
|
};
|
|
12
13
|
}
|
|
14
|
+
|
|
15
|
+
/** A mapping of attribute keys to their possible values */
|
|
16
|
+
export type AttributeValuesMap = Partial<Record<AllowedAttributeNames, AttributeValue[]>>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Expands an attribute values map into all combinations of attribute objects.
|
|
20
|
+
* Example: { status: ['ok', 'fail'], type: ['a', 'b'] } =>
|
|
21
|
+
* [{ status: 'ok', type: 'a' }, { status: 'ok', type: 'b' }, { status: 'fail', type: 'a' }, { status: 'fail', type: 'b' }]
|
|
22
|
+
*/
|
|
23
|
+
export function expandAttributeCombinations(attrMap: AttributeValuesMap): MetricAttributesType[] {
|
|
24
|
+
const keys = Object.keys(attrMap) as AllowedAttributeNames[];
|
|
25
|
+
if (keys.length === 0) {
|
|
26
|
+
return [{}];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const result: MetricAttributesType[] = [];
|
|
30
|
+
|
|
31
|
+
function generate(index: number, current: MetricAttributesType) {
|
|
32
|
+
if (index === keys.length) {
|
|
33
|
+
result.push({ ...current });
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const key = keys[index];
|
|
37
|
+
for (const value of attrMap[key]!) {
|
|
38
|
+
current[key] = value;
|
|
39
|
+
generate(index + 1, current);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
generate(0, {});
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Creates an UpDownCounter and initializes it to 0.
|
|
49
|
+
* @param meter - The meter to create the counter on
|
|
50
|
+
* @param metric - The metric definition
|
|
51
|
+
* @param attributes - Optional attributes for initialization. Can be:
|
|
52
|
+
* - AttributeValuesMap: mapping of attribute keys to arrays of possible values (generates cartesian product)
|
|
53
|
+
* - MetricAttributesType[]: explicit array of attribute objects
|
|
54
|
+
* - undefined: initializes without attributes
|
|
55
|
+
*/
|
|
56
|
+
export function createUpDownCounterWithDefault(
|
|
57
|
+
meter: Meter,
|
|
58
|
+
metric: MetricDefinition,
|
|
59
|
+
attributes: AttributeValuesMap | MetricAttributesType[] | undefined = undefined,
|
|
60
|
+
): UpDownCounter {
|
|
61
|
+
const counter = meter.createUpDownCounter(metric);
|
|
62
|
+
if (attributes === undefined) {
|
|
63
|
+
counter.add(0);
|
|
64
|
+
} else if (Array.isArray(attributes)) {
|
|
65
|
+
for (const attrs of attributes) {
|
|
66
|
+
counter.add(0, attrs);
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
const combinations = expandAttributeCombinations(attributes);
|
|
70
|
+
for (const attrs of combinations) {
|
|
71
|
+
counter.add(0, attrs);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return counter;
|
|
75
|
+
}
|
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',
|
|
@@ -296,6 +350,13 @@ export const ARCHIVER_BLOCK_PROPOSAL_TX_TARGET_COUNT: MetricDefinition = {
|
|
|
296
350
|
valueType: ValueType.INT,
|
|
297
351
|
};
|
|
298
352
|
|
|
353
|
+
export const ARCHIVER_CHECKPOINT_L1_INCLUSION_DELAY: MetricDefinition = {
|
|
354
|
+
name: 'aztec.archiver.checkpoint_l1_inclusion_delay',
|
|
355
|
+
description: 'Seconds into the L2 slot when the checkpoint L1 tx was included',
|
|
356
|
+
unit: 's',
|
|
357
|
+
valueType: ValueType.INT,
|
|
358
|
+
};
|
|
359
|
+
|
|
299
360
|
export const NODE_RECEIVE_TX_DURATION: MetricDefinition = {
|
|
300
361
|
name: 'aztec.node.receive_tx.duration',
|
|
301
362
|
description: 'The duration of the receiveTx method',
|
|
@@ -344,9 +405,9 @@ export const SEQUENCER_BLOCK_COUNT: MetricDefinition = {
|
|
|
344
405
|
description: 'Number of blocks built by this sequencer',
|
|
345
406
|
valueType: ValueType.INT,
|
|
346
407
|
};
|
|
347
|
-
export const
|
|
348
|
-
name: 'aztec.sequencer.
|
|
349
|
-
description: 'The rewards earned',
|
|
408
|
+
export const SEQUENCER_CURRENT_SLOT_REWARDS: MetricDefinition = {
|
|
409
|
+
name: 'aztec.sequencer.current_slot_rewards',
|
|
410
|
+
description: 'The rewards earned per filled slot',
|
|
350
411
|
valueType: ValueType.DOUBLE,
|
|
351
412
|
};
|
|
352
413
|
export const SEQUENCER_SLOT_COUNT: MetricDefinition = {
|
|
@@ -369,12 +430,12 @@ export const SEQUENCER_CHECKPOINT_ATTESTATION_DELAY: MetricDefinition = {
|
|
|
369
430
|
|
|
370
431
|
export const SEQUENCER_COLLECTED_ATTESTATIONS_COUNT: MetricDefinition = {
|
|
371
432
|
name: 'aztec.sequencer.attestations.collected_count',
|
|
372
|
-
description: 'The number of attestations collected for a
|
|
433
|
+
description: 'The number of attestations collected for a checkpoint proposal',
|
|
373
434
|
valueType: ValueType.INT,
|
|
374
435
|
};
|
|
375
436
|
export const SEQUENCER_REQUIRED_ATTESTATIONS_COUNT: MetricDefinition = {
|
|
376
437
|
name: 'aztec.sequencer.attestations.required_count',
|
|
377
|
-
description: 'The minimum number of attestations required to publish a
|
|
438
|
+
description: 'The minimum number of attestations required to publish a checkpoint',
|
|
378
439
|
valueType: ValueType.INT,
|
|
379
440
|
};
|
|
380
441
|
export const SEQUENCER_COLLECT_ATTESTATIONS_DURATION: MetricDefinition = {
|
|
@@ -395,14 +456,42 @@ export const SEQUENCER_BLOCK_PROPOSAL_FAILED_COUNT: MetricDefinition = {
|
|
|
395
456
|
description: 'The number of times block proposal failed (including validation builds)',
|
|
396
457
|
valueType: ValueType.INT,
|
|
397
458
|
};
|
|
398
|
-
export const
|
|
399
|
-
name: 'aztec.sequencer.
|
|
400
|
-
description: 'The number of times
|
|
459
|
+
export const SEQUENCER_CHECKPOINT_PROPOSAL_SUCCESS_COUNT: MetricDefinition = {
|
|
460
|
+
name: 'aztec.sequencer.checkpoint.proposal_success_count',
|
|
461
|
+
description: 'The number of times checkpoint proposal succeeded',
|
|
462
|
+
valueType: ValueType.INT,
|
|
463
|
+
};
|
|
464
|
+
export const SEQUENCER_CHECKPOINT_PRECHECK_FAILED_COUNT: MetricDefinition = {
|
|
465
|
+
name: 'aztec.sequencer.checkpoint.precheck_failed_count',
|
|
466
|
+
description: 'The number of times checkpoint pre-build checks failed',
|
|
467
|
+
valueType: ValueType.INT,
|
|
468
|
+
};
|
|
469
|
+
export const SEQUENCER_CHECKPOINT_PROPOSAL_FAILED_COUNT: MetricDefinition = {
|
|
470
|
+
name: 'aztec.sequencer.checkpoint.proposal_failed_count',
|
|
471
|
+
description: 'The number of times checkpoint proposal failed',
|
|
472
|
+
valueType: ValueType.INT,
|
|
473
|
+
};
|
|
474
|
+
export const SEQUENCER_CHECKPOINT_BUILD_DURATION: MetricDefinition = {
|
|
475
|
+
name: 'aztec.sequencer.checkpoint.build_duration',
|
|
476
|
+
description: 'Total duration to build all blocks in a checkpoint',
|
|
477
|
+
unit: 'ms',
|
|
478
|
+
valueType: ValueType.INT,
|
|
479
|
+
};
|
|
480
|
+
export const SEQUENCER_CHECKPOINT_BLOCK_COUNT: MetricDefinition = {
|
|
481
|
+
name: 'aztec.sequencer.checkpoint.block_count',
|
|
482
|
+
description: 'Number of blocks built in a checkpoint',
|
|
483
|
+
valueType: ValueType.INT,
|
|
484
|
+
};
|
|
485
|
+
export const SEQUENCER_CHECKPOINT_TX_COUNT: MetricDefinition = {
|
|
486
|
+
name: 'aztec.sequencer.checkpoint.tx_count',
|
|
487
|
+
description: 'Total number of transactions across all blocks in a checkpoint',
|
|
488
|
+
unit: 'tx',
|
|
401
489
|
valueType: ValueType.INT,
|
|
402
490
|
};
|
|
403
|
-
export const
|
|
404
|
-
name: 'aztec.sequencer.
|
|
405
|
-
description: '
|
|
491
|
+
export const SEQUENCER_CHECKPOINT_TOTAL_MANA: MetricDefinition = {
|
|
492
|
+
name: 'aztec.sequencer.checkpoint.total_mana',
|
|
493
|
+
description: 'Total L2 mana used across all blocks in a checkpoint',
|
|
494
|
+
unit: 'mana',
|
|
406
495
|
valueType: ValueType.INT,
|
|
407
496
|
};
|
|
408
497
|
export const SEQUENCER_SLASHING_ATTEMPTS_COUNT: MetricDefinition = {
|
|
@@ -474,6 +563,29 @@ export const FISHERMAN_FEE_ANALYSIS_MINED_BLOB_TX_TOTAL_COST: MetricDefinition =
|
|
|
474
563
|
unit: 'eth',
|
|
475
564
|
valueType: ValueType.DOUBLE,
|
|
476
565
|
};
|
|
566
|
+
export const FISHERMAN_FEE_ANALYSIS_PENDING_BLOB_COUNT: MetricDefinition = {
|
|
567
|
+
name: 'aztec.fisherman.fee_analysis.pending_blob_count',
|
|
568
|
+
description: 'Total number of blobs in pending blob transactions',
|
|
569
|
+
unit: 'blobs',
|
|
570
|
+
valueType: ValueType.INT,
|
|
571
|
+
};
|
|
572
|
+
export const FISHERMAN_FEE_ANALYSIS_INCLUDED_BLOB_COUNT: MetricDefinition = {
|
|
573
|
+
name: 'aztec.fisherman.fee_analysis.included_blob_count',
|
|
574
|
+
description: 'Total number of blobs included in the mined block',
|
|
575
|
+
unit: 'blobs',
|
|
576
|
+
valueType: ValueType.INT,
|
|
577
|
+
};
|
|
578
|
+
export const FISHERMAN_FEE_ANALYSIS_BLOCK_BLOBS_FULL: MetricDefinition = {
|
|
579
|
+
name: 'aztec.fisherman.fee_analysis.block_blobs_full',
|
|
580
|
+
description: 'Whether the mined block reached 100% blob capacity',
|
|
581
|
+
valueType: ValueType.INT,
|
|
582
|
+
};
|
|
583
|
+
export const FISHERMAN_FEE_ANALYSIS_MAX_BLOB_CAPACITY: MetricDefinition = {
|
|
584
|
+
name: 'aztec.fisherman.fee_analysis.max_blob_capacity',
|
|
585
|
+
description: 'Maximum blob capacity for the analyzed block based on L1 upgrade schedule',
|
|
586
|
+
unit: 'blobs',
|
|
587
|
+
valueType: ValueType.INT,
|
|
588
|
+
};
|
|
477
589
|
|
|
478
590
|
export const VALIDATOR_INVALID_ATTESTATION_RECEIVED_COUNT: MetricDefinition = {
|
|
479
591
|
name: 'aztec.validator.invalid_attestation_received_count',
|
|
@@ -936,6 +1048,11 @@ export const PROVING_QUEUE_REJECTED_JOBS: MetricDefinition = {
|
|
|
936
1048
|
description: 'Number of rejected proving jobs',
|
|
937
1049
|
valueType: ValueType.INT,
|
|
938
1050
|
};
|
|
1051
|
+
export const PROVING_QUEUE_ABORTED_JOBS: MetricDefinition = {
|
|
1052
|
+
name: 'aztec.proving_queue.aborted_jobs_count',
|
|
1053
|
+
description: 'Number of aborted proving jobs',
|
|
1054
|
+
valueType: ValueType.INT,
|
|
1055
|
+
};
|
|
939
1056
|
export const PROVING_QUEUE_RETRIED_JOBS: MetricDefinition = {
|
|
940
1057
|
name: 'aztec.proving_queue.retried_jobs_count',
|
|
941
1058
|
description: 'Number of retried proving jobs',
|
|
@@ -1271,6 +1388,55 @@ export const TX_COLLECTOR_DURATION_PER_TX: MetricDefinition = {
|
|
|
1271
1388
|
valueType: ValueType.INT,
|
|
1272
1389
|
};
|
|
1273
1390
|
|
|
1391
|
+
export const TX_FILE_STORE_UPLOADS_SUCCESS: MetricDefinition = {
|
|
1392
|
+
name: 'aztec.p2p.tx_file_store.uploads_success',
|
|
1393
|
+
description: 'Number of successful tx uploads to file storage',
|
|
1394
|
+
valueType: ValueType.INT,
|
|
1395
|
+
};
|
|
1396
|
+
export const TX_FILE_STORE_UPLOADS_FAILED: MetricDefinition = {
|
|
1397
|
+
name: 'aztec.p2p.tx_file_store.uploads_failed',
|
|
1398
|
+
description: 'Number of failed tx uploads to file storage',
|
|
1399
|
+
valueType: ValueType.INT,
|
|
1400
|
+
};
|
|
1401
|
+
export const TX_FILE_STORE_UPLOADS_SKIPPED: MetricDefinition = {
|
|
1402
|
+
name: 'aztec.p2p.tx_file_store.uploads_skipped',
|
|
1403
|
+
description: 'Number of tx uploads skipped (duplicates)',
|
|
1404
|
+
valueType: ValueType.INT,
|
|
1405
|
+
};
|
|
1406
|
+
export const TX_FILE_STORE_UPLOAD_DURATION: MetricDefinition = {
|
|
1407
|
+
name: 'aztec.p2p.tx_file_store.upload_duration',
|
|
1408
|
+
description: 'Duration to upload a tx to file storage',
|
|
1409
|
+
unit: 'ms',
|
|
1410
|
+
valueType: ValueType.INT,
|
|
1411
|
+
};
|
|
1412
|
+
export const TX_FILE_STORE_QUEUE_SIZE: MetricDefinition = {
|
|
1413
|
+
name: 'aztec.p2p.tx_file_store.queue_size',
|
|
1414
|
+
description: 'Number of txs pending upload',
|
|
1415
|
+
valueType: ValueType.INT,
|
|
1416
|
+
};
|
|
1417
|
+
export const TX_FILE_STORE_DOWNLOADS_SUCCESS: MetricDefinition = {
|
|
1418
|
+
name: 'aztec.p2p.tx_file_store.downloads_success',
|
|
1419
|
+
description: 'Number of successful tx downloads from file storage',
|
|
1420
|
+
valueType: ValueType.INT,
|
|
1421
|
+
};
|
|
1422
|
+
export const TX_FILE_STORE_DOWNLOADS_FAILED: MetricDefinition = {
|
|
1423
|
+
name: 'aztec.p2p.tx_file_store.downloads_failed',
|
|
1424
|
+
description: 'Number of failed tx downloads from file storage',
|
|
1425
|
+
valueType: ValueType.INT,
|
|
1426
|
+
};
|
|
1427
|
+
export const TX_FILE_STORE_DOWNLOAD_DURATION: MetricDefinition = {
|
|
1428
|
+
name: 'aztec.p2p.tx_file_store.download_duration',
|
|
1429
|
+
description: 'Duration to download a tx from file storage',
|
|
1430
|
+
unit: 'ms',
|
|
1431
|
+
valueType: ValueType.INT,
|
|
1432
|
+
};
|
|
1433
|
+
export const TX_FILE_STORE_DOWNLOAD_SIZE: MetricDefinition = {
|
|
1434
|
+
name: 'aztec.p2p.tx_file_store.download_size',
|
|
1435
|
+
description: 'Size of a downloaded tx from file storage',
|
|
1436
|
+
unit: 'By',
|
|
1437
|
+
valueType: ValueType.INT,
|
|
1438
|
+
};
|
|
1439
|
+
|
|
1274
1440
|
export const IVC_VERIFIER_TIME: MetricDefinition = {
|
|
1275
1441
|
name: 'aztec.ivc_verifier.time',
|
|
1276
1442
|
description: 'Duration to verify chonk proofs',
|
|
@@ -1319,3 +1485,51 @@ export const IVC_VERIFIER_AGG_DURATION_AVG: MetricDefinition = {
|
|
|
1319
1485
|
unit: 'ms',
|
|
1320
1486
|
valueType: ValueType.DOUBLE,
|
|
1321
1487
|
};
|
|
1488
|
+
|
|
1489
|
+
// HA Signer metrics
|
|
1490
|
+
export const HA_SIGNER_SIGNING_DURATION: MetricDefinition = {
|
|
1491
|
+
name: 'aztec.ha_signer.signing_duration',
|
|
1492
|
+
description: 'End-to-end duration for signing with HA protection (lock + sign + record)',
|
|
1493
|
+
unit: 'ms',
|
|
1494
|
+
valueType: ValueType.INT,
|
|
1495
|
+
};
|
|
1496
|
+
export const HA_SIGNER_SIGNING_SUCCESS_COUNT: MetricDefinition = {
|
|
1497
|
+
name: 'aztec.ha_signer.signing_success_count',
|
|
1498
|
+
description: 'Count of successful signing operations',
|
|
1499
|
+
valueType: ValueType.INT,
|
|
1500
|
+
};
|
|
1501
|
+
export const HA_SIGNER_DUTY_ALREADY_SIGNED_COUNT: MetricDefinition = {
|
|
1502
|
+
name: 'aztec.ha_signer.duty_already_signed_count',
|
|
1503
|
+
description: 'Count of DutyAlreadySignedError (expected in HA; another node signed first)',
|
|
1504
|
+
valueType: ValueType.INT,
|
|
1505
|
+
};
|
|
1506
|
+
export const HA_SIGNER_SLASHING_PROTECTION_COUNT: MetricDefinition = {
|
|
1507
|
+
name: 'aztec.ha_signer.slashing_protection_count',
|
|
1508
|
+
description: 'Count of SlashingProtectionError (attempted to sign different data)',
|
|
1509
|
+
valueType: ValueType.INT,
|
|
1510
|
+
};
|
|
1511
|
+
export const HA_SIGNER_SIGNING_ERROR_COUNT: MetricDefinition = {
|
|
1512
|
+
name: 'aztec.ha_signer.signing_error_count',
|
|
1513
|
+
description: 'Count of signing function failures (lock deleted for retry)',
|
|
1514
|
+
valueType: ValueType.INT,
|
|
1515
|
+
};
|
|
1516
|
+
export const HA_SIGNER_LOCK_ACQUIRED_COUNT: MetricDefinition = {
|
|
1517
|
+
name: 'aztec.ha_signer.lock_acquired_count',
|
|
1518
|
+
description: 'Count of lock acquisitions (new lock acquired vs existing record found)',
|
|
1519
|
+
valueType: ValueType.INT,
|
|
1520
|
+
};
|
|
1521
|
+
export const HA_SIGNER_CLEANUP_STUCK_DUTIES_COUNT: MetricDefinition = {
|
|
1522
|
+
name: 'aztec.ha_signer.cleanup_stuck_duties_count',
|
|
1523
|
+
description: 'Number of stuck duties cleaned up per cleanup run',
|
|
1524
|
+
valueType: ValueType.INT,
|
|
1525
|
+
};
|
|
1526
|
+
export const HA_SIGNER_CLEANUP_OLD_DUTIES_COUNT: MetricDefinition = {
|
|
1527
|
+
name: 'aztec.ha_signer.cleanup_old_duties_count',
|
|
1528
|
+
description: 'Number of old duties cleaned up',
|
|
1529
|
+
valueType: ValueType.INT,
|
|
1530
|
+
};
|
|
1531
|
+
export const HA_SIGNER_CLEANUP_OUTDATED_ROLLUP_DUTIES_COUNT: MetricDefinition = {
|
|
1532
|
+
name: 'aztec.ha_signer.cleanup_outdated_rollup_duties_count',
|
|
1533
|
+
description: 'Number of duties cleaned due to rollup upgrade',
|
|
1534
|
+
valueType: ValueType.INT,
|
|
1535
|
+
};
|
|
@@ -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';
|