@sentio/runtime 2.57.10-rc.3 → 2.57.10-rc.5
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/lib/{chunk-XDJHH7HG.js → chunk-W4Q3Q5DX.js} +8 -41
- package/lib/{chunk-XDJHH7HG.js.map → chunk-W4Q3Q5DX.js.map} +1 -1
- package/lib/index.d.ts +3 -6
- package/lib/index.js +1 -1
- package/lib/processor-runner.js +23 -1
- package/lib/processor-runner.js.map +1 -1
- package/package.json +1 -1
- package/src/gen/processor/protos/processor.ts +1 -17
- package/src/gen/service/common/protos/common.ts +60 -2
- package/src/metrics.ts +3 -5
- package/src/processor-runner.ts +25 -0
- package/src/service.ts +1 -4
- package/src/tsup.config.ts +1 -1
package/package.json
CHANGED
@@ -416,7 +416,6 @@ export interface ExecutionConfig_DecoderWorkerConfig {
|
|
416
416
|
enabled: boolean;
|
417
417
|
workerCount?: number | undefined;
|
418
418
|
skipWhenDecodeFailed?: boolean | undefined;
|
419
|
-
recordTiming?: boolean | undefined;
|
420
419
|
}
|
421
420
|
|
422
421
|
export interface ProcessConfigRequest {
|
@@ -1596,7 +1595,7 @@ export const ExecutionConfig = {
|
|
1596
1595
|
};
|
1597
1596
|
|
1598
1597
|
function createBaseExecutionConfig_DecoderWorkerConfig(): ExecutionConfig_DecoderWorkerConfig {
|
1599
|
-
return { enabled: false, workerCount: undefined, skipWhenDecodeFailed: undefined
|
1598
|
+
return { enabled: false, workerCount: undefined, skipWhenDecodeFailed: undefined };
|
1600
1599
|
}
|
1601
1600
|
|
1602
1601
|
export const ExecutionConfig_DecoderWorkerConfig = {
|
@@ -1610,9 +1609,6 @@ export const ExecutionConfig_DecoderWorkerConfig = {
|
|
1610
1609
|
if (message.skipWhenDecodeFailed !== undefined) {
|
1611
1610
|
writer.uint32(24).bool(message.skipWhenDecodeFailed);
|
1612
1611
|
}
|
1613
|
-
if (message.recordTiming !== undefined) {
|
1614
|
-
writer.uint32(32).bool(message.recordTiming);
|
1615
|
-
}
|
1616
1612
|
return writer;
|
1617
1613
|
},
|
1618
1614
|
|
@@ -1644,13 +1640,6 @@ export const ExecutionConfig_DecoderWorkerConfig = {
|
|
1644
1640
|
|
1645
1641
|
message.skipWhenDecodeFailed = reader.bool();
|
1646
1642
|
continue;
|
1647
|
-
case 4:
|
1648
|
-
if (tag !== 32) {
|
1649
|
-
break;
|
1650
|
-
}
|
1651
|
-
|
1652
|
-
message.recordTiming = reader.bool();
|
1653
|
-
continue;
|
1654
1643
|
}
|
1655
1644
|
if ((tag & 7) === 4 || tag === 0) {
|
1656
1645
|
break;
|
@@ -1667,7 +1656,6 @@ export const ExecutionConfig_DecoderWorkerConfig = {
|
|
1667
1656
|
skipWhenDecodeFailed: isSet(object.skipWhenDecodeFailed)
|
1668
1657
|
? globalThis.Boolean(object.skipWhenDecodeFailed)
|
1669
1658
|
: undefined,
|
1670
|
-
recordTiming: isSet(object.recordTiming) ? globalThis.Boolean(object.recordTiming) : undefined,
|
1671
1659
|
};
|
1672
1660
|
},
|
1673
1661
|
|
@@ -1682,9 +1670,6 @@ export const ExecutionConfig_DecoderWorkerConfig = {
|
|
1682
1670
|
if (message.skipWhenDecodeFailed !== undefined) {
|
1683
1671
|
obj.skipWhenDecodeFailed = message.skipWhenDecodeFailed;
|
1684
1672
|
}
|
1685
|
-
if (message.recordTiming !== undefined) {
|
1686
|
-
obj.recordTiming = message.recordTiming;
|
1687
|
-
}
|
1688
1673
|
return obj;
|
1689
1674
|
},
|
1690
1675
|
|
@@ -1696,7 +1681,6 @@ export const ExecutionConfig_DecoderWorkerConfig = {
|
|
1696
1681
|
message.enabled = object.enabled ?? false;
|
1697
1682
|
message.workerCount = object.workerCount ?? undefined;
|
1698
1683
|
message.skipWhenDecodeFailed = object.skipWhenDecodeFailed ?? undefined;
|
1699
|
-
message.recordTiming = object.recordTiming ?? undefined;
|
1700
1684
|
return message;
|
1701
1685
|
},
|
1702
1686
|
};
|
@@ -667,6 +667,7 @@ export interface Query {
|
|
667
667
|
labelSelector: { [key: string]: string };
|
668
668
|
aggregate: Aggregate | undefined;
|
669
669
|
functions: Function[];
|
670
|
+
color: string;
|
670
671
|
disabled: boolean;
|
671
672
|
}
|
672
673
|
|
@@ -873,6 +874,7 @@ export interface SegmentationQuery {
|
|
873
874
|
groupBy: string[];
|
874
875
|
limit: number;
|
875
876
|
functions: Function[];
|
877
|
+
color: string;
|
876
878
|
disabled: boolean;
|
877
879
|
}
|
878
880
|
|
@@ -1481,6 +1483,7 @@ export interface PriceSegmentationQuery {
|
|
1481
1483
|
id: string;
|
1482
1484
|
alias: string;
|
1483
1485
|
coinId: CoinID[];
|
1486
|
+
color: string;
|
1484
1487
|
disabled: boolean;
|
1485
1488
|
}
|
1486
1489
|
|
@@ -5755,7 +5758,16 @@ export const Function = {
|
|
5755
5758
|
};
|
5756
5759
|
|
5757
5760
|
function createBaseQuery(): Query {
|
5758
|
-
return {
|
5761
|
+
return {
|
5762
|
+
query: "",
|
5763
|
+
alias: "",
|
5764
|
+
id: "",
|
5765
|
+
labelSelector: {},
|
5766
|
+
aggregate: undefined,
|
5767
|
+
functions: [],
|
5768
|
+
color: "",
|
5769
|
+
disabled: false,
|
5770
|
+
};
|
5759
5771
|
}
|
5760
5772
|
|
5761
5773
|
export const Query = {
|
@@ -5778,6 +5790,9 @@ export const Query = {
|
|
5778
5790
|
for (const v of message.functions) {
|
5779
5791
|
Function.encode(v!, writer.uint32(58).fork()).ldelim();
|
5780
5792
|
}
|
5793
|
+
if (message.color !== "") {
|
5794
|
+
writer.uint32(74).string(message.color);
|
5795
|
+
}
|
5781
5796
|
if (message.disabled !== false) {
|
5782
5797
|
writer.uint32(64).bool(message.disabled);
|
5783
5798
|
}
|
@@ -5836,6 +5851,13 @@ export const Query = {
|
|
5836
5851
|
|
5837
5852
|
message.functions.push(Function.decode(reader, reader.uint32()));
|
5838
5853
|
continue;
|
5854
|
+
case 9:
|
5855
|
+
if (tag !== 74) {
|
5856
|
+
break;
|
5857
|
+
}
|
5858
|
+
|
5859
|
+
message.color = reader.string();
|
5860
|
+
continue;
|
5839
5861
|
case 8:
|
5840
5862
|
if (tag !== 64) {
|
5841
5863
|
break;
|
@@ -5867,6 +5889,7 @@ export const Query = {
|
|
5867
5889
|
functions: globalThis.Array.isArray(object?.functions)
|
5868
5890
|
? object.functions.map((e: any) => Function.fromJSON(e))
|
5869
5891
|
: [],
|
5892
|
+
color: isSet(object.color) ? globalThis.String(object.color) : "",
|
5870
5893
|
disabled: isSet(object.disabled) ? globalThis.Boolean(object.disabled) : false,
|
5871
5894
|
};
|
5872
5895
|
},
|
@@ -5897,6 +5920,9 @@ export const Query = {
|
|
5897
5920
|
if (message.functions?.length) {
|
5898
5921
|
obj.functions = message.functions.map((e) => Function.toJSON(e));
|
5899
5922
|
}
|
5923
|
+
if (message.color !== "") {
|
5924
|
+
obj.color = message.color;
|
5925
|
+
}
|
5900
5926
|
if (message.disabled !== false) {
|
5901
5927
|
obj.disabled = message.disabled;
|
5902
5928
|
}
|
@@ -5924,6 +5950,7 @@ export const Query = {
|
|
5924
5950
|
? Aggregate.fromPartial(object.aggregate)
|
5925
5951
|
: undefined;
|
5926
5952
|
message.functions = object.functions?.map((e) => Function.fromPartial(e)) || [];
|
5953
|
+
message.color = object.color ?? "";
|
5927
5954
|
message.disabled = object.disabled ?? false;
|
5928
5955
|
return message;
|
5929
5956
|
},
|
@@ -6510,6 +6537,7 @@ function createBaseSegmentationQuery(): SegmentationQuery {
|
|
6510
6537
|
groupBy: [],
|
6511
6538
|
limit: 0,
|
6512
6539
|
functions: [],
|
6540
|
+
color: "",
|
6513
6541
|
disabled: false,
|
6514
6542
|
};
|
6515
6543
|
}
|
@@ -6540,6 +6568,9 @@ export const SegmentationQuery = {
|
|
6540
6568
|
for (const v of message.functions) {
|
6541
6569
|
Function.encode(v!, writer.uint32(74).fork()).ldelim();
|
6542
6570
|
}
|
6571
|
+
if (message.color !== "") {
|
6572
|
+
writer.uint32(82).string(message.color);
|
6573
|
+
}
|
6543
6574
|
if (message.disabled !== false) {
|
6544
6575
|
writer.uint32(56).bool(message.disabled);
|
6545
6576
|
}
|
@@ -6609,6 +6640,13 @@ export const SegmentationQuery = {
|
|
6609
6640
|
|
6610
6641
|
message.functions.push(Function.decode(reader, reader.uint32()));
|
6611
6642
|
continue;
|
6643
|
+
case 10:
|
6644
|
+
if (tag !== 82) {
|
6645
|
+
break;
|
6646
|
+
}
|
6647
|
+
|
6648
|
+
message.color = reader.string();
|
6649
|
+
continue;
|
6612
6650
|
case 7:
|
6613
6651
|
if (tag !== 56) {
|
6614
6652
|
break;
|
@@ -6639,6 +6677,7 @@ export const SegmentationQuery = {
|
|
6639
6677
|
functions: globalThis.Array.isArray(object?.functions)
|
6640
6678
|
? object.functions.map((e: any) => Function.fromJSON(e))
|
6641
6679
|
: [],
|
6680
|
+
color: isSet(object.color) ? globalThis.String(object.color) : "",
|
6642
6681
|
disabled: isSet(object.disabled) ? globalThis.Boolean(object.disabled) : false,
|
6643
6682
|
};
|
6644
6683
|
},
|
@@ -6669,6 +6708,9 @@ export const SegmentationQuery = {
|
|
6669
6708
|
if (message.functions?.length) {
|
6670
6709
|
obj.functions = message.functions.map((e) => Function.toJSON(e));
|
6671
6710
|
}
|
6711
|
+
if (message.color !== "") {
|
6712
|
+
obj.color = message.color;
|
6713
|
+
}
|
6672
6714
|
if (message.disabled !== false) {
|
6673
6715
|
obj.disabled = message.disabled;
|
6674
6716
|
}
|
@@ -6694,6 +6736,7 @@ export const SegmentationQuery = {
|
|
6694
6736
|
message.groupBy = object.groupBy?.map((e) => e) || [];
|
6695
6737
|
message.limit = object.limit ?? 0;
|
6696
6738
|
message.functions = object.functions?.map((e) => Function.fromPartial(e)) || [];
|
6739
|
+
message.color = object.color ?? "";
|
6697
6740
|
message.disabled = object.disabled ?? false;
|
6698
6741
|
return message;
|
6699
6742
|
},
|
@@ -9815,7 +9858,7 @@ export const CoinID_AddressIdentifier = {
|
|
9815
9858
|
};
|
9816
9859
|
|
9817
9860
|
function createBasePriceSegmentationQuery(): PriceSegmentationQuery {
|
9818
|
-
return { id: "", alias: "", coinId: [], disabled: false };
|
9861
|
+
return { id: "", alias: "", coinId: [], color: "", disabled: false };
|
9819
9862
|
}
|
9820
9863
|
|
9821
9864
|
export const PriceSegmentationQuery = {
|
@@ -9829,6 +9872,9 @@ export const PriceSegmentationQuery = {
|
|
9829
9872
|
for (const v of message.coinId) {
|
9830
9873
|
CoinID.encode(v!, writer.uint32(26).fork()).ldelim();
|
9831
9874
|
}
|
9875
|
+
if (message.color !== "") {
|
9876
|
+
writer.uint32(34).string(message.color);
|
9877
|
+
}
|
9832
9878
|
if (message.disabled !== false) {
|
9833
9879
|
writer.uint32(72).bool(message.disabled);
|
9834
9880
|
}
|
@@ -9863,6 +9909,13 @@ export const PriceSegmentationQuery = {
|
|
9863
9909
|
|
9864
9910
|
message.coinId.push(CoinID.decode(reader, reader.uint32()));
|
9865
9911
|
continue;
|
9912
|
+
case 4:
|
9913
|
+
if (tag !== 34) {
|
9914
|
+
break;
|
9915
|
+
}
|
9916
|
+
|
9917
|
+
message.color = reader.string();
|
9918
|
+
continue;
|
9866
9919
|
case 9:
|
9867
9920
|
if (tag !== 72) {
|
9868
9921
|
break;
|
@@ -9884,6 +9937,7 @@ export const PriceSegmentationQuery = {
|
|
9884
9937
|
id: isSet(object.id) ? globalThis.String(object.id) : "",
|
9885
9938
|
alias: isSet(object.alias) ? globalThis.String(object.alias) : "",
|
9886
9939
|
coinId: globalThis.Array.isArray(object?.coinId) ? object.coinId.map((e: any) => CoinID.fromJSON(e)) : [],
|
9940
|
+
color: isSet(object.color) ? globalThis.String(object.color) : "",
|
9887
9941
|
disabled: isSet(object.disabled) ? globalThis.Boolean(object.disabled) : false,
|
9888
9942
|
};
|
9889
9943
|
},
|
@@ -9899,6 +9953,9 @@ export const PriceSegmentationQuery = {
|
|
9899
9953
|
if (message.coinId?.length) {
|
9900
9954
|
obj.coinId = message.coinId.map((e) => CoinID.toJSON(e));
|
9901
9955
|
}
|
9956
|
+
if (message.color !== "") {
|
9957
|
+
obj.color = message.color;
|
9958
|
+
}
|
9902
9959
|
if (message.disabled !== false) {
|
9903
9960
|
obj.disabled = message.disabled;
|
9904
9961
|
}
|
@@ -9913,6 +9970,7 @@ export const PriceSegmentationQuery = {
|
|
9913
9970
|
message.id = object.id ?? "";
|
9914
9971
|
message.alias = object.alias ?? "";
|
9915
9972
|
message.coinId = object.coinId?.map((e) => CoinID.fromPartial(e)) || [];
|
9973
|
+
message.color = object.color ?? "";
|
9916
9974
|
message.disabled = object.disabled ?? false;
|
9917
9975
|
return message;
|
9918
9976
|
},
|
package/src/metrics.ts
CHANGED
@@ -172,11 +172,10 @@ export const processMetrics = {
|
|
172
172
|
processor_rpc_duration: new H('processor_rpc_duration'),
|
173
173
|
processor_rpc_queue_duration: new H('processor_rpc_queue_duration'),
|
174
174
|
processor_template_instance_count: new C('process_template_instance_count'),
|
175
|
-
processor_worker_run_time: new
|
176
|
-
processor_worker_wait_time: new
|
177
|
-
processor_worker_utilization: new G('processor_worker_utilization'),
|
175
|
+
processor_worker_run_time: new C('processor_worker_run_time'),
|
176
|
+
processor_worker_wait_time: new C('processor_worker_wait_time'),
|
178
177
|
processor_worker_queue_size: new G('processor_worker_queue_size'),
|
179
|
-
processor_worker_completed: new
|
178
|
+
processor_worker_completed: new C('processor_worker_completed'),
|
180
179
|
stats() {
|
181
180
|
return {
|
182
181
|
process_binding_count: this.process_binding_count.get(),
|
@@ -194,7 +193,6 @@ export const processMetrics = {
|
|
194
193
|
processor_template_instance_count: this.processor_template_instance_count.get(),
|
195
194
|
processor_worker_run_time: this.processor_worker_run_time.get(),
|
196
195
|
processor_worker_wait_time: this.processor_worker_wait_time.get(),
|
197
|
-
processor_worker_utilization: this.processor_worker_utilization.get(),
|
198
196
|
processor_worker_queue_size: this.processor_worker_queue_size.get(),
|
199
197
|
processor_worker_completed: this.processor_worker_completed.get()
|
200
198
|
}
|
package/src/processor-runner.ts
CHANGED
@@ -127,6 +127,31 @@ const httpServer = http
|
|
127
127
|
// const metrics = await mergedRegistry.metrics()
|
128
128
|
// res.write(metrics)
|
129
129
|
// break
|
130
|
+
case '/heap': {
|
131
|
+
try {
|
132
|
+
const file = '/tmp/' + Date.now() + '.heapsnapshot'
|
133
|
+
const session = new Session()
|
134
|
+
|
135
|
+
const fd = fs.openSync(file, 'w')
|
136
|
+
session.connect()
|
137
|
+
session.on('HeapProfiler.addHeapSnapshotChunk', (m) => {
|
138
|
+
fs.writeSync(fd, m.params.chunk)
|
139
|
+
})
|
140
|
+
|
141
|
+
await session.post('HeapProfiler.takeHeapSnapshot')
|
142
|
+
session.disconnect()
|
143
|
+
fs.closeSync(fd)
|
144
|
+
// send the file
|
145
|
+
const readStream = fs.createReadStream(file)
|
146
|
+
res.writeHead(200, { 'Content-Type': 'application/json' })
|
147
|
+
readStream.pipe(res)
|
148
|
+
res.end()
|
149
|
+
} catch {
|
150
|
+
res.writeHead(500)
|
151
|
+
res.end()
|
152
|
+
}
|
153
|
+
break
|
154
|
+
}
|
130
155
|
case '/profile': {
|
131
156
|
try {
|
132
157
|
const profileTime = parseInt(queries.get('t') || '1000', 10) || 1000
|
package/src/service.ts
CHANGED
@@ -35,7 +35,7 @@ import { EthChainId } from '@sentio/chain'
|
|
35
35
|
import { Provider } from 'ethers'
|
36
36
|
import { decodeMulticallResult, encodeMulticallData, getMulticallAddress, Multicall3Call } from './multicall.js'
|
37
37
|
|
38
|
-
import {
|
38
|
+
import { processMetrics } from './metrics.js'
|
39
39
|
|
40
40
|
const { process_binding_count, process_binding_time, process_binding_error } = processMetrics
|
41
41
|
|
@@ -454,11 +454,8 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
454
454
|
})
|
455
455
|
.finally(() => {
|
456
456
|
const cost = Date.now() - start
|
457
|
-
console.debug('processBinding', request.processId, ' took', cost, 'ms')
|
458
457
|
process_binding_time.add(cost)
|
459
458
|
contexts.delete(request.processId)
|
460
|
-
console.debug('db stats', JSON.stringify(dbMetrics.stats()))
|
461
|
-
console.debug('provider stats', JSON.stringify(providerMetrics.stats()))
|
462
459
|
})
|
463
460
|
}
|
464
461
|
if (request.dbResult) {
|