@aztec/telemetry-client 0.0.1-commit.a072138 → 0.0.1-commit.a5db02d
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 +17 -2
- package/dest/attributes.d.ts.map +1 -1
- package/dest/attributes.js +8 -1
- package/dest/config.d.ts +3 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +17 -9
- package/dest/lmdb_metrics.d.ts +2 -2
- package/dest/lmdb_metrics.d.ts.map +1 -1
- package/dest/metrics.d.ts +73 -5
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +388 -19
- package/dest/monitored_batch_span_processor.d.ts +29 -0
- package/dest/monitored_batch_span_processor.d.ts.map +1 -0
- package/dest/monitored_batch_span_processor.js +75 -0
- package/dest/otel.d.ts +6 -1
- package/dest/otel.d.ts.map +1 -1
- package/dest/otel.js +99 -4
- package/dest/otel_propagation.d.ts +3 -1
- package/dest/otel_propagation.d.ts.map +1 -1
- package/dest/otel_propagation.js +49 -1
- package/dest/start.d.ts +1 -1
- package/dest/start.d.ts.map +1 -1
- package/dest/start.js +1 -1
- package/dest/telemetry.d.ts +2 -2
- package/dest/telemetry.d.ts.map +1 -1
- package/dest/wrappers/fetch.d.ts +3 -3
- package/dest/wrappers/fetch.d.ts.map +1 -1
- package/dest/wrappers/fetch.js +3 -2
- package/dest/wrappers/index.d.ts +1 -2
- package/dest/wrappers/index.d.ts.map +1 -1
- package/dest/wrappers/index.js +0 -1
- package/package.json +3 -3
- package/src/attributes.ts +21 -1
- package/src/config.ts +24 -9
- package/src/metrics.ts +400 -19
- package/src/monitored_batch_span_processor.ts +100 -0
- package/src/otel.ts +69 -3
- package/src/otel_propagation.ts +42 -1
- package/src/start.ts +6 -1
- package/src/telemetry.ts +0 -1
- package/src/wrappers/fetch.ts +9 -3
- package/src/wrappers/index.ts +0 -1
- package/dest/wrappers/l2_block_stream.d.ts +0 -16
- package/dest/wrappers/l2_block_stream.d.ts.map +0 -1
- package/dest/wrappers/l2_block_stream.js +0 -400
- package/src/wrappers/l2_block_stream.ts +0 -41
package/src/metrics.ts
CHANGED
|
@@ -162,11 +162,60 @@ export const MEMPOOL_TX_ADDED_COUNT: MetricDefinition = {
|
|
|
162
162
|
};
|
|
163
163
|
export const MEMPOOL_TX_MINED_DELAY: MetricDefinition = {
|
|
164
164
|
name: 'aztec.mempool.tx_mined_delay',
|
|
165
|
-
description: 'Delay
|
|
165
|
+
description: 'Delay (ms) from a transaction being received into the pool to being mined',
|
|
166
166
|
unit: 'ms',
|
|
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',
|
|
@@ -280,7 +340,8 @@ export const ARCHIVER_PRUNE_DURATION: MetricDefinition = {
|
|
|
280
340
|
};
|
|
281
341
|
export const ARCHIVER_PRUNE_COUNT: MetricDefinition = {
|
|
282
342
|
name: 'aztec.archiver.prune_count',
|
|
283
|
-
description:
|
|
343
|
+
description:
|
|
344
|
+
'Number of prunes detected, dimensioned by prune_type: unproven (epoch prune of checkpoints that will not be proven), uncheckpointed (proposed blocks whose slot ended without a checkpoint), l1_conflict (proposed blocks conflicting with an L1 checkpoint), orphan (proposed blocks whose matching proposed checkpoint never arrived before the deadline), and l1_mismatch (the local checkpointed tip diverged from L1 — an L1 reorg or a pruned/missed-proof checkpoint — rewinding already-checkpointed blocks).',
|
|
284
345
|
valueType: ValueType.INT,
|
|
285
346
|
};
|
|
286
347
|
|
|
@@ -296,6 +357,19 @@ export const ARCHIVER_BLOCK_PROPOSAL_TX_TARGET_COUNT: MetricDefinition = {
|
|
|
296
357
|
valueType: ValueType.INT,
|
|
297
358
|
};
|
|
298
359
|
|
|
360
|
+
export const ARCHIVER_CHECKPOINT_L1_INCLUSION_DELAY: MetricDefinition = {
|
|
361
|
+
name: 'aztec.archiver.checkpoint_l1_inclusion_delay',
|
|
362
|
+
description: 'Seconds into the L2 slot when the checkpoint L1 tx was included',
|
|
363
|
+
unit: 's',
|
|
364
|
+
valueType: ValueType.INT,
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
export const ARCHIVER_CHECKPOINT_PROMOTED_COUNT: MetricDefinition = {
|
|
368
|
+
name: 'aztec.archiver.checkpoint_promoted_count',
|
|
369
|
+
description: 'Number of checkpoints promoted from proposed (blob fetch skipped)',
|
|
370
|
+
valueType: ValueType.INT,
|
|
371
|
+
};
|
|
372
|
+
|
|
299
373
|
export const NODE_RECEIVE_TX_DURATION: MetricDefinition = {
|
|
300
374
|
name: 'aztec.node.receive_tx.duration',
|
|
301
375
|
description: 'The duration of the receiveTx method',
|
|
@@ -327,6 +401,12 @@ export const SEQUENCER_STATE_TRANSITION_BUFFER_DURATION: MetricDefinition = {
|
|
|
327
401
|
unit: 'ms',
|
|
328
402
|
valueType: ValueType.INT,
|
|
329
403
|
};
|
|
404
|
+
export const SEQUENCER_STATE_DURATION: MetricDefinition = {
|
|
405
|
+
name: 'aztec.sequencer.state_duration',
|
|
406
|
+
description: 'Wall-clock time spent in each sequencer state, labelled by the state being left',
|
|
407
|
+
unit: 'ms',
|
|
408
|
+
valueType: ValueType.INT,
|
|
409
|
+
};
|
|
330
410
|
export const SEQUENCER_BLOCK_BUILD_DURATION: MetricDefinition = {
|
|
331
411
|
name: 'aztec.sequencer.block.build_duration',
|
|
332
412
|
description: 'Duration to build a block',
|
|
@@ -344,9 +424,15 @@ export const SEQUENCER_BLOCK_COUNT: MetricDefinition = {
|
|
|
344
424
|
description: 'Number of blocks built by this sequencer',
|
|
345
425
|
valueType: ValueType.INT,
|
|
346
426
|
};
|
|
347
|
-
export const
|
|
348
|
-
name: 'aztec.sequencer.
|
|
349
|
-
description: '
|
|
427
|
+
export const SEQUENCER_BLOCK_INTER_BLOCK_TIME: MetricDefinition = {
|
|
428
|
+
name: 'aztec.sequencer.block.inter_block_time',
|
|
429
|
+
description: 'Wall-clock time elapsed between consecutive blocks being built by this sequencer',
|
|
430
|
+
unit: 'ms',
|
|
431
|
+
valueType: ValueType.INT,
|
|
432
|
+
};
|
|
433
|
+
export const SEQUENCER_CURRENT_SLOT_REWARDS: MetricDefinition = {
|
|
434
|
+
name: 'aztec.sequencer.current_slot_rewards',
|
|
435
|
+
description: 'The rewards earned per filled slot',
|
|
350
436
|
valueType: ValueType.DOUBLE,
|
|
351
437
|
};
|
|
352
438
|
export const SEQUENCER_SLOT_COUNT: MetricDefinition = {
|
|
@@ -369,12 +455,12 @@ export const SEQUENCER_CHECKPOINT_ATTESTATION_DELAY: MetricDefinition = {
|
|
|
369
455
|
|
|
370
456
|
export const SEQUENCER_COLLECTED_ATTESTATIONS_COUNT: MetricDefinition = {
|
|
371
457
|
name: 'aztec.sequencer.attestations.collected_count',
|
|
372
|
-
description: 'The number of attestations collected for a
|
|
458
|
+
description: 'The number of attestations collected for a checkpoint proposal',
|
|
373
459
|
valueType: ValueType.INT,
|
|
374
460
|
};
|
|
375
461
|
export const SEQUENCER_REQUIRED_ATTESTATIONS_COUNT: MetricDefinition = {
|
|
376
462
|
name: 'aztec.sequencer.attestations.required_count',
|
|
377
|
-
description: 'The minimum number of attestations required to publish a
|
|
463
|
+
description: 'The minimum number of attestations required to publish a checkpoint',
|
|
378
464
|
valueType: ValueType.INT,
|
|
379
465
|
};
|
|
380
466
|
export const SEQUENCER_COLLECT_ATTESTATIONS_DURATION: MetricDefinition = {
|
|
@@ -395,14 +481,61 @@ export const SEQUENCER_BLOCK_PROPOSAL_FAILED_COUNT: MetricDefinition = {
|
|
|
395
481
|
description: 'The number of times block proposal failed (including validation builds)',
|
|
396
482
|
valueType: ValueType.INT,
|
|
397
483
|
};
|
|
398
|
-
export const
|
|
399
|
-
name: 'aztec.sequencer.
|
|
400
|
-
description: 'The number of times
|
|
484
|
+
export const SEQUENCER_CHECKPOINT_PROPOSAL_SUCCESS_COUNT: MetricDefinition = {
|
|
485
|
+
name: 'aztec.sequencer.checkpoint.proposal_success_count',
|
|
486
|
+
description: 'The number of times checkpoint proposal succeeded',
|
|
487
|
+
valueType: ValueType.INT,
|
|
488
|
+
};
|
|
489
|
+
export const SEQUENCER_CHECKPOINT_PRECHECK_FAILED_COUNT: MetricDefinition = {
|
|
490
|
+
name: 'aztec.sequencer.checkpoint.precheck_failed_count',
|
|
491
|
+
description: 'The number of times checkpoint pre-build checks failed',
|
|
492
|
+
valueType: ValueType.INT,
|
|
493
|
+
};
|
|
494
|
+
export const SEQUENCER_CHECKPOINT_PROPOSAL_FAILED_COUNT: MetricDefinition = {
|
|
495
|
+
name: 'aztec.sequencer.checkpoint.proposal_failed_count',
|
|
496
|
+
description: 'The number of times checkpoint proposal failed',
|
|
401
497
|
valueType: ValueType.INT,
|
|
402
498
|
};
|
|
403
|
-
export const
|
|
404
|
-
name: 'aztec.sequencer.
|
|
405
|
-
description: '
|
|
499
|
+
export const SEQUENCER_CHECKPOINT_BUILD_DURATION: MetricDefinition = {
|
|
500
|
+
name: 'aztec.sequencer.checkpoint.build_duration',
|
|
501
|
+
description: 'Total duration to build all blocks in a checkpoint',
|
|
502
|
+
unit: 'ms',
|
|
503
|
+
valueType: ValueType.INT,
|
|
504
|
+
};
|
|
505
|
+
export const SEQUENCER_CHECKPOINT_START_TO_FIRST_BLOCK_DURATION: MetricDefinition = {
|
|
506
|
+
name: 'aztec.sequencer.checkpoint.start_to_first_block_duration',
|
|
507
|
+
description: 'Time from starting checkpoint work to the first block finishing build',
|
|
508
|
+
unit: 'ms',
|
|
509
|
+
valueType: ValueType.INT,
|
|
510
|
+
};
|
|
511
|
+
export const SEQUENCER_CHECKPOINT_LAST_BLOCK_TO_BROADCAST_DURATION: MetricDefinition = {
|
|
512
|
+
name: 'aztec.sequencer.checkpoint.last_block_to_broadcast_duration',
|
|
513
|
+
description: 'Time from the final block finishing build to the checkpoint proposal being broadcast',
|
|
514
|
+
unit: 'ms',
|
|
515
|
+
valueType: ValueType.INT,
|
|
516
|
+
};
|
|
517
|
+
export const SEQUENCER_PIPELINED_CHECKPOINT_BUILD_START_OFFSET_FROM_SLOT_BOUNDARY: MetricDefinition = {
|
|
518
|
+
name: 'aztec.sequencer.pipelined_checkpoint.build_start_offset_from_slot_boundary',
|
|
519
|
+
description:
|
|
520
|
+
'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.',
|
|
521
|
+
unit: 'ms',
|
|
522
|
+
valueType: ValueType.INT,
|
|
523
|
+
};
|
|
524
|
+
export const SEQUENCER_CHECKPOINT_BLOCK_COUNT: MetricDefinition = {
|
|
525
|
+
name: 'aztec.sequencer.checkpoint.block_count',
|
|
526
|
+
description: 'Number of blocks built in a checkpoint',
|
|
527
|
+
valueType: ValueType.INT,
|
|
528
|
+
};
|
|
529
|
+
export const SEQUENCER_CHECKPOINT_TX_COUNT: MetricDefinition = {
|
|
530
|
+
name: 'aztec.sequencer.checkpoint.tx_count',
|
|
531
|
+
description: 'Total number of transactions across all blocks in a checkpoint',
|
|
532
|
+
unit: 'tx',
|
|
533
|
+
valueType: ValueType.INT,
|
|
534
|
+
};
|
|
535
|
+
export const SEQUENCER_CHECKPOINT_TOTAL_MANA: MetricDefinition = {
|
|
536
|
+
name: 'aztec.sequencer.checkpoint.total_mana',
|
|
537
|
+
description: 'Total L2 mana used across all blocks in a checkpoint',
|
|
538
|
+
unit: 'mana',
|
|
406
539
|
valueType: ValueType.INT,
|
|
407
540
|
};
|
|
408
541
|
export const SEQUENCER_SLASHING_ATTEMPTS_COUNT: MetricDefinition = {
|
|
@@ -410,11 +543,31 @@ export const SEQUENCER_SLASHING_ATTEMPTS_COUNT: MetricDefinition = {
|
|
|
410
543
|
description: 'The number of slashing action attempts',
|
|
411
544
|
valueType: ValueType.INT,
|
|
412
545
|
};
|
|
546
|
+
export const SLASHER_ROUND_EXECUTED_COUNT: MetricDefinition = {
|
|
547
|
+
name: 'aztec.slasher.round.executed_count',
|
|
548
|
+
description: 'The number of slashing rounds executed',
|
|
549
|
+
valueType: ValueType.INT,
|
|
550
|
+
};
|
|
413
551
|
export const SEQUENCER_CHECKPOINT_SUCCESS_COUNT: MetricDefinition = {
|
|
414
552
|
name: 'aztec.sequencer.checkpoint.success_count',
|
|
415
553
|
description: 'The number of times checkpoint publishing succeeded',
|
|
416
554
|
valueType: ValueType.INT,
|
|
417
555
|
};
|
|
556
|
+
export const SEQUENCER_PIPELINE_DEPTH: MetricDefinition = {
|
|
557
|
+
name: 'aztec.sequencer.pipeline.depth',
|
|
558
|
+
description: 'Current pipeline depth when builder pipelining is enabled',
|
|
559
|
+
valueType: ValueType.INT,
|
|
560
|
+
};
|
|
561
|
+
export const SEQUENCER_PIPELINE_DISCARDS_COUNT: MetricDefinition = {
|
|
562
|
+
name: 'aztec.sequencer.pipeline.discards_count',
|
|
563
|
+
description: 'The number of times a pipeline was discarded',
|
|
564
|
+
valueType: ValueType.INT,
|
|
565
|
+
};
|
|
566
|
+
export const SEQUENCER_PIPELINE_PARENT_CHECKPOINT_MISMATCH_COUNT: MetricDefinition = {
|
|
567
|
+
name: 'aztec.sequencer.pipeline.parent_checkpoint_mismatch_count',
|
|
568
|
+
description: 'The number of times a pipelined checkpoint was discarded because the parent did not match expectations',
|
|
569
|
+
valueType: ValueType.INT,
|
|
570
|
+
};
|
|
418
571
|
|
|
419
572
|
// Fisherman fee analysis metrics
|
|
420
573
|
export const FISHERMAN_FEE_ANALYSIS_WOULD_BE_INCLUDED: MetricDefinition = {
|
|
@@ -474,6 +627,29 @@ export const FISHERMAN_FEE_ANALYSIS_MINED_BLOB_TX_TOTAL_COST: MetricDefinition =
|
|
|
474
627
|
unit: 'eth',
|
|
475
628
|
valueType: ValueType.DOUBLE,
|
|
476
629
|
};
|
|
630
|
+
export const FISHERMAN_FEE_ANALYSIS_PENDING_BLOB_COUNT: MetricDefinition = {
|
|
631
|
+
name: 'aztec.fisherman.fee_analysis.pending_blob_count',
|
|
632
|
+
description: 'Total number of blobs in pending blob transactions',
|
|
633
|
+
unit: 'blobs',
|
|
634
|
+
valueType: ValueType.INT,
|
|
635
|
+
};
|
|
636
|
+
export const FISHERMAN_FEE_ANALYSIS_INCLUDED_BLOB_COUNT: MetricDefinition = {
|
|
637
|
+
name: 'aztec.fisherman.fee_analysis.included_blob_count',
|
|
638
|
+
description: 'Total number of blobs included in the mined block',
|
|
639
|
+
unit: 'blobs',
|
|
640
|
+
valueType: ValueType.INT,
|
|
641
|
+
};
|
|
642
|
+
export const FISHERMAN_FEE_ANALYSIS_BLOCK_BLOBS_FULL: MetricDefinition = {
|
|
643
|
+
name: 'aztec.fisherman.fee_analysis.block_blobs_full',
|
|
644
|
+
description: 'Whether the mined block reached 100% blob capacity',
|
|
645
|
+
valueType: ValueType.INT,
|
|
646
|
+
};
|
|
647
|
+
export const FISHERMAN_FEE_ANALYSIS_MAX_BLOB_CAPACITY: MetricDefinition = {
|
|
648
|
+
name: 'aztec.fisherman.fee_analysis.max_blob_capacity',
|
|
649
|
+
description: 'Maximum blob capacity for the analyzed block based on L1 upgrade schedule',
|
|
650
|
+
unit: 'blobs',
|
|
651
|
+
valueType: ValueType.INT,
|
|
652
|
+
};
|
|
477
653
|
|
|
478
654
|
export const VALIDATOR_INVALID_ATTESTATION_RECEIVED_COUNT: MetricDefinition = {
|
|
479
655
|
name: 'aztec.validator.invalid_attestation_received_count',
|
|
@@ -559,6 +735,24 @@ export const L1_PUBLISHER_TX_TOTAL_FEE: MetricDefinition = {
|
|
|
559
735
|
unit: 'eth',
|
|
560
736
|
valueType: ValueType.DOUBLE,
|
|
561
737
|
};
|
|
738
|
+
export const PROVER_NODE_ESTIMATED_SUBMISSION_GAS: MetricDefinition = {
|
|
739
|
+
name: 'aztec.prover_node.estimated_submission.gas',
|
|
740
|
+
description: 'Estimated gas for a proof submission tx (proof publishing disabled, not actually sent)',
|
|
741
|
+
unit: 'gas',
|
|
742
|
+
valueType: ValueType.INT,
|
|
743
|
+
};
|
|
744
|
+
export const PROVER_NODE_ESTIMATED_SUBMISSION_GAS_PRICE: MetricDefinition = {
|
|
745
|
+
name: 'aztec.prover_node.estimated_submission.gas_price',
|
|
746
|
+
description: 'Estimated effective gas price for a proof submission tx (proof publishing disabled, not actually sent)',
|
|
747
|
+
unit: 'gwei',
|
|
748
|
+
valueType: ValueType.DOUBLE,
|
|
749
|
+
};
|
|
750
|
+
export const PROVER_NODE_ESTIMATED_SUBMISSION_TOTAL_FEE: MetricDefinition = {
|
|
751
|
+
name: 'aztec.prover_node.estimated_submission.total_fee',
|
|
752
|
+
description: 'Estimated total L1 fee for a proof submission tx (proof publishing disabled, not actually sent)',
|
|
753
|
+
unit: 'eth',
|
|
754
|
+
valueType: ValueType.DOUBLE,
|
|
755
|
+
};
|
|
562
756
|
|
|
563
757
|
export const L1_BLOCK_HEIGHT: MetricDefinition = {
|
|
564
758
|
name: 'aztec.l1.block_height',
|
|
@@ -652,6 +846,12 @@ export const PEER_MANAGER_PEER_COUNT: MetricDefinition = {
|
|
|
652
846
|
unit: 'peers',
|
|
653
847
|
valueType: ValueType.INT,
|
|
654
848
|
};
|
|
849
|
+
export const PEER_MANAGER_HEALTHY_PEER_COUNT: MetricDefinition = {
|
|
850
|
+
name: 'aztec.peer_manager.healthy_peer_count',
|
|
851
|
+
description: 'Number of healthy (non-protected, non-banned) peers',
|
|
852
|
+
unit: 'peers',
|
|
853
|
+
valueType: ValueType.INT,
|
|
854
|
+
};
|
|
655
855
|
export const PEER_MANAGER_LOW_SCORE_DISCONNECTS: MetricDefinition = {
|
|
656
856
|
name: 'aztec.peer_manager.low_score_disconnects',
|
|
657
857
|
description: 'Number of peers disconnected due to low score',
|
|
@@ -781,6 +981,12 @@ export const P2P_GOSSIP_AGG_MESSAGE_VALIDATION_DURATION_AVG: MetricDefinition =
|
|
|
781
981
|
valueType: ValueType.INT,
|
|
782
982
|
};
|
|
783
983
|
|
|
984
|
+
export const P2P_GOSSIP_SLOW_VALIDATION_COUNT: MetricDefinition = {
|
|
985
|
+
name: 'aztec.p2p.gossip.slow_validation_count',
|
|
986
|
+
description: 'Number of gossip validations that exceeded 75% of the mcache eviction window',
|
|
987
|
+
valueType: ValueType.INT,
|
|
988
|
+
};
|
|
989
|
+
|
|
784
990
|
export const PUBLIC_PROCESSOR_TX_DURATION: MetricDefinition = {
|
|
785
991
|
name: 'aztec.public_processor.tx_duration',
|
|
786
992
|
description: 'Duration to process a public transaction',
|
|
@@ -844,6 +1050,17 @@ export const PUBLIC_PROCESSOR_TREE_INSERTION: MetricDefinition = {
|
|
|
844
1050
|
unit: 'ms',
|
|
845
1051
|
valueType: ValueType.INT,
|
|
846
1052
|
};
|
|
1053
|
+
export const PUBLIC_PROCESSOR_SILENTLY_SKIPPED_COUNT: MetricDefinition = {
|
|
1054
|
+
name: 'aztec.public_processor.silently_skipped_count',
|
|
1055
|
+
description: 'Public txs fully processed then skipped (e.g. blob-field limit); not counted as processed or failed',
|
|
1056
|
+
valueType: ValueType.INT,
|
|
1057
|
+
};
|
|
1058
|
+
export const PUBLIC_PROCESSOR_SILENTLY_SKIPPED_DURATION: MetricDefinition = {
|
|
1059
|
+
name: 'aztec.public_processor.silently_skipped_duration',
|
|
1060
|
+
description: 'Wall-clock time spent processing txs that were then silently skipped',
|
|
1061
|
+
unit: 'ms',
|
|
1062
|
+
valueType: ValueType.INT,
|
|
1063
|
+
};
|
|
847
1064
|
|
|
848
1065
|
export const PUBLIC_EXECUTOR_PREFIX = 'aztec.public_executor.';
|
|
849
1066
|
export const PUBLIC_EXECUTOR_SIMULATION_COUNT: MetricDefinition = {
|
|
@@ -936,6 +1153,11 @@ export const PROVING_QUEUE_REJECTED_JOBS: MetricDefinition = {
|
|
|
936
1153
|
description: 'Number of rejected proving jobs',
|
|
937
1154
|
valueType: ValueType.INT,
|
|
938
1155
|
};
|
|
1156
|
+
export const PROVING_QUEUE_ABORTED_JOBS: MetricDefinition = {
|
|
1157
|
+
name: 'aztec.proving_queue.aborted_jobs_count',
|
|
1158
|
+
description: 'Number of aborted proving jobs',
|
|
1159
|
+
valueType: ValueType.INT,
|
|
1160
|
+
};
|
|
939
1161
|
export const PROVING_QUEUE_RETRIED_JOBS: MetricDefinition = {
|
|
940
1162
|
name: 'aztec.proving_queue.retried_jobs_count',
|
|
941
1163
|
description: 'Number of retried proving jobs',
|
|
@@ -983,12 +1205,6 @@ export const PROVING_AGENT_IDLE: MetricDefinition = {
|
|
|
983
1205
|
valueType: ValueType.DOUBLE,
|
|
984
1206
|
};
|
|
985
1207
|
|
|
986
|
-
export const PROVER_NODE_EXECUTION_DURATION: MetricDefinition = {
|
|
987
|
-
name: 'aztec.prover_node.execution.duration',
|
|
988
|
-
description: 'Duration of execution of an epoch by the prover',
|
|
989
|
-
unit: 'ms',
|
|
990
|
-
valueType: ValueType.INT,
|
|
991
|
-
};
|
|
992
1208
|
export const PROVER_NODE_JOB_DURATION: MetricDefinition = {
|
|
993
1209
|
name: 'aztec.prover_node.job_duration',
|
|
994
1210
|
description: 'Duration of proving job',
|
|
@@ -1010,6 +1226,51 @@ 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_BLOCK_PROCESSING_DURATION: MetricDefinition = {
|
|
1236
|
+
name: 'aztec.prover_node.block_processing.duration',
|
|
1237
|
+
description: 'Duration of processing a single block in epoch proving job',
|
|
1238
|
+
unit: 'ms',
|
|
1239
|
+
valueType: ValueType.INT,
|
|
1240
|
+
};
|
|
1241
|
+
export const PROVER_NODE_CHECKPOINT_PROCESSING_DURATION: MetricDefinition = {
|
|
1242
|
+
name: 'aztec.prover_node.checkpoint_processing.duration',
|
|
1243
|
+
description: 'Duration of processing a single checkpoint in epoch proving job',
|
|
1244
|
+
unit: 'ms',
|
|
1245
|
+
valueType: ValueType.INT,
|
|
1246
|
+
};
|
|
1247
|
+
export const PROVER_NODE_CHECKPOINT_BLOCKS: MetricDefinition = {
|
|
1248
|
+
name: 'aztec.prover_node.checkpoint_blocks',
|
|
1249
|
+
description: 'Number of blocks in a proven checkpoint',
|
|
1250
|
+
valueType: ValueType.INT,
|
|
1251
|
+
};
|
|
1252
|
+
export const PROVER_NODE_CHECKPOINT_TRANSACTIONS: MetricDefinition = {
|
|
1253
|
+
name: 'aztec.prover_node.checkpoint_transactions',
|
|
1254
|
+
description: 'Number of transactions in a proven checkpoint',
|
|
1255
|
+
valueType: ValueType.INT,
|
|
1256
|
+
};
|
|
1257
|
+
export const PROVER_NODE_CHECKPOINT_PROVING_DURATION: MetricDefinition = {
|
|
1258
|
+
name: 'aztec.prover_node.checkpoint_proving.duration',
|
|
1259
|
+
description:
|
|
1260
|
+
'Duration from the start of checkpoint processing to its block proofs being ready (excludes tx gathering)',
|
|
1261
|
+
unit: 'ms',
|
|
1262
|
+
valueType: ValueType.INT,
|
|
1263
|
+
};
|
|
1264
|
+
export const PROVER_NODE_ACTIVE_CHECKPOINTS: MetricDefinition = {
|
|
1265
|
+
name: 'aztec.prover_node.active_checkpoints',
|
|
1266
|
+
description: 'Current number of canonical CheckpointProvers in the store (i.e. checkpoints currently being proven)',
|
|
1267
|
+
valueType: ValueType.INT,
|
|
1268
|
+
};
|
|
1269
|
+
export const PROVER_NODE_ACTIVE_EPOCH_SESSIONS: MetricDefinition = {
|
|
1270
|
+
name: 'aztec.prover_node.active_epoch_sessions',
|
|
1271
|
+
description: 'Current number of live EpochSessions, broken down by kind (full|partial)',
|
|
1272
|
+
valueType: ValueType.INT,
|
|
1273
|
+
};
|
|
1013
1274
|
export const PROVER_NODE_REWARDS_TOTAL: MetricDefinition = {
|
|
1014
1275
|
name: 'aztec.prover_node.rewards_total',
|
|
1015
1276
|
description: 'The rewards earned (total)',
|
|
@@ -1123,6 +1384,19 @@ export const VALIDATOR_RE_EXECUTION_TX_COUNT: MetricDefinition = {
|
|
|
1123
1384
|
unit: 'tx',
|
|
1124
1385
|
valueType: ValueType.INT,
|
|
1125
1386
|
};
|
|
1387
|
+
export const VALIDATOR_CHECKPOINT_PROPOSAL_TO_PIPELINED_STATE_DURATION: MetricDefinition = {
|
|
1388
|
+
name: 'aztec.validator.checkpoint_proposal_to_pipelined_state_duration',
|
|
1389
|
+
description: 'Time from receiving a checkpoint proposal to setting proposed checkpoint state for pipelining',
|
|
1390
|
+
unit: 'ms',
|
|
1391
|
+
valueType: ValueType.INT,
|
|
1392
|
+
};
|
|
1393
|
+
export const VALIDATOR_CHECKPOINT_PROPOSAL_RECEIVE_OFFSET_FROM_NEXT_SLOT_BOUNDARY: MetricDefinition = {
|
|
1394
|
+
name: 'aztec.validator.checkpoint.proposal_receive_offset_from_next_slot_boundary',
|
|
1395
|
+
description:
|
|
1396
|
+
'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.',
|
|
1397
|
+
unit: 'ms',
|
|
1398
|
+
valueType: ValueType.INT,
|
|
1399
|
+
};
|
|
1126
1400
|
|
|
1127
1401
|
export const VALIDATOR_FAILED_REEXECUTION_COUNT: MetricDefinition = {
|
|
1128
1402
|
name: 'aztec.validator.failed_reexecution_count',
|
|
@@ -1144,6 +1418,16 @@ export const VALIDATOR_ATTESTATION_FAILED_NODE_ISSUE_COUNT: MetricDefinition = {
|
|
|
1144
1418
|
description: 'The number of failed attestations due to node issues (timeout, missing data, etc.)',
|
|
1145
1419
|
valueType: ValueType.INT,
|
|
1146
1420
|
};
|
|
1421
|
+
export const VALIDATOR_CURRENT_EPOCH: MetricDefinition = {
|
|
1422
|
+
name: 'aztec.validator.current_epoch',
|
|
1423
|
+
description: 'The current epoch number, reflecting total epochs elapsed since genesis',
|
|
1424
|
+
valueType: ValueType.INT,
|
|
1425
|
+
};
|
|
1426
|
+
export const VALIDATOR_ATTESTED_EPOCH_COUNT: MetricDefinition = {
|
|
1427
|
+
name: 'aztec.validator.attested_epoch_count',
|
|
1428
|
+
description: 'The number of epochs in which this node successfully submitted at least one attestation',
|
|
1429
|
+
valueType: ValueType.INT,
|
|
1430
|
+
};
|
|
1147
1431
|
|
|
1148
1432
|
export const NODEJS_EVENT_LOOP_DELAY_MIN: MetricDefinition = {
|
|
1149
1433
|
name: 'nodejs.eventloop.delay.min',
|
|
@@ -1271,6 +1555,55 @@ export const TX_COLLECTOR_DURATION_PER_TX: MetricDefinition = {
|
|
|
1271
1555
|
valueType: ValueType.INT,
|
|
1272
1556
|
};
|
|
1273
1557
|
|
|
1558
|
+
export const TX_FILE_STORE_UPLOADS_SUCCESS: MetricDefinition = {
|
|
1559
|
+
name: 'aztec.p2p.tx_file_store.uploads_success',
|
|
1560
|
+
description: 'Number of successful tx uploads to file storage',
|
|
1561
|
+
valueType: ValueType.INT,
|
|
1562
|
+
};
|
|
1563
|
+
export const TX_FILE_STORE_UPLOADS_FAILED: MetricDefinition = {
|
|
1564
|
+
name: 'aztec.p2p.tx_file_store.uploads_failed',
|
|
1565
|
+
description: 'Number of failed tx uploads to file storage',
|
|
1566
|
+
valueType: ValueType.INT,
|
|
1567
|
+
};
|
|
1568
|
+
export const TX_FILE_STORE_UPLOADS_SKIPPED: MetricDefinition = {
|
|
1569
|
+
name: 'aztec.p2p.tx_file_store.uploads_skipped',
|
|
1570
|
+
description: 'Number of tx uploads skipped (duplicates)',
|
|
1571
|
+
valueType: ValueType.INT,
|
|
1572
|
+
};
|
|
1573
|
+
export const TX_FILE_STORE_UPLOAD_DURATION: MetricDefinition = {
|
|
1574
|
+
name: 'aztec.p2p.tx_file_store.upload_duration',
|
|
1575
|
+
description: 'Duration to upload a tx to file storage',
|
|
1576
|
+
unit: 'ms',
|
|
1577
|
+
valueType: ValueType.INT,
|
|
1578
|
+
};
|
|
1579
|
+
export const TX_FILE_STORE_QUEUE_SIZE: MetricDefinition = {
|
|
1580
|
+
name: 'aztec.p2p.tx_file_store.queue_size',
|
|
1581
|
+
description: 'Number of txs pending upload',
|
|
1582
|
+
valueType: ValueType.INT,
|
|
1583
|
+
};
|
|
1584
|
+
export const TX_FILE_STORE_DOWNLOADS_SUCCESS: MetricDefinition = {
|
|
1585
|
+
name: 'aztec.p2p.tx_file_store.downloads_success',
|
|
1586
|
+
description: 'Number of successful tx downloads from file storage',
|
|
1587
|
+
valueType: ValueType.INT,
|
|
1588
|
+
};
|
|
1589
|
+
export const TX_FILE_STORE_DOWNLOADS_FAILED: MetricDefinition = {
|
|
1590
|
+
name: 'aztec.p2p.tx_file_store.downloads_failed',
|
|
1591
|
+
description: 'Number of failed tx downloads from file storage',
|
|
1592
|
+
valueType: ValueType.INT,
|
|
1593
|
+
};
|
|
1594
|
+
export const TX_FILE_STORE_DOWNLOAD_DURATION: MetricDefinition = {
|
|
1595
|
+
name: 'aztec.p2p.tx_file_store.download_duration',
|
|
1596
|
+
description: 'Duration to download a tx from file storage',
|
|
1597
|
+
unit: 'ms',
|
|
1598
|
+
valueType: ValueType.INT,
|
|
1599
|
+
};
|
|
1600
|
+
export const TX_FILE_STORE_DOWNLOAD_SIZE: MetricDefinition = {
|
|
1601
|
+
name: 'aztec.p2p.tx_file_store.download_size',
|
|
1602
|
+
description: 'Size of a downloaded tx from file storage',
|
|
1603
|
+
unit: 'By',
|
|
1604
|
+
valueType: ValueType.INT,
|
|
1605
|
+
};
|
|
1606
|
+
|
|
1274
1607
|
export const IVC_VERIFIER_TIME: MetricDefinition = {
|
|
1275
1608
|
name: 'aztec.ivc_verifier.time',
|
|
1276
1609
|
description: 'Duration to verify chonk proofs',
|
|
@@ -1319,3 +1652,51 @@ export const IVC_VERIFIER_AGG_DURATION_AVG: MetricDefinition = {
|
|
|
1319
1652
|
unit: 'ms',
|
|
1320
1653
|
valueType: ValueType.DOUBLE,
|
|
1321
1654
|
};
|
|
1655
|
+
|
|
1656
|
+
// HA Signer metrics
|
|
1657
|
+
export const HA_SIGNER_SIGNING_DURATION: MetricDefinition = {
|
|
1658
|
+
name: 'aztec.ha_signer.signing_duration',
|
|
1659
|
+
description: 'End-to-end duration for signing with HA protection (lock + sign + record)',
|
|
1660
|
+
unit: 'ms',
|
|
1661
|
+
valueType: ValueType.INT,
|
|
1662
|
+
};
|
|
1663
|
+
export const HA_SIGNER_SIGNING_SUCCESS_COUNT: MetricDefinition = {
|
|
1664
|
+
name: 'aztec.ha_signer.signing_success_count',
|
|
1665
|
+
description: 'Count of successful signing operations',
|
|
1666
|
+
valueType: ValueType.INT,
|
|
1667
|
+
};
|
|
1668
|
+
export const HA_SIGNER_DUTY_ALREADY_SIGNED_COUNT: MetricDefinition = {
|
|
1669
|
+
name: 'aztec.ha_signer.duty_already_signed_count',
|
|
1670
|
+
description: 'Count of DutyAlreadySignedError (expected in HA; another node signed first)',
|
|
1671
|
+
valueType: ValueType.INT,
|
|
1672
|
+
};
|
|
1673
|
+
export const HA_SIGNER_SLASHING_PROTECTION_COUNT: MetricDefinition = {
|
|
1674
|
+
name: 'aztec.ha_signer.slashing_protection_count',
|
|
1675
|
+
description: 'Count of SlashingProtectionError (attempted to sign different data)',
|
|
1676
|
+
valueType: ValueType.INT,
|
|
1677
|
+
};
|
|
1678
|
+
export const HA_SIGNER_SIGNING_ERROR_COUNT: MetricDefinition = {
|
|
1679
|
+
name: 'aztec.ha_signer.signing_error_count',
|
|
1680
|
+
description: 'Count of signing function failures (lock deleted for retry)',
|
|
1681
|
+
valueType: ValueType.INT,
|
|
1682
|
+
};
|
|
1683
|
+
export const HA_SIGNER_LOCK_ACQUIRED_COUNT: MetricDefinition = {
|
|
1684
|
+
name: 'aztec.ha_signer.lock_acquired_count',
|
|
1685
|
+
description: 'Count of lock acquisitions (new lock acquired vs existing record found)',
|
|
1686
|
+
valueType: ValueType.INT,
|
|
1687
|
+
};
|
|
1688
|
+
export const HA_SIGNER_CLEANUP_STUCK_DUTIES_COUNT: MetricDefinition = {
|
|
1689
|
+
name: 'aztec.ha_signer.cleanup_stuck_duties_count',
|
|
1690
|
+
description: 'Number of stuck duties cleaned up per cleanup run',
|
|
1691
|
+
valueType: ValueType.INT,
|
|
1692
|
+
};
|
|
1693
|
+
export const HA_SIGNER_CLEANUP_OLD_DUTIES_COUNT: MetricDefinition = {
|
|
1694
|
+
name: 'aztec.ha_signer.cleanup_old_duties_count',
|
|
1695
|
+
description: 'Number of old duties cleaned up',
|
|
1696
|
+
valueType: ValueType.INT,
|
|
1697
|
+
};
|
|
1698
|
+
export const HA_SIGNER_CLEANUP_OUTDATED_ROLLUP_DUTIES_COUNT: MetricDefinition = {
|
|
1699
|
+
name: 'aztec.ha_signer.cleanup_outdated_rollup_duties_count',
|
|
1700
|
+
description: 'Number of duties cleaned due to rollup upgrade',
|
|
1701
|
+
valueType: ValueType.INT,
|
|
1702
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
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
|
+
const DEFAULT_MAX_QUEUE_SIZE = 16384;
|
|
14
|
+
|
|
15
|
+
/** Cap on the per-export batch size, so a large queue can actually be drained instead of dribbling out
|
|
16
|
+
* at the SDK default of 512 spans per scheduled export. Kept <= maxQueueSize per the BatchSpanProcessor contract. */
|
|
17
|
+
const DEFAULT_MAX_EXPORT_BATCH_SIZE = 2048;
|
|
18
|
+
|
|
19
|
+
export type MonitoredBatchSpanProcessorConfig = BufferConfig & {
|
|
20
|
+
minTraceDurationMs?: number;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Wraps BatchSpanProcessor to emit warnings when spans are dropped due to a full queue.
|
|
25
|
+
* The standard BatchSpanProcessor silently discards spans when its internal queue reaches
|
|
26
|
+
* maxQueueSize, making telemetry data loss invisible to operators.
|
|
27
|
+
*/
|
|
28
|
+
export class MonitoredBatchSpanProcessor extends BatchSpanProcessor {
|
|
29
|
+
private readonly maxQueueSize: number;
|
|
30
|
+
private readonly minTraceDurationMs: number;
|
|
31
|
+
private readonly log: Logger;
|
|
32
|
+
|
|
33
|
+
private approxQueueSize = 0;
|
|
34
|
+
private droppedSinceLastWarning = 0;
|
|
35
|
+
private totalDropped = 0;
|
|
36
|
+
private lastWarningTime = 0;
|
|
37
|
+
|
|
38
|
+
constructor(exporter: SpanExporter, log: Logger, config?: MonitoredBatchSpanProcessorConfig) {
|
|
39
|
+
const maxQueueSize = config?.maxQueueSize ?? DEFAULT_MAX_QUEUE_SIZE;
|
|
40
|
+
const maxExportBatchSize = Math.min(config?.maxExportBatchSize ?? DEFAULT_MAX_EXPORT_BATCH_SIZE, maxQueueSize);
|
|
41
|
+
super(exporter, { ...config, maxQueueSize, maxExportBatchSize });
|
|
42
|
+
this.maxQueueSize = maxQueueSize;
|
|
43
|
+
this.minTraceDurationMs = Math.max(0, config?.minTraceDurationMs ?? DEFAULT_MIN_TRACE_DURATION_MS);
|
|
44
|
+
this.log = log;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
override onStart(span: Span, parentContext: Context): void {
|
|
48
|
+
super.onStart(span, parentContext);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
override onEnd(span: ReadableSpan): void {
|
|
52
|
+
if (this.shouldDropShortSpan(span)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (this.approxQueueSize >= this.maxQueueSize) {
|
|
57
|
+
this.droppedSinceLastWarning++;
|
|
58
|
+
this.totalDropped++;
|
|
59
|
+
this.maybeLogDropWarning();
|
|
60
|
+
} else {
|
|
61
|
+
this.approxQueueSize++;
|
|
62
|
+
}
|
|
63
|
+
super.onEnd(span);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
override async forceFlush(): Promise<void> {
|
|
67
|
+
await super.forceFlush();
|
|
68
|
+
this.approxQueueSize = 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
override async shutdown(): Promise<void> {
|
|
72
|
+
if (this.totalDropped > 0) {
|
|
73
|
+
this.log.warn(`BatchSpanProcessor shutting down with ${this.totalDropped} total spans dropped`, {
|
|
74
|
+
totalDropped: this.totalDropped,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
await super.shutdown();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private shouldDropShortSpan(span: ReadableSpan): boolean {
|
|
81
|
+
return (
|
|
82
|
+
this.minTraceDurationMs > 0 &&
|
|
83
|
+
span.status.code !== SpanStatusCode.ERROR &&
|
|
84
|
+
hrTimeToMilliseconds(span.duration) < this.minTraceDurationMs
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private maybeLogDropWarning(): void {
|
|
89
|
+
const now = Date.now();
|
|
90
|
+
if (now - this.lastWarningTime >= DROP_WARNING_INTERVAL_MS) {
|
|
91
|
+
this.log.warn(
|
|
92
|
+
`BatchSpanProcessor dropping spans: queue full (maxQueueSize=${this.maxQueueSize}). ` +
|
|
93
|
+
`${this.droppedSinceLastWarning} dropped since last warning, ${this.totalDropped} total.`,
|
|
94
|
+
{ droppedSinceLastWarning: this.droppedSinceLastWarning, totalDropped: this.totalDropped },
|
|
95
|
+
);
|
|
96
|
+
this.droppedSinceLastWarning = 0;
|
|
97
|
+
this.lastWarningTime = now;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|