@usherlabs/cex-broker 0.2.19 → 0.2.20
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/dist/commands/cli.js +33 -19
- package/dist/index.js +40 -24
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/commands/cli.js
CHANGED
|
@@ -315470,6 +315470,8 @@ async function captureMarketMetadataSnapshot(archiver, broker, input) {
|
|
|
315470
315470
|
}
|
|
315471
315471
|
// src/helpers/broker-execution-archive/writer.ts
|
|
315472
315472
|
var import_api_logs2 = __toESM(require_src7(), 1);
|
|
315473
|
+
import { request as httpRequest2 } from "node:http";
|
|
315474
|
+
import { request as httpsRequest2 } from "node:https";
|
|
315473
315475
|
|
|
315474
315476
|
// src/helpers/market-data-archive/types.ts
|
|
315475
315477
|
var MARKET_ARCHIVE_TABLES = new Set([
|
|
@@ -315698,35 +315700,47 @@ class BrokerExecutionArchiver {
|
|
|
315698
315700
|
log.warn("Broker execution archive OTLP emit failed", { error });
|
|
315699
315701
|
}
|
|
315700
315702
|
}
|
|
315701
|
-
|
|
315703
|
+
postToForwarder(batch) {
|
|
315702
315704
|
if (!this.forwarderUrl || batch.length === 0) {
|
|
315703
|
-
return;
|
|
315705
|
+
return Promise.resolve();
|
|
315704
315706
|
}
|
|
315705
|
-
const
|
|
315706
|
-
|
|
315707
|
+
const body = JSON.stringify({
|
|
315708
|
+
source: "broker_write",
|
|
315709
|
+
deployment_id: this.deploymentId,
|
|
315710
|
+
rows: batch
|
|
315711
|
+
});
|
|
315712
|
+
const url2 = new URL(this.forwarderUrl);
|
|
315713
|
+
const doRequest = url2.protocol === "http:" ? httpRequest2 : httpsRequest2;
|
|
315707
315714
|
const headers = {
|
|
315708
|
-
"content-type": "application/json"
|
|
315715
|
+
"content-type": "application/json",
|
|
315716
|
+
"content-length": Buffer.byteLength(body)
|
|
315709
315717
|
};
|
|
315710
315718
|
if (this.forwarderAuthToken) {
|
|
315711
315719
|
headers.authorization = `Bearer ${this.forwarderAuthToken}`;
|
|
315712
315720
|
}
|
|
315713
|
-
|
|
315714
|
-
const
|
|
315721
|
+
return new Promise((resolve, reject) => {
|
|
315722
|
+
const req = doRequest(url2, {
|
|
315715
315723
|
method: "POST",
|
|
315716
315724
|
headers,
|
|
315717
|
-
|
|
315718
|
-
|
|
315719
|
-
|
|
315720
|
-
|
|
315721
|
-
|
|
315722
|
-
|
|
315725
|
+
timeout: this.forwarderTimeoutMs
|
|
315726
|
+
}, (res) => {
|
|
315727
|
+
res.on("data", () => {});
|
|
315728
|
+
res.on("end", () => {
|
|
315729
|
+
const status = res.statusCode ?? 0;
|
|
315730
|
+
if (status < 200 || status >= 300) {
|
|
315731
|
+
reject(new Error(`Archive forwarder returned ${status} ${res.statusMessage ?? ""}`));
|
|
315732
|
+
return;
|
|
315733
|
+
}
|
|
315734
|
+
resolve();
|
|
315735
|
+
});
|
|
315723
315736
|
});
|
|
315724
|
-
|
|
315725
|
-
|
|
315726
|
-
|
|
315727
|
-
|
|
315728
|
-
|
|
315729
|
-
|
|
315737
|
+
req.on("error", reject);
|
|
315738
|
+
req.on("timeout", () => {
|
|
315739
|
+
req.destroy(new Error("Archive forwarder request timed out"));
|
|
315740
|
+
});
|
|
315741
|
+
req.write(body);
|
|
315742
|
+
req.end();
|
|
315743
|
+
});
|
|
315730
315744
|
}
|
|
315731
315745
|
}
|
|
315732
315746
|
function flattenArchiveAttributes(entry) {
|
package/dist/index.js
CHANGED
|
@@ -274721,6 +274721,10 @@ async function captureMarketMetadataSnapshot(archiver, broker, input) {
|
|
|
274721
274721
|
return;
|
|
274722
274722
|
}
|
|
274723
274723
|
}
|
|
274724
|
+
// src/helpers/broker-execution-archive/writer.ts
|
|
274725
|
+
import { request as httpRequest2 } from "http";
|
|
274726
|
+
import { request as httpsRequest2 } from "https";
|
|
274727
|
+
|
|
274724
274728
|
// node_modules/@opentelemetry/api-logs/build/esm/types/LogRecord.js
|
|
274725
274729
|
var SeverityNumber2;
|
|
274726
274730
|
(function(SeverityNumber3) {
|
|
@@ -275076,35 +275080,47 @@ class BrokerExecutionArchiver {
|
|
|
275076
275080
|
log.warn("Broker execution archive OTLP emit failed", { error });
|
|
275077
275081
|
}
|
|
275078
275082
|
}
|
|
275079
|
-
|
|
275083
|
+
postToForwarder(batch) {
|
|
275080
275084
|
if (!this.forwarderUrl || batch.length === 0) {
|
|
275081
|
-
return;
|
|
275085
|
+
return Promise.resolve();
|
|
275082
275086
|
}
|
|
275083
|
-
const
|
|
275084
|
-
|
|
275087
|
+
const body = JSON.stringify({
|
|
275088
|
+
source: "broker_write",
|
|
275089
|
+
deployment_id: this.deploymentId,
|
|
275090
|
+
rows: batch
|
|
275091
|
+
});
|
|
275092
|
+
const url2 = new URL(this.forwarderUrl);
|
|
275093
|
+
const doRequest = url2.protocol === "http:" ? httpRequest2 : httpsRequest2;
|
|
275085
275094
|
const headers = {
|
|
275086
|
-
"content-type": "application/json"
|
|
275095
|
+
"content-type": "application/json",
|
|
275096
|
+
"content-length": Buffer.byteLength(body)
|
|
275087
275097
|
};
|
|
275088
275098
|
if (this.forwarderAuthToken) {
|
|
275089
275099
|
headers.authorization = `Bearer ${this.forwarderAuthToken}`;
|
|
275090
275100
|
}
|
|
275091
|
-
|
|
275092
|
-
const
|
|
275101
|
+
return new Promise((resolve, reject) => {
|
|
275102
|
+
const req = doRequest(url2, {
|
|
275093
275103
|
method: "POST",
|
|
275094
275104
|
headers,
|
|
275095
|
-
|
|
275096
|
-
|
|
275097
|
-
|
|
275098
|
-
|
|
275099
|
-
|
|
275100
|
-
|
|
275105
|
+
timeout: this.forwarderTimeoutMs
|
|
275106
|
+
}, (res) => {
|
|
275107
|
+
res.on("data", () => {});
|
|
275108
|
+
res.on("end", () => {
|
|
275109
|
+
const status = res.statusCode ?? 0;
|
|
275110
|
+
if (status < 200 || status >= 300) {
|
|
275111
|
+
reject(new Error(`Archive forwarder returned ${status} ${res.statusMessage ?? ""}`));
|
|
275112
|
+
return;
|
|
275113
|
+
}
|
|
275114
|
+
resolve();
|
|
275115
|
+
});
|
|
275101
275116
|
});
|
|
275102
|
-
|
|
275103
|
-
|
|
275104
|
-
|
|
275105
|
-
|
|
275106
|
-
|
|
275107
|
-
|
|
275117
|
+
req.on("error", reject);
|
|
275118
|
+
req.on("timeout", () => {
|
|
275119
|
+
req.destroy(new Error("Archive forwarder request timed out"));
|
|
275120
|
+
});
|
|
275121
|
+
req.write(body);
|
|
275122
|
+
req.end();
|
|
275123
|
+
});
|
|
275108
275124
|
}
|
|
275109
275125
|
}
|
|
275110
275126
|
function flattenArchiveAttributes(entry) {
|
|
@@ -278110,11 +278126,11 @@ var JsonMetricsSerializer = {
|
|
|
278110
278126
|
}
|
|
278111
278127
|
};
|
|
278112
278128
|
// node_modules/@opentelemetry/exporter-logs-otlp-http/build/esm/platform/node/OTLPLogExporter.js
|
|
278113
|
-
var
|
|
278129
|
+
var import_node_http3 = __toESM(require_index_node_http(), 1);
|
|
278114
278130
|
|
|
278115
278131
|
class OTLPLogExporter extends import_otlp_exporter_base.OTLPExporterBase {
|
|
278116
278132
|
constructor(config = {}) {
|
|
278117
|
-
super(
|
|
278133
|
+
super(import_node_http3.createOtlpHttpExportDelegate(import_node_http3.convertLegacyHttpOptions(config, "LOGS", "v1/logs", {
|
|
278118
278134
|
"Content-Type": "application/json"
|
|
278119
278135
|
}), JsonLogsSerializer));
|
|
278120
278136
|
}
|
|
@@ -278209,11 +278225,11 @@ class OTLPMetricExporterBase extends import_otlp_exporter_base2.OTLPExporterBase
|
|
|
278209
278225
|
}
|
|
278210
278226
|
|
|
278211
278227
|
// node_modules/@opentelemetry/exporter-metrics-otlp-http/build/esm/platform/node/OTLPMetricExporter.js
|
|
278212
|
-
var
|
|
278228
|
+
var import_node_http4 = __toESM(require_index_node_http(), 1);
|
|
278213
278229
|
|
|
278214
278230
|
class OTLPMetricExporter extends OTLPMetricExporterBase {
|
|
278215
278231
|
constructor(config) {
|
|
278216
|
-
super(
|
|
278232
|
+
super(import_node_http4.createOtlpHttpExportDelegate(import_node_http4.convertLegacyHttpOptions(config ?? {}, "METRICS", "v1/metrics", {
|
|
278217
278233
|
"Content-Type": "application/json"
|
|
278218
278234
|
}), JsonMetricsSerializer), config);
|
|
278219
278235
|
}
|
|
@@ -296390,4 +296406,4 @@ export {
|
|
|
296390
296406
|
CEXBroker as default
|
|
296391
296407
|
};
|
|
296392
296408
|
|
|
296393
|
-
//# debugId=
|
|
296409
|
+
//# debugId=2BAA8D1C40735DFB64756E2164756E21
|