@sentio/runtime 2.40.0-rc.20 → 2.40.0-rc.22
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-WN27EZMT.js → chunk-PDNEVCRT.js} +237 -135
- package/lib/index.js +1 -1
- package/lib/processor-runner.js +8 -2
- package/package.json +1 -1
- package/src/db-context.ts +15 -36
- package/src/metrics.ts +138 -0
- package/src/processor-runner.ts +8 -1
- package/src/provider.ts +2 -9
- package/src/service.ts +4 -6
@@ -24074,6 +24074,62 @@ var require_lib3 = __commonJS({
|
|
24074
24074
|
}
|
24075
24075
|
});
|
24076
24076
|
|
24077
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag/types.js
|
24078
|
+
var DiagLogLevel;
|
24079
|
+
var init_types = __esm({
|
24080
|
+
"../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag/types.js"() {
|
24081
|
+
(function(DiagLogLevel2) {
|
24082
|
+
DiagLogLevel2[DiagLogLevel2["NONE"] = 0] = "NONE";
|
24083
|
+
DiagLogLevel2[DiagLogLevel2["ERROR"] = 30] = "ERROR";
|
24084
|
+
DiagLogLevel2[DiagLogLevel2["WARN"] = 50] = "WARN";
|
24085
|
+
DiagLogLevel2[DiagLogLevel2["INFO"] = 60] = "INFO";
|
24086
|
+
DiagLogLevel2[DiagLogLevel2["DEBUG"] = 70] = "DEBUG";
|
24087
|
+
DiagLogLevel2[DiagLogLevel2["VERBOSE"] = 80] = "VERBOSE";
|
24088
|
+
DiagLogLevel2[DiagLogLevel2["ALL"] = 9999] = "ALL";
|
24089
|
+
})(DiagLogLevel || (DiagLogLevel = {}));
|
24090
|
+
}
|
24091
|
+
});
|
24092
|
+
|
24093
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag/consoleLogger.js
|
24094
|
+
var consoleMap, DiagConsoleLogger;
|
24095
|
+
var init_consoleLogger = __esm({
|
24096
|
+
"../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag/consoleLogger.js"() {
|
24097
|
+
consoleMap = [
|
24098
|
+
{ n: "error", c: "error" },
|
24099
|
+
{ n: "warn", c: "warn" },
|
24100
|
+
{ n: "info", c: "info" },
|
24101
|
+
{ n: "debug", c: "debug" },
|
24102
|
+
{ n: "verbose", c: "trace" }
|
24103
|
+
];
|
24104
|
+
DiagConsoleLogger = /** @class */
|
24105
|
+
function() {
|
24106
|
+
function DiagConsoleLogger2() {
|
24107
|
+
function _consoleFunc(funcName) {
|
24108
|
+
return function() {
|
24109
|
+
var args = [];
|
24110
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
24111
|
+
args[_i] = arguments[_i];
|
24112
|
+
}
|
24113
|
+
if (console) {
|
24114
|
+
var theFunc = console[funcName];
|
24115
|
+
if (typeof theFunc !== "function") {
|
24116
|
+
theFunc = console.log;
|
24117
|
+
}
|
24118
|
+
if (typeof theFunc === "function") {
|
24119
|
+
return theFunc.apply(console, args);
|
24120
|
+
}
|
24121
|
+
}
|
24122
|
+
};
|
24123
|
+
}
|
24124
|
+
for (var i = 0; i < consoleMap.length; i++) {
|
24125
|
+
this[consoleMap[i].n] = _consoleFunc(consoleMap[i].c);
|
24126
|
+
}
|
24127
|
+
}
|
24128
|
+
return DiagConsoleLogger2;
|
24129
|
+
}();
|
24130
|
+
}
|
24131
|
+
});
|
24132
|
+
|
24077
24133
|
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/platform/node/globalThis.js
|
24078
24134
|
var _globalThis;
|
24079
24135
|
var init_globalThis = __esm({
|
@@ -24317,22 +24373,6 @@ var init_ComponentLogger = __esm({
|
|
24317
24373
|
}
|
24318
24374
|
});
|
24319
24375
|
|
24320
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag/types.js
|
24321
|
-
var DiagLogLevel;
|
24322
|
-
var init_types = __esm({
|
24323
|
-
"../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag/types.js"() {
|
24324
|
-
(function(DiagLogLevel2) {
|
24325
|
-
DiagLogLevel2[DiagLogLevel2["NONE"] = 0] = "NONE";
|
24326
|
-
DiagLogLevel2[DiagLogLevel2["ERROR"] = 30] = "ERROR";
|
24327
|
-
DiagLogLevel2[DiagLogLevel2["WARN"] = 50] = "WARN";
|
24328
|
-
DiagLogLevel2[DiagLogLevel2["INFO"] = 60] = "INFO";
|
24329
|
-
DiagLogLevel2[DiagLogLevel2["DEBUG"] = 70] = "DEBUG";
|
24330
|
-
DiagLogLevel2[DiagLogLevel2["VERBOSE"] = 80] = "VERBOSE";
|
24331
|
-
DiagLogLevel2[DiagLogLevel2["ALL"] = 9999] = "ALL";
|
24332
|
-
})(DiagLogLevel || (DiagLogLevel = {}));
|
24333
|
-
}
|
24334
|
-
});
|
24335
|
-
|
24336
24376
|
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js
|
24337
24377
|
function createLogLevelDiagLogger(maxLevel, logger) {
|
24338
24378
|
if (maxLevel < DiagLogLevel.NONE) {
|
@@ -24468,6 +24508,15 @@ var init_diag = __esm({
|
|
24468
24508
|
}
|
24469
24509
|
});
|
24470
24510
|
|
24511
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag-api.js
|
24512
|
+
var diag;
|
24513
|
+
var init_diag_api = __esm({
|
24514
|
+
"../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag-api.js"() {
|
24515
|
+
init_diag();
|
24516
|
+
diag = DiagAPI.instance();
|
24517
|
+
}
|
24518
|
+
});
|
24519
|
+
|
24471
24520
|
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.js
|
24472
24521
|
var __read3, __values, BaggageImpl;
|
24473
24522
|
var init_baggage_impl = __esm({
|
@@ -24585,7 +24634,7 @@ function createBaggage(entries) {
|
|
24585
24634
|
}
|
24586
24635
|
function baggageEntryMetadataFromString(str) {
|
24587
24636
|
if (typeof str !== "string") {
|
24588
|
-
|
24637
|
+
diag2.error("Cannot create baggage metadata from unknown type: " + typeof str);
|
24589
24638
|
str = "";
|
24590
24639
|
}
|
24591
24640
|
return {
|
@@ -24595,13 +24644,13 @@ function baggageEntryMetadataFromString(str) {
|
|
24595
24644
|
}
|
24596
24645
|
};
|
24597
24646
|
}
|
24598
|
-
var
|
24647
|
+
var diag2;
|
24599
24648
|
var init_utils = __esm({
|
24600
24649
|
"../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/baggage/utils.js"() {
|
24601
24650
|
init_diag();
|
24602
24651
|
init_baggage_impl();
|
24603
24652
|
init_symbol();
|
24604
|
-
|
24653
|
+
diag2 = DiagAPI.instance();
|
24605
24654
|
}
|
24606
24655
|
});
|
24607
24656
|
|
@@ -24637,46 +24686,6 @@ var init_context = __esm({
|
|
24637
24686
|
}
|
24638
24687
|
});
|
24639
24688
|
|
24640
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag/consoleLogger.js
|
24641
|
-
var consoleMap, DiagConsoleLogger;
|
24642
|
-
var init_consoleLogger = __esm({
|
24643
|
-
"../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag/consoleLogger.js"() {
|
24644
|
-
consoleMap = [
|
24645
|
-
{ n: "error", c: "error" },
|
24646
|
-
{ n: "warn", c: "warn" },
|
24647
|
-
{ n: "info", c: "info" },
|
24648
|
-
{ n: "debug", c: "debug" },
|
24649
|
-
{ n: "verbose", c: "trace" }
|
24650
|
-
];
|
24651
|
-
DiagConsoleLogger = /** @class */
|
24652
|
-
function() {
|
24653
|
-
function DiagConsoleLogger2() {
|
24654
|
-
function _consoleFunc(funcName) {
|
24655
|
-
return function() {
|
24656
|
-
var args = [];
|
24657
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
24658
|
-
args[_i] = arguments[_i];
|
24659
|
-
}
|
24660
|
-
if (console) {
|
24661
|
-
var theFunc = console[funcName];
|
24662
|
-
if (typeof theFunc !== "function") {
|
24663
|
-
theFunc = console.log;
|
24664
|
-
}
|
24665
|
-
if (typeof theFunc === "function") {
|
24666
|
-
return theFunc.apply(console, args);
|
24667
|
-
}
|
24668
|
-
}
|
24669
|
-
};
|
24670
|
-
}
|
24671
|
-
for (var i = 0; i < consoleMap.length; i++) {
|
24672
|
-
this[consoleMap[i].n] = _consoleFunc(consoleMap[i].c);
|
24673
|
-
}
|
24674
|
-
}
|
24675
|
-
return DiagConsoleLogger2;
|
24676
|
-
}();
|
24677
|
-
}
|
24678
|
-
});
|
24679
|
-
|
24680
24689
|
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js
|
24681
24690
|
function createNoopMeter() {
|
24682
24691
|
return NOOP_METER;
|
@@ -25430,15 +25439,6 @@ var init_context_api = __esm({
|
|
25430
25439
|
}
|
25431
25440
|
});
|
25432
25441
|
|
25433
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag-api.js
|
25434
|
-
var diag2;
|
25435
|
-
var init_diag_api = __esm({
|
25436
|
-
"../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag-api.js"() {
|
25437
|
-
init_diag();
|
25438
|
-
diag2 = DiagAPI.instance();
|
25439
|
-
}
|
25440
|
-
});
|
25441
|
-
|
25442
25442
|
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeterProvider.js
|
25443
25443
|
var NoopMeterProvider, NOOP_METER_PROVIDER;
|
25444
25444
|
var init_NoopMeterProvider = __esm({
|
@@ -25693,7 +25693,7 @@ __export(esm_exports2, {
|
|
25693
25693
|
default: () => esm_default,
|
25694
25694
|
defaultTextMapGetter: () => defaultTextMapGetter,
|
25695
25695
|
defaultTextMapSetter: () => defaultTextMapSetter,
|
25696
|
-
diag: () =>
|
25696
|
+
diag: () => diag,
|
25697
25697
|
isSpanContextValid: () => isSpanContextValid,
|
25698
25698
|
isValidSpanId: () => isValidSpanId,
|
25699
25699
|
isValidTraceId: () => isValidTraceId,
|
@@ -25727,7 +25727,7 @@ var init_esm2 = __esm({
|
|
25727
25727
|
init_trace_api();
|
25728
25728
|
esm_default = {
|
25729
25729
|
context,
|
25730
|
-
diag
|
25730
|
+
diag,
|
25731
25731
|
metrics,
|
25732
25732
|
propagation,
|
25733
25733
|
trace
|
@@ -59567,38 +59567,147 @@ function deepFreeze(object2) {
|
|
59567
59567
|
}
|
59568
59568
|
|
59569
59569
|
// src/db-context.ts
|
59570
|
-
init_esm2();
|
59571
59570
|
import * as process2 from "process";
|
59572
|
-
|
59573
|
-
|
59574
|
-
|
59575
|
-
var
|
59576
|
-
|
59577
|
-
|
59578
|
-
|
59579
|
-
|
59571
|
+
|
59572
|
+
// src/metrics.ts
|
59573
|
+
init_esm2();
|
59574
|
+
var meter = metrics.getMeter("processor");
|
59575
|
+
var C = class {
|
59576
|
+
counter;
|
59577
|
+
value = 0;
|
59578
|
+
constructor(name) {
|
59579
|
+
this.counter = meter.createCounter(name);
|
59580
|
+
}
|
59581
|
+
add(value, attributes) {
|
59582
|
+
this.counter.add(value, attributes);
|
59583
|
+
this.value += value;
|
59584
|
+
}
|
59585
|
+
get() {
|
59586
|
+
return this.value;
|
59587
|
+
}
|
59588
|
+
};
|
59589
|
+
var G = class {
|
59590
|
+
gauge;
|
59591
|
+
value = 0;
|
59592
|
+
constructor(name) {
|
59593
|
+
this.gauge = meter.createGauge(name);
|
59594
|
+
}
|
59595
|
+
record(value, attributes) {
|
59596
|
+
this.gauge.record(value, attributes);
|
59597
|
+
this.value = value;
|
59598
|
+
}
|
59599
|
+
get() {
|
59600
|
+
return this.value;
|
59601
|
+
}
|
59580
59602
|
};
|
59581
|
-
var
|
59582
|
-
|
59583
|
-
|
59584
|
-
|
59585
|
-
|
59603
|
+
var dbMetrics = {
|
59604
|
+
send_counts: {
|
59605
|
+
get: new C("store_get_count"),
|
59606
|
+
upsert: new C("store_upsert_count"),
|
59607
|
+
list: new C("store_list_count"),
|
59608
|
+
delete: new C("store_delete_count")
|
59609
|
+
},
|
59610
|
+
recv_counts: {
|
59611
|
+
get: new C("store_get_count"),
|
59612
|
+
upsert: new C("store_upsert_count"),
|
59613
|
+
list: new C("store_list_count"),
|
59614
|
+
delete: new C("store_delete_count")
|
59615
|
+
},
|
59616
|
+
request_times: {
|
59617
|
+
get: new C("store_get_time"),
|
59618
|
+
upsert: new C("store_upsert_time"),
|
59619
|
+
list: new C("store_list_time"),
|
59620
|
+
delete: new C("store_delete_time")
|
59621
|
+
},
|
59622
|
+
request_errors: {
|
59623
|
+
get: new C("store_get_error"),
|
59624
|
+
upsert: new C("store_upsert_error"),
|
59625
|
+
list: new C("store_list_error"),
|
59626
|
+
delete: new C("store_delete_error")
|
59627
|
+
},
|
59628
|
+
batched_total_count: new C("batched_total_count"),
|
59629
|
+
batched_request_count: new C("batched_request_count"),
|
59630
|
+
unsolved_requests: new G("store_unsolved_requests"),
|
59631
|
+
stats() {
|
59632
|
+
return {
|
59633
|
+
send_counts: {
|
59634
|
+
get: this.send_counts.get.get(),
|
59635
|
+
upsert: this.send_counts.upsert.get(),
|
59636
|
+
list: this.send_counts.list.get(),
|
59637
|
+
delete: this.send_counts.delete.get()
|
59638
|
+
},
|
59639
|
+
recv_counts: {
|
59640
|
+
get: this.recv_counts.get.get(),
|
59641
|
+
upsert: this.recv_counts.upsert.get(),
|
59642
|
+
list: this.recv_counts.list.get(),
|
59643
|
+
delete: this.recv_counts.delete.get()
|
59644
|
+
},
|
59645
|
+
request_times: {
|
59646
|
+
get: this.request_times.get.get(),
|
59647
|
+
upsert: this.request_times.upsert.get(),
|
59648
|
+
list: this.request_times.list.get(),
|
59649
|
+
delete: this.request_times.delete.get()
|
59650
|
+
},
|
59651
|
+
request_errors: {
|
59652
|
+
get: this.request_errors.get.get(),
|
59653
|
+
upsert: this.request_errors.upsert.get(),
|
59654
|
+
list: this.request_errors.list.get(),
|
59655
|
+
delete: this.request_errors.delete.get()
|
59656
|
+
},
|
59657
|
+
batched_total_count: this.batched_total_count.get(),
|
59658
|
+
batched_request_count: this.batched_request_count.get(),
|
59659
|
+
unsolved_requests: this.unsolved_requests.get(),
|
59660
|
+
average_request_time: {
|
59661
|
+
get: this.request_times.get.get() / this.send_counts.get.get(),
|
59662
|
+
upsert: this.request_times.upsert.get() / this.send_counts.upsert.get(),
|
59663
|
+
list: this.request_times.list.get() / this.send_counts.list.get()
|
59664
|
+
}
|
59665
|
+
};
|
59666
|
+
}
|
59586
59667
|
};
|
59587
|
-
var
|
59588
|
-
|
59589
|
-
|
59590
|
-
|
59591
|
-
|
59668
|
+
var providerMetrics = {
|
59669
|
+
hit_count: new C("provider_hit_count"),
|
59670
|
+
miss_count: new C("provider_miss_count"),
|
59671
|
+
queue_size: new G("provider_queue_size"),
|
59672
|
+
total_duration: new C("provider_total_duration"),
|
59673
|
+
total_queued: new C("provider_total_queued"),
|
59674
|
+
stats() {
|
59675
|
+
return {
|
59676
|
+
hit_count: this.hit_count.get(),
|
59677
|
+
miss_count: this.miss_count.get(),
|
59678
|
+
queue_size: this.queue_size.get(),
|
59679
|
+
total_duration: this.total_duration.get(),
|
59680
|
+
total_queued: this.total_queued.get(),
|
59681
|
+
average_queue_time: this.total_queued.get() / (this.hit_count.get() + this.miss_count.get()),
|
59682
|
+
average_duration: this.total_duration.get() / (this.hit_count.get() + this.miss_count.get())
|
59683
|
+
};
|
59684
|
+
}
|
59592
59685
|
};
|
59593
|
-
var
|
59594
|
-
|
59595
|
-
|
59596
|
-
|
59597
|
-
|
59686
|
+
var processMetrics = {
|
59687
|
+
process_binding_count: new C("process_binding_count"),
|
59688
|
+
process_binding_time: new C("process_binding_time"),
|
59689
|
+
process_binding_error: new C("process_binding_error"),
|
59690
|
+
stats() {
|
59691
|
+
return {
|
59692
|
+
process_binding_count: this.process_binding_count.get(),
|
59693
|
+
process_binding_time: this.process_binding_time.get(),
|
59694
|
+
process_binding_error: this.process_binding_error.get()
|
59695
|
+
};
|
59696
|
+
}
|
59598
59697
|
};
|
59599
|
-
|
59600
|
-
|
59601
|
-
var
|
59698
|
+
|
59699
|
+
// src/db-context.ts
|
59700
|
+
var {
|
59701
|
+
request_errors,
|
59702
|
+
unsolved_requests,
|
59703
|
+
request_times,
|
59704
|
+
batched_request_count,
|
59705
|
+
batched_total_count,
|
59706
|
+
send_counts,
|
59707
|
+
recv_counts
|
59708
|
+
} = dbMetrics;
|
59709
|
+
var STORE_BATCH_IDLE = process2.env["STORE_BATCH_MAX_IDLE"] ? parseInt(process2.env["STORE_BATCH_MAX_IDLE"]) : 1;
|
59710
|
+
var STORE_BATCH_SIZE = process2.env["STORE_BATCH_SIZE"] ? parseInt(process2.env["STORE_BATCH_SIZE"]) : 10;
|
59602
59711
|
var timeoutError = Symbol();
|
59603
59712
|
var _StoreContext = class {
|
59604
59713
|
constructor(subject, processId) {
|
@@ -59622,7 +59731,6 @@ var _StoreContext = class {
|
|
59622
59731
|
const promise = this.newPromise(opId, requestType);
|
59623
59732
|
const start = Date.now();
|
59624
59733
|
const promises = [promise];
|
59625
|
-
console.debug("sending db request ", opId, request);
|
59626
59734
|
let timer;
|
59627
59735
|
if (timeoutSecs) {
|
59628
59736
|
const timeoutPromise = new Promise((_r, rej) => timer = setTimeout(rej, timeoutSecs * 1e3, timeoutError));
|
@@ -59637,7 +59745,9 @@ var _StoreContext = class {
|
|
59637
59745
|
});
|
59638
59746
|
send_counts[requestType]?.add(1);
|
59639
59747
|
return Promise.race(promises).then((result) => {
|
59640
|
-
|
59748
|
+
if (timeoutSecs) {
|
59749
|
+
console.debug("db request", requestType, "op", opId, " took", Date.now() - start, "ms");
|
59750
|
+
}
|
59641
59751
|
request_times[requestType]?.add(Date.now() - start);
|
59642
59752
|
return result;
|
59643
59753
|
}).catch((e) => {
|
@@ -59655,7 +59765,6 @@ var _StoreContext = class {
|
|
59655
59765
|
result(dbResult) {
|
59656
59766
|
const opId = dbResult.opId;
|
59657
59767
|
const defer = this.defers.get(opId);
|
59658
|
-
console.debug("received db result ", opId, dbResult);
|
59659
59768
|
if (defer) {
|
59660
59769
|
if (defer.requestType) {
|
59661
59770
|
recv_counts[defer.requestType]?.add(1);
|
@@ -59745,7 +59854,6 @@ var import_nice_grpc_error_details = __toESM(require_lib3(), 1);
|
|
59745
59854
|
var import_Ix_dom_asynciterable = __toESM(require_Ix_dom_asynciterable(), 1);
|
59746
59855
|
var import_Ix_dom_asynciterable_operators = __toESM(require_Ix_dom_asynciterable_operators(), 1);
|
59747
59856
|
var import_rxjs = __toESM(require_cjs(), 1);
|
59748
|
-
init_esm2();
|
59749
59857
|
|
59750
59858
|
// ../../node_modules/.pnpm/@sentio+ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/_version.js
|
59751
59859
|
var version = "6.13.1";
|
@@ -62325,18 +62433,18 @@ var SHA256 = class extends SHA2 {
|
|
62325
62433
|
this.H = IV[7] | 0;
|
62326
62434
|
}
|
62327
62435
|
get() {
|
62328
|
-
const { A, B, C, D, E, F, G, H } = this;
|
62329
|
-
return [A, B,
|
62436
|
+
const { A, B, C: C2, D, E, F, G: G2, H } = this;
|
62437
|
+
return [A, B, C2, D, E, F, G2, H];
|
62330
62438
|
}
|
62331
62439
|
// prettier-ignore
|
62332
|
-
set(A, B,
|
62440
|
+
set(A, B, C2, D, E, F, G2, H) {
|
62333
62441
|
this.A = A | 0;
|
62334
62442
|
this.B = B | 0;
|
62335
|
-
this.C =
|
62443
|
+
this.C = C2 | 0;
|
62336
62444
|
this.D = D | 0;
|
62337
62445
|
this.E = E | 0;
|
62338
62446
|
this.F = F | 0;
|
62339
|
-
this.G =
|
62447
|
+
this.G = G2 | 0;
|
62340
62448
|
this.H = H | 0;
|
62341
62449
|
}
|
62342
62450
|
process(view, offset) {
|
@@ -62349,30 +62457,30 @@ var SHA256 = class extends SHA2 {
|
|
62349
62457
|
const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
|
62350
62458
|
SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
|
62351
62459
|
}
|
62352
|
-
let { A, B, C, D, E, F, G, H } = this;
|
62460
|
+
let { A, B, C: C2, D, E, F, G: G2, H } = this;
|
62353
62461
|
for (let i = 0; i < 64; i++) {
|
62354
62462
|
const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
|
62355
|
-
const T12 = H + sigma1 + Chi(E, F,
|
62463
|
+
const T12 = H + sigma1 + Chi(E, F, G2) + SHA256_K[i] + SHA256_W[i] | 0;
|
62356
62464
|
const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
|
62357
|
-
const T2 = sigma0 + Maj(A, B,
|
62358
|
-
H =
|
62359
|
-
|
62465
|
+
const T2 = sigma0 + Maj(A, B, C2) | 0;
|
62466
|
+
H = G2;
|
62467
|
+
G2 = F;
|
62360
62468
|
F = E;
|
62361
62469
|
E = D + T12 | 0;
|
62362
|
-
D =
|
62363
|
-
|
62470
|
+
D = C2;
|
62471
|
+
C2 = B;
|
62364
62472
|
B = A;
|
62365
62473
|
A = T12 + T2 | 0;
|
62366
62474
|
}
|
62367
62475
|
A = A + this.A | 0;
|
62368
62476
|
B = B + this.B | 0;
|
62369
|
-
|
62477
|
+
C2 = C2 + this.C | 0;
|
62370
62478
|
D = D + this.D | 0;
|
62371
62479
|
E = E + this.E | 0;
|
62372
62480
|
F = F + this.F | 0;
|
62373
|
-
|
62481
|
+
G2 = G2 + this.G | 0;
|
62374
62482
|
H = H + this.H | 0;
|
62375
|
-
this.set(A, B,
|
62483
|
+
this.set(A, B, C2, D, E, F, G2, H);
|
62376
62484
|
}
|
62377
62485
|
roundClean() {
|
62378
62486
|
SHA256_W.fill(0);
|
@@ -63505,8 +63613,8 @@ function weierstrassPoints(opts) {
|
|
63505
63613
|
* @returns non-zero affine point
|
63506
63614
|
*/
|
63507
63615
|
multiplyAndAddUnsafe(Q, a, b2) {
|
63508
|
-
const
|
63509
|
-
const mul = (P, a2) => a2 === _0n5 || a2 === _1n5 || !P.equals(
|
63616
|
+
const G2 = Point2.BASE;
|
63617
|
+
const mul = (P, a2) => a2 === _0n5 || a2 === _1n5 || !P.equals(G2) ? P.multiplyUnsafe(a2) : P.multiply(a2);
|
63510
63618
|
const sum = mul(this, a).add(mul(Q, b2));
|
63511
63619
|
return sum.is0() ? void 0 : sum;
|
63512
63620
|
}
|
@@ -63820,8 +63928,8 @@ function weierstrass(curveDef) {
|
|
63820
63928
|
const defaultVerOpts = { lowS: CURVE.lowS, prehash: false };
|
63821
63929
|
function sign(msgHash, privKey, opts = defaultSigOpts) {
|
63822
63930
|
const { seed, k2sig } = prepSig(msgHash, privKey, opts);
|
63823
|
-
const
|
63824
|
-
const drbg = createHmacDrbg(
|
63931
|
+
const C2 = CURVE;
|
63932
|
+
const drbg = createHmacDrbg(C2.hash.outputLen, C2.nByteLength, C2.hmac);
|
63825
63933
|
return drbg(seed, k2sig);
|
63826
63934
|
}
|
63827
63935
|
Point2.BASE._setWindowSize(8);
|
@@ -66205,7 +66313,7 @@ function init() {
|
|
66205
66313
|
let recs = [];
|
66206
66314
|
for (let cp of V) {
|
66207
66315
|
let gs = GROUPS.filter((g) => group_has_cp(g, cp));
|
66208
|
-
let rec = recs.find(({ G }) => gs.some((g) =>
|
66316
|
+
let rec = recs.find(({ G: G2 }) => gs.some((g) => G2.has(g)));
|
66209
66317
|
if (!rec) {
|
66210
66318
|
rec = { G: /* @__PURE__ */ new Set(), V: [] };
|
66211
66319
|
recs.push(rec);
|
@@ -66214,8 +66322,8 @@ function init() {
|
|
66214
66322
|
set_add_many(rec.G, gs);
|
66215
66323
|
}
|
66216
66324
|
let union = recs.flatMap((x) => Array_from(x.G));
|
66217
|
-
for (let { G, V: V2 } of recs) {
|
66218
|
-
let complement = new Set(union.filter((g) => !
|
66325
|
+
for (let { G: G2, V: V2 } of recs) {
|
66326
|
+
let complement = new Set(union.filter((g) => !G2.has(g)));
|
66219
66327
|
for (let cp of V2) {
|
66220
66328
|
M.set(cp, complement);
|
66221
66329
|
}
|
@@ -78290,14 +78398,8 @@ var LRUCache = class {
|
|
78290
78398
|
};
|
78291
78399
|
|
78292
78400
|
// src/provider.ts
|
78293
|
-
|
78401
|
+
var { miss_count, hit_count, total_duration, total_queued, queue_size } = providerMetrics;
|
78294
78402
|
var DummyProvider = new JsonRpcProvider("", Network.from(1));
|
78295
|
-
var meter2 = metrics.getMeter("processor_provider");
|
78296
|
-
var hit_count = meter2.createCounter("provider_hit_count");
|
78297
|
-
var miss_count = meter2.createCounter("provider_miss_count");
|
78298
|
-
var queue_size = meter2.createGauge("provider_queue_size");
|
78299
|
-
var total_duration = meter2.createCounter("provider_total_duration");
|
78300
|
-
var total_queued = meter2.createCounter("provider_total_queued");
|
78301
78403
|
var providers = /* @__PURE__ */ new Map();
|
78302
78404
|
function getProvider2(chainId) {
|
78303
78405
|
if (!chainId) {
|
@@ -78414,10 +78516,7 @@ var QueuedStaticJsonRpcProvider = class extends JsonRpcProvider {
|
|
78414
78516
|
};
|
78415
78517
|
|
78416
78518
|
// src/service.ts
|
78417
|
-
var
|
78418
|
-
var process_binding_count = meter3.createCounter("process_binding_count");
|
78419
|
-
var process_binding_time = meter3.createCounter("process_binding_time");
|
78420
|
-
var process_binding_error = meter3.createCounter("process_binding_error");
|
78519
|
+
var { process_binding_count, process_binding_time, process_binding_error } = processMetrics;
|
78421
78520
|
BigInt.prototype.toJSON = function() {
|
78422
78521
|
return this.toString();
|
78423
78522
|
};
|
@@ -78667,6 +78766,8 @@ var ProcessorServiceImpl = class {
|
|
78667
78766
|
console.debug("processBinding", request.processId, " took", cost, "ms");
|
78668
78767
|
process_binding_time.add(cost);
|
78669
78768
|
contexts.delete(request.processId);
|
78769
|
+
console.debug("db stats", JSON.stringify(dbMetrics.stats()));
|
78770
|
+
console.debug("provider stats", JSON.stringify(providerMetrics.stats()));
|
78670
78771
|
});
|
78671
78772
|
}
|
78672
78773
|
if (request.dbResult) {
|
@@ -78734,6 +78835,7 @@ export {
|
|
78734
78835
|
DiagLogLevel,
|
78735
78836
|
baggageEntryMetadataFromString,
|
78736
78837
|
createContextKey,
|
78838
|
+
DiagConsoleLogger,
|
78737
78839
|
createNoopMeter,
|
78738
78840
|
ValueType,
|
78739
78841
|
TraceFlags,
|
@@ -78745,7 +78847,7 @@ export {
|
|
78745
78847
|
SpanKind,
|
78746
78848
|
SpanStatusCode,
|
78747
78849
|
context,
|
78748
|
-
|
78850
|
+
diag,
|
78749
78851
|
metrics,
|
78750
78852
|
propagation,
|
78751
78853
|
trace,
|
package/lib/index.js
CHANGED
package/lib/processor-runner.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
2
|
import { createRequire as createRequireShim } from 'module'; const require = createRequireShim(import.meta.url);
|
3
3
|
import {
|
4
|
+
DiagConsoleLogger,
|
4
5
|
DiagLogLevel,
|
5
6
|
Endpoints,
|
6
7
|
ExecutionConfig,
|
@@ -40,7 +41,7 @@ import {
|
|
40
41
|
require_minimal,
|
41
42
|
require_src,
|
42
43
|
trace
|
43
|
-
} from "./chunk-
|
44
|
+
} from "./chunk-PDNEVCRT.js";
|
44
45
|
|
45
46
|
// ../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js
|
46
47
|
var require_universalify = __commonJS({
|
@@ -51346,6 +51347,7 @@ var import_sdk_node = __toESM(require_src7(), 1);
|
|
51346
51347
|
var import_exporter_metrics_otlp_grpc = __toESM(require_src8(), 1);
|
51347
51348
|
var import_exporter_trace_otlp_grpc = __toESM(require_src6(), 1);
|
51348
51349
|
init_esm7();
|
51350
|
+
init_esm();
|
51349
51351
|
var sdk = new import_sdk_node.NodeSDK({
|
51350
51352
|
traceExporter: new import_exporter_trace_otlp_grpc.OTLPTraceExporter(),
|
51351
51353
|
metricReader: new PeriodicExportingMetricReader({
|
@@ -51373,8 +51375,12 @@ var optionDefinitions = [
|
|
51373
51375
|
{ name: "debug", type: Boolean, defaultValue: false }
|
51374
51376
|
];
|
51375
51377
|
var options = (0, import_command_line_args.default)(optionDefinitions, { partial: true });
|
51376
|
-
|
51378
|
+
var logLevel = process.env["LOG_LEVEL"]?.toUpperCase();
|
51379
|
+
setupLogger(options["log-format"] === "json", logLevel === "debug" ? true : options.debug);
|
51377
51380
|
console.debug("Starting with", options.target);
|
51381
|
+
if (options.debug) {
|
51382
|
+
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG);
|
51383
|
+
}
|
51378
51384
|
Error.stackTraceLimit = 20;
|
51379
51385
|
var fullPath = path4.resolve(options["chains-config"]);
|
51380
51386
|
var chainsConfig = import_fs_extra2.default.readJsonSync(fullPath);
|
package/package.json
CHANGED
package/src/db-context.ts
CHANGED
@@ -8,45 +8,22 @@ import {
|
|
8
8
|
ProcessStreamResponse
|
9
9
|
} from '@sentio/protos'
|
10
10
|
import * as process from 'node:process'
|
11
|
-
import {
|
12
|
-
|
11
|
+
import { dbMetrics } from './metrics.js'
|
12
|
+
const {
|
13
|
+
request_errors,
|
14
|
+
unsolved_requests,
|
15
|
+
request_times,
|
16
|
+
batched_request_count,
|
17
|
+
batched_total_count,
|
18
|
+
send_counts,
|
19
|
+
recv_counts
|
20
|
+
} = dbMetrics
|
13
21
|
const STORE_BATCH_IDLE = process.env['STORE_BATCH_MAX_IDLE'] ? parseInt(process.env['STORE_BATCH_MAX_IDLE']) : 1
|
14
22
|
const STORE_BATCH_SIZE = process.env['STORE_BATCH_SIZE'] ? parseInt(process.env['STORE_BATCH_SIZE']) : 10
|
15
23
|
|
16
24
|
type Request = Omit<DBRequest, 'opId'>
|
17
25
|
type RequestType = keyof Request
|
18
26
|
|
19
|
-
const meter = metrics.getMeter('processor_store')
|
20
|
-
const send_counts: Record<RequestType, Counter<Attributes>> = {
|
21
|
-
get: meter.createCounter('store_get_count'),
|
22
|
-
upsert: meter.createCounter('store_upsert_count'),
|
23
|
-
list: meter.createCounter('store_list_count'),
|
24
|
-
delete: meter.createCounter('store_delete_count')
|
25
|
-
}
|
26
|
-
const recv_counts: Record<RequestType, Counter<Attributes>> = {
|
27
|
-
get: meter.createCounter('store_get_count'),
|
28
|
-
upsert: meter.createCounter('store_upsert_count'),
|
29
|
-
list: meter.createCounter('store_list_count'),
|
30
|
-
delete: meter.createCounter('store_delete_count')
|
31
|
-
}
|
32
|
-
const request_times: Record<RequestType, Counter<Attributes>> = {
|
33
|
-
get: meter.createCounter('store_get_time'),
|
34
|
-
upsert: meter.createCounter('store_upsert_time'),
|
35
|
-
list: meter.createCounter('store_list_time'),
|
36
|
-
delete: meter.createCounter('store_delete_time')
|
37
|
-
}
|
38
|
-
const request_errors: Record<RequestType, Counter<Attributes>> = {
|
39
|
-
get: meter.createCounter('store_get_error'),
|
40
|
-
upsert: meter.createCounter('store_upsert_error'),
|
41
|
-
list: meter.createCounter('store_list_error'),
|
42
|
-
delete: meter.createCounter('store_delete_error')
|
43
|
-
}
|
44
|
-
|
45
|
-
const batched_total_count = meter.createCounter('batched_total_count')
|
46
|
-
const batched_request_count = meter.createCounter('batched_request_count')
|
47
|
-
|
48
|
-
const unsolved_requests = meter.createGauge('store_unsolved_requests')
|
49
|
-
|
50
27
|
export const timeoutError = Symbol()
|
51
28
|
|
52
29
|
export class StoreContext {
|
@@ -82,7 +59,7 @@ export class StoreContext {
|
|
82
59
|
|
83
60
|
const start = Date.now()
|
84
61
|
const promises = [promise]
|
85
|
-
console.debug('sending db request ', opId, request)
|
62
|
+
// console.debug('sending db request ', opId, request)
|
86
63
|
let timer: NodeJS.Timeout | undefined
|
87
64
|
if (timeoutSecs) {
|
88
65
|
const timeoutPromise = new Promise((_r, rej) => (timer = setTimeout(rej, timeoutSecs * 1000, timeoutError)))
|
@@ -101,7 +78,9 @@ export class StoreContext {
|
|
101
78
|
|
102
79
|
return Promise.race(promises)
|
103
80
|
.then((result: DBResponse) => {
|
104
|
-
|
81
|
+
if (timeoutSecs) {
|
82
|
+
console.debug('db request', requestType, 'op', opId, ' took', Date.now() - start, 'ms')
|
83
|
+
}
|
105
84
|
request_times[requestType]?.add(Date.now() - start)
|
106
85
|
return result
|
107
86
|
})
|
@@ -122,7 +101,7 @@ export class StoreContext {
|
|
122
101
|
result(dbResult: DBResponse) {
|
123
102
|
const opId = dbResult.opId
|
124
103
|
const defer = this.defers.get(opId)
|
125
|
-
console.debug('received db result ', opId, dbResult)
|
104
|
+
// console.debug('received db result ', opId, dbResult)
|
126
105
|
if (defer) {
|
127
106
|
if (defer.requestType) {
|
128
107
|
recv_counts[defer.requestType]?.add(1)
|
package/src/metrics.ts
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
import { Attributes, Counter, metrics, Gauge } from '@opentelemetry/api'
|
2
|
+
|
3
|
+
const meter = metrics.getMeter('processor')
|
4
|
+
|
5
|
+
class C {
|
6
|
+
private counter: Counter<Attributes>
|
7
|
+
private value: number = 0
|
8
|
+
|
9
|
+
constructor(name: string) {
|
10
|
+
this.counter = meter.createCounter(name)
|
11
|
+
}
|
12
|
+
|
13
|
+
add(value: number, attributes?: Attributes) {
|
14
|
+
this.counter.add(value, attributes)
|
15
|
+
this.value += value
|
16
|
+
}
|
17
|
+
|
18
|
+
get() {
|
19
|
+
return this.value
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
class G {
|
24
|
+
private gauge: Gauge<Attributes>
|
25
|
+
private value: number = 0
|
26
|
+
|
27
|
+
constructor(name: string) {
|
28
|
+
this.gauge = meter.createGauge(name)
|
29
|
+
}
|
30
|
+
|
31
|
+
record(value: number, attributes?: Attributes) {
|
32
|
+
this.gauge.record(value, attributes)
|
33
|
+
this.value = value
|
34
|
+
}
|
35
|
+
|
36
|
+
get() {
|
37
|
+
return this.value
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
export const dbMetrics = {
|
42
|
+
send_counts: {
|
43
|
+
get: new C('store_get_count'),
|
44
|
+
upsert: new C('store_upsert_count'),
|
45
|
+
list: new C('store_list_count'),
|
46
|
+
delete: new C('store_delete_count')
|
47
|
+
},
|
48
|
+
recv_counts: {
|
49
|
+
get: new C('store_get_count'),
|
50
|
+
upsert: new C('store_upsert_count'),
|
51
|
+
list: new C('store_list_count'),
|
52
|
+
delete: new C('store_delete_count')
|
53
|
+
},
|
54
|
+
request_times: {
|
55
|
+
get: new C('store_get_time'),
|
56
|
+
upsert: new C('store_upsert_time'),
|
57
|
+
list: new C('store_list_time'),
|
58
|
+
delete: new C('store_delete_time')
|
59
|
+
},
|
60
|
+
request_errors: {
|
61
|
+
get: new C('store_get_error'),
|
62
|
+
upsert: new C('store_upsert_error'),
|
63
|
+
list: new C('store_list_error'),
|
64
|
+
delete: new C('store_delete_error')
|
65
|
+
},
|
66
|
+
batched_total_count: new C('batched_total_count'),
|
67
|
+
batched_request_count: new C('batched_request_count'),
|
68
|
+
unsolved_requests: new G('store_unsolved_requests'),
|
69
|
+
|
70
|
+
stats() {
|
71
|
+
return {
|
72
|
+
send_counts: {
|
73
|
+
get: this.send_counts.get.get(),
|
74
|
+
upsert: this.send_counts.upsert.get(),
|
75
|
+
list: this.send_counts.list.get(),
|
76
|
+
delete: this.send_counts.delete.get()
|
77
|
+
},
|
78
|
+
recv_counts: {
|
79
|
+
get: this.recv_counts.get.get(),
|
80
|
+
upsert: this.recv_counts.upsert.get(),
|
81
|
+
list: this.recv_counts.list.get(),
|
82
|
+
delete: this.recv_counts.delete.get()
|
83
|
+
},
|
84
|
+
request_times: {
|
85
|
+
get: this.request_times.get.get(),
|
86
|
+
upsert: this.request_times.upsert.get(),
|
87
|
+
list: this.request_times.list.get(),
|
88
|
+
delete: this.request_times.delete.get()
|
89
|
+
},
|
90
|
+
request_errors: {
|
91
|
+
get: this.request_errors.get.get(),
|
92
|
+
upsert: this.request_errors.upsert.get(),
|
93
|
+
list: this.request_errors.list.get(),
|
94
|
+
delete: this.request_errors.delete.get()
|
95
|
+
},
|
96
|
+
batched_total_count: this.batched_total_count.get(),
|
97
|
+
batched_request_count: this.batched_request_count.get(),
|
98
|
+
unsolved_requests: this.unsolved_requests.get(),
|
99
|
+
average_request_time: {
|
100
|
+
get: this.request_times.get.get() / this.send_counts.get.get(),
|
101
|
+
upsert: this.request_times.upsert.get() / this.send_counts.upsert.get(),
|
102
|
+
list: this.request_times.list.get() / this.send_counts.list.get()
|
103
|
+
}
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
export const providerMetrics = {
|
109
|
+
hit_count: new C('provider_hit_count'),
|
110
|
+
miss_count: new C('provider_miss_count'),
|
111
|
+
queue_size: new G('provider_queue_size'),
|
112
|
+
total_duration: new C('provider_total_duration'),
|
113
|
+
total_queued: new C('provider_total_queued'),
|
114
|
+
stats() {
|
115
|
+
return {
|
116
|
+
hit_count: this.hit_count.get(),
|
117
|
+
miss_count: this.miss_count.get(),
|
118
|
+
queue_size: this.queue_size.get(),
|
119
|
+
total_duration: this.total_duration.get(),
|
120
|
+
total_queued: this.total_queued.get(),
|
121
|
+
average_queue_time: this.total_queued.get() / (this.hit_count.get() + this.miss_count.get()),
|
122
|
+
average_duration: this.total_duration.get() / (this.hit_count.get() + this.miss_count.get())
|
123
|
+
}
|
124
|
+
}
|
125
|
+
}
|
126
|
+
|
127
|
+
export const processMetrics = {
|
128
|
+
process_binding_count: new C('process_binding_count'),
|
129
|
+
process_binding_time: new C('process_binding_time'),
|
130
|
+
process_binding_error: new C('process_binding_error'),
|
131
|
+
stats() {
|
132
|
+
return {
|
133
|
+
process_binding_count: this.process_binding_count.get(),
|
134
|
+
process_binding_time: this.process_binding_time.get(),
|
135
|
+
process_binding_error: this.process_binding_error.get()
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
package/src/processor-runner.ts
CHANGED
@@ -25,6 +25,7 @@ import { NodeSDK } from '@opentelemetry/sdk-node'
|
|
25
25
|
import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-grpc'
|
26
26
|
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-grpc'
|
27
27
|
import { PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics'
|
28
|
+
import { diag, DiagConsoleLogger, DiagLogLevel } from '@opentelemetry/api'
|
28
29
|
|
29
30
|
const sdk = new NodeSDK({
|
30
31
|
traceExporter: new OTLPTraceExporter(),
|
@@ -58,9 +59,15 @@ const optionDefinitions = [
|
|
58
59
|
|
59
60
|
const options = commandLineArgs(optionDefinitions, { partial: true })
|
60
61
|
|
61
|
-
|
62
|
+
const logLevel = process.env['LOG_LEVEL']?.toUpperCase()
|
63
|
+
|
64
|
+
setupLogger(options['log-format'] === 'json', logLevel === 'debug' ? true : options.debug)
|
62
65
|
console.debug('Starting with', options.target)
|
63
66
|
|
67
|
+
if (options.debug) {
|
68
|
+
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG)
|
69
|
+
}
|
70
|
+
|
64
71
|
Error.stackTraceLimit = 20
|
65
72
|
|
66
73
|
const fullPath = path.resolve(options['chains-config'])
|
package/src/provider.ts
CHANGED
@@ -4,17 +4,10 @@ import PQueue from 'p-queue'
|
|
4
4
|
import { Endpoints } from './endpoints.js'
|
5
5
|
import { EthChainId } from '@sentio/chain'
|
6
6
|
import { LRUCache } from 'lru-cache'
|
7
|
-
import {
|
8
|
-
|
7
|
+
import { providerMetrics } from './metrics.js'
|
8
|
+
const { miss_count, hit_count, total_duration, total_queued, queue_size } = providerMetrics
|
9
9
|
export const DummyProvider = new JsonRpcProvider('', Network.from(1))
|
10
10
|
|
11
|
-
const meter = metrics.getMeter('processor_provider')
|
12
|
-
const hit_count = meter.createCounter('provider_hit_count')
|
13
|
-
const miss_count = meter.createCounter('provider_miss_count')
|
14
|
-
const queue_size = meter.createGauge('provider_queue_size')
|
15
|
-
const total_duration = meter.createCounter('provider_total_duration')
|
16
|
-
const total_queued = meter.createCounter('provider_total_queued')
|
17
|
-
|
18
11
|
const providers = new Map<string, JsonRpcProvider>()
|
19
12
|
|
20
13
|
// export function getEthChainId(networkish?: EthContext | EthChainId): EthChainId {
|
package/src/service.ts
CHANGED
@@ -30,15 +30,11 @@ import { freezeGlobalConfig, GLOBAL_CONFIG } from './global-config.js'
|
|
30
30
|
|
31
31
|
import { StoreContext } from './db-context.js'
|
32
32
|
import { Subject } from 'rxjs'
|
33
|
-
import { metrics } from '@opentelemetry/api'
|
34
33
|
import { getProvider } from './provider.js'
|
35
34
|
import { EthChainId } from '@sentio/chain'
|
36
35
|
import { Provider } from 'ethers'
|
37
|
-
|
38
|
-
const
|
39
|
-
const process_binding_count = meter.createCounter('process_binding_count')
|
40
|
-
const process_binding_time = meter.createCounter('process_binding_time')
|
41
|
-
const process_binding_error = meter.createCounter('process_binding_error')
|
36
|
+
import { processMetrics, providerMetrics, dbMetrics } from './metrics.js'
|
37
|
+
const { process_binding_count, process_binding_time, process_binding_error } = processMetrics
|
42
38
|
|
43
39
|
;(BigInt.prototype as any).toJSON = function () {
|
44
40
|
return this.toString()
|
@@ -383,6 +379,8 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
383
379
|
console.debug('processBinding', request.processId, ' took', cost, 'ms')
|
384
380
|
process_binding_time.add(cost)
|
385
381
|
contexts.delete(request.processId)
|
382
|
+
console.debug('db stats', JSON.stringify(dbMetrics.stats()))
|
383
|
+
console.debug('provider stats', JSON.stringify(providerMetrics.stats()))
|
386
384
|
})
|
387
385
|
}
|
388
386
|
if (request.dbResult) {
|