@aztec/telemetry-client 0.0.1-commit.e558bd1c → 0.0.1-commit.e57c76e

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.
Files changed (41) hide show
  1. package/dest/attributes.d.ts +13 -2
  2. package/dest/attributes.d.ts.map +1 -1
  3. package/dest/attributes.js +6 -1
  4. package/dest/config.d.ts +3 -1
  5. package/dest/config.d.ts.map +1 -1
  6. package/dest/config.js +17 -9
  7. package/dest/lmdb_metrics.d.ts +2 -2
  8. package/dest/lmdb_metrics.d.ts.map +1 -1
  9. package/dest/metrics.d.ts +64 -4
  10. package/dest/metrics.d.ts.map +1 -1
  11. package/dest/metrics.js +341 -11
  12. package/dest/monitored_batch_span_processor.d.ts +29 -0
  13. package/dest/monitored_batch_span_processor.d.ts.map +1 -0
  14. package/dest/monitored_batch_span_processor.js +70 -0
  15. package/dest/otel.d.ts +1 -1
  16. package/dest/otel.d.ts.map +1 -1
  17. package/dest/otel.js +62 -3
  18. package/dest/otel_propagation.d.ts +3 -1
  19. package/dest/otel_propagation.d.ts.map +1 -1
  20. package/dest/otel_propagation.js +49 -1
  21. package/dest/start.d.ts +1 -1
  22. package/dest/start.d.ts.map +1 -1
  23. package/dest/start.js +1 -1
  24. package/dest/telemetry.d.ts +2 -2
  25. package/dest/telemetry.d.ts.map +1 -1
  26. package/dest/wrappers/fetch.d.ts +3 -3
  27. package/dest/wrappers/fetch.d.ts.map +1 -1
  28. package/dest/wrappers/fetch.js +3 -2
  29. package/dest/wrappers/l2_block_stream.d.ts +2 -2
  30. package/dest/wrappers/l2_block_stream.d.ts.map +1 -1
  31. package/package.json +3 -3
  32. package/src/attributes.ts +17 -1
  33. package/src/config.ts +24 -9
  34. package/src/metrics.ts +350 -11
  35. package/src/monitored_batch_span_processor.ts +93 -0
  36. package/src/otel.ts +38 -2
  37. package/src/otel_propagation.ts +42 -1
  38. package/src/start.ts +6 -1
  39. package/src/telemetry.ts +0 -1
  40. package/src/wrappers/fetch.ts +9 -3
  41. package/src/wrappers/l2_block_stream.ts +1 -4
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',
@@ -254,6 +308,12 @@ export const ARCHIVER_SYNC_PER_BLOCK: MetricDefinition = {
254
308
  unit: 'ms',
255
309
  valueType: ValueType.INT,
256
310
  };
