@dbos-inc/dbos-sdk 0.7.35 → 0.8.14-preview
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/cloud-cli/applications/configure.d.ts +1 -1
- package/dist/src/cloud-cli/applications/configure.d.ts.map +1 -1
- package/dist/src/cloud-cli/applications/configure.js +35 -28
- package/dist/src/cloud-cli/applications/configure.js.map +1 -1
- package/dist/src/cloud-cli/applications/delete-app.js +1 -1
- package/dist/src/cloud-cli/applications/delete-app.js.map +1 -1
- package/dist/src/cloud-cli/applications/deploy-app-code.d.ts.map +1 -1
- package/dist/src/cloud-cli/applications/deploy-app-code.js +10 -2
- package/dist/src/cloud-cli/applications/deploy-app-code.js.map +1 -1
- package/dist/src/cloud-cli/applications/get-app-logs.js +1 -1
- package/dist/src/cloud-cli/applications/get-app-logs.js.map +1 -1
- package/dist/src/cloud-cli/applications/list-apps.js +1 -1
- package/dist/src/cloud-cli/applications/list-apps.js.map +1 -1
- package/dist/src/cloud-cli/applications/register-app.js +1 -1
- package/dist/src/cloud-cli/applications/register-app.js.map +1 -1
- package/dist/src/cloud-cli/applications/update-app.d.ts.map +1 -1
- package/dist/src/cloud-cli/applications/update-app.js +3 -2
- package/dist/src/cloud-cli/applications/update-app.js.map +1 -1
- package/dist/src/cloud-cli/cli.js +6 -6
- package/dist/src/cloud-cli/cli.js.map +1 -1
- package/dist/src/cloud-cli/login.d.ts.map +1 -1
- package/dist/src/cloud-cli/login.js +3 -2
- package/dist/src/cloud-cli/login.js.map +1 -1
- package/dist/src/cloud-cli/register.js +1 -1
- package/dist/src/cloud-cli/register.js.map +1 -1
- package/dist/src/cloud-cli/userdb.d.ts +10 -2
- package/dist/src/cloud-cli/userdb.d.ts.map +1 -1
- package/dist/src/cloud-cli/userdb.js +63 -100
- package/dist/src/cloud-cli/userdb.js.map +1 -1
- package/dist/src/communicator.d.ts +1 -1
- package/dist/src/communicator.d.ts.map +1 -1
- package/dist/src/context.d.ts +1 -1
- package/dist/src/context.d.ts.map +1 -1
- package/dist/src/context.js +1 -1
- package/dist/src/context.js.map +1 -1
- package/dist/src/dbos-executor.d.ts +18 -7
- package/dist/src/dbos-executor.d.ts.map +1 -1
- package/dist/src/dbos-executor.js +155 -52
- package/dist/src/dbos-executor.js.map +1 -1
- package/dist/src/dbos-runtime/cli.d.ts +0 -1
- package/dist/src/dbos-runtime/cli.d.ts.map +1 -1
- package/dist/src/dbos-runtime/cli.js +14 -2
- package/dist/src/dbos-runtime/cli.js.map +1 -1
- package/dist/src/dbos-runtime/config.d.ts +0 -1
- package/dist/src/dbos-runtime/config.d.ts.map +1 -1
- package/dist/src/dbos-runtime/config.js +0 -1
- package/dist/src/dbos-runtime/config.js.map +1 -1
- package/dist/src/dbos-runtime/debug.d.ts +4 -0
- package/dist/src/dbos-runtime/debug.d.ts.map +1 -0
- package/dist/src/dbos-runtime/debug.js +23 -0
- package/dist/src/dbos-runtime/debug.js.map +1 -0
- package/dist/src/dbos-runtime/runtime.d.ts +1 -1
- package/dist/src/dbos-runtime/runtime.d.ts.map +1 -1
- package/dist/src/dbos-runtime/runtime.js +13 -14
- package/dist/src/dbos-runtime/runtime.js.map +1 -1
- package/dist/src/debugger/debug_workflow.js +6 -6
- package/dist/src/debugger/debug_workflow.js.map +1 -1
- package/dist/src/httpServer/server.d.ts +1 -1
- package/dist/src/httpServer/server.d.ts.map +1 -1
- package/dist/src/{dbos-runtime → staticAnalysis}/TypeParser.d.ts +4 -0
- package/dist/src/staticAnalysis/TypeParser.d.ts.map +1 -0
- package/dist/src/{dbos-runtime → staticAnalysis}/TypeParser.js +34 -1
- package/dist/src/staticAnalysis/TypeParser.js.map +1 -0
- package/dist/src/{dbos-runtime → staticAnalysis}/openApi.d.ts.map +1 -1
- package/dist/src/{dbos-runtime → staticAnalysis}/openApi.js +1 -31
- package/dist/src/staticAnalysis/openApi.js.map +1 -0
- package/dist/src/staticAnalysis/tsDiagUtil.d.ts.map +1 -0
- package/dist/src/staticAnalysis/tsDiagUtil.js.map +1 -0
- package/dist/src/system_database.d.ts +20 -9
- package/dist/src/system_database.d.ts.map +1 -1
- package/dist/src/system_database.js +36 -41
- package/dist/src/system_database.js.map +1 -1
- package/dist/src/telemetry/collector.d.ts +5 -5
- package/dist/src/telemetry/collector.d.ts.map +1 -1
- package/dist/src/telemetry/collector.js +5 -17
- package/dist/src/telemetry/collector.js.map +1 -1
- package/dist/src/telemetry/exporters.d.ts +11 -24
- package/dist/src/telemetry/exporters.d.ts.map +1 -1
- package/dist/src/telemetry/exporters.js +42 -129
- package/dist/src/telemetry/exporters.js.map +1 -1
- package/dist/src/telemetry/index.d.ts +6 -2
- package/dist/src/telemetry/index.d.ts.map +1 -1
- package/dist/src/telemetry/index.js +16 -0
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/logs.d.ts +35 -11
- package/dist/src/telemetry/logs.d.ts.map +1 -1
- package/dist/src/telemetry/logs.js +158 -53
- package/dist/src/telemetry/logs.js.map +1 -1
- package/dist/src/telemetry/traces.d.ts +1 -6
- package/dist/src/telemetry/traces.d.ts.map +1 -1
- package/dist/src/telemetry/traces.js +2 -34
- package/dist/src/telemetry/traces.js.map +1 -1
- package/dist/src/testing/testing_runtime.d.ts +1 -1
- package/dist/src/testing/testing_runtime.js +1 -1
- package/dist/src/transaction.d.ts +1 -1
- package/dist/src/transaction.d.ts.map +1 -1
- package/dist/src/workflow.d.ts +2 -0
- package/dist/src/workflow.d.ts.map +1 -1
- package/dist/src/workflow.js +18 -13
- package/dist/src/workflow.js.map +1 -1
- package/examples/hello/dbos-config.yaml +0 -1
- package/package.json +3 -2
- package/dist/src/dbos-runtime/TypeParser.d.ts.map +0 -1
- package/dist/src/dbos-runtime/TypeParser.js.map +0 -1
- package/dist/src/dbos-runtime/openApi.js.map +0 -1
- package/dist/src/dbos-runtime/tsDiagUtil.d.ts.map +0 -1
- package/dist/src/dbos-runtime/tsDiagUtil.js.map +0 -1
- package/dist/src/telemetry/signals.d.ts +0 -20
- package/dist/src/telemetry/signals.d.ts.map +0 -1
- package/dist/src/telemetry/signals.js +0 -11
- package/dist/src/telemetry/signals.js.map +0 -1
- /package/dist/src/{dbos-runtime → staticAnalysis}/openApi.d.ts +0 -0
- /package/dist/src/{dbos-runtime → staticAnalysis}/tsDiagUtil.d.ts +0 -0
- /package/dist/src/{dbos-runtime → staticAnalysis}/tsDiagUtil.js +0 -0
@@ -1,146 +1,59 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
4
|
-
const
|
5
|
-
const lodash_1 = require("lodash");
|
6
|
-
const decorators_1 = require("./../decorators");
|
7
|
-
const error_1 = require("./../error");
|
3
|
+
exports.TelemetryExporter = void 0;
|
4
|
+
const _1 = require("./");
|
8
5
|
const exporter_trace_otlp_http_1 = require("@opentelemetry/exporter-trace-otlp-http");
|
6
|
+
const exporter_logs_otlp_http_1 = require("@opentelemetry/exporter-logs-otlp-http");
|
9
7
|
const core_1 = require("@opentelemetry/core");
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
8
|
+
class TelemetryExporter {
|
9
|
+
tracesExporter;
|
10
|
+
logsExporter;
|
11
|
+
constructor(config) {
|
12
|
+
if (config.tracesEndpoint) {
|
13
|
+
this.tracesExporter = new exporter_trace_otlp_http_1.OTLPTraceExporter({
|
14
|
+
url: config.tracesEndpoint,
|
15
|
+
});
|
16
|
+
console.log(`Traces will be exported to ${config.tracesEndpoint}`);
|
17
|
+
}
|
18
|
+
if (config.logsEndpoint) {
|
19
|
+
this.logsExporter = new exporter_logs_otlp_http_1.OTLPLogExporter({
|
20
|
+
url: config.logsEndpoint,
|
21
|
+
});
|
22
|
+
console.log(`Logs will be exported to ${config.logsEndpoint}`);
|
23
|
+
}
|
18
24
|
}
|
19
25
|
async export(signals) {
|
20
26
|
return await new Promise((resolve) => {
|
27
|
+
// Sort out traces and logs
|
21
28
|
const exportSpans = [];
|
29
|
+
const exportLogs = [];
|
22
30
|
signals.forEach((signal) => {
|
23
|
-
if (
|
24
|
-
exportSpans.push(signal
|
31
|
+
if ((0, _1.isTraceSignal)(signal)) {
|
32
|
+
exportSpans.push(signal);
|
25
33
|
}
|
26
|
-
|
27
|
-
|
28
|
-
if (results.code !== core_1.ExportResultCode.SUCCESS) {
|
29
|
-
console.warn(`Jaeger export failed`);
|
34
|
+
if ((0, _1.isLogSignal)(signal)) {
|
35
|
+
exportLogs.push(signal);
|
30
36
|
}
|
31
37
|
});
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
poolConfig;
|
40
|
-
observabilityDBName;
|
41
|
-
pgClient;
|
42
|
-
constructor(poolConfig, observabilityDBName = "dbos_observability") {
|
43
|
-
this.poolConfig = poolConfig;
|
44
|
-
this.observabilityDBName = observabilityDBName;
|
45
|
-
const pgClientConfig = { ...poolConfig };
|
46
|
-
pgClientConfig.database = this.observabilityDBName;
|
47
|
-
this.pgClient = new pg_1.Client(pgClientConfig);
|
48
|
-
}
|
49
|
-
static getPGDataType(t) {
|
50
|
-
if (t.dataType === "double") {
|
51
|
-
return "double precision"; // aka "float8"
|
52
|
-
}
|
53
|
-
return t.formatAsString();
|
54
|
-
}
|
55
|
-
async init(registeredOperations = []) {
|
56
|
-
const pgSystemClient = new pg_1.Client(this.poolConfig);
|
57
|
-
await pgSystemClient.connect();
|
58
|
-
// First check if the log database exists using pgSystemClient.
|
59
|
-
const dbExists = await pgSystemClient.query(`SELECT FROM pg_database WHERE datname = '${this.observabilityDBName}'`);
|
60
|
-
if (dbExists.rows.length === 0) {
|
61
|
-
// Create the logs backend database
|
62
|
-
await pgSystemClient.query(`CREATE DATABASE ${this.observabilityDBName}`);
|
63
|
-
}
|
64
|
-
await pgSystemClient.end();
|
65
|
-
// Connect the exporter client
|
66
|
-
await this.pgClient.connect();
|
67
|
-
// Configure tables for registered workflows
|
68
|
-
for (const registeredOperation of registeredOperations) {
|
69
|
-
const tableName = `signal_${registeredOperation.name}`;
|
70
|
-
let createSignalTableQuery = `CREATE TABLE IF NOT EXISTS ${tableName} (
|
71
|
-
workflow_uuid TEXT NOT NULL,
|
72
|
-
function_name TEXT NOT NULL,
|
73
|
-
run_as TEXT NOT NULL,
|
74
|
-
timestamp BIGINT NOT NULL,
|
75
|
-
transaction_id TEXT DEFAULT NULL,
|
76
|
-
trace_id TEXT DEFAULT NULL,
|
77
|
-
trace_span JSONB DEFAULT NULL,\n`;
|
78
|
-
for (const arg of registeredOperation.args) {
|
79
|
-
if (arg.logMask === decorators_1.LogMasks.SKIP) {
|
80
|
-
continue;
|
81
|
-
}
|
82
|
-
else if (arg.logMask === decorators_1.LogMasks.HASH) {
|
83
|
-
const row = `${arg.name} VARCHAR(64) DEFAULT NULL,\n`;
|
84
|
-
createSignalTableQuery = createSignalTableQuery.concat(row);
|
85
|
-
}
|
86
|
-
else {
|
87
|
-
const row = `${arg.name} ${PostgresExporter.getPGDataType(arg.dataType)} DEFAULT NULL,\n`;
|
88
|
-
createSignalTableQuery = createSignalTableQuery.concat(row);
|
89
|
-
}
|
38
|
+
if (exportSpans.length > 0 && this.tracesExporter) {
|
39
|
+
this.tracesExporter.export(exportSpans, (results) => {
|
40
|
+
if (results.code !== core_1.ExportResultCode.SUCCESS) {
|
41
|
+
console.warn(`Trace export failed: ${results.code}`);
|
42
|
+
console.warn(results);
|
43
|
+
}
|
44
|
+
});
|
90
45
|
}
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
}
|
99
|
-
process(signals) {
|
100
|
-
const groupByFunctionName = new Map(Object.entries((0, lodash_1.groupBy)(signals, ({ operationName }) => operationName)));
|
101
|
-
const queries = [];
|
102
|
-
for (const [operationName, signals] of groupByFunctionName) {
|
103
|
-
const tableName = `signal_${operationName}`;
|
104
|
-
const query = `
|
105
|
-
INSERT INTO ${tableName}
|
106
|
-
SELECT * FROM jsonb_to_recordset($1::jsonb) AS tmp (workflow_uuid text, function_name text, run_as text, timestamp bigint, transaction_id text, trace_id text, trace_span json)
|
107
|
-
`;
|
108
|
-
const values = JSON.stringify(signals.map((signal) => {
|
109
|
-
return {
|
110
|
-
workflow_uuid: signal.workflowUUID,
|
111
|
-
function_name: signal.operationName,
|
112
|
-
run_as: signal.runAs,
|
113
|
-
timestamp: signal.timestamp,
|
114
|
-
transaction_id: signal.transactionID,
|
115
|
-
trace_id: signal.traceID,
|
116
|
-
trace_span: signal.traceSpan ? (0, traces_1.spanToString)(signal.traceSpan) : null,
|
117
|
-
};
|
118
|
-
}));
|
119
|
-
queries.push({
|
120
|
-
name: `insert-${tableName}`,
|
121
|
-
text: query,
|
122
|
-
values: [values],
|
123
|
-
});
|
124
|
-
}
|
125
|
-
return queries;
|
126
|
-
}
|
127
|
-
async export(telemetrySignals) {
|
128
|
-
const results = [];
|
129
|
-
// Find all telemetry signals and process.
|
130
|
-
if (telemetrySignals.length > 0) {
|
131
|
-
const queries = this.process(telemetrySignals);
|
132
|
-
for (const query of queries) {
|
133
|
-
results.push(this.pgClient.query(query));
|
46
|
+
if (exportLogs.length > 0 && this.logsExporter) {
|
47
|
+
this.logsExporter.export(exportLogs, (results) => {
|
48
|
+
if (results.code !== core_1.ExportResultCode.SUCCESS) {
|
49
|
+
console.warn(`Log export failed: ${results.code}`);
|
50
|
+
console.warn(results);
|
51
|
+
}
|
52
|
+
});
|
134
53
|
}
|
135
|
-
|
136
|
-
|
137
|
-
// We do await here so we can catch and format PostgresExporter specific errors
|
138
|
-
return await Promise.all(results);
|
139
|
-
}
|
140
|
-
catch (err) {
|
141
|
-
throw new error_1.DBOSPostgresExporterError(err);
|
142
|
-
}
|
54
|
+
resolve();
|
55
|
+
});
|
143
56
|
}
|
144
57
|
}
|
145
|
-
exports.
|
58
|
+
exports.TelemetryExporter = TelemetryExporter;
|
146
59
|
//# sourceMappingURL=exporters.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"exporters.js","sourceRoot":"","sources":["../../../src/telemetry/exporters.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"exporters.js","sourceRoot":"","sources":["../../../src/telemetry/exporters.ts"],"names":[],"mappings":";;;AACA,yBAAgD;AAChD,sFAA4E;AAC5E,oFAAyE;AAGzE,8CAAqE;AAWrE,MAAa,iBAAiB;IACX,cAAc,CAAqB;IACnC,YAAY,CAAmB;IAChD,YAAY,MAA0B;QACpC,IAAI,MAAM,CAAC,cAAc,EAAE;YACzB,IAAI,CAAC,cAAc,GAAG,IAAI,4CAAiB,CAAC;gBAC1C,GAAG,EAAE,MAAM,CAAC,cAAc;aAC3B,CAAC,CAAC;YACH,OAAO,CAAC,GAAG,CAAC,8BAA8B,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC;SACpE;QACD,IAAI,MAAM,CAAC,YAAY,EAAE;YACvB,IAAI,CAAC,YAAY,GAAG,IAAI,yCAAe,CAAC;gBACtC,GAAG,EAAE,MAAM,CAAC,YAAY;aACzB,CAAC,CAAC;YACH,OAAO,CAAC,GAAG,CAAC,4BAA4B,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;SAChE;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAA0B;QACrC,OAAO,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YACzC,2BAA2B;YAC3B,MAAM,WAAW,GAAmB,EAAE,CAAC;YACvC,MAAM,UAAU,GAAwB,EAAE,CAAC;YAC3C,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACzB,IAAI,IAAA,gBAAa,EAAC,MAAM,CAAC,EAAE;oBACzB,WAAW,CAAC,IAAI,CAAC,MAAsB,CAAC,CAAC;iBAC1C;gBACD,IAAI,IAAA,cAAW,EAAC,MAAM,CAAC,EAAE;oBACvB,UAAU,CAAC,IAAI,CAAC,MAA2B,CAAC,CAAC;iBAC9C;YACH,CAAC,CAAC,CAAC;YAEH,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,cAAc,EAAE;gBACjD,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,OAAqB,EAAE,EAAE;oBAChE,IAAI,OAAO,CAAC,IAAI,KAAK,uBAAgB,CAAC,OAAO,EAAE;wBAC7C,OAAO,CAAC,IAAI,CAAC,wBAAwB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;wBACrD,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;qBACvB;gBACH,CAAC,CAAC,CAAC;aACJ;YAED,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,YAAY,EAAE;gBAC9C,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,OAAqB,EAAE,EAAE;oBAC7D,IAAI,OAAO,CAAC,IAAI,KAAK,uBAAgB,CAAC,OAAO,EAAE;wBAC7C,OAAO,CAAC,IAAI,CAAC,sBAAsB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;wBACnD,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;qBACvB;gBACH,CAAC,CAAC,CAAC;aACJ;YAED,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AArDD,8CAqDC"}
|
@@ -1,7 +1,11 @@
|
|
1
1
|
import { LoggerConfig } from "./logs";
|
2
|
-
import {
|
2
|
+
import { OTLPExporterConfig } from "./exporters";
|
3
|
+
import { Span } from "@opentelemetry/sdk-trace-base";
|
4
|
+
import { LogRecord } from "@opentelemetry/api-logs";
|
5
|
+
export declare function isTraceSignal(signal: any): signal is Span;
|
6
|
+
export declare function isLogSignal(signal: any): signal is LogRecord;
|
3
7
|
export interface TelemetryConfig {
|
4
8
|
logs?: LoggerConfig;
|
5
|
-
|
9
|
+
OTLPExporter?: OTLPExporterConfig;
|
6
10
|
}
|
7
11
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAIpD,wBAAgB,aAAa,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,IAAI,CAIzD;AAGD,wBAAgB,WAAW,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,SAAS,CAI5D;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,YAAY,CAAC,EAAE,kBAAkB,CAAC;CACnC"}
|
@@ -1,3 +1,19 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.isLogSignal = exports.isTraceSignal = void 0;
|
4
|
+
// We could implement our own types and avoid having `any`, but this has likely little value
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
6
|
+
function isTraceSignal(signal) {
|
7
|
+
// Span is an interface that has a property 'kind'
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
9
|
+
return signal && 'kind' in signal;
|
10
|
+
}
|
11
|
+
exports.isTraceSignal = isTraceSignal;
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
13
|
+
function isLogSignal(signal) {
|
14
|
+
// LogRecord is an interface that has a property 'severityText' and 'severityNumber'
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
16
|
+
return signal && 'severityText' in signal && 'severityNumber' in signal;
|
17
|
+
}
|
18
|
+
exports.isLogSignal = isLogSignal;
|
3
19
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/telemetry/index.ts"],"names":[],"mappings":""}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/telemetry/index.ts"],"names":[],"mappings":";;;AAKA,4FAA4F;AAC5F,8DAA8D;AAC9D,SAAgB,aAAa,CAAC,MAAW;IACvC,kDAAkD;IAClD,+DAA+D;IAC/D,OAAO,MAAM,IAAI,MAAM,IAAI,MAAM,CAAC;AACpC,CAAC;AAJD,sCAIC;AAED,8DAA8D;AAC9D,SAAgB,WAAW,CAAC,MAAW;IACrC,oFAAoF;IACpF,+DAA+D;IAC/D,OAAO,MAAM,IAAI,cAAc,IAAI,MAAM,IAAI,gBAAgB,IAAI,MAAM,CAAC;AAC1E,CAAC;AAJD,kCAIC"}
|
@@ -1,25 +1,49 @@
|
|
1
1
|
import { Logger as IWinstonLogger } from "winston";
|
2
2
|
import { DBOSContext } from "../context";
|
3
|
+
import { TelemetryCollector } from "./collector";
|
4
|
+
/*****************/
|
5
|
+
/*****************/
|
3
6
|
export interface LoggerConfig {
|
4
7
|
logLevel?: string;
|
5
8
|
silent?: boolean;
|
6
9
|
addContextMetadata?: boolean;
|
7
10
|
}
|
8
|
-
|
9
|
-
|
11
|
+
type ContextualMetadata = {
|
12
|
+
includeContextMetadata?: boolean;
|
13
|
+
workflowUUID: string;
|
14
|
+
authenticatedUser: string;
|
15
|
+
traceId: string;
|
16
|
+
spanId: string;
|
17
|
+
};
|
18
|
+
interface StackTrace {
|
19
|
+
stack?: string;
|
10
20
|
}
|
21
|
+
export interface IGlobalLogger extends IWinstonLogger {
|
22
|
+
readonly addContextMetadata: boolean;
|
23
|
+
readonly logger: IWinstonLogger;
|
24
|
+
readonly telemetryCollector: TelemetryCollector;
|
25
|
+
}
|
26
|
+
export declare class GlobalLogger {
|
27
|
+
private readonly telemetryCollector?;
|
28
|
+
private readonly logger;
|
29
|
+
readonly addContextMetadata: boolean;
|
30
|
+
constructor(telemetryCollector?: TelemetryCollector | undefined, config?: LoggerConfig);
|
31
|
+
info(logEntry: any, metadata?: ContextualMetadata): void;
|
32
|
+
debug(logEntry: any, metadata?: ContextualMetadata): void;
|
33
|
+
warn(logEntry: any, metadata?: ContextualMetadata): void;
|
34
|
+
error(inputError: any, metadata?: ContextualMetadata & StackTrace): void;
|
35
|
+
}
|
36
|
+
/******************/
|
37
|
+
/******************/
|
11
38
|
export declare class Logger {
|
12
39
|
private readonly globalLogger;
|
13
40
|
private readonly ctx;
|
14
|
-
readonly metadata:
|
15
|
-
constructor(globalLogger:
|
16
|
-
info(
|
17
|
-
debug(
|
18
|
-
warn(
|
19
|
-
emerg(message: string): void;
|
20
|
-
alert(message: string): void;
|
21
|
-
crit(message: string): void;
|
41
|
+
readonly metadata: ContextualMetadata;
|
42
|
+
constructor(globalLogger: GlobalLogger, ctx: DBOSContext);
|
43
|
+
info(logEntry: any): void;
|
44
|
+
debug(logEntry: any): void;
|
45
|
+
warn(logEntry: any): void;
|
22
46
|
error(inputError: any): void;
|
23
47
|
}
|
24
|
-
export
|
48
|
+
export {};
|
25
49
|
//# sourceMappingURL=logs.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../../src/telemetry/logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,MAAM,IAAI,cAAc,EAAE,MAAM,SAAS,CAAC;
|
1
|
+
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../../src/telemetry/logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,MAAM,IAAI,cAAc,EAAE,MAAM,SAAS,CAAC;AAGrF,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAIzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aA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B,qBAAa,MAAM;IAGf,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,GAAG;IAHtB,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;gBAEnB,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,WAAW;IAYnC,IAAI,CAAC,QAAQ,EAAE,GAAG,GAAG,IAAI;IASzB,KAAK,CAAC,QAAQ,EAAE,GAAG,GAAG,IAAI;IAS1B,IAAI,CAAC,QAAQ,EAAE,GAAG,GAAG,IAAI;IAUzB,KAAK,CAAC,UAAU,EAAE,GAAG,GAAG,IAAI;CAU7B"}
|
@@ -1,91 +1,196 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.Logger = exports.GlobalLogger = void 0;
|
4
4
|
const winston_1 = require("winston");
|
5
|
+
const TransportStream = require("winston-transport");
|
5
6
|
const applicationVersion_1 = require("../dbos-runtime/applicationVersion");
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
const api_1 = require("@opentelemetry/api");
|
8
|
+
const api_logs_1 = require("@opentelemetry/api-logs");
|
9
|
+
const sdk_logs_1 = require("@opentelemetry/sdk-logs");
|
10
|
+
class GlobalLogger {
|
11
|
+
telemetryCollector;
|
12
|
+
logger;
|
13
|
+
addContextMetadata;
|
14
|
+
constructor(telemetryCollector, config) {
|
15
|
+
this.telemetryCollector = telemetryCollector;
|
16
|
+
const winstonTransports = [];
|
17
|
+
winstonTransports.push(new winston_1.transports.Console({
|
18
|
+
format: consoleFormat,
|
19
|
+
level: config?.logLevel || "info",
|
20
|
+
silent: config?.silent || false,
|
21
|
+
}));
|
22
|
+
// Only enable the OTLP transport if we have a telemetry collector and an exporter
|
23
|
+
if (this.telemetryCollector?.exporter) {
|
24
|
+
winstonTransports.push(new OTLPLogQueueTransport(this.telemetryCollector));
|
25
|
+
}
|
26
|
+
this.logger = (0, winston_1.createLogger)({ transports: winstonTransports });
|
27
|
+
this.addContextMetadata = config?.addContextMetadata || false;
|
28
|
+
}
|
29
|
+
// We use this form of winston logging methods: `(message: string, ...meta: any[])`. See node_modules/winston/index.d.ts
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
31
|
+
info(logEntry, metadata) {
|
32
|
+
if (typeof logEntry === "string") {
|
33
|
+
this.logger.info(logEntry, metadata);
|
34
|
+
}
|
35
|
+
else {
|
36
|
+
this.logger.info(JSON.stringify(logEntry), metadata);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
40
|
+
debug(logEntry, metadata) {
|
41
|
+
if (typeof logEntry === "string") {
|
42
|
+
this.logger.debug(logEntry, metadata);
|
43
|
+
}
|
44
|
+
else {
|
45
|
+
this.logger.debug(JSON.stringify(logEntry), metadata);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
49
|
+
warn(logEntry, metadata) {
|
50
|
+
if (typeof logEntry === "string") {
|
51
|
+
this.logger.warn(logEntry, metadata);
|
52
|
+
}
|
53
|
+
else {
|
54
|
+
this.logger.warn(JSON.stringify(logEntry), metadata);
|
55
|
+
}
|
56
|
+
}
|
57
|
+
// metadata can have both ContextualMetadata and the error stack trace
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
59
|
+
error(inputError, metadata) {
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
61
|
+
this.logger.error(inputError, metadata);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
exports.GlobalLogger = GlobalLogger;
|
65
|
+
/******************/
|
66
|
+
/* CONTEXT LOGGER */
|
67
|
+
/******************/
|
68
|
+
// Wrapper around our global logger. Expected to be instantiated by a new contexts so they can inject contextual metadata
|
9
69
|
class Logger {
|
10
70
|
globalLogger;
|
11
71
|
ctx;
|
12
|
-
|
13
|
-
metadata = {};
|
72
|
+
metadata;
|
14
73
|
constructor(globalLogger, ctx) {
|
15
74
|
this.globalLogger = globalLogger;
|
16
75
|
this.ctx = ctx;
|
17
|
-
|
18
|
-
this.
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
}
|
76
|
+
this.metadata = {
|
77
|
+
includeContextMetadata: this.globalLogger.addContextMetadata,
|
78
|
+
workflowUUID: this.ctx.workflowUUID,
|
79
|
+
authenticatedUser: this.ctx.authenticatedUser,
|
80
|
+
traceId: this.ctx.span.spanContext().traceId,
|
81
|
+
spanId: this.ctx.span.spanContext().spanId,
|
82
|
+
};
|
25
83
|
}
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
}
|
35
|
-
emerg(message) {
|
36
|
-
this.globalLogger.emerg(message, this.metadata);
|
84
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
85
|
+
info(logEntry) {
|
86
|
+
if (typeof logEntry === "string") {
|
87
|
+
this.globalLogger.info(logEntry, this.metadata);
|
88
|
+
}
|
89
|
+
else {
|
90
|
+
this.globalLogger.info(JSON.stringify(logEntry), this.metadata);
|
91
|
+
}
|
37
92
|
}
|
38
|
-
|
39
|
-
|
93
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
94
|
+
debug(logEntry) {
|
95
|
+
if (typeof logEntry === "string") {
|
96
|
+
this.globalLogger.debug(logEntry, this.metadata);
|
97
|
+
}
|
98
|
+
else {
|
99
|
+
this.globalLogger.debug(JSON.stringify(logEntry), this.metadata);
|
100
|
+
}
|
40
101
|
}
|
41
|
-
|
42
|
-
|
102
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
103
|
+
warn(logEntry) {
|
104
|
+
if (typeof logEntry === "string") {
|
105
|
+
this.globalLogger.warn(logEntry, this.metadata);
|
106
|
+
}
|
107
|
+
else {
|
108
|
+
this.globalLogger.warn(JSON.stringify(logEntry), this.metadata);
|
109
|
+
}
|
43
110
|
}
|
44
111
|
// We give users the same interface (message: string argument) but create an error to get a stack trace
|
45
112
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
46
113
|
error(inputError) {
|
47
114
|
if (inputError instanceof Error) {
|
48
|
-
this.globalLogger.error(inputError.message, { ...this.metadata, stack: inputError.stack
|
115
|
+
this.globalLogger.error(inputError.message, { ...this.metadata, stack: inputError.stack });
|
49
116
|
}
|
50
117
|
else if (typeof inputError === "string") {
|
51
|
-
|
52
|
-
this.globalLogger.error(inputError, { ...this.metadata, stack: e.stack });
|
118
|
+
this.globalLogger.error(inputError, { ...this.metadata, stack: new Error().stack });
|
53
119
|
}
|
54
120
|
else {
|
55
|
-
// If this is neither a string nor an error, we just log it as is an ommit the context
|
56
121
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
57
|
-
this.globalLogger.error(inputError.
|
122
|
+
this.globalLogger.error(JSON.stringify(inputError), { ...this.metadata, stack: new Error().stack });
|
58
123
|
}
|
59
124
|
}
|
60
125
|
}
|
61
126
|
exports.Logger = Logger;
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
new winston_1.transports.Console({
|
67
|
-
level: config?.logLevel || "info",
|
68
|
-
}),
|
69
|
-
],
|
70
|
-
silent: config?.silent || false,
|
71
|
-
});
|
72
|
-
logger.addContextMetadata = config?.addContextMetadata || false;
|
73
|
-
return logger;
|
74
|
-
}
|
75
|
-
exports.createGlobalLogger = createGlobalLogger;
|
76
|
-
const consoleFormat = winston_1.format.combine(winston_1.format.errors({ stack: true }), winston_1.format.timestamp(), winston_1.format.colorize(),
|
77
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
78
|
-
winston_1.format.printf((info) => {
|
127
|
+
/***********************/
|
128
|
+
/* FORMAT & TRANSPORTS */
|
129
|
+
/***********************/
|
130
|
+
const consoleFormat = winston_1.format.combine(winston_1.format.errors({ stack: true }), winston_1.format.timestamp(), winston_1.format.colorize(), winston_1.format.printf((info) => {
|
79
131
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
80
|
-
const { timestamp, level, message, stack
|
132
|
+
const { timestamp, level, message, stack } = info;
|
81
133
|
const applicationVersion = (0, applicationVersion_1.getApplicationVersion)();
|
82
134
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment
|
83
135
|
const ts = timestamp.slice(0, 19).replace("T", " ");
|
84
136
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment
|
85
137
|
const formattedStack = stack?.split("\n").slice(1).join("\n");
|
138
|
+
const contextualMetadata = {
|
139
|
+
workflowUUID: info.workflowUUID,
|
140
|
+
authenticatedUser: info.authenticatedUser,
|
141
|
+
traceId: info.traceId,
|
142
|
+
spanId: info.spanId,
|
143
|
+
};
|
86
144
|
const messageString = typeof message === "string" ? message : JSON.stringify(message);
|
145
|
+
const fullMessageString = `${messageString}${info.includeContextMetadata ? ` ${JSON.stringify(contextualMetadata)}` : ""}`;
|
87
146
|
const versionString = applicationVersion ? ` [version ${applicationVersion}]` : "";
|
88
147
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
89
|
-
return `${ts}${versionString} [${level}]: ${
|
148
|
+
return `${ts}${versionString} [${level}]: ${fullMessageString} ${stack ? "\n" + formattedStack : ""}`;
|
90
149
|
}));
|
150
|
+
class OTLPLogQueueTransport extends TransportStream {
|
151
|
+
telemetryCollector;
|
152
|
+
name = "OTLPLogQueueTransport";
|
153
|
+
otelLogger;
|
154
|
+
constructor(telemetryCollector) {
|
155
|
+
super();
|
156
|
+
this.telemetryCollector = telemetryCollector;
|
157
|
+
// not sure if we need a more explicit name here
|
158
|
+
this.otelLogger = new sdk_logs_1.LoggerProvider().getLogger("default");
|
159
|
+
}
|
160
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
161
|
+
log(info, callback) {
|
162
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
163
|
+
const { level, message, stack } = info;
|
164
|
+
const contextualMetadata = {
|
165
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
166
|
+
workflowUUID: info.workflowUUID,
|
167
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
168
|
+
authenticatedUser: info.authenticatedUser,
|
169
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
170
|
+
traceId: info.traceId,
|
171
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
172
|
+
spanId: info.spanId,
|
173
|
+
};
|
174
|
+
const levelToSeverityNumber = {
|
175
|
+
error: api_logs_1.SeverityNumber.ERROR,
|
176
|
+
warn: api_logs_1.SeverityNumber.WARN,
|
177
|
+
info: api_logs_1.SeverityNumber.INFO,
|
178
|
+
debug: api_logs_1.SeverityNumber.DEBUG,
|
179
|
+
};
|
180
|
+
const log = {
|
181
|
+
severityNumber: levelToSeverityNumber[level],
|
182
|
+
severityText: level,
|
183
|
+
body: message,
|
184
|
+
timestamp: new Date().getTime(),
|
185
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
186
|
+
attributes: { ...contextualMetadata, stack },
|
187
|
+
// TODO as a nice-to-have, we could retrieve the operation current context, if we use a context manager, and inject the traceId/spanId in the LogRecord
|
188
|
+
// See https://opentelemetry.io/docs/instrumentation/js/context/#active-context
|
189
|
+
context: api_1.context.active(),
|
190
|
+
};
|
191
|
+
const logRecord = new sdk_logs_1.LogRecord(this.otelLogger, log);
|
192
|
+
this.telemetryCollector.push(logRecord);
|
193
|
+
callback();
|
194
|
+
}
|
195
|
+
}
|
91
196
|
//# sourceMappingURL=logs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../../src/telemetry/logs.ts"],"names":[],"mappings":";;;AAAA,qCAAqF;AACrF,2EAA2E;
|
1
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AkB,GAAuB;YAC7C,sEAAsE;YACtE,YAAY,EAAE,IAAI,CAAC,YAAsB;YACzC,sEAAsE;YACtE,iBAAiB,EAAE,IAAI,CAAC,iBAA2B;YACnD,sEAAsE;YACtE,OAAO,EAAE,IAAI,CAAC,OAAiB;YAC/B,sEAAsE;YACtE,MAAM,EAAE,IAAI,CAAC,MAAgB;SAC9B,CAAC;QAEF,MAAM,qBAAqB,GAAsC;YAC/D,KAAK,EAAE,yBAAc,CAAC,KAAK;YAC3B,IAAI,EAAE,yBAAc,CAAC,IAAI;YACzB,IAAI,EAAE,yBAAc,CAAC,IAAI;YACzB,KAAK,EAAE,yBAAc,CAAC,KAAK;SAC5B,CAAC;QAEF,MAAM,GAAG,GAAc;YACrB,cAAc,EAAE,qBAAqB,CAAC,KAAe,CAAC;YACtD,YAAY,EAAE,KAAe;YAC7B,IAAI,EAAE,OAAiB;YACvB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE;YAC/B,mEAAmE;YACnE,UAAU,EAAE,EAAE,GAAG,kBAAkB,EAAE,KAAK,EAAmB;YAC7D,uJAAuJ;YACvJ,+EAA+E;YAC/E,OAAO,EAAE,aAAO,CAAC,MAAM,EAAE;SAC1B,CAAC;QAEF,MAAM,SAAS,GAAkB,IAAI,oBAAa,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QAEzE,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAExC,QAAQ,EAAE,CAAC;IACb,CAAC;CACF"}
|
@@ -1,11 +1,6 @@
|
|
1
|
-
import {
|
1
|
+
import { Span } from "@opentelemetry/sdk-trace-base";
|
2
2
|
import { Attributes, SpanContext } from "@opentelemetry/api";
|
3
3
|
import { TelemetryCollector } from "./collector";
|
4
|
-
export interface TracerConfig {
|
5
|
-
enabled?: boolean;
|
6
|
-
endpoint?: string;
|
7
|
-
}
|
8
|
-
export declare function spanToString(span: ReadableSpan): string;
|
9
4
|
export declare class Tracer {
|
10
5
|
private readonly telemetryCollector;
|
11
6
|
private readonly tracer;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"traces.d.ts","sourceRoot":"","sources":["../../../src/telemetry/traces.ts"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"traces.d.ts","sourceRoot":"","sources":["../../../src/telemetry/traces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAExF,OAAsB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,qBAAa,MAAM;IAEL,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IAD/C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;gBAChB,kBAAkB,EAAE,kBAAkB;IASnE,oBAAoB,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI;IAM3F,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI;IAUzE,OAAO,CAAC,IAAI,EAAE,IAAI;CAInB"}
|