envio 3.3.0-alpha.1 → 3.3.0-alpha.11
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/licenses/CLA.md +35 -0
- package/licenses/EULA.md +67 -0
- package/licenses/LICENSE.md +45 -0
- package/licenses/README.md +35 -0
- package/package.json +10 -9
- 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 +53 -16
- package/src/ChainFetching.res.mjs +37 -19
- package/src/ChainMetadata.res +1 -11
- package/src/ChainMetadata.res.mjs +1 -10
- package/src/ChainState.res +630 -161
- package/src/ChainState.res.mjs +438 -101
- package/src/ChainState.resi +77 -4
- package/src/Config.res +70 -38
- package/src/Config.res.mjs +52 -12
- package/src/ContractRegisterContext.res +2 -12
- package/src/ContractRegisterContext.res.mjs +3 -5
- package/src/Core.res +34 -3
- package/src/Core.res.mjs +12 -0
- package/src/CrossChainState.res +130 -89
- package/src/CrossChainState.res.mjs +66 -61
- package/src/CrossChainState.resi +1 -1
- package/src/Ecosystem.res +5 -6
- package/src/Ecosystem.res.mjs +3 -3
- package/src/Envio.res +17 -11
- package/src/EnvioGlobal.res +53 -0
- package/src/EnvioGlobal.res.mjs +31 -0
- package/src/EventConfigBuilder.res +191 -127
- package/src/EventConfigBuilder.res.mjs +116 -66
- package/src/EventProcessing.res +77 -28
- package/src/EventProcessing.res.mjs +56 -29
- package/src/ExitOnCaughtUp.res +10 -2
- package/src/ExitOnCaughtUp.res.mjs +10 -1
- package/src/FetchState.res +684 -415
- package/src/FetchState.res.mjs +505 -486
- package/src/HandlerLoader.res +8 -104
- package/src/HandlerLoader.res.mjs +2 -81
- package/src/HandlerRegister.res +520 -144
- package/src/HandlerRegister.res.mjs +286 -133
- package/src/HandlerRegister.resi +24 -8
- package/src/IndexerState.res +10 -3
- package/src/IndexerState.res.mjs +11 -4
- package/src/IndexerState.resi +2 -1
- package/src/IndexingAddresses.res +108 -0
- package/src/IndexingAddresses.res.mjs +101 -0
- package/src/IndexingAddresses.resi +34 -0
- package/src/Internal.res +166 -48
- package/src/Internal.res.mjs +30 -2
- package/src/LoadLayer.res +5 -5
- package/src/LoadLayer.res.mjs +6 -6
- package/src/LogSelection.res +92 -217
- package/src/LogSelection.res.mjs +95 -184
- 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 -63
- package/src/Prometheus.res.mjs +124 -171
- 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 +128 -28
- package/src/SimulateItems.res.mjs +82 -40
- package/src/TestIndexer.res +55 -41
- package/src/TestIndexer.res.mjs +39 -32
- package/src/TopicFilter.res +1 -25
- package/src/TopicFilter.res.mjs +0 -74
- 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 -46
- 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 +31 -49
- package/src/sources/EventRouter.res.mjs +12 -25
- package/src/sources/Evm.res +83 -72
- package/src/sources/Evm.res.mjs +53 -69
- package/src/sources/EvmChain.res +7 -34
- package/src/sources/EvmChain.res.mjs +6 -27
- package/src/sources/EvmRpcClient.res +71 -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 +45 -42
- package/src/sources/HyperSync.res.mjs +68 -60
- package/src/sources/HyperSync.resi +14 -4
- package/src/sources/HyperSyncClient.res +107 -119
- package/src/sources/HyperSyncClient.res.mjs +36 -31
- package/src/sources/HyperSyncHeightStream.res +1 -8
- package/src/sources/HyperSyncHeightStream.res.mjs +0 -2
- package/src/sources/HyperSyncSource.res +60 -254
- package/src/sources/HyperSyncSource.res.mjs +57 -180
- package/src/sources/Rpc.res +15 -79
- package/src/sources/Rpc.res.mjs +25 -101
- package/src/sources/RpcSource.res +221 -514
- package/src/sources/RpcSource.res.mjs +216 -411
- package/src/sources/RpcWebSocketHeightStream.res +0 -5
- package/src/sources/RpcWebSocketHeightStream.res.mjs +0 -2
- package/src/sources/SimulateSource.res +44 -20
- package/src/sources/SimulateSource.res.mjs +41 -14
- package/src/sources/Source.res +34 -6
- package/src/sources/SourceManager.res +77 -19
- package/src/sources/SourceManager.res.mjs +63 -21
- package/src/sources/SourceManager.resi +10 -0
- 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,39 +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 = makeOrThrow$1("
|
|
403
|
+
let gauge$5 = makeOrThrow$1("envio_indexing_partitions", "The number of partitions used to split fetching logic by addresses and block ranges.", chainIdLabelsSchema);
|
|
404
404
|
|
|
405
|
-
function set$5(
|
|
406
|
-
handleInt$1(gauge$5, chainId,
|
|
405
|
+
function set$5(partitionsCount, chainId) {
|
|
406
|
+
handleInt$1(gauge$5, chainId, partitionsCount);
|
|
407
407
|
}
|
|
408
408
|
|
|
409
|
-
let
|
|
409
|
+
let IndexingPartitions = {
|
|
410
410
|
gauge: gauge$5,
|
|
411
411
|
set: set$5
|
|
412
412
|
};
|
|
413
413
|
|
|
414
|
-
let gauge$6 = makeOrThrow$1("envio_indexing_partitions", "The number of partitions used to split fetching logic by addresses and block ranges.", chainIdLabelsSchema);
|
|
415
|
-
|
|
416
|
-
function set$6(partitionsCount, chainId) {
|
|
417
|
-
handleInt$1(gauge$6, chainId, partitionsCount);
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
let IndexingPartitions = {
|
|
421
|
-
gauge: gauge$6,
|
|
422
|
-
set: set$6
|
|
423
|
-
};
|
|
424
|
-
|
|
425
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);
|
|
426
415
|
|
|
427
416
|
let IndexingIdleTime = {
|
|
@@ -440,51 +429,51 @@ let IndexingQueryTime = {
|
|
|
440
429
|
counter: counter$2
|
|
441
430
|
};
|
|
442
431
|
|
|
443
|
-
let gauge$
|
|
432
|
+
let gauge$6 = makeOrThrow$1("envio_indexing_buffer_size", "The current number of items in the indexing buffer.", chainIdLabelsSchema);
|
|
444
433
|
|
|
445
|
-
function set$
|
|
446
|
-
handleInt$1(gauge$
|
|
434
|
+
function set$6(bufferSize, chainId) {
|
|
435
|
+
handleInt$1(gauge$6, chainId, bufferSize);
|
|
447
436
|
}
|
|
448
437
|
|
|
449
438
|
let IndexingBufferSize = {
|
|
450
|
-
gauge: gauge$
|
|
451
|
-
set: set$
|
|
439
|
+
gauge: gauge$6,
|
|
440
|
+
set: set$6
|
|
452
441
|
};
|
|
453
442
|
|
|
454
|
-
let gauge$
|
|
443
|
+
let gauge$7 = PromClient.Gauge.makeGauge({
|
|
455
444
|
name: "envio_indexing_target_buffer_size",
|
|
456
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."
|
|
457
446
|
});
|
|
458
447
|
|
|
459
|
-
function set$
|
|
460
|
-
gauge$
|
|
448
|
+
function set$7(targetBufferSize) {
|
|
449
|
+
gauge$7.set(targetBufferSize);
|
|
461
450
|
}
|
|
462
451
|
|
|
463
452
|
let IndexingTargetBufferSize = {
|
|
464
|
-
gauge: gauge$
|
|
465
|
-
set: set$
|
|
453
|
+
gauge: gauge$7,
|
|
454
|
+
set: set$7
|
|
466
455
|
};
|
|
467
456
|
|
|
468
|
-
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);
|
|
469
458
|
|
|
470
|
-
function set$
|
|
471
|
-
handleInt$1(gauge$
|
|
459
|
+
function set$8(blockNumber, chainId) {
|
|
460
|
+
handleInt$1(gauge$8, chainId, blockNumber);
|
|
472
461
|
}
|
|
473
462
|
|
|
474
463
|
let IndexingBufferBlockNumber = {
|
|
475
|
-
gauge: gauge$
|
|
476
|
-
set: set$
|
|
464
|
+
gauge: gauge$8,
|
|
465
|
+
set: set$8
|
|
477
466
|
};
|
|
478
467
|
|
|
479
|
-
let gauge$
|
|
468
|
+
let gauge$9 = makeOrThrow$1("envio_indexing_end_block", "The block number to stop indexing at. (inclusive)", chainIdLabelsSchema);
|
|
480
469
|
|
|
481
|
-
function set$
|
|
482
|
-
handleInt$1(gauge$
|
|
470
|
+
function set$9(endBlock, chainId) {
|
|
471
|
+
handleInt$1(gauge$9, chainId, endBlock);
|
|
483
472
|
}
|
|
484
473
|
|
|
485
474
|
let IndexingEndBlock = {
|
|
486
|
-
gauge: gauge$
|
|
487
|
-
set: set$
|
|
475
|
+
gauge: gauge$9,
|
|
476
|
+
set: set$9
|
|
488
477
|
};
|
|
489
478
|
|
|
490
479
|
let sourceLabelsSchema = S$RescriptSchema.schema(s => ({
|
|
@@ -492,101 +481,68 @@ let sourceLabelsSchema = S$RescriptSchema.schema(s => ({
|
|
|
492
481
|
chainId: s.m(S$RescriptSchema.coerce(S$RescriptSchema.string, S$RescriptSchema.int))
|
|
493
482
|
}));
|
|
494
483
|
|
|
495
|
-
let
|
|
496
|
-
source: s.m(S$RescriptSchema.string),
|
|
497
|
-
chainId: s.m(S$RescriptSchema.coerce(S$RescriptSchema.string, S$RescriptSchema.int)),
|
|
498
|
-
method: s.m(S$RescriptSchema.string)
|
|
499
|
-
}));
|
|
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);
|
|
500
485
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
let sumTimeCounter$1 = makeOrThrow("envio_source_request_seconds_total", "Cumulative time spent on data source requests.", sourceRequestLabelsSchema);
|
|
504
|
-
|
|
505
|
-
function increment$4(sourceName, chainId, method) {
|
|
506
|
-
increment(counter$3, {
|
|
507
|
-
source: sourceName,
|
|
508
|
-
chainId: chainId,
|
|
509
|
-
method: method
|
|
510
|
-
});
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
function addSeconds(sourceName, chainId, method, seconds) {
|
|
514
|
-
handleFloat(sumTimeCounter$1, {
|
|
515
|
-
source: sourceName,
|
|
516
|
-
chainId: chainId,
|
|
517
|
-
method: method
|
|
518
|
-
}, seconds);
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
let SourceRequestCount = {
|
|
522
|
-
counter: counter$3,
|
|
523
|
-
sumTimeCounter: sumTimeCounter$1,
|
|
524
|
-
increment: increment$4,
|
|
525
|
-
addSeconds: addSeconds
|
|
526
|
-
};
|
|
527
|
-
|
|
528
|
-
let gauge$11 = 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);
|
|
529
|
-
|
|
530
|
-
function set$11(sourceName, chainId, blockNumber) {
|
|
531
|
-
handleInt$1(gauge$11, {
|
|
486
|
+
function set$10(sourceName, chainId, blockNumber) {
|
|
487
|
+
handleInt$1(gauge$10, {
|
|
532
488
|
source: sourceName,
|
|
533
489
|
chainId: chainId
|
|
534
490
|
}, blockNumber);
|
|
535
491
|
}
|
|
536
492
|
|
|
537
493
|
let SourceHeight = {
|
|
538
|
-
gauge: gauge$
|
|
539
|
-
set: set$
|
|
494
|
+
gauge: gauge$10,
|
|
495
|
+
set: set$10
|
|
540
496
|
};
|
|
541
497
|
|
|
542
|
-
let counter$
|
|
498
|
+
let counter$3 = makeOrThrow("envio_reorg_detected_total", "Total number of reorgs detected", chainIdLabelsSchema);
|
|
543
499
|
|
|
544
|
-
function increment$
|
|
545
|
-
increment(counter$
|
|
500
|
+
function increment$4(chain) {
|
|
501
|
+
increment(counter$3, chain);
|
|
546
502
|
}
|
|
547
503
|
|
|
548
504
|
let ReorgCount = {
|
|
549
|
-
counter: counter$
|
|
550
|
-
increment: increment$
|
|
505
|
+
counter: counter$3,
|
|
506
|
+
increment: increment$4
|
|
551
507
|
};
|
|
552
508
|
|
|
553
|
-
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);
|
|
554
510
|
|
|
555
|
-
function set$
|
|
556
|
-
handleInt$1(gauge$
|
|
511
|
+
function set$11(blockNumber, chain) {
|
|
512
|
+
handleInt$1(gauge$11, chain, blockNumber);
|
|
557
513
|
}
|
|
558
514
|
|
|
559
515
|
let ReorgDetectionBlockNumber = {
|
|
560
|
-
gauge: gauge$
|
|
561
|
-
set: set$
|
|
516
|
+
gauge: gauge$11,
|
|
517
|
+
set: set$11
|
|
562
518
|
};
|
|
563
519
|
|
|
564
|
-
let gauge$
|
|
520
|
+
let gauge$12 = PromClient.Gauge.makeGauge({
|
|
565
521
|
name: "envio_reorg_threshold",
|
|
566
522
|
help: "Whether indexing is currently within the reorg threshold"
|
|
567
523
|
});
|
|
568
524
|
|
|
569
|
-
function set$
|
|
570
|
-
gauge$
|
|
525
|
+
function set$12(isInReorgThreshold) {
|
|
526
|
+
gauge$12.set(isInReorgThreshold ? 1 : 0);
|
|
571
527
|
}
|
|
572
528
|
|
|
573
529
|
let ReorgThreshold = {
|
|
574
|
-
gauge: gauge$
|
|
575
|
-
set: set$
|
|
530
|
+
gauge: gauge$12,
|
|
531
|
+
set: set$12
|
|
576
532
|
};
|
|
577
533
|
|
|
578
|
-
let gauge$
|
|
534
|
+
let gauge$13 = PromClient.Gauge.makeGauge({
|
|
579
535
|
name: "envio_rollback_enabled",
|
|
580
536
|
help: "Whether rollback on reorg is enabled"
|
|
581
537
|
});
|
|
582
538
|
|
|
583
|
-
function set$
|
|
584
|
-
gauge$
|
|
539
|
+
function set$13(enabled) {
|
|
540
|
+
gauge$13.set(enabled ? 1 : 0);
|
|
585
541
|
}
|
|
586
542
|
|
|
587
543
|
let RollbackEnabled = {
|
|
588
|
-
gauge: gauge$
|
|
589
|
-
set: set$
|
|
544
|
+
gauge: gauge$13,
|
|
545
|
+
set: set$13
|
|
590
546
|
};
|
|
591
547
|
|
|
592
548
|
let timeCounter$3 = PromClient.Counter.makeCounter({
|
|
@@ -594,7 +550,7 @@ let timeCounter$3 = PromClient.Counter.makeCounter({
|
|
|
594
550
|
help: "Rollback on reorg total time."
|
|
595
551
|
});
|
|
596
552
|
|
|
597
|
-
let counter$
|
|
553
|
+
let counter$4 = PromClient.Counter.makeCounter({
|
|
598
554
|
name: "envio_rollback_total",
|
|
599
555
|
help: "Number of successful rollbacks on reorg"
|
|
600
556
|
});
|
|
@@ -604,100 +560,100 @@ let eventsCounter = PromClient.Counter.makeCounter({
|
|
|
604
560
|
help: "Number of events rollbacked on reorg"
|
|
605
561
|
});
|
|
606
562
|
|
|
607
|
-
function increment$
|
|
563
|
+
function increment$5(timeSeconds, rollbackedProcessedEvents) {
|
|
608
564
|
timeCounter$3.inc(timeSeconds);
|
|
609
|
-
counter$
|
|
565
|
+
counter$4.inc();
|
|
610
566
|
eventsCounter.inc(Math.trunc(rollbackedProcessedEvents));
|
|
611
567
|
}
|
|
612
568
|
|
|
613
569
|
let RollbackSuccess = {
|
|
614
570
|
timeCounter: timeCounter$3,
|
|
615
|
-
counter: counter$
|
|
571
|
+
counter: counter$4,
|
|
616
572
|
eventsCounter: eventsCounter,
|
|
617
|
-
increment: increment$
|
|
573
|
+
increment: increment$5
|
|
618
574
|
};
|
|
619
575
|
|
|
620
576
|
let entityNameLabelsSchema = S$RescriptSchema.object(s => s.f("entity", S$RescriptSchema.string));
|
|
621
577
|
|
|
622
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);
|
|
623
579
|
|
|
624
|
-
let counter$
|
|
580
|
+
let counter$5 = makeOrThrow("envio_rollback_history_prune_total", "Number of successful entity history prunes", entityNameLabelsSchema);
|
|
625
581
|
|
|
626
|
-
function increment$
|
|
582
|
+
function increment$6(timeSeconds, entityName) {
|
|
627
583
|
handleFloat(timeCounter$4, entityName, timeSeconds);
|
|
628
|
-
increment(counter$
|
|
584
|
+
increment(counter$5, entityName);
|
|
629
585
|
}
|
|
630
586
|
|
|
631
587
|
let RollbackHistoryPrune = {
|
|
632
588
|
entityNameLabelsSchema: entityNameLabelsSchema,
|
|
633
589
|
timeCounter: timeCounter$4,
|
|
634
|
-
counter: counter$
|
|
635
|
-
increment: increment$
|
|
590
|
+
counter: counter$5,
|
|
591
|
+
increment: increment$6
|
|
636
592
|
};
|
|
637
593
|
|
|
638
|
-
let gauge$
|
|
594
|
+
let gauge$14 = makeOrThrow$1("envio_rollback_target_block", "The block number reorg was rollbacked to the last time.", chainIdLabelsSchema);
|
|
639
595
|
|
|
640
|
-
function set$
|
|
641
|
-
handleInt$1(gauge$
|
|
596
|
+
function set$14(blockNumber, chain) {
|
|
597
|
+
handleInt$1(gauge$14, chain, blockNumber);
|
|
642
598
|
}
|
|
643
599
|
|
|
644
600
|
let RollbackTargetBlockNumber = {
|
|
645
|
-
gauge: gauge$
|
|
646
|
-
set: set$
|
|
601
|
+
gauge: gauge$14,
|
|
602
|
+
set: set$14
|
|
647
603
|
};
|
|
648
604
|
|
|
649
|
-
let gauge$
|
|
605
|
+
let gauge$15 = PromClient.Gauge.makeGauge({
|
|
650
606
|
name: "envio_processing_max_batch_size",
|
|
651
607
|
help: "The maximum number of items to process in a single batch."
|
|
652
608
|
});
|
|
653
609
|
|
|
654
|
-
function set$
|
|
655
|
-
gauge$
|
|
610
|
+
function set$15(maxBatchSize) {
|
|
611
|
+
gauge$15.set(maxBatchSize);
|
|
656
612
|
}
|
|
657
613
|
|
|
658
614
|
let ProcessingMaxBatchSize = {
|
|
659
|
-
gauge: gauge$
|
|
660
|
-
set: set$
|
|
615
|
+
gauge: gauge$15,
|
|
616
|
+
set: set$15
|
|
661
617
|
};
|
|
662
618
|
|
|
663
|
-
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);
|
|
664
620
|
|
|
665
|
-
function set$
|
|
666
|
-
handleInt$1(gauge$
|
|
621
|
+
function set$16(blockNumber, chainId) {
|
|
622
|
+
handleInt$1(gauge$16, chainId, blockNumber);
|
|
667
623
|
}
|
|
668
624
|
|
|
669
625
|
let ProgressBlockNumber = {
|
|
670
|
-
gauge: gauge$
|
|
671
|
-
set: set$
|
|
626
|
+
gauge: gauge$16,
|
|
627
|
+
set: set$16
|
|
672
628
|
};
|
|
673
629
|
|
|
674
|
-
let gauge$
|
|
630
|
+
let gauge$17 = makeOrThrow$1("envio_progress_events", "The number of events processed and reflected in the database.", chainIdLabelsSchema);
|
|
675
631
|
|
|
676
|
-
function set$
|
|
677
|
-
handleFloat$1(gauge$
|
|
632
|
+
function set$17(processedCount, chainId) {
|
|
633
|
+
handleFloat$1(gauge$17, chainId, processedCount);
|
|
678
634
|
}
|
|
679
635
|
|
|
680
636
|
let ProgressEventsCount = {
|
|
681
|
-
gauge: gauge$
|
|
682
|
-
set: set$
|
|
637
|
+
gauge: gauge$17,
|
|
638
|
+
set: set$17
|
|
683
639
|
};
|
|
684
640
|
|
|
685
|
-
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);
|
|
686
642
|
|
|
687
|
-
function set$
|
|
688
|
-
handleInt$1(gauge$
|
|
643
|
+
function set$18(latencyMs, chainId) {
|
|
644
|
+
handleInt$1(gauge$18, chainId, latencyMs);
|
|
689
645
|
}
|
|
690
646
|
|
|
691
647
|
let ProgressLatency = {
|
|
692
|
-
gauge: gauge$
|
|
693
|
-
set: set$
|
|
648
|
+
gauge: gauge$18,
|
|
649
|
+
set: set$18
|
|
694
650
|
};
|
|
695
651
|
|
|
696
652
|
let effectLabelsSchema = S$RescriptSchema.object(s => s.f("effect", S$RescriptSchema.string));
|
|
697
653
|
|
|
698
654
|
let timeCounter$5 = makeOrThrow("envio_effect_call_seconds", "Processing time taken to call the Effect function.", effectLabelsSchema);
|
|
699
655
|
|
|
700
|
-
let sumTimeCounter$
|
|
656
|
+
let sumTimeCounter$1 = makeOrThrow("envio_effect_call_seconds_total", "Cumulative time spent calling the Effect function during the indexing process.", effectLabelsSchema);
|
|
701
657
|
|
|
702
658
|
let totalCallsCount = makeOrThrow("envio_effect_call_total", "Cumulative number of resolved Effect function calls during the indexing process.", effectLabelsSchema);
|
|
703
659
|
|
|
@@ -705,45 +661,45 @@ let activeCallsCount = makeOrThrow$1("envio_effect_active_calls", "The number of
|
|
|
705
661
|
|
|
706
662
|
let EffectCalls = {
|
|
707
663
|
timeCounter: timeCounter$5,
|
|
708
|
-
sumTimeCounter: sumTimeCounter$
|
|
664
|
+
sumTimeCounter: sumTimeCounter$1,
|
|
709
665
|
totalCallsCount: totalCallsCount,
|
|
710
666
|
activeCallsCount: activeCallsCount
|
|
711
667
|
};
|
|
712
668
|
|
|
713
|
-
let gauge$
|
|
669
|
+
let gauge$19 = makeOrThrow$1("envio_effect_cache", "The number of items in the effect cache.", effectLabelsSchema);
|
|
714
670
|
|
|
715
|
-
function set$
|
|
716
|
-
handleInt$1(gauge$
|
|
671
|
+
function set$19(count, effectName) {
|
|
672
|
+
handleInt$1(gauge$19, effectName, count);
|
|
717
673
|
}
|
|
718
674
|
|
|
719
675
|
let EffectCacheCount = {
|
|
720
|
-
gauge: gauge$
|
|
721
|
-
set: set$
|
|
676
|
+
gauge: gauge$19,
|
|
677
|
+
set: set$19
|
|
722
678
|
};
|
|
723
679
|
|
|
724
|
-
let counter$
|
|
680
|
+
let counter$6 = makeOrThrow("envio_effect_cache_invalidations", "The number of effect cache invalidations.", effectLabelsSchema);
|
|
725
681
|
|
|
726
|
-
function increment$
|
|
727
|
-
increment(counter$
|
|
682
|
+
function increment$7(effectName) {
|
|
683
|
+
increment(counter$6, effectName);
|
|
728
684
|
}
|
|
729
685
|
|
|
730
686
|
let EffectCacheInvalidationsCount = {
|
|
731
|
-
counter: counter$
|
|
732
|
-
increment: increment$
|
|
687
|
+
counter: counter$6,
|
|
688
|
+
increment: increment$7
|
|
733
689
|
};
|
|
734
690
|
|
|
735
|
-
let gauge$
|
|
691
|
+
let gauge$20 = makeOrThrow$1("envio_effect_queue", "The number of effect calls waiting in the rate limit queue.", effectLabelsSchema);
|
|
736
692
|
|
|
737
693
|
let timeCounter$6 = makeOrThrow("envio_effect_queue_wait_seconds", "The time spent waiting in the rate limit queue.", effectLabelsSchema);
|
|
738
694
|
|
|
739
|
-
function set$
|
|
740
|
-
handleInt$1(gauge$
|
|
695
|
+
function set$20(count, effectName) {
|
|
696
|
+
handleInt$1(gauge$20, effectName, count);
|
|
741
697
|
}
|
|
742
698
|
|
|
743
699
|
let EffectQueueCount = {
|
|
744
|
-
gauge: gauge$
|
|
700
|
+
gauge: gauge$20,
|
|
745
701
|
timeCounter: timeCounter$6,
|
|
746
|
-
set: set$
|
|
702
|
+
set: set$20
|
|
747
703
|
};
|
|
748
704
|
|
|
749
705
|
let loadLabelsSchema = S$RescriptSchema.schema(s => ({
|
|
@@ -753,9 +709,9 @@ let loadLabelsSchema = S$RescriptSchema.schema(s => ({
|
|
|
753
709
|
|
|
754
710
|
let timeCounter$7 = makeOrThrow("envio_storage_load_seconds", "Processing time taken to load data from storage.", loadLabelsSchema);
|
|
755
711
|
|
|
756
|
-
let sumTimeCounter$
|
|
712
|
+
let sumTimeCounter$2 = makeOrThrow("envio_storage_load_seconds_total", "Cumulative time spent loading data from storage during the indexing process.", loadLabelsSchema);
|
|
757
713
|
|
|
758
|
-
let counter$
|
|
714
|
+
let counter$7 = makeOrThrow("envio_storage_load_total", "Cumulative number of successful storage load operations during the indexing process.", loadLabelsSchema);
|
|
759
715
|
|
|
760
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);
|
|
761
717
|
|
|
@@ -775,10 +731,10 @@ function startOperation$1(storage, operation) {
|
|
|
775
731
|
} else {
|
|
776
732
|
operations$1[key] = {
|
|
777
733
|
pendingCount: 1,
|
|
778
|
-
timerRef:
|
|
734
|
+
timerRef: Performance.now()
|
|
779
735
|
};
|
|
780
736
|
}
|
|
781
|
-
return
|
|
737
|
+
return Performance.now();
|
|
782
738
|
}
|
|
783
739
|
|
|
784
740
|
function endOperation$1(timerRef, storage, operation, whereSize, size) {
|
|
@@ -790,11 +746,11 @@ function endOperation$1(timerRef, storage, operation, whereSize, size) {
|
|
|
790
746
|
let operationRef = operations$1[key];
|
|
791
747
|
operationRef.pendingCount = operationRef.pendingCount - 1 | 0;
|
|
792
748
|
if (operationRef.pendingCount === 0) {
|
|
793
|
-
handleFloat(timeCounter$7, labels,
|
|
749
|
+
handleFloat(timeCounter$7, labels, Performance.secondsSince(operationRef.timerRef));
|
|
794
750
|
Utils.Dict.deleteInPlace(operations$1, key);
|
|
795
751
|
}
|
|
796
|
-
handleFloat(sumTimeCounter$
|
|
797
|
-
increment(counter$
|
|
752
|
+
handleFloat(sumTimeCounter$2, labels, Performance.secondsSince(timerRef));
|
|
753
|
+
increment(counter$7, labels);
|
|
798
754
|
handleInt(whereSizeCounter, labels, whereSize);
|
|
799
755
|
handleInt(sizeCounter$1, labels, size);
|
|
800
756
|
}
|
|
@@ -802,8 +758,8 @@ function endOperation$1(timerRef, storage, operation, whereSize, size) {
|
|
|
802
758
|
let StorageLoad = {
|
|
803
759
|
loadLabelsSchema: loadLabelsSchema,
|
|
804
760
|
timeCounter: timeCounter$7,
|
|
805
|
-
sumTimeCounter: sumTimeCounter$
|
|
806
|
-
counter: counter$
|
|
761
|
+
sumTimeCounter: sumTimeCounter$2,
|
|
762
|
+
counter: counter$7,
|
|
807
763
|
whereSizeCounter: whereSizeCounter,
|
|
808
764
|
sizeCounter: sizeCounter$1,
|
|
809
765
|
operations: operations$1,
|
|
@@ -816,18 +772,18 @@ let storageLabelsSchema = S$RescriptSchema.object(s => s.f("storage", S$Rescript
|
|
|
816
772
|
|
|
817
773
|
let timeCounter$8 = makeOrThrow("envio_storage_write_seconds", "Cumulative time spent writing batch data to storage.", storageLabelsSchema);
|
|
818
774
|
|
|
819
|
-
let counter$
|
|
775
|
+
let counter$8 = makeOrThrow("envio_storage_write_total", "Cumulative number of successful storage write operations during the indexing process.", storageLabelsSchema);
|
|
820
776
|
|
|
821
|
-
function increment$
|
|
777
|
+
function increment$8(storage, timeSeconds) {
|
|
822
778
|
handleFloat(timeCounter$8, storage, timeSeconds);
|
|
823
|
-
increment(counter$
|
|
779
|
+
increment(counter$8, storage);
|
|
824
780
|
}
|
|
825
781
|
|
|
826
782
|
let StorageWrite = {
|
|
827
783
|
storageLabelsSchema: storageLabelsSchema,
|
|
828
784
|
timeCounter: timeCounter$8,
|
|
829
|
-
counter: counter$
|
|
830
|
-
increment: increment$
|
|
785
|
+
counter: counter$8,
|
|
786
|
+
increment: increment$8
|
|
831
787
|
};
|
|
832
788
|
|
|
833
789
|
export {
|
|
@@ -846,7 +802,6 @@ export {
|
|
|
846
802
|
IndexingKnownHeight,
|
|
847
803
|
Info,
|
|
848
804
|
ProcessStartTimeSeconds,
|
|
849
|
-
IndexingAddresses,
|
|
850
805
|
IndexingConcurrency,
|
|
851
806
|
IndexingPartitions,
|
|
852
807
|
IndexingIdleTime,
|
|
@@ -857,8 +812,6 @@ export {
|
|
|
857
812
|
IndexingBufferBlockNumber,
|
|
858
813
|
IndexingEndBlock,
|
|
859
814
|
sourceLabelsSchema,
|
|
860
|
-
sourceRequestLabelsSchema,
|
|
861
|
-
SourceRequestCount,
|
|
862
815
|
SourceHeight,
|
|
863
816
|
ReorgCount,
|
|
864
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 {chain, blockNumber, logIndex} = eventItem
|
|
36
|
+
let eventConfig = eventItem.onEventRegistration.eventConfig
|
|
32
37
|
let chainId = chain->ChainMap.Chain.toChainId
|
|
33
38
|
let eventId = EventUtils.packEventIndex(~logIndex, ~blockNumber)
|
|
34
39
|
let blockFields =
|