311
+ export const ARCHIVER_SYNC_PER_CHECKPOINT: MetricDefinition = {
312
+ name: 'aztec.archiver.checkpoint.sync_per_item_duration',
313
+ description: 'Duration to sync a checkpoint',
314
+ unit: 'ms',
315
+ valueType: ValueType.INT,
316
+ };
257
317
  export const ARCHIVER_SYNC_BLOCK_COUNT: MetricDefinition = {
258
318
  name: 'aztec.archiver.block.sync_count',
259
319
  description: 'Number of blocks synced from L1',
@@ -296,6 +356,19 @@ export const ARCHIVER_BLOCK_PROPOSAL_TX_TARGET_COUNT: MetricDefinition = {
296
356
  valueType: ValueType.INT,
297
357
  };
298
358
 
359
+ export const ARCHIVER_CHECKPOINT_L1_INCLUSION_DELAY: MetricDefinition = {
360
+ name: 'aztec.archiver.checkpoint_l1_inclusion_delay',
361
+ description: 'Seconds into the L2 slot when the checkpoint L1 tx was included',
362
+ unit: 's',
363
+ valueType: ValueType.INT,
364
+ };
365
+
366
+ export const ARCHIVER_CHECKPOINT_PROMOTED_COUNT: MetricDefinition = {
367
+ name: 'aztec.archiver.checkpoint_promoted_count',
368
+ description: 'Number of checkpoints promoted from proposed (blob fetch skipped)',
369
+ valueType: ValueType.INT,
370
+ };
371
+
299
372
  export const NODE_RECEIVE_TX_DURATION: MetricDefinition = {
300
373
  name: 'aztec.node.receive_tx.duration',
301
374
  description: 'The duration of the receiveTx method',
@@ -327,6 +400,12 @@ export const SEQUENCER_STATE_TRANSITION_BUFFER_DURATION: MetricDefinition = {
327
400
  unit: 'ms',
328
401
  valueType: ValueType.INT,
329
402
  };
403
+ export const SEQUENCER_STATE_DURATION: MetricDefinition = {
404
+ name: 'aztec.sequencer.state_duration',
405
+ description: 'Wall-clock time spent in each sequencer state, labelled by the state being left',
406
+ unit: 'ms',
407
+ valueType: ValueType.INT,
408
+ };
330
409
  export const SEQUENCER_BLOCK_BUILD_DURATION: MetricDefinition = {
331
410
  name: 'aztec.sequencer.block.build_duration',
332
411
  description: 'Duration to build a block',
@@ -344,9 +423,15 @@ export const SEQUENCER_BLOCK_COUNT: MetricDefinition = {
344
423
  description: 'Number of blocks built by this sequencer',
345
424
  valueType: ValueType.INT,
346
425
  };
347
- export const SEQUENCER_CURRENT_BLOCK_REWARDS: MetricDefinition = {
348
- name: 'aztec.sequencer.current_block_rewards',
349
- description: 'The rewards earned',
426
+ export const SEQUENCER_BLOCK_INTER_BLOCK_TIME: MetricDefinition = {
427
+ name: 'aztec.sequencer.block.inter_block_time',
428
+ description: 'Wall-clock time elapsed between consecutive blocks being built by this sequencer',
429
+ unit: 'ms',
430
+ valueType: ValueType.INT,
431
+ };
432
+ export const SEQUENCER_CURRENT_SLOT_REWARDS: MetricDefinition = {
433
+ name: 'aztec.sequencer.current_slot_rewards',
434
+ description: 'The rewards earned per filled slot',
350
435
  valueType: ValueType.DOUBLE,
351
436
  };
352
437
  export const SEQUENCER_SLOT_COUNT: MetricDefinition = {
@@ -369,12 +454,12 @@ export const SEQUENCER_CHECKPOINT_ATTESTATION_DELAY: MetricDefinition = {
369
454
 
370
455
  export const SEQUENCER_COLLECTED_ATTESTATIONS_COUNT: MetricDefinition = {
371
456
  name: 'aztec.sequencer.attestations.collected_count',
372
- description: 'The number of attestations collected for a block proposal',
457
+ description: 'The number of attestations collected for a checkpoint proposal',
373
458
  valueType: ValueType.INT,
374
459
  };
375
460
  export const SEQUENCER_REQUIRED_ATTESTATIONS_COUNT: MetricDefinition = {
376
461
  name: 'aztec.sequencer.attestations.required_count',
377
- description: 'The minimum number of attestations required to publish a block',
462
+ description: 'The minimum number of attestations required to publish a checkpoint',
378
463
  valueType: ValueType.INT,
379
464
  };
380
465
  export const SEQUENCER_COLLECT_ATTESTATIONS_DURATION: MetricDefinition = {
@@ -395,14 +480,61 @@ export const SEQUENCER_BLOCK_PROPOSAL_FAILED_COUNT: MetricDefinition = {
395
480
  description: 'The number of times block proposal failed (including validation builds)',
396
481
  valueType: ValueType.INT,
397
482
  };
398
- export const SEQUENCER_BLOCK_PROPOSAL_SUCCESS_COUNT: MetricDefinition = {
399
- name: 'aztec.sequencer.block.proposal_success_count',
400
- description: 'The number of times block proposal succeeded (including validation builds)',
483
+ export const SEQUENCER_CHECKPOINT_PROPOSAL_SUCCESS_COUNT: MetricDefinition = {
484
+ name: 'aztec.sequencer.checkpoint.proposal_success_count',
485
+ description: 'The number of times checkpoint proposal succeeded',
486
+ valueType: ValueType.INT,
487
+ };
488
+ export const SEQUENCER_CHECKPOINT_PRECHECK_FAILED_COUNT: MetricDefinition = {
489
+ name: 'aztec.sequencer.checkpoint.precheck_failed_count',
490
+ description: 'The number of times checkpoint pre-build checks failed',
491
+ valueType: ValueType.INT,
492
+ };
493
+ export const SEQUENCER_CHECKPOINT_PROPOSAL_FAILED_COUNT: MetricDefinition = {
494
+ name: 'aztec.sequencer.checkpoint.proposal_failed_count',
495
+ description: 'The number of times checkpoint proposal failed',
496
+ valueType: ValueType.INT,
497
+ };
498
+ export const SEQUENCER_CHECKPOINT_BUILD_DURATION: MetricDefinition = {
499
+ name: 'aztec.sequencer.checkpoint.build_duration',
500
+ description: 'Total duration to build all blocks in a checkpoint',
501
+ unit: 'ms',
502
+ valueType: ValueType.INT,
503
+ };
504
+ export const SEQUENCER_CHECKPOINT_START_TO_FIRST_BLOCK_DURATION: MetricDefinition = {
505
+ name: 'aztec.sequencer.checkpoint.start_to_first_block_duration',
506
+ description: 'Time from starting checkpoint work to the first block finishing build',
507
+ unit: 'ms',
508
+ valueType: ValueType.INT,
509
+ };
510
+ export const SEQUENCER_CHECKPOINT_LAST_BLOCK_TO_BROADCAST_DURATION: MetricDefinition = {
511
+ name: 'aztec.sequencer.checkpoint.last_block_to_broadcast_duration',
512
+ description: 'Time from the final block finishing build to the checkpoint proposal being broadcast',
513
+ unit: 'ms',
514
+ valueType: ValueType.INT,
515
+ };
516
+ export const SEQUENCER_PIPELINED_CHECKPOINT_BUILD_START_OFFSET_FROM_SLOT_BOUNDARY: MetricDefinition = {
517
+ name: 'aztec.sequencer.pipelined_checkpoint.build_start_offset_from_slot_boundary',
518
+ description:
519
+ 'Absolute offset from the wall-clock slot boundary when a pipelined checkpoint build starts. Use aztec.slot_boundary_side to distinguish before vs after the boundary.',
520
+ unit: 'ms',
521
+ valueType: ValueType.INT,
522
+ };
523
+ export const SEQUENCER_CHECKPOINT_BLOCK_COUNT: MetricDefinition = {
524
+ name: 'aztec.sequencer.checkpoint.block_count',
525
+ description: 'Number of blocks built in a checkpoint',
401
526
  valueType: ValueType.INT,
402
527
  };
403
- export const SEQUENCER_BLOCK_PROPOSAL_PRECHECK_FAILED_COUNT: MetricDefinition = {
404
- name: 'aztec.sequencer.block.proposal_precheck_failed_count',
405
- description: 'The number of times block proposal pre-build checks failed',
528
+ export const SEQUENCER_CHECKPOINT_TX_COUNT: MetricDefinition = {
529
+ name: 'aztec.sequencer.checkpoint.tx_count',
530
+ description: 'Total number of transactions across all blocks in a checkpoint',
531
+ unit: 'tx',
532
+ valueType: ValueType.INT,
533
+ };
534
+ export const SEQUENCER_CHECKPOINT_TOTAL_MANA: MetricDefinition = {
535
+ name: 'aztec.sequencer.checkpoint.total_mana',
536
+ description: 'Total L2 mana used across all blocks in a checkpoint',
537
+ unit: 'mana',
406
538
  valueType: ValueType.INT,
407
539
  };
408
540
  export const SEQUENCER_SLASHING_ATTEMPTS_COUNT: MetricDefinition = {
@@ -415,6 +547,21 @@ export const SEQUENCER_CHECKPOINT_SUCCESS_COUNT: MetricDefinition = {
415
547
  description: 'The number of times checkpoint publishing succeeded',
416
548
  valueType: ValueType.INT,
417
549
  };
550
+ export const SEQUENCER_PIPELINE_DEPTH: MetricDefinition = {
551
+ name: 'aztec.sequencer.pipeline.depth',
552
+ description: 'Current pipeline depth when builder pipelining is enabled',
553
+ valueType: ValueType.INT,
554
+ };
555
+ export const SEQUENCER_PIPELINE_DISCARDS_COUNT: MetricDefinition = {
556
+ name: 'aztec.sequencer.pipeline.discards_count',
557
+ description: 'The number of times a pipeline was discarded',
558
+ valueType: ValueType.INT,
559
+ };
560
+ export const SEQUENCER_PIPELINE_PARENT_CHECKPOINT_MISMATCH_COUNT: MetricDefinition = {
561
+ name: 'aztec.sequencer.pipeline.parent_checkpoint_mismatch_count',
562
+ description: 'The number of times a pipelined checkpoint was discarded because the parent did not match expectations',
563
+ valueType: ValueType.INT,
564
+ };
418
565
 
419
566
  // Fisherman fee analysis metrics
420
567
  export const FISHERMAN_FEE_ANALYSIS_WOULD_BE_INCLUDED: MetricDefinition = {
@@ -474,6 +621,29 @@ export const FISHERMAN_FEE_ANALYSIS_MINED_BLOB_TX_TOTAL_COST: MetricDefinition =
474
621
  unit: 'eth',
475
622
  valueType: ValueType.DOUBLE,
476
623
  };
624
+ export const FISHERMAN_FEE_ANALYSIS_PENDING_BLOB_COUNT: MetricDefinition = {
625
+ name: 'aztec.fisherman.fee_analysis.pending_blob_count',
626
+ description: 'Total number of blobs in pending blob transactions',
627
+ unit: 'blobs',
628
+ valueType: ValueType.INT,
629
+ };
630
+ export const FISHERMAN_FEE_ANALYSIS_INCLUDED_BLOB_COUNT: MetricDefinition = {
631
+ name: 'aztec.fisherman.fee_analysis.included_blob_count',
632
+ description: 'Total number of blobs included in the mined block',
633
+ unit: 'blobs',
634
+ valueType: ValueType.INT,
635
+ };
636
+ export const FISHERMAN_FEE_ANALYSIS_BLOCK_BLOBS_FULL: MetricDefinition = {
637
+ name: 'aztec.fisherman.fee_analysis.block_blobs_full',
638
+ description: 'Whether the mined block reached 100% blob capacity',
639
+ valueType: ValueType.INT,
640
+ };
641
+ export const FISHERMAN_FEE_ANALYSIS_MAX_BLOB_CAPACITY: MetricDefinition = {
642
+ name: 'aztec.fisherman.fee_analysis.max_blob_capacity',
643
+ description: 'Maximum blob capacity for the analyzed block based on L1 upgrade schedule',
644
+ unit: 'blobs',
645
+ valueType: ValueType.INT,
646
+ };
477
647
 
478
648
  export const VALIDATOR_INVALID_ATTESTATION_RECEIVED_COUNT: MetricDefinition = {
479
649
  name: 'aztec.validator.invalid_attestation_received_count',
@@ -559,6 +729,24 @@ export const L1_PUBLISHER_TX_TOTAL_FEE: MetricDefinition = {
559
729
  unit: 'eth',
560
730
  valueType: ValueType.DOUBLE,
561
731
  };
732
+ export const PROVER_NODE_ESTIMATED_SUBMISSION_GAS: MetricDefinition = {
733
+ name: 'aztec.prover_node.estimated_submission.gas',
734
+ description: 'Estimated gas for a proof submission tx (proof publishing disabled, not actually sent)',
735
+ unit: 'gas',
736
+ valueType: ValueType.INT,
737
+ };
738
+ export const PROVER_NODE_ESTIMATED_SUBMISSION_GAS_PRICE: MetricDefinition = {
739
+ name: 'aztec.prover_node.estimated_submission.gas_price',
740
+ description: 'Estimated effective gas price for a proof submission tx (proof publishing disabled, not actually sent)',
741
+ unit: 'gwei',
742
+ valueType: ValueType.DOUBLE,
743
+ };
744
+ export const PROVER_NODE_ESTIMATED_SUBMISSION_TOTAL_FEE: MetricDefinition = {
745
+ name: 'aztec.prover_node.estimated_submission.total_fee',
746
+ description: 'Estimated total L1 fee for a proof submission tx (proof publishing disabled, not actually sent)',
747
+ unit: 'eth',
748
+ valueType: ValueType.DOUBLE,
749
+ };
562
750
 
563
751
  export const L1_BLOCK_HEIGHT: MetricDefinition = {
564
752
  name: 'aztec.l1.block_height',
@@ -652,6 +840,12 @@ export const PEER_MANAGER_PEER_COUNT: MetricDefinition = {
652
840
  unit: 'peers',
653
841
  valueType: ValueType.INT,
654
842
  };
843
+ export const PEER_MANAGER_HEALTHY_PEER_COUNT: MetricDefinition = {
844
+ name: 'aztec.peer_manager.healthy_peer_count',
845
+ description: 'Number of healthy (non-protected, non-banned) peers',
846
+ unit: 'peers',
847
+ valueType: ValueType.INT,
848
+ };
655
849
  export const PEER_MANAGER_LOW_SCORE_DISCONNECTS: MetricDefinition = {
656
850
  name: 'aztec.peer_manager.low_score_disconnects',
657
851
  description: 'Number of peers disconnected due to low score',
@@ -781,6 +975,12 @@ export const P2P_GOSSIP_AGG_MESSAGE_VALIDATION_DURATION_AVG: MetricDefinition =
781
975
  valueType: ValueType.INT,
782
976
  };
783
977
 
978
+ export const P2P_GOSSIP_SLOW_VALIDATION_COUNT: MetricDefinition = {
979
+ name: 'aztec.p2p.gossip.slow_validation_count',
980
+ description: 'Number of gossip validations that exceeded 75% of the mcache eviction window',
981
+ valueType: ValueType.INT,
982
+ };
983
+
784
984
  export const PUBLIC_PROCESSOR_TX_DURATION: MetricDefinition = {
785
985
  name: 'aztec.public_processor.tx_duration',
786
986
  description: 'Duration to process a public transaction',
@@ -844,6 +1044,17 @@ export const PUBLIC_PROCESSOR_TREE_INSERTION: MetricDefinition = {
844
1044
  unit: 'ms',
845
1045
  valueType: ValueType.INT,
846
1046
  };
1047
+ export const PUBLIC_PROCESSOR_SILENTLY_SKIPPED_COUNT: MetricDefinition = {
1048
+ name: 'aztec.public_processor.silently_skipped_count',
1049
+ description: 'Public txs fully processed then skipped (e.g. blob-field limit); not counted as processed or failed',
1050
+ valueType: ValueType.INT,
1051
+ };
1052
+ export const PUBLIC_PROCESSOR_SILENTLY_SKIPPED_DURATION: MetricDefinition = {
1053
+ name: 'aztec.public_processor.silently_skipped_duration',
1054
+ description: 'Wall-clock time spent processing txs that were then silently skipped',
1055
+ unit: 'ms',
1056
+ valueType: ValueType.INT,
1057
+ };
847
1058
 
848
1059
  export const PUBLIC_EXECUTOR_PREFIX = 'aztec.public_executor.';
849
1060
  export const PUBLIC_EXECUTOR_SIMULATION_COUNT: MetricDefinition = {
@@ -936,6 +1147,11 @@ export const PROVING_QUEUE_REJECTED_JOBS: MetricDefinition = {
936
1147
  description: 'Number of rejected proving jobs',
937
1148
  valueType: ValueType.INT,
938
1149
  };
1150
+ export const PROVING_QUEUE_ABORTED_JOBS: MetricDefinition = {
1151
+ name: 'aztec.proving_queue.aborted_jobs_count',
1152
+ description: 'Number of aborted proving jobs',
1153
+ valueType: ValueType.INT,
1154
+ };
939
1155
  export const PROVING_QUEUE_RETRIED_JOBS: MetricDefinition = {
940
1156
  name: 'aztec.proving_queue.retried_jobs_count',
941
1157
  description: 'Number of retried proving jobs',
@@ -1010,6 +1226,36 @@ export const PROVER_NODE_JOB_TRANSACTIONS: MetricDefinition = {
1010
1226
  description: 'Number of transactions in a proven epoch',
1011
1227
  valueType: ValueType.INT,
1012
1228
  };
1229
+ export const PROVER_NODE_BLOB_PROCESSING_LAST_DURATION: MetricDefinition = {
1230
+ name: 'aztec.prover_node.blob_processing.last_duration',
1231
+ description: 'Duration of blob processing step in epoch proving job',
1232
+ unit: 'ms',
1233
+ valueType: ValueType.INT,
1234
+ };
1235
+ export const PROVER_NODE_CHONK_VERIFIER_LAST_DURATION: MetricDefinition = {
1236
+ name: 'aztec.prover_node.chonk_verifier.last_duration',
1237
+ description: 'Duration of chonk verifier enqueuing in epoch proving job',
1238
+ unit: 'ms',
1239
+ valueType: ValueType.INT,
1240
+ };
1241
+ export const PROVER_NODE_BLOCK_PROCESSING_DURATION: MetricDefinition = {
1242
+ name: 'aztec.prover_node.block_processing.duration',
1243
+ description: 'Duration of processing a single block in epoch proving job',
1244
+ unit: 'ms',
1245
+ valueType: ValueType.INT,
1246
+ };
1247
+ export const PROVER_NODE_CHECKPOINT_PROCESSING_DURATION: MetricDefinition = {
1248
+ name: 'aztec.prover_node.checkpoint_processing.duration',
1249
+ description: 'Duration of processing a single checkpoint in epoch proving job',
1250
+ unit: 'ms',
1251
+ valueType: ValueType.INT,
1252
+ };
1253
+ export const PROVER_NODE_ALL_CHECKPOINTS_PROCESSING_LAST_DURATION: MetricDefinition = {
1254
+ name: 'aztec.prover_node.all_checkpoints_processing.last_duration',
1255
+ description: 'Duration of processing all checkpoints in epoch proving job',
1256
+ unit: 'ms',
1257
+ valueType: ValueType.INT,
1258
+ };
1013
1259
  export const PROVER_NODE_REWARDS_TOTAL: MetricDefinition = {
1014
1260
  name: 'aztec.prover_node.rewards_total',
1015
1261
  description: 'The rewards earned (total)',
@@ -1123,6 +1369,19 @@ export const VALIDATOR_RE_EXECUTION_TX_COUNT: MetricDefinition = {
1123
1369
  unit: 'tx',
1124
1370
  valueType: ValueType.INT,
1125
1371
  };
1372
+ export const VALIDATOR_CHECKPOINT_PROPOSAL_TO_PIPELINED_STATE_DURATION: MetricDefinition = {
1373
+ name: 'aztec.validator.checkpoint_proposal_to_pipelined_state_duration',
1374
+ description: 'Time from receiving a checkpoint proposal to setting proposed checkpoint state for pipelining',
1375
+ unit: 'ms',
1376
+ valueType: ValueType.INT,
1377
+ };
1378
+ export const VALIDATOR_CHECKPOINT_PROPOSAL_RECEIVE_OFFSET_FROM_NEXT_SLOT_BOUNDARY: MetricDefinition = {
1379
+ name: 'aztec.validator.checkpoint.proposal_receive_offset_from_next_slot_boundary',
1380
+ description:
1381
+ 'Absolute offset from the next slot boundary when a foreign checkpoint proposal is received. Use aztec.slot_boundary_side to distinguish before vs after the boundary.',
1382
+ unit: 'ms',
1383
+ valueType: ValueType.INT,
1384
+ };
1126
1385
 
1127
1386
  export const VALIDATOR_FAILED_REEXECUTION_COUNT: MetricDefinition = {
1128
1387
  name: 'aztec.validator.failed_reexecution_count',
@@ -1144,6 +1403,16 @@ export const VALIDATOR_ATTESTATION_FAILED_NODE_ISSUE_COUNT: MetricDefinition = {
1144
1403
  description: 'The number of failed attestations due to node issues (timeout, missing data, etc.)',
1145
1404
  valueType: ValueType.INT,
1146
1405
  };
1406
+ export const VALIDATOR_CURRENT_EPOCH: MetricDefinition = {
1407
+ name: 'aztec.validator.current_epoch',
1408
+ description: 'The current epoch number, reflecting total epochs elapsed since genesis',
1409
+ valueType: ValueType.INT,
1410
+ };
1411
+ export const VALIDATOR_ATTESTED_EPOCH_COUNT: MetricDefinition = {
1412
+ name: 'aztec.validator.attested_epoch_count',
1413
+ description: 'The number of epochs in which this node successfully submitted at least one attestation',
1414
+ valueType: ValueType.INT,
1415
+ };
1147
1416
 
1148
1417
  export const NODEJS_EVENT_LOOP_DELAY_MIN: MetricDefinition = {
1149
1418
  name: 'nodejs.eventloop.delay.min',
@@ -1297,6 +1566,28 @@ export const TX_FILE_STORE_QUEUE_SIZE: MetricDefinition = {
1297
1566
  description: 'Number of txs pending upload',
1298
1567
  valueType: ValueType.INT,
1299
1568
  };
1569
+ export const TX_FILE_STORE_DOWNLOADS_SUCCESS: MetricDefinition = {
1570
+ name: 'aztec.p2p.tx_file_store.downloads_success',
1571
+ description: 'Number of successful tx downloads from file storage',
1572
+ valueType: ValueType.INT,
1573
+ };
1574
+ export const TX_FILE_STORE_DOWNLOADS_FAILED: MetricDefinition = {
1575
+ name: 'aztec.p2p.tx_file_store.downloads_failed',
1576
+ description: 'Number of failed tx downloads from file storage',
1577
+ valueType: ValueType.INT,
1578
+ };
1579
+ export const TX_FILE_STORE_DOWNLOAD_DURATION: MetricDefinition = {
1580
+ name: 'aztec.p2p.tx_file_store.download_duration',
1581
+ description: 'Duration to download a tx from file storage',
1582
+ unit: 'ms',
1583
+ valueType: ValueType.INT,
1584
+ };
1585
+ export const TX_FILE_STORE_DOWNLOAD_SIZE: MetricDefinition = {
1586
+ name: 'aztec.p2p.tx_file_store.download_size',
1587
+ description: 'Size of a downloaded tx from file storage',
1588
+ unit: 'By',
1589
+ valueType: ValueType.INT,
1590
+ };
1300
1591
 
1301
1592
  export const IVC_VERIFIER_TIME: MetricDefinition = {
1302
1593
  name: 'aztec.ivc_verifier.time',
@@ -1346,3 +1637,51 @@ export const IVC_VERIFIER_AGG_DURATION_AVG: MetricDefinition = {
1346
1637
  unit: 'ms',
1347
1638
  valueType: ValueType.DOUBLE,
1348
1639
  };
1640
+
1641
+ // HA Signer metrics
1642
+ export const HA_SIGNER_SIGNING_DURATION: MetricDefinition = {
1643
+ name: 'aztec.ha_signer.signing_duration',
1644
+ description: 'End-to-end duration for signing with HA protection (lock + sign + record)',
1645
+ unit: 'ms',
1646
+ valueType: ValueType.INT,
1647
+ };
1648
+ export const HA_SIGNER_SIGNING_SUCCESS_COUNT: MetricDefinition = {
1649
+ name: 'aztec.ha_signer.signing_success_count',
1650
+ description: 'Count of successful signing operations',
1651
+ valueType: ValueType.INT,
1652
+ };
1653
+ export const HA_SIGNER_DUTY_ALREADY_SIGNED_COUNT: MetricDefinition = {
1654
+ name: 'aztec.ha_signer.duty_already_signed_count',
1655
+ description: 'Count of DutyAlreadySignedError (expected in HA; another node signed first)',
1656
+ valueType: ValueType.INT,
1657
+ };
1658
+ export const HA_SIGNER_SLASHING_PROTECTION_COUNT: MetricDefinition = {
1659
+ name: 'aztec.ha_signer.slashing_protection_count',
1660
+ description: 'Count of SlashingProtectionError (attempted to sign different data)',
1661
+ valueType: ValueType.INT,
1662
+ };
1663
+ export const HA_SIGNER_SIGNING_ERROR_COUNT: MetricDefinition = {
1664
+ name: 'aztec.ha_signer.signing_error_count',
1665
+ description: 'Count of signing function failures (lock deleted for retry)',
1666
+ valueType: ValueType.INT,
1667
+ };
1668
+ export const HA_SIGNER_LOCK_ACQUIRED_COUNT: MetricDefinition = {
1669
+ name: 'aztec.ha_signer.lock_acquired_count',
1670
+ description: 'Count of lock acquisitions (new lock acquired vs existing record found)',
1671
+ valueType: ValueType.INT,
1672
+ };
1673
+ export const HA_SIGNER_CLEANUP_STUCK_DUTIES_COUNT: MetricDefinition = {
1674
+ name: 'aztec.ha_signer.cleanup_stuck_duties_count',
1675
+ description: 'Number of stuck duties cleaned up per cleanup run',
1676
+ valueType: ValueType.INT,
1677
+ };
1678
+ export const HA_SIGNER_CLEANUP_OLD_DUTIES_COUNT: MetricDefinition = {
1679
+ name: 'aztec.ha_signer.cleanup_old_duties_count',
1680
+ description: 'Number of old duties cleaned up',
1681
+ valueType: ValueType.INT,
1682
+ };
1683
+ export const HA_SIGNER_CLEANUP_OUTDATED_ROLLUP_DUTIES_COUNT: MetricDefinition = {
1684
+ name: 'aztec.ha_signer.cleanup_outdated_rollup_duties_count',
1685
+ description: 'Number of duties cleaned due to rollup upgrade',
1686
+ valueType: ValueType.INT,
1687
+ };
@@ -0,0 +1,93 @@
1
+ import type { Logger } from '@aztec/foundation/log';
2
+
3
+ import { type Context, SpanStatusCode } from '@opentelemetry/api';
4
+ import { hrTimeToMilliseconds } from '@opentelemetry/core';
5
+ import type { SpanExporter } from '@opentelemetry/sdk-trace-base';
6
+ import { BatchSpanProcessor, type BufferConfig, type ReadableSpan, type Span } from '@opentelemetry/sdk-trace-node';
7
+
8
+ /** Minimum interval between drop warnings to avoid log spam. */
9
+ const DROP_WARNING_INTERVAL_MS = 30_000;
10
+
11
+ const DEFAULT_MIN_TRACE_DURATION_MS = 10;
12
+
13
+ export type MonitoredBatchSpanProcessorConfig = BufferConfig & {
14
+ minTraceDurationMs?: number;
15
+ };
16
+
17
+ /**
18
+ * Wraps BatchSpanProcessor to emit warnings when spans are dropped due to a full queue.
19
+ * The standard BatchSpanProcessor silently discards spans when its internal queue reaches
20
+ * maxQueueSize, making telemetry data loss invisible to operators.
21
+ */
22
+ export class MonitoredBatchSpanProcessor extends BatchSpanProcessor {
23
+ private readonly maxQueueSize: number;
24
+ private readonly minTraceDurationMs: number;
25
+ private readonly log: Logger;
26
+
27
+ private approxQueueSize = 0;
28
+ private droppedSinceLastWarning = 0;
29
+ private totalDropped = 0;
30
+ private lastWarningTime = 0;
31
+
32
+ constructor(exporter: SpanExporter, log: Logger, config?: MonitoredBatchSpanProcessorConfig) {
33
+ const maxQueueSize = config?.maxQueueSize ?? 2048;
34
+ super(exporter, { ...config, maxQueueSize });
35
+ this.maxQueueSize = maxQueueSize;
36
+ this.minTraceDurationMs = Math.max(0, config?.minTraceDurationMs ?? DEFAULT_MIN_TRACE_DURATION_MS);
37
+ this.log = log;
38
+ }
39
+
40
+ override onStart(span: Span, parentContext: Context): void {
41
+ super.onStart(span, parentContext);
42
+ }
43
+
44
+ override onEnd(span: ReadableSpan): void {
45
+ if (this.shouldDropShortSpan(span)) {
46
+ return;
47
+ }
48
+
49
+ if (this.approxQueueSize >= this.maxQueueSize) {
50
+ this.droppedSinceLastWarning++;
51
+ this.totalDropped++;
52
+ this.maybeLogDropWarning();
53
+ } else {
54
+ this.approxQueueSize++;
55
+ }
56
+ super.onEnd(span);
57
+ }
58
+
59
+ override async forceFlush(): Promise<void> {
60
+ await super.forceFlush();
61
+ this.approxQueueSize = 0;
62
+ }
63
+
64
+ override async shutdown(): Promise<void> {
65
+ if (this.totalDropped > 0) {
66
+ this.log.warn(`BatchSpanProcessor shutting down with ${this.totalDropped} total spans dropped`, {
67
+ totalDropped: this.totalDropped,
68
+ });
69
+ }
70
+ await super.shutdown();
71
+ }
72
+
73
+ private shouldDropShortSpan(span: ReadableSpan): boolean {
74
+ return (
75
+ this.minTraceDurationMs > 0 &&
76
+ span.status.code !== SpanStatusCode.ERROR &&
77
+ hrTimeToMilliseconds(span.duration) < this.minTraceDurationMs
78
+ );
79
+ }
80
+
81
+ private maybeLogDropWarning(): void {
82
+ const now = Date.now();
83
+ if (now - this.lastWarningTime >= DROP_WARNING_INTERVAL_MS) {
84
+ this.log.warn(
85
+ `BatchSpanProcessor dropping spans: queue full (maxQueueSize=${this.maxQueueSize}). ` +
86
+ `${this.droppedSinceLastWarning} dropped since last warning, ${this.totalDropped} total.`,
87
+ { droppedSinceLastWarning: this.droppedSinceLastWarning, totalDropped: this.totalDropped },
88
+ );
89
+ this.droppedSinceLastWarning = 0;
90
+ this.lastWarningTime = now;
91
+ }
92
+ }
93
+ }
package/src/otel.ts CHANGED
@@ -28,12 +28,13 @@ import {
28
28
  type PeriodicExportingMetricReaderOptions,
29
29
  View,
30
30
  } from '@opentelemetry/sdk-metrics';
31
- import { BatchSpanProcessor, NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
31
+ import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
32
32
  import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from '@opentelemetry/semantic-conventions';
33
33
 
34
34
  import type { TelemetryClientConfig } from './config.js';
35
35
  import { toMetricOptions } from './metric-utils.js';
36
36
  import type { MetricDefinition } from './metrics.js';
37
+ import { MonitoredBatchSpanProcessor } from './monitored_batch_span_processor.js';
37
38
  import { NodejsMetricsMonitor } from './nodejs_metrics_monitor.js';
38
39
  import { OtelFilterMetricExporter, PublicOtelFilterMetricExporter } from './otel_filter_metric_exporter.js';
39
40
  import { registerOtelLoggerProvider } from './otel_logger_provider.js';
@@ -334,6 +335,36 @@ export class OpenTelemetryClient implements TelemetryClient {
334
335
  true,
335
336
  ),
336
337
  }),
338
+ // L1 gas prices in gwei: priority fees ~0.01-10, base fees ~1-500, spikes to 1000+
339
+ new View({
340
+ instrumentType: InstrumentType.HISTOGRAM,
341
+ instrumentUnit: 'gwei',
342
+ aggregation: new ExplicitBucketHistogramAggregation(
343
+ [0.1, 0.5, 1, 2, 5, 10, 20, 50, 100, 200, 500, 1_000],
344
+ true,
345
+ ),
346
+ }),
347
+ // L1 gas consumption: tx gas 100k-30M, calldata/blob gas varies
348
+ new View({
349
+ instrumentType: InstrumentType.HISTOGRAM,
350
+ instrumentUnit: 'gas',
351
+ aggregation: new ExplicitBucketHistogramAggregation(
352
+ [
353
+ 10_000, 50_000, 100_000, 250_000, 500_000, 1_000_000, 2_000_000, 5_000_000, 10_000_000, 15_000_000,
354
+ 30_000_000,
355
+ ],
356
+ true,
357
+ ),
358
+ }),
359
+ // L1 tx total fee in ETH: typically 0.001 - 1 ETH
360
+ new View({
361
+ instrumentType: InstrumentType.HISTOGRAM,
362
+ instrumentUnit: 'eth',
363
+ aggregation: new ExplicitBucketHistogramAggregation(
364
+ [0.0001, 0.0005, 0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1, 5, 10],
365
+ true,
366
+ ),
367
+ }),
337
368
  ],
338
369
  });
339
370
  }
@@ -343,7 +374,12 @@ export class OpenTelemetryClient implements TelemetryClient {
343
374
  const tracerProvider = new NodeTracerProvider({
344
375
  resource,
345
376
  spanProcessors: config.tracesCollectorUrl
346
- ? [new BatchSpanProcessor(new OTLPTraceExporter({ url: config.tracesCollectorUrl.href }))]
377
+ ? [
378
+ new MonitoredBatchSpanProcessor(new OTLPTraceExporter({ url: config.tracesCollectorUrl.href }), log, {
379
+ maxQueueSize: config.otelBspMaxQueueSize,
380
+ minTraceDurationMs: config.otelMinTraceDurationMs,
381
+ }),
382
+ ]
347
383
  : [],
348
384
  });
349
385