envio 3.0.0-alpha.21 → 3.0.0-alpha.23
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/README.md +3 -3
- package/bin.mjs +2 -48
- package/evm.schema.json +67 -0
- package/fuel.schema.json +67 -0
- package/index.d.ts +822 -38
- package/index.js +5 -3
- package/package.json +10 -8
- package/rescript.json +5 -9
- package/src/Address.res +4 -5
- package/src/Address.res.mjs +9 -12
- package/src/Api.res +15 -0
- package/src/Api.res.mjs +20 -0
- package/src/Batch.res +32 -34
- package/src/Batch.res.mjs +172 -187
- package/src/Bin.res +89 -0
- package/src/Bin.res.mjs +97 -0
- package/src/ChainFetcher.res +33 -57
- package/src/ChainFetcher.res.mjs +197 -227
- package/src/ChainManager.res +6 -14
- package/src/ChainManager.res.mjs +74 -85
- package/src/ChainMap.res +14 -16
- package/src/ChainMap.res.mjs +38 -38
- package/src/Config.res +193 -135
- package/src/Config.res.mjs +566 -592
- package/src/Core.res +182 -0
- package/src/Core.res.mjs +207 -0
- package/src/Ecosystem.res +25 -4
- package/src/Ecosystem.res.mjs +12 -13
- package/src/Env.res +20 -13
- package/src/Env.res.mjs +124 -113
- package/src/EnvSafe.res +269 -0
- package/src/EnvSafe.res.mjs +296 -0
- package/src/EnvSafe.resi +18 -0
- package/src/Envio.res +37 -26
- package/src/Envio.res.mjs +59 -60
- package/src/ErrorHandling.res +2 -2
- package/src/ErrorHandling.res.mjs +15 -15
- package/src/EventConfigBuilder.res +219 -81
- package/src/EventConfigBuilder.res.mjs +259 -202
- package/src/EventProcessing.res +27 -38
- package/src/EventProcessing.res.mjs +165 -183
- package/src/EventUtils.res +11 -11
- package/src/EventUtils.res.mjs +21 -22
- package/src/EvmTypes.res +0 -1
- package/src/EvmTypes.res.mjs +5 -5
- package/src/FetchState.res +360 -256
- package/src/FetchState.res.mjs +958 -914
- package/src/GlobalState.res +365 -351
- package/src/GlobalState.res.mjs +958 -992
- package/src/GlobalStateManager.res +1 -2
- package/src/GlobalStateManager.res.mjs +36 -44
- package/src/HandlerLoader.res +107 -23
- package/src/HandlerLoader.res.mjs +128 -38
- package/src/HandlerRegister.res +127 -103
- package/src/HandlerRegister.res.mjs +164 -164
- package/src/HandlerRegister.resi +12 -4
- package/src/Hasura.res +35 -22
- package/src/Hasura.res.mjs +158 -167
- package/src/InMemoryStore.res +20 -27
- package/src/InMemoryStore.res.mjs +64 -80
- package/src/InMemoryTable.res +34 -39
- package/src/InMemoryTable.res.mjs +165 -170
- package/src/Internal.res +52 -33
- package/src/Internal.res.mjs +84 -81
- package/src/LazyLoader.res.mjs +55 -61
- package/src/LoadLayer.res +77 -78
- package/src/LoadLayer.res.mjs +160 -189
- package/src/LoadManager.res +16 -21
- package/src/LoadManager.res.mjs +79 -84
- package/src/LogSelection.res +236 -68
- package/src/LogSelection.res.mjs +211 -141
- package/src/Logging.res +13 -9
- package/src/Logging.res.mjs +130 -143
- package/src/Main.res +430 -51
- package/src/Main.res.mjs +530 -271
- package/src/Persistence.res +80 -84
- package/src/Persistence.res.mjs +131 -132
- package/src/PgStorage.res +294 -167
- package/src/PgStorage.res.mjs +799 -817
- package/src/Prometheus.res +50 -58
- package/src/Prometheus.res.mjs +345 -373
- package/src/ReorgDetection.res +22 -24
- package/src/ReorgDetection.res.mjs +100 -106
- package/src/SafeCheckpointTracking.res +7 -7
- package/src/SafeCheckpointTracking.res.mjs +40 -43
- package/src/SimulateItems.res +41 -49
- package/src/SimulateItems.res.mjs +257 -272
- package/src/Sink.res +2 -2
- package/src/Sink.res.mjs +22 -26
- package/src/TableIndices.res +1 -2
- package/src/TableIndices.res.mjs +42 -48
- package/src/TestIndexer.res +196 -189
- package/src/TestIndexer.res.mjs +536 -536
- package/src/TestIndexerProxyStorage.res +16 -16
- package/src/TestIndexerProxyStorage.res.mjs +99 -122
- package/src/TestIndexerWorker.res +4 -0
- package/src/TestIndexerWorker.res.mjs +7 -0
- package/src/Throttler.res +3 -3
- package/src/Throttler.res.mjs +23 -24
- package/src/Time.res +1 -1
- package/src/Time.res.mjs +18 -21
- package/src/TopicFilter.res +3 -3
- package/src/TopicFilter.res.mjs +29 -30
- package/src/UserContext.res +93 -54
- package/src/UserContext.res.mjs +197 -182
- package/src/Utils.res +141 -86
- package/src/Utils.res.mjs +334 -295
- package/src/bindings/BigDecimal.res +0 -2
- package/src/bindings/BigDecimal.res.mjs +19 -23
- package/src/bindings/ClickHouse.res +28 -27
- package/src/bindings/ClickHouse.res.mjs +243 -240
- package/src/bindings/DateFns.res +11 -11
- package/src/bindings/DateFns.res.mjs +7 -7
- package/src/bindings/EventSource.res.mjs +2 -2
- package/src/bindings/Express.res +2 -5
- package/src/bindings/Hrtime.res +2 -2
- package/src/bindings/Hrtime.res.mjs +30 -32
- package/src/bindings/Lodash.res.mjs +1 -1
- package/src/bindings/NodeJs.res +14 -9
- package/src/bindings/NodeJs.res.mjs +20 -20
- package/src/bindings/Pino.res +8 -10
- package/src/bindings/Pino.res.mjs +40 -43
- package/src/bindings/Postgres.res +7 -5
- package/src/bindings/Postgres.res.mjs +9 -9
- package/src/bindings/PromClient.res +17 -2
- package/src/bindings/PromClient.res.mjs +30 -7
- package/src/bindings/SDSL.res.mjs +2 -2
- package/src/bindings/Viem.res +4 -4
- package/src/bindings/Viem.res.mjs +20 -22
- package/src/bindings/Vitest.res +1 -1
- package/src/bindings/Vitest.res.mjs +2 -2
- package/src/bindings/WebSocket.res +1 -1
- package/src/db/EntityHistory.res +9 -3
- package/src/db/EntityHistory.res.mjs +84 -59
- package/src/db/InternalTable.res +62 -60
- package/src/db/InternalTable.res.mjs +271 -203
- package/src/db/Schema.res +1 -2
- package/src/db/Schema.res.mjs +28 -32
- package/src/db/Table.res +28 -27
- package/src/db/Table.res.mjs +276 -292
- package/src/sources/EventRouter.res +21 -16
- package/src/sources/EventRouter.res.mjs +55 -57
- package/src/sources/Evm.res +17 -1
- package/src/sources/Evm.res.mjs +16 -8
- package/src/sources/EvmChain.res +15 -17
- package/src/sources/EvmChain.res.mjs +40 -42
- package/src/sources/Fuel.res +14 -1
- package/src/sources/Fuel.res.mjs +16 -8
- package/src/sources/FuelSDK.res +1 -1
- package/src/sources/FuelSDK.res.mjs +6 -8
- package/src/sources/HyperFuel.res +8 -10
- package/src/sources/HyperFuel.res.mjs +113 -123
- package/src/sources/HyperFuelClient.res.mjs +6 -7
- package/src/sources/HyperFuelSource.res +19 -20
- package/src/sources/HyperFuelSource.res.mjs +339 -356
- package/src/sources/HyperSync.res +11 -13
- package/src/sources/HyperSync.res.mjs +206 -220
- package/src/sources/HyperSyncClient.res +5 -7
- package/src/sources/HyperSyncClient.res.mjs +70 -75
- package/src/sources/HyperSyncHeightStream.res +8 -9
- package/src/sources/HyperSyncHeightStream.res.mjs +78 -86
- package/src/sources/HyperSyncJsonApi.res +18 -15
- package/src/sources/HyperSyncJsonApi.res.mjs +201 -231
- package/src/sources/HyperSyncSource.res +17 -21
- package/src/sources/HyperSyncSource.res.mjs +268 -290
- package/src/sources/Rpc.res +5 -5
- package/src/sources/Rpc.res.mjs +168 -192
- package/src/sources/RpcSource.res +166 -167
- package/src/sources/RpcSource.res.mjs +972 -1046
- package/src/sources/RpcWebSocketHeightStream.res +10 -11
- package/src/sources/RpcWebSocketHeightStream.res.mjs +131 -145
- package/src/sources/SimulateSource.res +1 -1
- package/src/sources/SimulateSource.res.mjs +35 -38
- package/src/sources/Source.res +1 -1
- package/src/sources/Source.res.mjs +3 -3
- package/src/sources/SourceManager.res +39 -20
- package/src/sources/SourceManager.res.mjs +340 -371
- package/src/sources/SourceManager.resi +2 -1
- package/src/sources/Svm.res +12 -5
- package/src/sources/Svm.res.mjs +44 -41
- package/src/tui/Tui.res +23 -12
- package/src/tui/Tui.res.mjs +292 -290
- package/src/tui/bindings/Ink.res +2 -4
- package/src/tui/bindings/Ink.res.mjs +35 -41
- package/src/tui/components/BufferedProgressBar.res +7 -7
- package/src/tui/components/BufferedProgressBar.res.mjs +46 -46
- package/src/tui/components/CustomHooks.res +1 -2
- package/src/tui/components/CustomHooks.res.mjs +102 -122
- package/src/tui/components/Messages.res +1 -2
- package/src/tui/components/Messages.res.mjs +38 -42
- package/src/tui/components/SyncETA.res +10 -11
- package/src/tui/components/SyncETA.res.mjs +178 -196
- package/src/tui/components/TuiData.res +1 -1
- package/src/tui/components/TuiData.res.mjs +7 -6
- package/src/vendored/Rest.res +52 -66
- package/src/vendored/Rest.res.mjs +324 -364
- package/svm.schema.json +67 -0
- package/src/Address.gen.ts +0 -8
- package/src/Config.gen.ts +0 -19
- package/src/Envio.gen.ts +0 -55
- package/src/EvmTypes.gen.ts +0 -6
- package/src/InMemoryStore.gen.ts +0 -6
- package/src/Internal.gen.ts +0 -64
- package/src/PgStorage.gen.ts +0 -10
- package/src/PgStorage.res.d.mts +0 -5
- package/src/Types.ts +0 -56
- package/src/bindings/BigDecimal.gen.ts +0 -14
- package/src/bindings/BigDecimal.res.d.mts +0 -5
- package/src/bindings/BigInt.gen.ts +0 -10
- package/src/bindings/BigInt.res +0 -70
- package/src/bindings/BigInt.res.d.mts +0 -5
- package/src/bindings/BigInt.res.mjs +0 -154
- package/src/bindings/Ethers.res.d.mts +0 -5
- package/src/bindings/Pino.gen.ts +0 -17
- package/src/bindings/Postgres.gen.ts +0 -8
- package/src/bindings/Postgres.res.d.mts +0 -5
- package/src/bindings/Promise.res +0 -67
- package/src/bindings/Promise.res.mjs +0 -26
- package/src/db/InternalTable.gen.ts +0 -36
- package/src/sources/HyperSyncClient.gen.ts +0 -19
package/src/Prometheus.res.mjs
CHANGED
|
@@ -2,27 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
import * as Utils from "./Utils.res.mjs";
|
|
4
4
|
import * as Hrtime from "./bindings/Hrtime.res.mjs";
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
7
|
-
import * as
|
|
5
|
+
import * as Belt_Array from "@rescript/runtime/lib/es6/Belt_Array.js";
|
|
6
|
+
import * as PromClient from "./bindings/PromClient.res.mjs";
|
|
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";
|
|
9
9
|
|
|
10
10
|
function schemaIsString(_schema) {
|
|
11
|
-
while(true) {
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
while (true) {
|
|
12
|
+
let schema = _schema;
|
|
13
|
+
let match = schema.t;
|
|
14
14
|
if (typeof match !== "object") {
|
|
15
|
-
|
|
16
|
-
return true;
|
|
17
|
-
} else {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
15
|
+
return match === "string";
|
|
20
16
|
}
|
|
21
17
|
switch (match.TAG) {
|
|
22
18
|
case "option" :
|
|
23
19
|
case "null" :
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
_schema = match._0;
|
|
21
|
+
continue;
|
|
26
22
|
default:
|
|
27
23
|
return false;
|
|
28
24
|
}
|
|
@@ -30,117 +26,109 @@ function schemaIsString(_schema) {
|
|
|
30
26
|
}
|
|
31
27
|
|
|
32
28
|
function getLabelNames(schema) {
|
|
33
|
-
|
|
29
|
+
let match = schema.t;
|
|
34
30
|
if (typeof match !== "object") {
|
|
35
31
|
return {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
TAG: "Error",
|
|
33
|
+
_0: "Label schema must be an object"
|
|
34
|
+
};
|
|
39
35
|
}
|
|
40
36
|
if (match.TAG !== "object") {
|
|
41
37
|
return {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
TAG: "Error",
|
|
39
|
+
_0: "Label schema must be an object"
|
|
40
|
+
};
|
|
45
41
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
let items = match.items;
|
|
43
|
+
let nonStringFields = Belt_Array.reduce(items, [], (nonStringFields, item) => {
|
|
44
|
+
if (schemaIsString(item.schema)) {
|
|
45
|
+
return nonStringFields;
|
|
46
|
+
} else {
|
|
47
|
+
return Belt_Array.concat(nonStringFields, [item.location]);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
54
50
|
if (nonStringFields.length === 0) {
|
|
55
51
|
return {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}))
|
|
60
|
-
};
|
|
52
|
+
TAG: "Ok",
|
|
53
|
+
_0: Belt_Array.map(items, item => item.location)
|
|
54
|
+
};
|
|
61
55
|
}
|
|
62
|
-
|
|
56
|
+
let nonStringItems = nonStringFields.join(", ");
|
|
63
57
|
return {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
TAG: "Error",
|
|
59
|
+
_0: `Label schema must be an object with string (or optional string) values. Non string values: ` + nonStringItems
|
|
60
|
+
};
|
|
67
61
|
}
|
|
68
62
|
|
|
69
|
-
|
|
63
|
+
let Labels = {
|
|
70
64
|
schemaIsString: schemaIsString,
|
|
71
65
|
getLabelNames: getLabelNames
|
|
72
66
|
};
|
|
73
67
|
|
|
74
|
-
|
|
68
|
+
let metricNames = new Set();
|
|
75
69
|
|
|
76
70
|
function MakeSafePromMetric(M) {
|
|
77
|
-
|
|
78
|
-
|
|
71
|
+
let makeOrThrow = (name, help, labelSchema) => {
|
|
72
|
+
let labelNames = getLabelNames(labelSchema);
|
|
79
73
|
if (labelNames.TAG !== "Ok") {
|
|
80
|
-
return
|
|
74
|
+
return Stdlib_JsError.throwWithMessage(labelNames._0);
|
|
81
75
|
}
|
|
82
76
|
if (metricNames.has(name)) {
|
|
83
|
-
return
|
|
77
|
+
return Stdlib_JsError.throwWithMessage("Duplicate prometheus metric name: " + name);
|
|
84
78
|
}
|
|
85
79
|
metricNames.add(name);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
80
|
+
let metric = M.make({
|
|
81
|
+
name: name,
|
|
82
|
+
help: help,
|
|
83
|
+
labelNames: labelNames._0
|
|
84
|
+
});
|
|
91
85
|
return {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
};
|
|
96
|
-
var handleFloat = function (param, labels, value) {
|
|
97
|
-
M.handleFloat(M.labels(param.metric, S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema)), value);
|
|
98
|
-
};
|
|
99
|
-
var handleInt = function (param, labels, value) {
|
|
100
|
-
M.handleInt(M.labels(param.metric, S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema)), value);
|
|
101
|
-
};
|
|
102
|
-
var increment = function (param, labels) {
|
|
103
|
-
return M.labels(param.metric, S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema)).inc();
|
|
104
|
-
};
|
|
105
|
-
var incrementMany = function (param, labels, value) {
|
|
106
|
-
return M.labels(param.metric, S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema)).inc(value);
|
|
86
|
+
metric: metric,
|
|
87
|
+
labelSchema: labelSchema
|
|
88
|
+
};
|
|
107
89
|
};
|
|
90
|
+
let handleFloat = (param, labels, value) => M.handleFloat(M.labels(param.metric, S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema)), value);
|
|
91
|
+
let handleInt = (param, labels, value) => M.handleInt(M.labels(param.metric, S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema)), value);
|
|
92
|
+
let increment = (param, labels) => M.labels(param.metric, S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema)).inc();
|
|
93
|
+
let incrementMany = (param, labels, value) => M.labels(param.metric, S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema)).inc(value);
|
|
108
94
|
return {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
95
|
+
makeOrThrow: makeOrThrow,
|
|
96
|
+
handleInt: handleInt,
|
|
97
|
+
handleFloat: handleFloat,
|
|
98
|
+
increment: increment,
|
|
99
|
+
incrementMany: incrementMany
|
|
100
|
+
};
|
|
115
101
|
}
|
|
116
102
|
|
|
103
|
+
let make = PromClient.Counter.makeCounter;
|
|
104
|
+
|
|
117
105
|
function makeOrThrow(name, help, labelSchema) {
|
|
118
|
-
|
|
106
|
+
let labelNames = getLabelNames(labelSchema);
|
|
119
107
|
if (labelNames.TAG !== "Ok") {
|
|
120
|
-
return
|
|
108
|
+
return Stdlib_JsError.throwWithMessage(labelNames._0);
|
|
121
109
|
}
|
|
122
110
|
if (metricNames.has(name)) {
|
|
123
|
-
return
|
|
111
|
+
return Stdlib_JsError.throwWithMessage("Duplicate prometheus metric name: " + name);
|
|
124
112
|
}
|
|
125
113
|
metricNames.add(name);
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
114
|
+
let metric = make({
|
|
115
|
+
name: name,
|
|
116
|
+
help: help,
|
|
117
|
+
labelNames: labelNames._0
|
|
118
|
+
});
|
|
131
119
|
return {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
120
|
+
metric: metric,
|
|
121
|
+
labelSchema: labelSchema
|
|
122
|
+
};
|
|
135
123
|
}
|
|
136
124
|
|
|
137
125
|
function handleFloat(param, labels, value) {
|
|
138
|
-
|
|
126
|
+
let prim0 = param.metric.labels(S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema));
|
|
139
127
|
prim0.inc(value);
|
|
140
128
|
}
|
|
141
129
|
|
|
142
130
|
function handleInt(param, labels, value) {
|
|
143
|
-
|
|
131
|
+
let prim0 = param.metric.labels(S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema));
|
|
144
132
|
prim0.inc(value);
|
|
145
133
|
}
|
|
146
134
|
|
|
@@ -152,7 +140,7 @@ function incrementMany(param, labels, value) {
|
|
|
152
140
|
return param.metric.labels(S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema)).inc(value);
|
|
153
141
|
}
|
|
154
142
|
|
|
155
|
-
|
|
143
|
+
let SafeCounter = {
|
|
156
144
|
makeOrThrow: makeOrThrow,
|
|
157
145
|
handleInt: handleInt,
|
|
158
146
|
handleFloat: handleFloat,
|
|
@@ -160,33 +148,35 @@ var SafeCounter = {
|
|
|
160
148
|
incrementMany: incrementMany
|
|
161
149
|
};
|
|
162
150
|
|
|
151
|
+
let make$1 = PromClient.Gauge.makeGauge;
|
|
152
|
+
|
|
163
153
|
function makeOrThrow$1(name, help, labelSchema) {
|
|
164
|
-
|
|
154
|
+
let labelNames = getLabelNames(labelSchema);
|
|
165
155
|
if (labelNames.TAG !== "Ok") {
|
|
166
|
-
return
|
|
156
|
+
return Stdlib_JsError.throwWithMessage(labelNames._0);
|
|
167
157
|
}
|
|
168
158
|
if (metricNames.has(name)) {
|
|
169
|
-
return
|
|
159
|
+
return Stdlib_JsError.throwWithMessage("Duplicate prometheus metric name: " + name);
|
|
170
160
|
}
|
|
171
161
|
metricNames.add(name);
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
162
|
+
let metric = make$1({
|
|
163
|
+
name: name,
|
|
164
|
+
help: help,
|
|
165
|
+
labelNames: labelNames._0
|
|
166
|
+
});
|
|
177
167
|
return {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
168
|
+
metric: metric,
|
|
169
|
+
labelSchema: labelSchema
|
|
170
|
+
};
|
|
181
171
|
}
|
|
182
172
|
|
|
183
173
|
function handleFloat$1(param, labels, value) {
|
|
184
|
-
|
|
174
|
+
let prim0 = param.metric.labels(S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema));
|
|
185
175
|
prim0.set(value);
|
|
186
176
|
}
|
|
187
177
|
|
|
188
178
|
function handleInt$1(param, labels, value) {
|
|
189
|
-
|
|
179
|
+
let prim0 = param.metric.labels(S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema));
|
|
190
180
|
prim0.set(value);
|
|
191
181
|
}
|
|
192
182
|
|
|
@@ -198,7 +188,7 @@ function incrementMany$1(param, labels, value) {
|
|
|
198
188
|
return param.metric.labels(S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema)).inc(value);
|
|
199
189
|
}
|
|
200
190
|
|
|
201
|
-
|
|
191
|
+
let SafeGauge = {
|
|
202
192
|
makeOrThrow: makeOrThrow$1,
|
|
203
193
|
handleInt: handleInt$1,
|
|
204
194
|
handleFloat: handleFloat$1,
|
|
@@ -206,51 +196,35 @@ var SafeGauge = {
|
|
|
206
196
|
incrementMany: incrementMany$1
|
|
207
197
|
};
|
|
208
198
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
199
|
+
let loadTimeCounter = PromClient.Counter.makeCounter({
|
|
200
|
+
name: "envio_preload_seconds",
|
|
201
|
+
help: "Cumulative time spent on preloading entities during batch processing."
|
|
202
|
+
});
|
|
213
203
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
204
|
+
let handlerTimeCounter = PromClient.Counter.makeCounter({
|
|
205
|
+
name: "envio_processing_seconds",
|
|
206
|
+
help: "Cumulative time spent executing event handlers during batch processing."
|
|
207
|
+
});
|
|
218
208
|
|
|
219
|
-
|
|
220
|
-
name: "envio_storage_write_seconds",
|
|
221
|
-
help: "Cumulative time spent writing batch data to storage."
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
var writeCount = new PromClient.Counter({
|
|
225
|
-
name: "envio_storage_write_total",
|
|
226
|
-
help: "Total number of batch writes to storage."
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
function registerMetrics(loadDuration, handlerDuration, dbWriteDuration) {
|
|
209
|
+
function registerMetrics(loadDuration, handlerDuration) {
|
|
230
210
|
loadTimeCounter.inc(loadDuration);
|
|
231
211
|
handlerTimeCounter.inc(handlerDuration);
|
|
232
|
-
writeTimeCounter.inc(dbWriteDuration);
|
|
233
|
-
writeCount.inc();
|
|
234
212
|
}
|
|
235
213
|
|
|
236
|
-
|
|
214
|
+
let ProcessingBatch = {
|
|
237
215
|
loadTimeCounter: loadTimeCounter,
|
|
238
216
|
handlerTimeCounter: handlerTimeCounter,
|
|
239
|
-
writeTimeCounter: writeTimeCounter,
|
|
240
|
-
writeCount: writeCount,
|
|
241
217
|
registerMetrics: registerMetrics
|
|
242
218
|
};
|
|
243
219
|
|
|
244
|
-
|
|
245
|
-
return s.f("chainId", S$RescriptSchema.coerce(S$RescriptSchema.string, S$RescriptSchema.$$int));
|
|
246
|
-
});
|
|
220
|
+
let chainIdLabelsSchema = S$RescriptSchema.object(s => s.f("chainId", S$RescriptSchema.coerce(S$RescriptSchema.string, S$RescriptSchema.int)));
|
|
247
221
|
|
|
248
|
-
|
|
222
|
+
let gauge = makeOrThrow$1("envio_progress_ready", "Whether the chain is fully synced to the head.", chainIdLabelsSchema);
|
|
249
223
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
224
|
+
let legacyGauge = PromClient.Gauge.makeGauge({
|
|
225
|
+
name: "hyperindex_synced_to_head",
|
|
226
|
+
help: "All chains fully synced"
|
|
227
|
+
});
|
|
254
228
|
|
|
255
229
|
function init(chainId) {
|
|
256
230
|
handleInt$1(gauge, chainId, 0);
|
|
@@ -264,7 +238,7 @@ function setAllReady() {
|
|
|
264
238
|
legacyGauge.set(1);
|
|
265
239
|
}
|
|
266
240
|
|
|
267
|
-
|
|
241
|
+
let ProgressReady = {
|
|
268
242
|
gauge: gauge,
|
|
269
243
|
legacyGauge: legacyGauge,
|
|
270
244
|
init: init,
|
|
@@ -272,47 +246,45 @@ var ProgressReady = {
|
|
|
272
246
|
setAllReady: setAllReady
|
|
273
247
|
};
|
|
274
248
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
};
|
|
280
|
-
});
|
|
249
|
+
let handlerLabelsSchema = S$RescriptSchema.schema(s => ({
|
|
250
|
+
contract: s.m(S$RescriptSchema.string),
|
|
251
|
+
event: s.m(S$RescriptSchema.string)
|
|
252
|
+
}));
|
|
281
253
|
|
|
282
|
-
|
|
254
|
+
let timeCounter = makeOrThrow("envio_processing_handler_seconds", "Cumulative time spent inside individual event handler executions.", handlerLabelsSchema);
|
|
283
255
|
|
|
284
|
-
|
|
256
|
+
let count = makeOrThrow("envio_processing_handler_total", "Total number of individual event handler executions.", handlerLabelsSchema);
|
|
285
257
|
|
|
286
|
-
function increment$2(contract,
|
|
287
|
-
|
|
258
|
+
function increment$2(contract, event, duration) {
|
|
259
|
+
let labels = {
|
|
288
260
|
contract: contract,
|
|
289
|
-
event:
|
|
261
|
+
event: event
|
|
290
262
|
};
|
|
291
263
|
handleFloat(timeCounter, labels, duration);
|
|
292
264
|
increment(count, labels);
|
|
293
265
|
}
|
|
294
266
|
|
|
295
|
-
|
|
267
|
+
let ProcessingHandler = {
|
|
296
268
|
timeCounter: timeCounter,
|
|
297
269
|
count: count,
|
|
298
270
|
increment: increment$2
|
|
299
271
|
};
|
|
300
272
|
|
|
301
|
-
|
|
273
|
+
let timeCounter$1 = makeOrThrow("envio_preload_handler_seconds", "Wall-clock time spent inside individual preload handler executions.", handlerLabelsSchema);
|
|
302
274
|
|
|
303
|
-
|
|
275
|
+
let count$1 = makeOrThrow("envio_preload_handler_total", "Total number of individual preload handler executions.", handlerLabelsSchema);
|
|
304
276
|
|
|
305
|
-
|
|
277
|
+
let sumTimeCounter = makeOrThrow("envio_preload_handler_seconds_total", "Cumulative time spent inside individual preload handler executions. Can exceed wall-clock time due to parallel execution.", handlerLabelsSchema);
|
|
306
278
|
|
|
307
|
-
|
|
279
|
+
let operations = {};
|
|
308
280
|
|
|
309
|
-
function makeKey(contract,
|
|
310
|
-
return contract + ":" +
|
|
281
|
+
function makeKey(contract, event) {
|
|
282
|
+
return contract + ":" + event;
|
|
311
283
|
}
|
|
312
284
|
|
|
313
|
-
function startOperation(contract,
|
|
314
|
-
|
|
315
|
-
|
|
285
|
+
function startOperation(contract, event) {
|
|
286
|
+
let key = makeKey(contract, event);
|
|
287
|
+
let operationRef = operations[key];
|
|
316
288
|
if (operationRef !== undefined) {
|
|
317
289
|
operationRef.pendingCount = operationRef.pendingCount + 1 | 0;
|
|
318
290
|
} else {
|
|
@@ -324,13 +296,13 @@ function startOperation(contract, $$event) {
|
|
|
324
296
|
return Hrtime.makeTimer();
|
|
325
297
|
}
|
|
326
298
|
|
|
327
|
-
function endOperation(timerRef, contract,
|
|
328
|
-
|
|
329
|
-
|
|
299
|
+
function endOperation(timerRef, contract, event) {
|
|
300
|
+
let key = makeKey(contract, event);
|
|
301
|
+
let labels = {
|
|
330
302
|
contract: contract,
|
|
331
|
-
event:
|
|
303
|
+
event: event
|
|
332
304
|
};
|
|
333
|
-
|
|
305
|
+
let operationRef = operations[key];
|
|
334
306
|
operationRef.pendingCount = operationRef.pendingCount - 1 | 0;
|
|
335
307
|
if (operationRef.pendingCount === 0) {
|
|
336
308
|
handleFloat(timeCounter$1, labels, Hrtime.toSecondsFloat(Hrtime.timeSince(operationRef.timerRef)));
|
|
@@ -340,7 +312,7 @@ function endOperation(timerRef, contract, $$event) {
|
|
|
340
312
|
increment(count$1, labels);
|
|
341
313
|
}
|
|
342
314
|
|
|
343
|
-
|
|
315
|
+
let PreloadHandler = {
|
|
344
316
|
timeCounter: timeCounter$1,
|
|
345
317
|
count: count$1,
|
|
346
318
|
sumTimeCounter: sumTimeCounter,
|
|
@@ -350,15 +322,15 @@ var PreloadHandler = {
|
|
|
350
322
|
endOperation: endOperation
|
|
351
323
|
};
|
|
352
324
|
|
|
353
|
-
|
|
325
|
+
let timeCounter$2 = makeOrThrow("envio_fetching_block_range_seconds", "Cumulative time spent fetching block ranges.", chainIdLabelsSchema);
|
|
354
326
|
|
|
355
|
-
|
|
327
|
+
let parseTimeCounter = makeOrThrow("envio_fetching_block_range_parse_seconds", "Cumulative time spent parsing block range fetch responses.", chainIdLabelsSchema);
|
|
356
328
|
|
|
357
|
-
|
|
329
|
+
let count$2 = makeOrThrow("envio_fetching_block_range_total", "Total number of block range fetch operations.", chainIdLabelsSchema);
|
|
358
330
|
|
|
359
|
-
|
|
331
|
+
let eventsCount = makeOrThrow("envio_fetching_block_range_events_total", "Cumulative number of events fetched across all block range operations.", chainIdLabelsSchema);
|
|
360
332
|
|
|
361
|
-
|
|
333
|
+
let sizeCounter = makeOrThrow("envio_fetching_block_range_size", "Cumulative number of blocks covered across all block range fetch operations.", chainIdLabelsSchema);
|
|
362
334
|
|
|
363
335
|
function increment$3(chainId, totalTimeElapsed, parsingTimeElapsed, numEvents, blockRangeSize) {
|
|
364
336
|
handleFloat(timeCounter$2, chainId, totalTimeElapsed);
|
|
@@ -368,7 +340,7 @@ function increment$3(chainId, totalTimeElapsed, parsingTimeElapsed, numEvents, b
|
|
|
368
340
|
handleInt(sizeCounter, chainId, blockRangeSize);
|
|
369
341
|
}
|
|
370
342
|
|
|
371
|
-
|
|
343
|
+
let FetchingBlockRange = {
|
|
372
344
|
timeCounter: timeCounter$2,
|
|
373
345
|
parseTimeCounter: parseTimeCounter,
|
|
374
346
|
count: count$2,
|
|
@@ -377,277 +349,271 @@ var FetchingBlockRange = {
|
|
|
377
349
|
increment: increment$3
|
|
378
350
|
};
|
|
379
351
|
|
|
380
|
-
|
|
352
|
+
let gauge$1 = makeOrThrow$1("envio_indexing_known_height", "The latest known block number reported by the active indexing source. This value may lag behind the actual chain height, as it is updated only when needed.", chainIdLabelsSchema);
|
|
381
353
|
|
|
382
354
|
function set$1(blockNumber, chainId) {
|
|
383
355
|
handleInt$1(gauge$1, chainId, blockNumber);
|
|
384
356
|
}
|
|
385
357
|
|
|
386
|
-
|
|
358
|
+
let IndexingKnownHeight = {
|
|
387
359
|
gauge: gauge$1,
|
|
388
360
|
set: set$1
|
|
389
361
|
};
|
|
390
362
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
};
|
|
395
|
-
}));
|
|
363
|
+
let gauge$2 = makeOrThrow$1("envio_info", "Information about the indexer", S$RescriptSchema.schema(s => ({
|
|
364
|
+
version: s.m(S$RescriptSchema.string)
|
|
365
|
+
})));
|
|
396
366
|
|
|
397
367
|
function set$2(version) {
|
|
398
368
|
handleInt$1(gauge$2, {
|
|
399
|
-
|
|
400
|
-
|
|
369
|
+
version: version
|
|
370
|
+
}, 1);
|
|
401
371
|
}
|
|
402
372
|
|
|
403
|
-
|
|
373
|
+
let Info = {
|
|
404
374
|
gauge: gauge$2,
|
|
405
375
|
set: set$2
|
|
406
376
|
};
|
|
407
377
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
378
|
+
let gauge$3 = PromClient.Gauge.makeGauge({
|
|
379
|
+
name: "envio_process_start_time_seconds",
|
|
380
|
+
help: "Start time of the process since unix epoch in seconds."
|
|
381
|
+
});
|
|
412
382
|
|
|
413
383
|
function set$3() {
|
|
414
384
|
gauge$3.set(Date.now() / 1000.0);
|
|
415
385
|
}
|
|
416
386
|
|
|
417
|
-
|
|
387
|
+
let ProcessStartTimeSeconds = {
|
|
418
388
|
gauge: gauge$3,
|
|
419
389
|
set: set$3
|
|
420
390
|
};
|
|
421
391
|
|
|
422
|
-
|
|
392
|
+
let gauge$4 = makeOrThrow$1("envio_indexing_addresses", "The number of addresses indexed on chain. Includes both static and dynamic addresses.", chainIdLabelsSchema);
|
|
423
393
|
|
|
424
394
|
function set$4(addressesCount, chainId) {
|
|
425
395
|
handleInt$1(gauge$4, chainId, addressesCount);
|
|
426
396
|
}
|
|
427
397
|
|
|
428
|
-
|
|
398
|
+
let IndexingAddresses = {
|
|
429
399
|
gauge: gauge$4,
|
|
430
400
|
set: set$4
|
|
431
401
|
};
|
|
432
402
|
|
|
433
|
-
|
|
403
|
+
let gauge$5 = makeOrThrow$1("envio_indexing_max_concurrency", "The maximum number of concurrent queries to the chain data-source.", chainIdLabelsSchema);
|
|
434
404
|
|
|
435
405
|
function set$5(maxConcurrency, chainId) {
|
|
436
406
|
handleInt$1(gauge$5, chainId, maxConcurrency);
|
|
437
407
|
}
|
|
438
408
|
|
|
439
|
-
|
|
409
|
+
let IndexingMaxConcurrency = {
|
|
440
410
|
gauge: gauge$5,
|
|
441
411
|
set: set$5
|
|
442
412
|
};
|
|
443
413
|
|
|
444
|
-
|
|
414
|
+
let gauge$6 = makeOrThrow$1("envio_indexing_concurrency", "The number of executing concurrent queries to the chain data-source.", chainIdLabelsSchema);
|
|
445
415
|
|
|
446
416
|
function set$6(concurrency, chainId) {
|
|
447
417
|
handleInt$1(gauge$6, chainId, concurrency);
|
|
448
418
|
}
|
|
449
419
|
|
|
450
|
-
|
|
420
|
+
let IndexingConcurrency = {
|
|
451
421
|
gauge: gauge$6,
|
|
452
422
|
set: set$6
|
|
453
423
|
};
|
|
454
424
|
|
|
455
|
-
|
|
425
|
+
let gauge$7 = makeOrThrow$1("envio_indexing_partitions", "The number of partitions used to split fetching logic by addresses and block ranges.", chainIdLabelsSchema);
|
|
456
426
|
|
|
457
427
|
function set$7(partitionsCount, chainId) {
|
|
458
428
|
handleInt$1(gauge$7, chainId, partitionsCount);
|
|
459
429
|
}
|
|
460
430
|
|
|
461
|
-
|
|
431
|
+
let IndexingPartitions = {
|
|
462
432
|
gauge: gauge$7,
|
|
463
433
|
set: set$7
|
|
464
434
|
};
|
|
465
435
|
|
|
466
|
-
|
|
436
|
+
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);
|
|
467
437
|
|
|
468
|
-
|
|
438
|
+
let IndexingIdleTime = {
|
|
469
439
|
counter: counter
|
|
470
440
|
};
|
|
471
441
|
|
|
472
|
-
|
|
442
|
+
let counter$1 = makeOrThrow("envio_indexing_source_waiting_seconds", "The time the indexer has been waiting for new blocks.", chainIdLabelsSchema);
|
|
473
443
|
|
|
474
|
-
|
|
444
|
+
let IndexingSourceWaitingTime = {
|
|
475
445
|
counter: counter$1
|
|
476
446
|
};
|
|
477
447
|
|
|
478
|
-
|
|
448
|
+
let counter$2 = makeOrThrow("envio_indexing_source_querying_seconds", "The time spent performing queries to the chain data-source.", chainIdLabelsSchema);
|
|
479
449
|
|
|
480
|
-
|
|
450
|
+
let IndexingQueryTime = {
|
|
481
451
|
counter: counter$2
|
|
482
452
|
};
|
|
483
453
|
|
|
484
|
-
|
|
454
|
+
let gauge$8 = makeOrThrow$1("envio_indexing_buffer_size", "The current number of items in the indexing buffer.", chainIdLabelsSchema);
|
|
485
455
|
|
|
486
456
|
function set$8(bufferSize, chainId) {
|
|
487
457
|
handleInt$1(gauge$8, chainId, bufferSize);
|
|
488
458
|
}
|
|
489
459
|
|
|
490
|
-
|
|
460
|
+
let IndexingBufferSize = {
|
|
491
461
|
gauge: gauge$8,
|
|
492
462
|
set: set$8
|
|
493
463
|
};
|
|
494
464
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
465
|
+
let gauge$9 = PromClient.Gauge.makeGauge({
|
|
466
|
+
name: "envio_indexing_target_buffer_size",
|
|
467
|
+
help: "The target buffer size per chain for indexing. 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."
|
|
468
|
+
});
|
|
499
469
|
|
|
500
470
|
function set$9(targetBufferSize) {
|
|
501
471
|
gauge$9.set(targetBufferSize);
|
|
502
472
|
}
|
|
503
473
|
|
|
504
|
-
|
|
474
|
+
let IndexingTargetBufferSize = {
|
|
505
475
|
gauge: gauge$9,
|
|
506
476
|
set: set$9
|
|
507
477
|
};
|
|
508
478
|
|
|
509
|
-
|
|
479
|
+
let gauge$10 = makeOrThrow$1("envio_indexing_buffer_block", "The highest block number that has been fully fetched by the indexer.", chainIdLabelsSchema);
|
|
510
480
|
|
|
511
481
|
function set$10(blockNumber, chainId) {
|
|
512
482
|
handleInt$1(gauge$10, chainId, blockNumber);
|
|
513
483
|
}
|
|
514
484
|
|
|
515
|
-
|
|
485
|
+
let IndexingBufferBlockNumber = {
|
|
516
486
|
gauge: gauge$10,
|
|
517
487
|
set: set$10
|
|
518
488
|
};
|
|
519
489
|
|
|
520
|
-
|
|
490
|
+
let gauge$11 = makeOrThrow$1("envio_indexing_end_block", "The block number to stop indexing at. (inclusive)", chainIdLabelsSchema);
|
|
521
491
|
|
|
522
492
|
function set$11(endBlock, chainId) {
|
|
523
493
|
handleInt$1(gauge$11, chainId, endBlock);
|
|
524
494
|
}
|
|
525
495
|
|
|
526
|
-
|
|
496
|
+
let IndexingEndBlock = {
|
|
527
497
|
gauge: gauge$11,
|
|
528
498
|
set: set$11
|
|
529
499
|
};
|
|
530
500
|
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
};
|
|
536
|
-
});
|
|
501
|
+
let sourceLabelsSchema = S$RescriptSchema.schema(s => ({
|
|
502
|
+
source: s.m(S$RescriptSchema.string),
|
|
503
|
+
chainId: s.m(S$RescriptSchema.coerce(S$RescriptSchema.string, S$RescriptSchema.int))
|
|
504
|
+
}));
|
|
537
505
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
};
|
|
544
|
-
});
|
|
506
|
+
let sourceRequestLabelsSchema = S$RescriptSchema.schema(s => ({
|
|
507
|
+
source: s.m(S$RescriptSchema.string),
|
|
508
|
+
chainId: s.m(S$RescriptSchema.coerce(S$RescriptSchema.string, S$RescriptSchema.int)),
|
|
509
|
+
method: s.m(S$RescriptSchema.string)
|
|
510
|
+
}));
|
|
545
511
|
|
|
546
|
-
|
|
512
|
+
let counter$3 = makeOrThrow("envio_source_request_total", "The number of requests made to data sources.", sourceRequestLabelsSchema);
|
|
547
513
|
|
|
548
|
-
|
|
514
|
+
let sumTimeCounter$1 = makeOrThrow("envio_source_request_seconds_total", "Cumulative time spent on data source requests.", sourceRequestLabelsSchema);
|
|
549
515
|
|
|
550
516
|
function increment$4(sourceName, chainId, method) {
|
|
551
517
|
increment(counter$3, {
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
518
|
+
source: sourceName,
|
|
519
|
+
chainId: chainId,
|
|
520
|
+
method: method
|
|
521
|
+
});
|
|
556
522
|
}
|
|
557
523
|
|
|
558
524
|
function addSeconds(sourceName, chainId, method, seconds) {
|
|
559
525
|
handleFloat(sumTimeCounter$1, {
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
526
|
+
source: sourceName,
|
|
527
|
+
chainId: chainId,
|
|
528
|
+
method: method
|
|
529
|
+
}, seconds);
|
|
564
530
|
}
|
|
565
531
|
|
|
566
|
-
|
|
532
|
+
let SourceRequestCount = {
|
|
567
533
|
counter: counter$3,
|
|
568
534
|
sumTimeCounter: sumTimeCounter$1,
|
|
569
535
|
increment: increment$4,
|
|
570
536
|
addSeconds: addSeconds
|
|
571
537
|
};
|
|
572
538
|
|
|
573
|
-
|
|
539
|
+
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);
|
|
574
540
|
|
|
575
541
|
function set$12(sourceName, chainId, blockNumber) {
|
|
576
542
|
handleInt$1(gauge$12, {
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
543
|
+
source: sourceName,
|
|
544
|
+
chainId: chainId
|
|
545
|
+
}, blockNumber);
|
|
580
546
|
}
|
|
581
547
|
|
|
582
|
-
|
|
548
|
+
let SourceHeight = {
|
|
583
549
|
gauge: gauge$12,
|
|
584
550
|
set: set$12
|
|
585
551
|
};
|
|
586
552
|
|
|
587
|
-
|
|
553
|
+
let counter$4 = makeOrThrow("envio_reorg_detected_total", "Total number of reorgs detected", chainIdLabelsSchema);
|
|
588
554
|
|
|
589
555
|
function increment$5(chain) {
|
|
590
556
|
increment(counter$4, chain);
|
|
591
557
|
}
|
|
592
558
|
|
|
593
|
-
|
|
559
|
+
let ReorgCount = {
|
|
594
560
|
counter: counter$4,
|
|
595
561
|
increment: increment$5
|
|
596
562
|
};
|
|
597
563
|
|
|
598
|
-
|
|
564
|
+
let gauge$13 = 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);
|
|
599
565
|
|
|
600
566
|
function set$13(blockNumber, chain) {
|
|
601
567
|
handleInt$1(gauge$13, chain, blockNumber);
|
|
602
568
|
}
|
|
603
569
|
|
|
604
|
-
|
|
570
|
+
let ReorgDetectionBlockNumber = {
|
|
605
571
|
gauge: gauge$13,
|
|
606
572
|
set: set$13
|
|
607
573
|
};
|
|
608
574
|
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
575
|
+
let gauge$14 = PromClient.Gauge.makeGauge({
|
|
576
|
+
name: "envio_reorg_threshold",
|
|
577
|
+
help: "Whether indexing is currently within the reorg threshold"
|
|
578
|
+
});
|
|
613
579
|
|
|
614
580
|
function set$14(isInReorgThreshold) {
|
|
615
581
|
gauge$14.set(isInReorgThreshold ? 1 : 0);
|
|
616
582
|
}
|
|
617
583
|
|
|
618
|
-
|
|
584
|
+
let ReorgThreshold = {
|
|
619
585
|
gauge: gauge$14,
|
|
620
586
|
set: set$14
|
|
621
587
|
};
|
|
622
588
|
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
589
|
+
let gauge$15 = PromClient.Gauge.makeGauge({
|
|
590
|
+
name: "envio_rollback_enabled",
|
|
591
|
+
help: "Whether rollback on reorg is enabled"
|
|
592
|
+
});
|
|
627
593
|
|
|
628
594
|
function set$15(enabled) {
|
|
629
595
|
gauge$15.set(enabled ? 1 : 0);
|
|
630
596
|
}
|
|
631
597
|
|
|
632
|
-
|
|
598
|
+
let RollbackEnabled = {
|
|
633
599
|
gauge: gauge$15,
|
|
634
600
|
set: set$15
|
|
635
601
|
};
|
|
636
602
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
603
|
+
let timeCounter$3 = PromClient.Counter.makeCounter({
|
|
604
|
+
name: "envio_rollback_seconds",
|
|
605
|
+
help: "Rollback on reorg total time."
|
|
606
|
+
});
|
|
641
607
|
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
608
|
+
let counter$5 = PromClient.Counter.makeCounter({
|
|
609
|
+
name: "envio_rollback_total",
|
|
610
|
+
help: "Number of successful rollbacks on reorg"
|
|
611
|
+
});
|
|
646
612
|
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
613
|
+
let eventsCounter = PromClient.Counter.makeCounter({
|
|
614
|
+
name: "envio_rollback_events",
|
|
615
|
+
help: "Number of events rollbacked on reorg"
|
|
616
|
+
});
|
|
651
617
|
|
|
652
618
|
function increment$6(timeSeconds, rollbackedProcessedEvents) {
|
|
653
619
|
timeCounter$3.inc(timeSeconds);
|
|
@@ -655,168 +621,170 @@ function increment$6(timeSeconds, rollbackedProcessedEvents) {
|
|
|
655
621
|
eventsCounter.inc(Math.trunc(rollbackedProcessedEvents));
|
|
656
622
|
}
|
|
657
623
|
|
|
658
|
-
|
|
624
|
+
let RollbackSuccess = {
|
|
659
625
|
timeCounter: timeCounter$3,
|
|
660
626
|
counter: counter$5,
|
|
661
627
|
eventsCounter: eventsCounter,
|
|
662
628
|
increment: increment$6
|
|
663
629
|
};
|
|
664
630
|
|
|
665
|
-
|
|
666
|
-
return s.f("entity", S$RescriptSchema.string);
|
|
667
|
-
});
|
|
631
|
+
let entityNameLabelsSchema = S$RescriptSchema.object(s => s.f("entity", S$RescriptSchema.string));
|
|
668
632
|
|
|
669
|
-
|
|
633
|
+
let timeCounter$4 = makeOrThrow("envio_rollback_history_prune_seconds", "The total time spent pruning entity history which is not in the reorg threshold.", entityNameLabelsSchema);
|
|
670
634
|
|
|
671
|
-
|
|
635
|
+
let counter$6 = makeOrThrow("envio_rollback_history_prune_total", "Number of successful entity history prunes", entityNameLabelsSchema);
|
|
672
636
|
|
|
673
637
|
function increment$7(timeSeconds, entityName) {
|
|
674
638
|
handleFloat(timeCounter$4, entityName, timeSeconds);
|
|
675
639
|
increment(counter$6, entityName);
|
|
676
640
|
}
|
|
677
641
|
|
|
678
|
-
|
|
642
|
+
let RollbackHistoryPrune = {
|
|
679
643
|
entityNameLabelsSchema: entityNameLabelsSchema,
|
|
680
644
|
timeCounter: timeCounter$4,
|
|
681
645
|
counter: counter$6,
|
|
682
646
|
increment: increment$7
|
|
683
647
|
};
|
|
684
648
|
|
|
685
|
-
|
|
649
|
+
let gauge$16 = makeOrThrow$1("envio_rollback_target_block", "The block number reorg was rollbacked to the last time.", chainIdLabelsSchema);
|
|
686
650
|
|
|
687
651
|
function set$16(blockNumber, chain) {
|
|
688
652
|
handleInt$1(gauge$16, chain, blockNumber);
|
|
689
653
|
}
|
|
690
654
|
|
|
691
|
-
|
|
655
|
+
let RollbackTargetBlockNumber = {
|
|
692
656
|
gauge: gauge$16,
|
|
693
657
|
set: set$16
|
|
694
658
|
};
|
|
695
659
|
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
660
|
+
let gauge$17 = PromClient.Gauge.makeGauge({
|
|
661
|
+
name: "envio_processing_max_batch_size",
|
|
662
|
+
help: "The maximum number of items to process in a single batch."
|
|
663
|
+
});
|
|
700
664
|
|
|
701
665
|
function set$17(maxBatchSize) {
|
|
702
666
|
gauge$17.set(maxBatchSize);
|
|
703
667
|
}
|
|
704
668
|
|
|
705
|
-
|
|
669
|
+
let ProcessingMaxBatchSize = {
|
|
706
670
|
gauge: gauge$17,
|
|
707
671
|
set: set$17
|
|
708
672
|
};
|
|
709
673
|
|
|
710
|
-
|
|
674
|
+
let gauge$18 = makeOrThrow$1("envio_progress_block", "The block number of the latest block processed and stored in the database.", chainIdLabelsSchema);
|
|
711
675
|
|
|
712
676
|
function set$18(blockNumber, chainId) {
|
|
713
677
|
handleInt$1(gauge$18, chainId, blockNumber);
|
|
714
678
|
}
|
|
715
679
|
|
|
716
|
-
|
|
680
|
+
let ProgressBlockNumber = {
|
|
717
681
|
gauge: gauge$18,
|
|
718
682
|
set: set$18
|
|
719
683
|
};
|
|
720
684
|
|
|
721
|
-
|
|
685
|
+
let gauge$19 = makeOrThrow$1("envio_progress_events", "The number of events processed and reflected in the database.", chainIdLabelsSchema);
|
|
722
686
|
|
|
723
687
|
function set$19(processedCount, chainId) {
|
|
724
688
|
handleFloat$1(gauge$19, chainId, processedCount);
|
|
725
689
|
}
|
|
726
690
|
|
|
727
|
-
|
|
691
|
+
let ProgressEventsCount = {
|
|
728
692
|
gauge: gauge$19,
|
|
729
693
|
set: set$19
|
|
730
694
|
};
|
|
731
695
|
|
|
732
|
-
|
|
696
|
+
let gauge$20 = makeOrThrow$1("envio_progress_latency", "The latency in milliseconds between the latest processed event creation and the time it was written to storage.", chainIdLabelsSchema);
|
|
733
697
|
|
|
734
698
|
function set$20(latencyMs, chainId) {
|
|
735
699
|
handleInt$1(gauge$20, chainId, latencyMs);
|
|
736
700
|
}
|
|
737
701
|
|
|
738
|
-
|
|
702
|
+
let ProgressLatency = {
|
|
739
703
|
gauge: gauge$20,
|
|
740
704
|
set: set$20
|
|
741
705
|
};
|
|
742
706
|
|
|
743
|
-
|
|
744
|
-
return s.f("effect", S$RescriptSchema.string);
|
|
745
|
-
});
|
|
707
|
+
let effectLabelsSchema = S$RescriptSchema.object(s => s.f("effect", S$RescriptSchema.string));
|
|
746
708
|
|
|
747
|
-
|
|
709
|
+
let timeCounter$5 = makeOrThrow("envio_effect_call_seconds", "Processing time taken to call the Effect function.", effectLabelsSchema);
|
|
748
710
|
|
|
749
|
-
|
|
711
|
+
let sumTimeCounter$2 = makeOrThrow("envio_effect_call_seconds_total", "Cumulative time spent calling the Effect function during the indexing process.", effectLabelsSchema);
|
|
750
712
|
|
|
751
|
-
|
|
713
|
+
let totalCallsCount = makeOrThrow("envio_effect_call_total", "Cumulative number of resolved Effect function calls during the indexing process.", effectLabelsSchema);
|
|
752
714
|
|
|
753
|
-
|
|
715
|
+
let activeCallsCount = makeOrThrow$1("envio_effect_active_calls", "The number of Effect function calls that are currently running.", effectLabelsSchema);
|
|
754
716
|
|
|
755
|
-
|
|
717
|
+
let EffectCalls = {
|
|
756
718
|
timeCounter: timeCounter$5,
|
|
757
719
|
sumTimeCounter: sumTimeCounter$2,
|
|
758
720
|
totalCallsCount: totalCallsCount,
|
|
759
721
|
activeCallsCount: activeCallsCount
|
|
760
722
|
};
|
|
761
723
|
|
|
762
|
-
|
|
724
|
+
let gauge$21 = makeOrThrow$1("envio_effect_cache", "The number of items in the effect cache.", effectLabelsSchema);
|
|
763
725
|
|
|
764
726
|
function set$21(count, effectName) {
|
|
765
727
|
handleInt$1(gauge$21, effectName, count);
|
|
766
728
|
}
|
|
767
729
|
|
|
768
|
-
|
|
730
|
+
let EffectCacheCount = {
|
|
769
731
|
gauge: gauge$21,
|
|
770
732
|
set: set$21
|
|
771
733
|
};
|
|
772
734
|
|
|
773
|
-
|
|
735
|
+
let counter$7 = makeOrThrow("envio_effect_cache_invalidations", "The number of effect cache invalidations.", effectLabelsSchema);
|
|
774
736
|
|
|
775
737
|
function increment$8(effectName) {
|
|
776
738
|
increment(counter$7, effectName);
|
|
777
739
|
}
|
|
778
740
|
|
|
779
|
-
|
|
741
|
+
let EffectCacheInvalidationsCount = {
|
|
780
742
|
counter: counter$7,
|
|
781
743
|
increment: increment$8
|
|
782
744
|
};
|
|
783
745
|
|
|
784
|
-
|
|
746
|
+
let gauge$22 = makeOrThrow$1("envio_effect_queue", "The number of effect calls waiting in the rate limit queue.", effectLabelsSchema);
|
|
785
747
|
|
|
786
|
-
|
|
748
|
+
let timeCounter$6 = makeOrThrow("envio_effect_queue_wait_seconds", "The time spent waiting in the rate limit queue.", effectLabelsSchema);
|
|
787
749
|
|
|
788
750
|
function set$22(count, effectName) {
|
|
789
751
|
handleInt$1(gauge$22, effectName, count);
|
|
790
752
|
}
|
|
791
753
|
|
|
792
|
-
|
|
754
|
+
let EffectQueueCount = {
|
|
793
755
|
gauge: gauge$22,
|
|
794
756
|
timeCounter: timeCounter$6,
|
|
795
757
|
set: set$22
|
|
796
758
|
};
|
|
797
759
|
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
760
|
+
let loadLabelsSchema = S$RescriptSchema.schema(s => ({
|
|
761
|
+
operation: s.m(S$RescriptSchema.string),
|
|
762
|
+
storage: s.m(S$RescriptSchema.string)
|
|
763
|
+
}));
|
|
764
|
+
|
|
765
|
+
let timeCounter$7 = makeOrThrow("envio_storage_load_seconds", "Processing time taken to load data from storage.", loadLabelsSchema);
|
|
801
766
|
|
|
802
|
-
|
|
767
|
+
let sumTimeCounter$3 = makeOrThrow("envio_storage_load_seconds_total", "Cumulative time spent loading data from storage during the indexing process.", loadLabelsSchema);
|
|
803
768
|
|
|
804
|
-
|
|
769
|
+
let counter$8 = makeOrThrow("envio_storage_load_total", "Cumulative number of successful storage load operations during the indexing process.", loadLabelsSchema);
|
|
805
770
|
|
|
806
|
-
|
|
771
|
+
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);
|
|
807
772
|
|
|
808
|
-
|
|
773
|
+
let sizeCounter$1 = makeOrThrow("envio_storage_load_size", "Cumulative number of records loaded from storage during the indexing process.", loadLabelsSchema);
|
|
809
774
|
|
|
810
|
-
|
|
775
|
+
let operations$1 = {};
|
|
811
776
|
|
|
812
|
-
|
|
777
|
+
function makeKey$1(storage, operation) {
|
|
778
|
+
return storage + ":" + operation;
|
|
779
|
+
}
|
|
813
780
|
|
|
814
|
-
function startOperation$1(operation) {
|
|
815
|
-
|
|
781
|
+
function startOperation$1(storage, operation) {
|
|
782
|
+
let key = makeKey$1(storage, operation);
|
|
783
|
+
let operationRef = operations$1[key];
|
|
816
784
|
if (operationRef !== undefined) {
|
|
817
785
|
operationRef.pendingCount = operationRef.pendingCount + 1 | 0;
|
|
818
786
|
} else {
|
|
819
|
-
operations$1[
|
|
787
|
+
operations$1[key] = {
|
|
820
788
|
pendingCount: 1,
|
|
821
789
|
timerRef: Hrtime.makeTimer()
|
|
822
790
|
};
|
|
@@ -824,99 +792,103 @@ function startOperation$1(operation) {
|
|
|
824
792
|
return Hrtime.makeTimer();
|
|
825
793
|
}
|
|
826
794
|
|
|
827
|
-
function endOperation$1(timerRef, operation, whereSize, size) {
|
|
828
|
-
|
|
795
|
+
function endOperation$1(timerRef, storage, operation, whereSize, size) {
|
|
796
|
+
let key = makeKey$1(storage, operation);
|
|
797
|
+
let labels = {
|
|
798
|
+
operation: operation,
|
|
799
|
+
storage: storage
|
|
800
|
+
};
|
|
801
|
+
let operationRef = operations$1[key];
|
|
829
802
|
operationRef.pendingCount = operationRef.pendingCount - 1 | 0;
|
|
830
803
|
if (operationRef.pendingCount === 0) {
|
|
831
|
-
handleFloat(timeCounter$7,
|
|
832
|
-
Utils.Dict.deleteInPlace(operations$1,
|
|
804
|
+
handleFloat(timeCounter$7, labels, Hrtime.toSecondsFloat(Hrtime.timeSince(operationRef.timerRef)));
|
|
805
|
+
Utils.Dict.deleteInPlace(operations$1, key);
|
|
833
806
|
}
|
|
834
|
-
handleFloat(sumTimeCounter$3,
|
|
835
|
-
increment(counter$8,
|
|
836
|
-
handleInt(whereSizeCounter,
|
|
837
|
-
handleInt(sizeCounter$1,
|
|
807
|
+
handleFloat(sumTimeCounter$3, labels, Hrtime.toSecondsFloat(Hrtime.timeSince(timerRef)));
|
|
808
|
+
increment(counter$8, labels);
|
|
809
|
+
handleInt(whereSizeCounter, labels, whereSize);
|
|
810
|
+
handleInt(sizeCounter$1, labels, size);
|
|
838
811
|
}
|
|
839
812
|
|
|
840
|
-
|
|
841
|
-
|
|
813
|
+
let StorageLoad = {
|
|
814
|
+
loadLabelsSchema: loadLabelsSchema,
|
|
842
815
|
timeCounter: timeCounter$7,
|
|
843
816
|
sumTimeCounter: sumTimeCounter$3,
|
|
844
817
|
counter: counter$8,
|
|
845
818
|
whereSizeCounter: whereSizeCounter,
|
|
846
819
|
sizeCounter: sizeCounter$1,
|
|
847
820
|
operations: operations$1,
|
|
821
|
+
makeKey: makeKey$1,
|
|
848
822
|
startOperation: startOperation$1,
|
|
849
823
|
endOperation: endOperation$1
|
|
850
824
|
};
|
|
851
825
|
|
|
852
|
-
|
|
853
|
-
return s.f("sink", S$RescriptSchema.string);
|
|
854
|
-
});
|
|
826
|
+
let storageLabelsSchema = S$RescriptSchema.object(s => s.f("storage", S$RescriptSchema.string));
|
|
855
827
|
|
|
856
|
-
|
|
828
|
+
let timeCounter$8 = makeOrThrow("envio_storage_write_seconds", "Cumulative time spent writing batch data to storage.", storageLabelsSchema);
|
|
857
829
|
|
|
858
|
-
|
|
830
|
+
let counter$9 = makeOrThrow("envio_storage_write_total", "Cumulative number of successful storage write operations during the indexing process.", storageLabelsSchema);
|
|
859
831
|
|
|
860
|
-
function increment$9(
|
|
861
|
-
handleFloat(timeCounter$8,
|
|
862
|
-
increment(counter$9,
|
|
832
|
+
function increment$9(storage, timeSeconds) {
|
|
833
|
+
handleFloat(timeCounter$8, storage, timeSeconds);
|
|
834
|
+
increment(counter$9, storage);
|
|
863
835
|
}
|
|
864
836
|
|
|
865
|
-
|
|
866
|
-
|
|
837
|
+
let StorageWrite = {
|
|
838
|
+
storageLabelsSchema: storageLabelsSchema,
|
|
867
839
|
timeCounter: timeCounter$8,
|
|
868
840
|
counter: counter$9,
|
|
869
841
|
increment: increment$9
|
|
870
842
|
};
|
|
871
843
|
|
|
872
844
|
export {
|
|
873
|
-
Labels
|
|
874
|
-
metricNames
|
|
875
|
-
MakeSafePromMetric
|
|
876
|
-
SafeCounter
|
|
877
|
-
SafeGauge
|
|
878
|
-
ProcessingBatch
|
|
879
|
-
chainIdLabelsSchema
|
|
880
|
-
ProgressReady
|
|
881
|
-
handlerLabelsSchema
|
|
882
|
-
ProcessingHandler
|
|
883
|
-
PreloadHandler
|
|
884
|
-
FetchingBlockRange
|
|
885
|
-
IndexingKnownHeight
|
|
886
|
-
Info
|
|
887
|
-
ProcessStartTimeSeconds
|
|
888
|
-
IndexingAddresses
|
|
889
|
-
IndexingMaxConcurrency
|
|
890
|
-
IndexingConcurrency
|
|
891
|
-
IndexingPartitions
|
|
892
|
-
IndexingIdleTime
|
|
893
|
-
IndexingSourceWaitingTime
|
|
894
|
-
IndexingQueryTime
|
|
895
|
-
IndexingBufferSize
|
|
896
|
-
IndexingTargetBufferSize
|
|
897
|
-
IndexingBufferBlockNumber
|
|
898
|
-
IndexingEndBlock
|
|
899
|
-
sourceLabelsSchema
|
|
900
|
-
sourceRequestLabelsSchema
|
|
901
|
-
SourceRequestCount
|
|
902
|
-
SourceHeight
|
|
903
|
-
ReorgCount
|
|
904
|
-
ReorgDetectionBlockNumber
|
|
905
|
-
ReorgThreshold
|
|
906
|
-
RollbackEnabled
|
|
907
|
-
RollbackSuccess
|
|
908
|
-
RollbackHistoryPrune
|
|
909
|
-
RollbackTargetBlockNumber
|
|
910
|
-
ProcessingMaxBatchSize
|
|
911
|
-
ProgressBlockNumber
|
|
912
|
-
ProgressEventsCount
|
|
913
|
-
ProgressLatency
|
|
914
|
-
effectLabelsSchema
|
|
915
|
-
EffectCalls
|
|
916
|
-
EffectCacheCount
|
|
917
|
-
EffectCacheInvalidationsCount
|
|
918
|
-
EffectQueueCount
|
|
919
|
-
StorageLoad
|
|
920
|
-
|
|
845
|
+
Labels,
|
|
846
|
+
metricNames,
|
|
847
|
+
MakeSafePromMetric,
|
|
848
|
+
SafeCounter,
|
|
849
|
+
SafeGauge,
|
|
850
|
+
ProcessingBatch,
|
|
851
|
+
chainIdLabelsSchema,
|
|
852
|
+
ProgressReady,
|
|
853
|
+
handlerLabelsSchema,
|
|
854
|
+
ProcessingHandler,
|
|
855
|
+
PreloadHandler,
|
|
856
|
+
FetchingBlockRange,
|
|
857
|
+
IndexingKnownHeight,
|
|
858
|
+
Info,
|
|
859
|
+
ProcessStartTimeSeconds,
|
|
860
|
+
IndexingAddresses,
|
|
861
|
+
IndexingMaxConcurrency,
|
|
862
|
+
IndexingConcurrency,
|
|
863
|
+
IndexingPartitions,
|
|
864
|
+
IndexingIdleTime,
|
|
865
|
+
IndexingSourceWaitingTime,
|
|
866
|
+
IndexingQueryTime,
|
|
867
|
+
IndexingBufferSize,
|
|
868
|
+
IndexingTargetBufferSize,
|
|
869
|
+
IndexingBufferBlockNumber,
|
|
870
|
+
IndexingEndBlock,
|
|
871
|
+
sourceLabelsSchema,
|
|
872
|
+
sourceRequestLabelsSchema,
|
|
873
|
+
SourceRequestCount,
|
|
874
|
+
SourceHeight,
|
|
875
|
+
ReorgCount,
|
|
876
|
+
ReorgDetectionBlockNumber,
|
|
877
|
+
ReorgThreshold,
|
|
878
|
+
RollbackEnabled,
|
|
879
|
+
RollbackSuccess,
|
|
880
|
+
RollbackHistoryPrune,
|
|
881
|
+
RollbackTargetBlockNumber,
|
|
882
|
+
ProcessingMaxBatchSize,
|
|
883
|
+
ProgressBlockNumber,
|
|
884
|
+
ProgressEventsCount,
|
|
885
|
+
ProgressLatency,
|
|
886
|
+
effectLabelsSchema,
|
|
887
|
+
EffectCalls,
|
|
888
|
+
EffectCacheCount,
|
|
889
|
+
EffectCacheInvalidationsCount,
|
|
890
|
+
EffectQueueCount,
|
|
891
|
+
StorageLoad,
|
|
892
|
+
StorageWrite,
|
|
921
893
|
}
|
|
922
894
|
/* metricNames Not a pure module */
|