@malloy-publisher/server 0.0.198-dev2 → 0.0.198-dev4
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/build.ts +22 -12
- package/dist/compile_worker.mjs +633 -0
- package/dist/instrumentation.mjs +36 -57
- package/dist/server.mjs +986 -650
- package/package.json +1 -1
- package/src/compile/compile_pool.spec.ts +292 -0
- package/src/compile/compile_pool.ts +796 -0
- package/src/compile/compile_worker.ts +721 -0
- package/src/compile/protocol.ts +270 -0
- package/src/health.ts +13 -0
- package/src/instrumentation.ts +0 -50
- package/src/server.ts +0 -5
- package/src/service/environment_store.ts +0 -9
- package/src/service/model.ts +226 -3
- package/src/service/model_worker_path.spec.ts +133 -0
- package/src/service/package.spec.ts +7 -11
- package/src/service/package.ts +156 -49
- package/dist/service/schema_worker.mjs +0 -61
- package/src/service/process_stats_reporter.ts +0 -169
- package/src/service/schema_worker.ts +0 -123
- package/src/service/schema_worker_pool.ts +0 -278
- package/tests/integration/concurrent_environment/concurrent_environment.integration.spec.ts +0 -235
package/dist/instrumentation.mjs
CHANGED
|
@@ -43,6 +43,7 @@ var __export = (target, all) => {
|
|
|
43
43
|
set: __exportSetter.bind(all, name)
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
46
47
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
47
48
|
|
|
48
49
|
// ../../node_modules/@opentelemetry/api/build/src/platform/node/globalThis.js
|
|
@@ -115086,40 +115087,7 @@ var require_winston = __commonJS((exports) => {
|
|
|
115086
115087
|
warn.forProperties(exports, "deprecated", ["emitErrs", "levelLength"]);
|
|
115087
115088
|
});
|
|
115088
115089
|
|
|
115089
|
-
// src/instrumentation.ts
|
|
115090
|
-
var import_api = __toESM(require_src(), 1);
|
|
115091
|
-
var import_auto_instrumentations_node = __toESM(require_src59(), 1);
|
|
115092
|
-
var import_exporter_logs_otlp_proto = __toESM(require_src66(), 1);
|
|
115093
|
-
var import_exporter_prometheus = __toESM(require_src71(), 1);
|
|
115094
|
-
var import_exporter_trace_otlp_proto = __toESM(require_src72(), 1);
|
|
115095
|
-
var import_instrumentation_express = __toESM(require_src17(), 1);
|
|
115096
|
-
var import_resources = __toESM(require_src57(), 1);
|
|
115097
|
-
var import_sdk_logs = __toESM(require_src75(), 1);
|
|
115098
|
-
var import_sdk_node = __toESM(require_src106(), 1);
|
|
115099
|
-
var import_sdk_trace_base = __toESM(require_src82(), 1);
|
|
115100
|
-
var import_semantic_conventions = __toESM(require_src2(), 1);
|
|
115101
|
-
import { monitorEventLoopDelay } from "node:perf_hooks";
|
|
115102
|
-
|
|
115103
115090
|
// src/logger.ts
|
|
115104
|
-
var import_winston = __toESM(require_winston(), 1);
|
|
115105
|
-
var isTelemetryEnabled = Boolean(process.env.OTEL_EXPORTER_OTLP_ENDPOINT);
|
|
115106
|
-
var VALID_LOG_LEVELS = ["error", "warn", "info", "verbose", "debug", "silly"];
|
|
115107
|
-
var getLogLevel = () => {
|
|
115108
|
-
if (process.env.LOG_LEVEL) {
|
|
115109
|
-
const logLevel = process.env.LOG_LEVEL.toLowerCase();
|
|
115110
|
-
if (VALID_LOG_LEVELS.includes(logLevel)) {
|
|
115111
|
-
return logLevel;
|
|
115112
|
-
} else {
|
|
115113
|
-
console.error(`Invalid log level: ${process.env.LOG_LEVEL}. Valid log levels are: ${VALID_LOG_LEVELS.join(", ")}. Defaulting to "debug".`);
|
|
115114
|
-
}
|
|
115115
|
-
}
|
|
115116
|
-
return "debug";
|
|
115117
|
-
};
|
|
115118
|
-
var logger = import_winston.default.createLogger({
|
|
115119
|
-
level: getLogLevel(),
|
|
115120
|
-
format: isTelemetryEnabled ? import_winston.default.format.combine(import_winston.default.format.uncolorize(), import_winston.default.format.timestamp(), import_winston.default.format.errors({ stack: true }), import_winston.default.format.json()) : import_winston.default.format.combine(import_winston.default.format.colorize(), import_winston.default.format.simple()),
|
|
115121
|
-
transports: [new import_winston.default.transports.Console]
|
|
115122
|
-
});
|
|
115123
115091
|
function extractTraceIdFromTraceparent(traceparent) {
|
|
115124
115092
|
if (!traceparent) {
|
|
115125
115093
|
return;
|
|
@@ -115131,7 +115099,6 @@ function extractTraceIdFromTraceparent(traceparent) {
|
|
|
115131
115099
|
}
|
|
115132
115100
|
return;
|
|
115133
115101
|
}
|
|
115134
|
-
var DISABLE_RESPONSE_LOGGING = process.env.DISABLE_RESPONSE_LOGGING === "true" || process.env.DISABLE_RESPONSE_LOGGING === "1";
|
|
115135
115102
|
function formatDuration(durationMs) {
|
|
115136
115103
|
if (durationMs >= 1000) {
|
|
115137
115104
|
const seconds = durationMs / 1000;
|
|
@@ -115139,7 +115106,17 @@ function formatDuration(durationMs) {
|
|
|
115139
115106
|
}
|
|
115140
115107
|
return `${durationMs.toFixed(2)}ms`;
|
|
115141
115108
|
}
|
|
115142
|
-
var
|
|
115109
|
+
var import_winston, isTelemetryEnabled, VALID_LOG_LEVELS, getLogLevel = () => {
|
|
115110
|
+
if (process.env.LOG_LEVEL) {
|
|
115111
|
+
const logLevel = process.env.LOG_LEVEL.toLowerCase();
|
|
115112
|
+
if (VALID_LOG_LEVELS.includes(logLevel)) {
|
|
115113
|
+
return logLevel;
|
|
115114
|
+
} else {
|
|
115115
|
+
console.error(`Invalid log level: ${process.env.LOG_LEVEL}. Valid log levels are: ${VALID_LOG_LEVELS.join(", ")}. Defaulting to "debug".`);
|
|
115116
|
+
}
|
|
115117
|
+
}
|
|
115118
|
+
return "debug";
|
|
115119
|
+
}, logger, DISABLE_RESPONSE_LOGGING, loggerMiddleware = (req, res, next) => {
|
|
115143
115120
|
const startTime = performance.now();
|
|
115144
115121
|
const resJson = res.json;
|
|
115145
115122
|
res.json = (body) => {
|
|
@@ -115169,8 +115146,7 @@ var loggerMiddleware = (req, res, next) => {
|
|
|
115169
115146
|
}
|
|
115170
115147
|
});
|
|
115171
115148
|
next();
|
|
115172
|
-
}
|
|
115173
|
-
var logAxiosError = (error) => {
|
|
115149
|
+
}, logAxiosError = (error) => {
|
|
115174
115150
|
if (error.response) {
|
|
115175
115151
|
logger.error("Axios server-side error", {
|
|
115176
115152
|
url: error.response.config.url,
|
|
@@ -115184,8 +115160,31 @@ var logAxiosError = (error) => {
|
|
|
115184
115160
|
logger.error("Axios unknown error", { error });
|
|
115185
115161
|
}
|
|
115186
115162
|
};
|
|
115163
|
+
var init_logger = __esm(() => {
|
|
115164
|
+
import_winston = __toESM(require_winston(), 1);
|
|
115165
|
+
isTelemetryEnabled = Boolean(process.env.OTEL_EXPORTER_OTLP_ENDPOINT);
|
|
115166
|
+
VALID_LOG_LEVELS = ["error", "warn", "info", "verbose", "debug", "silly"];
|
|
115167
|
+
logger = import_winston.default.createLogger({
|
|
115168
|
+
level: getLogLevel(),
|
|
115169
|
+
format: isTelemetryEnabled ? import_winston.default.format.combine(import_winston.default.format.uncolorize(), import_winston.default.format.timestamp(), import_winston.default.format.errors({ stack: true }), import_winston.default.format.json()) : import_winston.default.format.combine(import_winston.default.format.colorize(), import_winston.default.format.simple()),
|
|
115170
|
+
transports: [new import_winston.default.transports.Console]
|
|
115171
|
+
});
|
|
115172
|
+
DISABLE_RESPONSE_LOGGING = process.env.DISABLE_RESPONSE_LOGGING === "true" || process.env.DISABLE_RESPONSE_LOGGING === "1";
|
|
115173
|
+
});
|
|
115187
115174
|
|
|
115188
115175
|
// src/instrumentation.ts
|
|
115176
|
+
init_logger();
|
|
115177
|
+
var import_api = __toESM(require_src(), 1);
|
|
115178
|
+
var import_auto_instrumentations_node = __toESM(require_src59(), 1);
|
|
115179
|
+
var import_exporter_logs_otlp_proto = __toESM(require_src66(), 1);
|
|
115180
|
+
var import_exporter_prometheus = __toESM(require_src71(), 1);
|
|
115181
|
+
var import_exporter_trace_otlp_proto = __toESM(require_src72(), 1);
|
|
115182
|
+
var import_instrumentation_express = __toESM(require_src17(), 1);
|
|
115183
|
+
var import_resources = __toESM(require_src57(), 1);
|
|
115184
|
+
var import_sdk_logs = __toESM(require_src75(), 1);
|
|
115185
|
+
var import_sdk_node = __toESM(require_src106(), 1);
|
|
115186
|
+
var import_sdk_trace_base = __toESM(require_src82(), 1);
|
|
115187
|
+
var import_semantic_conventions = __toESM(require_src2(), 1);
|
|
115189
115188
|
var prometheusExporter = null;
|
|
115190
115189
|
var sdk = null;
|
|
115191
115190
|
function getPrometheusMetricsHandler() {
|
|
@@ -115267,26 +115266,6 @@ var httpRequestDuration = meter.createHistogram("http_server_request_duration_ms
|
|
|
115267
115266
|
var httpRequestCount = meter.createCounter("http_server_requests_total", {
|
|
115268
115267
|
description: "Total number of HTTP requests"
|
|
115269
115268
|
});
|
|
115270
|
-
var eventLoopHistogram = monitorEventLoopDelay({ resolution: 20 });
|
|
115271
|
-
eventLoopHistogram.enable();
|
|
115272
|
-
var eventLoopLagP50 = meter.createObservableGauge("publisher_event_loop_lag_p50_ms", {
|
|
115273
|
-
description: "Event loop delay p50 since the last scrape, in milliseconds",
|
|
115274
|
-
unit: "ms"
|
|
115275
|
-
});
|
|
115276
|
-
var eventLoopLagP99 = meter.createObservableGauge("publisher_event_loop_lag_p99_ms", {
|
|
115277
|
-
description: "Event loop delay p99 since the last scrape, in milliseconds",
|
|
115278
|
-
unit: "ms"
|
|
115279
|
-
});
|
|
115280
|
-
var eventLoopLagMax = meter.createObservableGauge("publisher_event_loop_lag_max_ms", {
|
|
115281
|
-
description: "Event loop delay max since the last scrape, in milliseconds",
|
|
115282
|
-
unit: "ms"
|
|
115283
|
-
});
|
|
115284
|
-
meter.addBatchObservableCallback((observableResult) => {
|
|
115285
|
-
observableResult.observe(eventLoopLagP50, eventLoopHistogram.percentile(50) / 1e6);
|
|
115286
|
-
observableResult.observe(eventLoopLagP99, eventLoopHistogram.percentile(99) / 1e6);
|
|
115287
|
-
observableResult.observe(eventLoopLagMax, eventLoopHistogram.max / 1e6);
|
|
115288
|
-
eventLoopHistogram.reset();
|
|
115289
|
-
}, [eventLoopLagP50, eventLoopLagP99, eventLoopLagMax]);
|
|
115290
115269
|
var IGNORED_PATHS = new Set([
|
|
115291
115270
|
"/health",
|
|
115292
115271
|
"/health/liveness",
|