envio 3.3.0-alpha.0 → 3.3.0-alpha.10
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/evm.schema.json +10 -0
- package/index.d.ts +45 -25
- package/package.json +7 -7
- package/src/Address.res +5 -2
- package/src/Address.res.mjs +3 -1
- package/src/Api.res +1 -1
- package/src/Api.res.mjs +1 -1
- package/src/Batch.res +0 -6
- package/src/Batch.res.mjs +1 -12
- package/src/BatchProcessing.res +7 -12
- package/src/BatchProcessing.res.mjs +8 -7
- package/src/Bin.res +3 -0
- package/src/Bin.res.mjs +4 -0
- package/src/ChainFetching.res +48 -16
- package/src/ChainFetching.res.mjs +36 -17
- package/src/ChainMetadata.res +1 -11
- package/src/ChainMetadata.res.mjs +1 -10
- package/src/ChainState.res +628 -149
- package/src/ChainState.res.mjs +440 -102
- package/src/ChainState.resi +74 -4
- package/src/Config.res +61 -33
- package/src/Config.res.mjs +50 -10
- package/src/ContractRegisterContext.res +2 -12
- package/src/ContractRegisterContext.res.mjs +3 -5
- package/src/Core.res +14 -3
- package/src/CrossChainState.res +142 -93
- package/src/CrossChainState.res.mjs +88 -60
- package/src/CrossChainState.resi +2 -10
- package/src/Ecosystem.res +5 -6
- package/src/Ecosystem.res.mjs +3 -3
- package/src/Env.res +0 -7
- package/src/Env.res.mjs +0 -6
- package/src/Envio.res +17 -11
- package/src/EnvioGlobal.res +53 -0
- package/src/EnvioGlobal.res.mjs +31 -0
- package/src/EventConfigBuilder.res +177 -88
- package/src/EventConfigBuilder.res.mjs +99 -42
- package/src/EventProcessing.res +74 -28
- package/src/EventProcessing.res.mjs +55 -29
- package/src/ExitOnCaughtUp.res +10 -2
- package/src/ExitOnCaughtUp.res.mjs +10 -1
- package/src/FetchState.res +558 -300
- package/src/FetchState.res.mjs +437 -423
- package/src/HandlerLoader.res +8 -104
- package/src/HandlerLoader.res.mjs +2 -81
- package/src/HandlerRegister.res +518 -144
- package/src/HandlerRegister.res.mjs +285 -133
- package/src/HandlerRegister.resi +24 -8
- package/src/IndexerLoop.res +2 -3
- package/src/IndexerLoop.res.mjs +1 -1
- package/src/IndexerState.res +10 -11
- package/src/IndexerState.res.mjs +14 -11
- package/src/IndexerState.resi +2 -5
- package/src/IndexingAddresses.res +108 -0
- package/src/IndexingAddresses.res.mjs +101 -0
- package/src/IndexingAddresses.resi +34 -0
- package/src/Internal.res +155 -46
- package/src/Internal.res.mjs +30 -2
- package/src/LoadLayer.res +5 -5
- package/src/LoadLayer.res.mjs +6 -6
- package/src/LogSelection.res +102 -165
- package/src/LogSelection.res.mjs +101 -116
- package/src/Main.res +71 -236
- package/src/Main.res.mjs +60 -145
- package/src/Metrics.res +74 -0
- package/src/Metrics.res.mjs +75 -0
- package/src/PgStorage.res +4 -4
- package/src/PgStorage.res.mjs +5 -5
- package/src/Prometheus.res +10 -74
- package/src/Prometheus.res.mjs +124 -186
- package/src/PruneStaleHistory.res +2 -2
- package/src/PruneStaleHistory.res.mjs +3 -3
- package/src/RawEvent.res +7 -2
- package/src/RawEvent.res.mjs +4 -4
- package/src/Rollback.res +3 -3
- package/src/Rollback.res.mjs +4 -4
- package/src/RollbackCommit.res +4 -1
- package/src/RollbackCommit.res.mjs +3 -2
- package/src/SimulateDeadInputTracker.res +85 -0
- package/src/SimulateDeadInputTracker.res.mjs +73 -0
- package/src/SimulateDeadInputTracker.resi +12 -0
- package/src/SimulateItems.res +91 -23
- package/src/SimulateItems.res.mjs +55 -32
- package/src/TestIndexer.res +54 -40
- package/src/TestIndexer.res.mjs +37 -30
- package/src/bindings/Performance.res +7 -0
- package/src/bindings/Performance.res.mjs +21 -0
- package/src/bindings/Performance.resi +7 -0
- package/src/bindings/Viem.res +0 -41
- package/src/bindings/Viem.res.mjs +1 -43
- package/src/sources/BlockStore.res +46 -0
- package/src/sources/BlockStore.res.mjs +24 -0
- package/src/sources/EventRouter.res +36 -33
- package/src/sources/EventRouter.res.mjs +13 -14
- package/src/sources/Evm.res +83 -72
- package/src/sources/Evm.res.mjs +53 -69
- package/src/sources/EvmChain.res +18 -20
- package/src/sources/EvmChain.res.mjs +15 -15
- package/src/sources/EvmRpcClient.res +74 -5
- package/src/sources/EvmRpcClient.res.mjs +13 -4
- package/src/sources/FieldMask.res +39 -0
- package/src/sources/FieldMask.res.mjs +42 -0
- package/src/sources/Fuel.res +9 -6
- package/src/sources/Fuel.res.mjs +5 -10
- package/src/sources/HyperFuelSource.res +46 -50
- package/src/sources/HyperFuelSource.res.mjs +64 -54
- package/src/sources/HyperSync.res +39 -7
- package/src/sources/HyperSync.res.mjs +57 -37
- package/src/sources/HyperSync.resi +12 -2
- package/src/sources/HyperSyncClient.res +22 -111
- package/src/sources/HyperSyncClient.res.mjs +2 -30
- package/src/sources/HyperSyncHeightStream.res +1 -8
- package/src/sources/HyperSyncHeightStream.res.mjs +0 -2
- package/src/sources/HyperSyncSource.res +94 -107
- package/src/sources/HyperSyncSource.res.mjs +82 -86
- package/src/sources/Rpc.res +15 -47
- package/src/sources/Rpc.res.mjs +25 -56
- package/src/sources/RpcSource.res +320 -467
- package/src/sources/RpcSource.res.mjs +268 -385
- package/src/sources/RpcWebSocketHeightStream.res +0 -5
- package/src/sources/RpcWebSocketHeightStream.res.mjs +0 -2
- package/src/sources/SimulateSource.res +10 -4
- package/src/sources/SimulateSource.res.mjs +16 -6
- package/src/sources/Source.res +34 -6
- package/src/sources/SourceManager.res +86 -27
- package/src/sources/SourceManager.res.mjs +84 -47
- package/src/sources/SourceManager.resi +12 -3
- package/src/sources/Svm.res +31 -16
- package/src/sources/Svm.res.mjs +36 -13
- package/src/sources/SvmHyperSyncClient.res +5 -32
- package/src/sources/SvmHyperSyncSource.res +159 -134
- package/src/sources/SvmHyperSyncSource.res.mjs +164 -129
- package/src/sources/TransactionStore.res +49 -0
- package/src/sources/TransactionStore.res.mjs +30 -0
- package/src/tui/Tui.res +13 -16
- package/src/tui/Tui.res.mjs +12 -14
- package/svm.schema.json +49 -37
- package/src/bindings/Hrtime.res +0 -58
- package/src/bindings/Hrtime.res.mjs +0 -90
- package/src/bindings/Hrtime.resi +0 -30
package/src/Prometheus.res.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
3
|
import * as Utils from "./Utils.res.mjs";
|
|
4
|
-
import * as Hrtime from "./bindings/Hrtime.res.mjs";
|
|
5
4
|
import * as PromClient from "./bindings/PromClient.res.mjs";
|
|
5
|
+
import * as Performance from "./bindings/Performance.res.mjs";
|
|
6
6
|
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
7
7
|
import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
|
|
8
8
|
import * as S$RescriptSchema from "rescript-schema/src/S.res.mjs";
|
|
@@ -290,10 +290,10 @@ function startOperation(contract, event) {
|
|
|
290
290
|
} else {
|
|
291
291
|
operations[key] = {
|
|
292
292
|
pendingCount: 1,
|
|
293
|
-
timerRef:
|
|
293
|
+
timerRef: Performance.now()
|
|
294
294
|
};
|
|
295
295
|
}
|
|
296
|
-
return
|
|
296
|
+
return Performance.now();
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
function endOperation(timerRef, contract, event) {
|
|
@@ -305,10 +305,10 @@ function endOperation(timerRef, contract, event) {
|
|
|
305
305
|
let operationRef = operations[key];
|
|
306
306
|
operationRef.pendingCount = operationRef.pendingCount - 1 | 0;
|
|
307
307
|
if (operationRef.pendingCount === 0) {
|
|
308
|
-
handleFloat(timeCounter$1, labels,
|
|
308
|
+
handleFloat(timeCounter$1, labels, Performance.secondsSince(operationRef.timerRef));
|
|
309
309
|
Utils.Dict.deleteInPlace(operations, key);
|
|
310
310
|
}
|
|
311
|
-
handleFloat(sumTimeCounter, labels,
|
|
311
|
+
handleFloat(sumTimeCounter, labels, Performance.secondsSince(timerRef));
|
|
312
312
|
increment(count$1, labels);
|
|
313
313
|
}
|
|
314
314
|
|
|
@@ -389,53 +389,28 @@ let ProcessStartTimeSeconds = {
|
|
|
389
389
|
set: set$3
|
|
390
390
|
};
|
|
391
391
|
|
|
392
|
-
let gauge$4 = makeOrThrow$1("
|
|
392
|
+
let gauge$4 = makeOrThrow$1("envio_indexing_concurrency", "The number of executing concurrent queries to the chain data-source.", chainIdLabelsSchema);
|
|
393
393
|
|
|
394
|
-
function set$4(
|
|
395
|
-
handleInt$1(gauge$4, chainId,
|
|
394
|
+
function set$4(concurrency, chainId) {
|
|
395
|
+
handleInt$1(gauge$4, chainId, concurrency);
|
|
396
396
|
}
|
|
397
397
|
|
|
398
|
-
let
|
|
398
|
+
let IndexingConcurrency = {
|
|
399
399
|
gauge: gauge$4,
|
|
400
400
|
set: set$4
|
|
401
401
|
};
|
|
402
402
|
|
|
403
|
-
let gauge$5 =
|
|
404
|
-
name: "envio_indexing_max_concurrency",
|
|
405
|
-
help: "The maximum number of concurrent data-source queries across the whole indexer."
|
|
406
|
-
});
|
|
403
|
+
let gauge$5 = makeOrThrow$1("envio_indexing_partitions", "The number of partitions used to split fetching logic by addresses and block ranges.", chainIdLabelsSchema);
|
|
407
404
|
|
|
408
|
-
function set$5(
|
|
409
|
-
gauge$5
|
|
405
|
+
function set$5(partitionsCount, chainId) {
|
|
406
|
+
handleInt$1(gauge$5, chainId, partitionsCount);
|
|
410
407
|
}
|
|
411
408
|
|
|
412
|
-
let
|
|
409
|
+
let IndexingPartitions = {
|
|
413
410
|
gauge: gauge$5,
|
|
414
411
|
set: set$5
|
|
415
412
|
};
|
|
416
413
|
|
|
417
|
-
let gauge$6 = makeOrThrow$1("envio_indexing_concurrency", "The number of executing concurrent queries to the chain data-source.", chainIdLabelsSchema);
|
|
418
|
-
|
|
419
|
-
function set$6(concurrency, chainId) {
|
|
420
|
-
handleInt$1(gauge$6, chainId, concurrency);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
let IndexingConcurrency = {
|
|
424
|
-
gauge: gauge$6,
|
|
425
|
-
set: set$6
|
|
426
|
-
};
|
|
427
|
-
|
|
428
|
-
let gauge$7 = makeOrThrow$1("envio_indexing_partitions", "The number of partitions used to split fetching logic by addresses and block ranges.", chainIdLabelsSchema);
|
|
429
|
-
|
|
430
|
-
function set$7(partitionsCount, chainId) {
|
|
431
|
-
handleInt$1(gauge$7, chainId, partitionsCount);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
let IndexingPartitions = {
|
|
435
|
-
gauge: gauge$7,
|
|
436
|
-
set: set$7
|
|
437
|
-
};
|
|
438
|
-
|
|
439
414
|
let counter = makeOrThrow("envio_indexing_idle_seconds", "The time the indexer source syncing has been idle. A high value may indicate the source sync is a bottleneck.", chainIdLabelsSchema);
|
|
440
415
|
|
|
441
416
|
let IndexingIdleTime = {
|
|
@@ -454,51 +429,51 @@ let IndexingQueryTime = {
|
|
|
454
429
|
counter: counter$2
|
|
455
430
|
};
|
|
456
431
|
|
|
457
|
-
let gauge$
|
|
432
|
+
let gauge$6 = makeOrThrow$1("envio_indexing_buffer_size", "The current number of items in the indexing buffer.", chainIdLabelsSchema);
|
|
458
433
|
|
|
459
|
-
function set$
|
|
460
|
-
handleInt$1(gauge$
|
|
434
|
+
function set$6(bufferSize, chainId) {
|
|
435
|
+
handleInt$1(gauge$6, chainId, bufferSize);
|
|
461
436
|
}
|
|
462
437
|
|
|
463
438
|
let IndexingBufferSize = {
|
|
464
|
-
gauge: gauge$
|
|
465
|
-
set: set$
|
|
439
|
+
gauge: gauge$6,
|
|
440
|
+
set: set$6
|
|
466
441
|
};
|
|
467
442
|
|
|
468
|
-
let gauge$
|
|
443
|
+
let gauge$7 = PromClient.Gauge.makeGauge({
|
|
469
444
|
name: "envio_indexing_target_buffer_size",
|
|
470
445
|
help: "The indexer-wide target buffer size shared across all chains. The actual number of items in the queue may exceed this value, but the indexer always tries to keep the buffer filled up to this target."
|
|
471
446
|
});
|
|
472
447
|
|
|
473
|
-
function set$
|
|
474
|
-
gauge$
|
|
448
|
+
function set$7(targetBufferSize) {
|
|
449
|
+
gauge$7.set(targetBufferSize);
|
|
475
450
|
}
|
|
476
451
|
|
|
477
452
|
let IndexingTargetBufferSize = {
|
|
478
|
-
gauge: gauge$
|
|
479
|
-
set: set$
|
|
453
|
+
gauge: gauge$7,
|
|
454
|
+
set: set$7
|
|
480
455
|
};
|
|
481
456
|
|
|
482
|
-
let gauge$
|
|
457
|
+
let gauge$8 = makeOrThrow$1("envio_indexing_buffer_block", "The highest block number that has been fully fetched by the indexer.", chainIdLabelsSchema);
|
|
483
458
|
|
|
484
|
-
function set$
|
|
485
|
-
handleInt$1(gauge$
|
|
459
|
+
function set$8(blockNumber, chainId) {
|
|
460
|
+
handleInt$1(gauge$8, chainId, blockNumber);
|
|
486
461
|
}
|
|
487
462
|
|
|
488
463
|
let IndexingBufferBlockNumber = {
|
|
489
|
-
gauge: gauge$
|
|
490
|
-
set: set$
|
|
464
|
+
gauge: gauge$8,
|
|
465
|
+
set: set$8
|
|
491
466
|
};
|
|
492
467
|
|
|
493
|
-
let gauge$
|
|
468
|
+
let gauge$9 = makeOrThrow$1("envio_indexing_end_block", "The block number to stop indexing at. (inclusive)", chainIdLabelsSchema);
|
|
494
469
|
|
|
495
|
-
function set$
|
|
496
|
-
handleInt$1(gauge$
|
|
470
|
+
function set$9(endBlock, chainId) {
|
|
471
|
+
handleInt$1(gauge$9, chainId, endBlock);
|
|
497
472
|
}
|
|
498
473
|
|
|
499
474
|
let IndexingEndBlock = {
|
|
500
|
-
gauge: gauge$
|
|
501
|
-
set: set$
|
|
475
|
+
gauge: gauge$9,
|
|
476
|
+
set: set$9
|
|
502
477
|
};
|
|
503
478
|
|
|
504
479
|
let sourceLabelsSchema = S$RescriptSchema.schema(s => ({
|
|
@@ -506,101 +481,68 @@ let sourceLabelsSchema = S$RescriptSchema.schema(s => ({
|
|
|
506
481
|
chainId: s.m(S$RescriptSchema.coerce(S$RescriptSchema.string, S$RescriptSchema.int))
|
|
507
482
|
}));
|
|
508
483
|
|
|
509
|
-
let
|
|
510
|
-
source: s.m(S$RescriptSchema.string),
|
|
511
|
-
chainId: s.m(S$RescriptSchema.coerce(S$RescriptSchema.string, S$RescriptSchema.int)),
|
|
512
|
-
method: s.m(S$RescriptSchema.string)
|
|
513
|
-
}));
|
|
484
|
+
let gauge$10 = makeOrThrow$1("envio_source_known_height", "The latest known block number reported by the source. This value may lag behind the actual chain height, as it is updated only when queried.", sourceLabelsSchema);
|
|
514
485
|
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
let sumTimeCounter$1 = makeOrThrow("envio_source_request_seconds_total", "Cumulative time spent on data source requests.", sourceRequestLabelsSchema);
|
|
518
|
-
|
|
519
|
-
function increment$4(sourceName, chainId, method) {
|
|
520
|
-
increment(counter$3, {
|
|
521
|
-
source: sourceName,
|
|
522
|
-
chainId: chainId,
|
|
523
|
-
method: method
|
|
524
|
-
});
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
function addSeconds(sourceName, chainId, method, seconds) {
|
|
528
|
-
handleFloat(sumTimeCounter$1, {
|
|
529
|
-
source: sourceName,
|
|
530
|
-
chainId: chainId,
|
|
531
|
-
method: method
|
|
532
|
-
}, seconds);
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
let SourceRequestCount = {
|
|
536
|
-
counter: counter$3,
|
|
537
|
-
sumTimeCounter: sumTimeCounter$1,
|
|
538
|
-
increment: increment$4,
|
|
539
|
-
addSeconds: addSeconds
|
|
540
|
-
};
|
|
541
|
-
|
|
542
|
-
let gauge$12 = makeOrThrow$1("envio_source_known_height", "The latest known block number reported by the source. This value may lag behind the actual chain height, as it is updated only when queried.", sourceLabelsSchema);
|
|
543
|
-
|
|
544
|
-
function set$12(sourceName, chainId, blockNumber) {
|
|
545
|
-
handleInt$1(gauge$12, {
|
|
486
|
+
function set$10(sourceName, chainId, blockNumber) {
|
|
487
|
+
handleInt$1(gauge$10, {
|
|
546
488
|
source: sourceName,
|
|
547
489
|
chainId: chainId
|
|
548
490
|
}, blockNumber);
|
|
549
491
|
}
|
|
550
492
|
|
|
551
493
|
let SourceHeight = {
|
|
552
|
-
gauge: gauge$
|
|
553
|
-
set: set$
|
|
494
|
+
gauge: gauge$10,
|
|
495
|
+
set: set$10
|
|
554
496
|
};
|
|
555
497
|
|
|
556
|
-
let counter$
|
|
498
|
+
let counter$3 = makeOrThrow("envio_reorg_detected_total", "Total number of reorgs detected", chainIdLabelsSchema);
|
|
557
499
|
|
|
558
|
-
function increment$
|
|
559
|
-
increment(counter$
|
|
500
|
+
function increment$4(chain) {
|
|
501
|
+
increment(counter$3, chain);
|
|
560
502
|
}
|
|
561
503
|
|
|
562
504
|
let ReorgCount = {
|
|
563
|
-
counter: counter$
|
|
564
|
-
increment: increment$
|
|
505
|
+
counter: counter$3,
|
|
506
|
+
increment: increment$4
|
|
565
507
|
};
|
|
566
508
|
|
|
567
|
-
let gauge$
|
|
509
|
+
let gauge$11 = makeOrThrow$1("envio_reorg_detected_block", "The block number where reorg was detected the last time. This doesn't mean that the block was reorged, this is simply where we found block hash to be different.", chainIdLabelsSchema);
|
|
568
510
|
|
|
569
|
-
function set$
|
|
570
|
-
handleInt$1(gauge$
|
|
511
|
+
function set$11(blockNumber, chain) {
|
|
512
|
+
handleInt$1(gauge$11, chain, blockNumber);
|
|
571
513
|
}
|
|
572
514
|
|
|
573
515
|
let ReorgDetectionBlockNumber = {
|
|
574
|
-
gauge: gauge$
|
|
575
|
-
set: set$
|
|
516
|
+
gauge: gauge$11,
|
|
517
|
+
set: set$11
|
|
576
518
|
};
|
|
577
519
|
|
|
578
|
-
let gauge$
|
|
520
|
+
let gauge$12 = PromClient.Gauge.makeGauge({
|
|
579
521
|
name: "envio_reorg_threshold",
|
|
580
522
|
help: "Whether indexing is currently within the reorg threshold"
|
|
581
523
|
});
|
|
582
524
|
|
|
583
|
-
function set$
|
|
584
|
-
gauge$
|
|
525
|
+
function set$12(isInReorgThreshold) {
|
|
526
|
+
gauge$12.set(isInReorgThreshold ? 1 : 0);
|
|
585
527
|
}
|
|
586
528
|
|
|
587
529
|
let ReorgThreshold = {
|
|
588
|
-
gauge: gauge$
|
|
589
|
-
set: set$
|
|
530
|
+
gauge: gauge$12,
|
|
531
|
+
set: set$12
|
|
590
532
|
};
|
|
591
533
|
|
|
592
|
-
let gauge$
|
|
534
|
+
let gauge$13 = PromClient.Gauge.makeGauge({
|
|
593
535
|
name: "envio_rollback_enabled",
|
|
594
536
|
help: "Whether rollback on reorg is enabled"
|
|
595
537
|
});
|
|
596
538
|
|
|
597
|
-
function set$
|
|
598
|
-
gauge$
|
|
539
|
+
function set$13(enabled) {
|
|
540
|
+
gauge$13.set(enabled ? 1 : 0);
|
|
599
541
|
}
|
|
600
542
|
|
|
601
543
|
let RollbackEnabled = {
|
|
602
|
-
gauge: gauge$
|
|
603
|
-
set: set$
|
|
544
|
+
gauge: gauge$13,
|
|
545
|
+
set: set$13
|
|
604
546
|
};
|
|
605
547
|
|
|
606
548
|
let timeCounter$3 = PromClient.Counter.makeCounter({
|
|
@@ -608,7 +550,7 @@ let timeCounter$3 = PromClient.Counter.makeCounter({
|
|
|
608
550
|
help: "Rollback on reorg total time."
|
|
609
551
|
});
|
|
610
552
|
|
|
611
|
-
let counter$
|
|
553
|
+
let counter$4 = PromClient.Counter.makeCounter({
|
|
612
554
|
name: "envio_rollback_total",
|
|
613
555
|
help: "Number of successful rollbacks on reorg"
|
|
614
556
|
});
|
|
@@ -618,100 +560,100 @@ let eventsCounter = PromClient.Counter.makeCounter({
|
|
|
618
560
|
help: "Number of events rollbacked on reorg"
|
|
619
561
|
});
|
|
620
562
|
|
|
621
|
-
function increment$
|
|
563
|
+
function increment$5(timeSeconds, rollbackedProcessedEvents) {
|
|
622
564
|
timeCounter$3.inc(timeSeconds);
|
|
623
|
-
counter$
|
|
565
|
+
counter$4.inc();
|
|
624
566
|
eventsCounter.inc(Math.trunc(rollbackedProcessedEvents));
|
|
625
567
|
}
|
|
626
568
|
|
|
627
569
|
let RollbackSuccess = {
|
|
628
570
|
timeCounter: timeCounter$3,
|
|
629
|
-
counter: counter$
|
|
571
|
+
counter: counter$4,
|
|
630
572
|
eventsCounter: eventsCounter,
|
|
631
|
-
increment: increment$
|
|
573
|
+
increment: increment$5
|
|
632
574
|
};
|
|
633
575
|
|
|
634
576
|
let entityNameLabelsSchema = S$RescriptSchema.object(s => s.f("entity", S$RescriptSchema.string));
|
|
635
577
|
|
|
636
578
|
let timeCounter$4 = makeOrThrow("envio_rollback_history_prune_seconds", "The total time spent pruning entity history which is not in the reorg threshold.", entityNameLabelsSchema);
|
|
637
579
|
|
|
638
|
-
let counter$
|
|
580
|
+
let counter$5 = makeOrThrow("envio_rollback_history_prune_total", "Number of successful entity history prunes", entityNameLabelsSchema);
|
|
639
581
|
|
|
640
|
-
function increment$
|
|
582
|
+
function increment$6(timeSeconds, entityName) {
|
|
641
583
|
handleFloat(timeCounter$4, entityName, timeSeconds);
|
|
642
|
-
increment(counter$
|
|
584
|
+
increment(counter$5, entityName);
|
|
643
585
|
}
|
|
644
586
|
|
|
645
587
|
let RollbackHistoryPrune = {
|
|
646
588
|
entityNameLabelsSchema: entityNameLabelsSchema,
|
|
647
589
|
timeCounter: timeCounter$4,
|
|
648
|
-
counter: counter$
|
|
649
|
-
increment: increment$
|
|
590
|
+
counter: counter$5,
|
|
591
|
+
increment: increment$6
|
|
650
592
|
};
|
|
651
593
|
|
|
652
|
-
let gauge$
|
|
594
|
+
let gauge$14 = makeOrThrow$1("envio_rollback_target_block", "The block number reorg was rollbacked to the last time.", chainIdLabelsSchema);
|
|
653
595
|
|
|
654
|
-
function set$
|
|
655
|
-
handleInt$1(gauge$
|
|
596
|
+
function set$14(blockNumber, chain) {
|
|
597
|
+
handleInt$1(gauge$14, chain, blockNumber);
|
|
656
598
|
}
|
|
657
599
|
|
|
658
600
|
let RollbackTargetBlockNumber = {
|
|
659
|
-
gauge: gauge$
|
|
660
|
-
set: set$
|
|
601
|
+
gauge: gauge$14,
|
|
602
|
+
set: set$14
|
|
661
603
|
};
|
|
662
604
|
|
|
663
|
-
let gauge$
|
|
605
|
+
let gauge$15 = PromClient.Gauge.makeGauge({
|
|
664
606
|
name: "envio_processing_max_batch_size",
|
|
665
607
|
help: "The maximum number of items to process in a single batch."
|
|
666
608
|
});
|
|
667
609
|
|
|
668
|
-
function set$
|
|
669
|
-
gauge$
|
|
610
|
+
function set$15(maxBatchSize) {
|
|
611
|
+
gauge$15.set(maxBatchSize);
|
|
670
612
|
}
|
|
671
613
|
|
|
672
614
|
let ProcessingMaxBatchSize = {
|
|
673
|
-
gauge: gauge$
|
|
674
|
-
set: set$
|
|
615
|
+
gauge: gauge$15,
|
|
616
|
+
set: set$15
|
|
675
617
|
};
|
|
676
618
|
|
|
677
|
-
let gauge$
|
|
619
|
+
let gauge$16 = makeOrThrow$1("envio_progress_block", "The block number of the latest block processed and stored in the database.", chainIdLabelsSchema);
|
|
678
620
|
|
|
679
|
-
function set$
|
|
680
|
-
handleInt$1(gauge$
|
|
621
|
+
function set$16(blockNumber, chainId) {
|
|
622
|
+
handleInt$1(gauge$16, chainId, blockNumber);
|
|
681
623
|
}
|
|
682
624
|
|
|
683
625
|
let ProgressBlockNumber = {
|
|
684
|
-
gauge: gauge$
|
|
685
|
-
set: set$
|
|
626
|
+
gauge: gauge$16,
|
|
627
|
+
set: set$16
|
|
686
628
|
};
|
|
687
629
|
|
|
688
|
-
let gauge$
|
|
630
|
+
let gauge$17 = makeOrThrow$1("envio_progress_events", "The number of events processed and reflected in the database.", chainIdLabelsSchema);
|
|
689
631
|
|
|
690
|
-
function set$
|
|
691
|
-
handleFloat$1(gauge$
|
|
632
|
+
function set$17(processedCount, chainId) {
|
|
633
|
+
handleFloat$1(gauge$17, chainId, processedCount);
|
|
692
634
|
}
|
|
693
635
|
|
|
694
636
|
let ProgressEventsCount = {
|
|
695
|
-
gauge: gauge$
|
|
696
|
-
set: set$
|
|
637
|
+
gauge: gauge$17,
|
|
638
|
+
set: set$17
|
|
697
639
|
};
|
|
698
640
|
|
|
699
|
-
let gauge$
|
|
641
|
+
let gauge$18 = makeOrThrow$1("envio_progress_latency", "The latency in milliseconds between the latest processed event creation and the time it was written to storage.", chainIdLabelsSchema);
|
|
700
642
|
|
|
701
|
-
function set$
|
|
702
|
-
handleInt$1(gauge$
|
|
643
|
+
function set$18(latencyMs, chainId) {
|
|
644
|
+
handleInt$1(gauge$18, chainId, latencyMs);
|
|
703
645
|
}
|
|
704
646
|
|
|
705
647
|
let ProgressLatency = {
|
|
706
|
-
gauge: gauge$
|
|
707
|
-
set: set$
|
|
648
|
+
gauge: gauge$18,
|
|
649
|
+
set: set$18
|
|
708
650
|
};
|
|
709
651
|
|
|
710
652
|
let effectLabelsSchema = S$RescriptSchema.object(s => s.f("effect", S$RescriptSchema.string));
|
|
711
653
|
|
|
712
654
|
let timeCounter$5 = makeOrThrow("envio_effect_call_seconds", "Processing time taken to call the Effect function.", effectLabelsSchema);
|
|
713
655
|
|
|
714
|
-
let sumTimeCounter$
|
|
656
|
+
let sumTimeCounter$1 = makeOrThrow("envio_effect_call_seconds_total", "Cumulative time spent calling the Effect function during the indexing process.", effectLabelsSchema);
|
|
715
657
|
|
|
716
658
|
let totalCallsCount = makeOrThrow("envio_effect_call_total", "Cumulative number of resolved Effect function calls during the indexing process.", effectLabelsSchema);
|
|
717
659
|
|
|
@@ -719,45 +661,45 @@ let activeCallsCount = makeOrThrow$1("envio_effect_active_calls", "The number of
|
|
|
719
661
|
|
|
720
662
|
let EffectCalls = {
|
|
721
663
|
timeCounter: timeCounter$5,
|
|
722
|
-
sumTimeCounter: sumTimeCounter$
|
|
664
|
+
sumTimeCounter: sumTimeCounter$1,
|
|
723
665
|
totalCallsCount: totalCallsCount,
|
|
724
666
|
activeCallsCount: activeCallsCount
|
|
725
667
|
};
|
|
726
668
|
|
|
727
|
-
let gauge$
|
|
669
|
+
let gauge$19 = makeOrThrow$1("envio_effect_cache", "The number of items in the effect cache.", effectLabelsSchema);
|
|
728
670
|
|
|
729
|
-
function set$
|
|
730
|
-
handleInt$1(gauge$
|
|
671
|
+
function set$19(count, effectName) {
|
|
672
|
+
handleInt$1(gauge$19, effectName, count);
|
|
731
673
|
}
|
|
732
674
|
|
|
733
675
|
let EffectCacheCount = {
|
|
734
|
-
gauge: gauge$
|
|
735
|
-
set: set$
|
|
676
|
+
gauge: gauge$19,
|
|
677
|
+
set: set$19
|
|
736
678
|
};
|
|
737
679
|
|
|
738
|
-
let counter$
|
|
680
|
+
let counter$6 = makeOrThrow("envio_effect_cache_invalidations", "The number of effect cache invalidations.", effectLabelsSchema);
|
|
739
681
|
|
|
740
|
-
function increment$
|
|
741
|
-
increment(counter$
|
|
682
|
+
function increment$7(effectName) {
|
|
683
|
+
increment(counter$6, effectName);
|
|
742
684
|
}
|
|
743
685
|
|
|
744
686
|
let EffectCacheInvalidationsCount = {
|
|
745
|
-
counter: counter$
|
|
746
|
-
increment: increment$
|
|
687
|
+
counter: counter$6,
|
|
688
|
+
increment: increment$7
|
|
747
689
|
};
|
|
748
690
|
|
|
749
|
-
let gauge$
|
|
691
|
+
let gauge$20 = makeOrThrow$1("envio_effect_queue", "The number of effect calls waiting in the rate limit queue.", effectLabelsSchema);
|
|
750
692
|
|
|
751
693
|
let timeCounter$6 = makeOrThrow("envio_effect_queue_wait_seconds", "The time spent waiting in the rate limit queue.", effectLabelsSchema);
|
|
752
694
|
|
|
753
|
-
function set$
|
|
754
|
-
handleInt$1(gauge$
|
|
695
|
+
function set$20(count, effectName) {
|
|
696
|
+
handleInt$1(gauge$20, effectName, count);
|
|
755
697
|
}
|
|
756
698
|
|
|
757
699
|
let EffectQueueCount = {
|
|
758
|
-
gauge: gauge$
|
|
700
|
+
gauge: gauge$20,
|
|
759
701
|
timeCounter: timeCounter$6,
|
|
760
|
-
set: set$
|
|
702
|
+
set: set$20
|
|
761
703
|
};
|
|
762
704
|
|
|
763
705
|
let loadLabelsSchema = S$RescriptSchema.schema(s => ({
|
|
@@ -767,9 +709,9 @@ let loadLabelsSchema = S$RescriptSchema.schema(s => ({
|
|
|
767
709
|
|
|
768
710
|
let timeCounter$7 = makeOrThrow("envio_storage_load_seconds", "Processing time taken to load data from storage.", loadLabelsSchema);
|
|
769
711
|
|
|
770
|
-
let sumTimeCounter$
|
|
712
|
+
let sumTimeCounter$2 = makeOrThrow("envio_storage_load_seconds_total", "Cumulative time spent loading data from storage during the indexing process.", loadLabelsSchema);
|
|
771
713
|
|
|
772
|
-
let counter$
|
|
714
|
+
let counter$7 = makeOrThrow("envio_storage_load_total", "Cumulative number of successful storage load operations during the indexing process.", loadLabelsSchema);
|
|
773
715
|
|
|
774
716
|
let whereSizeCounter = makeOrThrow("envio_storage_load_where_size", "Cumulative number of filter conditions ('where' items) used in storage load operations during the indexing process.", loadLabelsSchema);
|
|
775
717
|
|
|
@@ -789,10 +731,10 @@ function startOperation$1(storage, operation) {
|
|
|
789
731
|
} else {
|
|
790
732
|
operations$1[key] = {
|
|
791
733
|
pendingCount: 1,
|
|
792
|
-
timerRef:
|
|
734
|
+
timerRef: Performance.now()
|
|
793
735
|
};
|
|
794
736
|
}
|
|
795
|
-
return
|
|
737
|
+
return Performance.now();
|
|
796
738
|
}
|
|
797
739
|
|
|
798
740
|
function endOperation$1(timerRef, storage, operation, whereSize, size) {
|
|
@@ -804,11 +746,11 @@ function endOperation$1(timerRef, storage, operation, whereSize, size) {
|
|
|
804
746
|
let operationRef = operations$1[key];
|
|
805
747
|
operationRef.pendingCount = operationRef.pendingCount - 1 | 0;
|
|
806
748
|
if (operationRef.pendingCount === 0) {
|
|
807
|
-
handleFloat(timeCounter$7, labels,
|
|
749
|
+
handleFloat(timeCounter$7, labels, Performance.secondsSince(operationRef.timerRef));
|
|
808
750
|
Utils.Dict.deleteInPlace(operations$1, key);
|
|
809
751
|
}
|
|
810
|
-
handleFloat(sumTimeCounter$
|
|
811
|
-
increment(counter$
|
|
752
|
+
handleFloat(sumTimeCounter$2, labels, Performance.secondsSince(timerRef));
|
|
753
|
+
increment(counter$7, labels);
|
|
812
754
|
handleInt(whereSizeCounter, labels, whereSize);
|
|
813
755
|
handleInt(sizeCounter$1, labels, size);
|
|
814
756
|
}
|
|
@@ -816,8 +758,8 @@ function endOperation$1(timerRef, storage, operation, whereSize, size) {
|
|
|
816
758
|
let StorageLoad = {
|
|
817
759
|
loadLabelsSchema: loadLabelsSchema,
|
|
818
760
|
timeCounter: timeCounter$7,
|
|
819
|
-
sumTimeCounter: sumTimeCounter$
|
|
820
|
-
counter: counter$
|
|
761
|
+
sumTimeCounter: sumTimeCounter$2,
|
|
762
|
+
counter: counter$7,
|
|
821
763
|
whereSizeCounter: whereSizeCounter,
|
|
822
764
|
sizeCounter: sizeCounter$1,
|
|
823
765
|
operations: operations$1,
|
|
@@ -830,18 +772,18 @@ let storageLabelsSchema = S$RescriptSchema.object(s => s.f("storage", S$Rescript
|
|
|
830
772
|
|
|
831
773
|
let timeCounter$8 = makeOrThrow("envio_storage_write_seconds", "Cumulative time spent writing batch data to storage.", storageLabelsSchema);
|
|
832
774
|
|
|
833
|
-
let counter$
|
|
775
|
+
let counter$8 = makeOrThrow("envio_storage_write_total", "Cumulative number of successful storage write operations during the indexing process.", storageLabelsSchema);
|
|
834
776
|
|
|
835
|
-
function increment$
|
|
777
|
+
function increment$8(storage, timeSeconds) {
|
|
836
778
|
handleFloat(timeCounter$8, storage, timeSeconds);
|
|
837
|
-
increment(counter$
|
|
779
|
+
increment(counter$8, storage);
|
|
838
780
|
}
|
|
839
781
|
|
|
840
782
|
let StorageWrite = {
|
|
841
783
|
storageLabelsSchema: storageLabelsSchema,
|
|
842
784
|
timeCounter: timeCounter$8,
|
|
843
|
-
counter: counter$
|
|
844
|
-
increment: increment$
|
|
785
|
+
counter: counter$8,
|
|
786
|
+
increment: increment$8
|
|
845
787
|
};
|
|
846
788
|
|
|
847
789
|
export {
|
|
@@ -860,8 +802,6 @@ export {
|
|
|
860
802
|
IndexingKnownHeight,
|
|
861
803
|
Info,
|
|
862
804
|
ProcessStartTimeSeconds,
|
|
863
|
-
IndexingAddresses,
|
|
864
|
-
IndexingMaxConcurrency,
|
|
865
805
|
IndexingConcurrency,
|
|
866
806
|
IndexingPartitions,
|
|
867
807
|
IndexingIdleTime,
|
|
@@ -872,8 +812,6 @@ export {
|
|
|
872
812
|
IndexingBufferBlockNumber,
|
|
873
813
|
IndexingEndBlock,
|
|
874
814
|
sourceLabelsSchema,
|
|
875
|
-
sourceRequestLabelsSchema,
|
|
876
|
-
SourceRequestCount,
|
|
877
815
|
SourceHeight,
|
|
878
816
|
ReorgCount,
|
|
879
817
|
ReorgDetectionBlockNumber,
|
|
@@ -14,7 +14,7 @@ let runPrune = async (state: IndexerState.t) => {
|
|
|
14
14
|
await Utils.delay(1000)
|
|
15
15
|
}
|
|
16
16
|
let entityConfig = persistence.allEntities->Array.getUnsafe(idx)
|
|
17
|
-
let timeRef =
|
|
17
|
+
let timeRef = Performance.now()
|
|
18
18
|
try {
|
|
19
19
|
let () = await persistence.storage.pruneStaleEntityHistory(
|
|
20
20
|
~entityName=entityConfig.name,
|
|
@@ -34,7 +34,7 @@ let runPrune = async (state: IndexerState.t) => {
|
|
|
34
34
|
)
|
|
35
35
|
}
|
|
36
36
|
Prometheus.RollbackHistoryPrune.increment(
|
|
37
|
-
~timeSeconds=
|
|
37
|
+
~timeSeconds=Performance.secondsSince(timeRef),
|
|
38
38
|
~entityName=entityConfig.name,
|
|
39
39
|
)
|
|
40
40
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
3
|
import * as Utils from "./Utils.res.mjs";
|
|
4
|
-
import * as Hrtime from "./bindings/Hrtime.res.mjs";
|
|
5
4
|
import * as Logging from "./Logging.res.mjs";
|
|
6
5
|
import * as Throttler from "./Throttler.res.mjs";
|
|
7
6
|
import * as Prometheus from "./Prometheus.res.mjs";
|
|
7
|
+
import * as Performance from "./bindings/Performance.res.mjs";
|
|
8
8
|
import * as IndexerState from "./IndexerState.res.mjs";
|
|
9
9
|
import * as ErrorHandling from "./ErrorHandling.res.mjs";
|
|
10
10
|
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
@@ -21,7 +21,7 @@ async function runPrune(state) {
|
|
|
21
21
|
await Utils.delay(1000);
|
|
22
22
|
}
|
|
23
23
|
let entityConfig = persistence.allEntities[idx];
|
|
24
|
-
let timeRef =
|
|
24
|
+
let timeRef = Performance.now();
|
|
25
25
|
try {
|
|
26
26
|
await persistence.storage.pruneStaleEntityHistory(entityConfig.name, entityConfig.index, safeCheckpointId);
|
|
27
27
|
} catch (raw_exn) {
|
|
@@ -31,7 +31,7 @@ async function runPrune(state) {
|
|
|
31
31
|
safeCheckpointId: safeCheckpointId
|
|
32
32
|
}), `Failed to prune stale entity history`, exn);
|
|
33
33
|
}
|
|
34
|
-
Prometheus.RollbackHistoryPrune.increment(
|
|
34
|
+
Prometheus.RollbackHistoryPrune.increment(Performance.secondsSince(timeRef), entityConfig.name);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
package/src/RawEvent.res
CHANGED
|
@@ -19,16 +19,21 @@ let convertFieldsToJson = (fields: option<dict<unknown>>) => {
|
|
|
19
19
|
|
|
20
20
|
// Block and transaction are passed already extracted from the ecosystem's
|
|
21
21
|
// concrete payload (EVM or Fuel) — `RawEvent` stays payload-shape-agnostic and
|
|
22
|
-
// only needs them as opaque field bags to serialise.
|
|
22
|
+
// only needs them as opaque field bags to serialise. The dedicated
|
|
23
|
+
// `block_hash`/`block_timestamp` column values are extracted from the payload
|
|
24
|
+
// block by the ecosystem caller (the field names differ per ecosystem).
|
|
23
25
|
let make = (
|
|
24
26
|
eventItem: Internal.eventItem,
|
|
25
27
|
~block,
|
|
26
28
|
~transaction,
|
|
27
29
|
~params: Internal.eventParams,
|
|
28
30
|
~srcAddress: Address.t,
|
|
31
|
+
~blockHash: string,
|
|
32
|
+
~blockTimestamp: int,
|
|
29
33
|
~cleanUpRawEventFieldsInPlace: JSON.t => unit,
|
|
30
34
|
): Internal.rawEvent => {
|
|
31
|
-
let {
|
|
35
|
+
let {onEventRegistration, chain, blockNumber, logIndex} = eventItem
|
|
36
|
+
let eventConfig = onEventRegistration.eventConfig
|
|
32
37
|
let chainId = chain->ChainMap.Chain.toChainId
|
|
33
38
|
let eventId = EventUtils.packEventIndex(~logIndex, ~blockNumber)
|
|
34
39
|
let blockFields =
|