@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.
Files changed (114) hide show
  1. package/dist/src/cloud-cli/applications/configure.d.ts +1 -1
  2. package/dist/src/cloud-cli/applications/configure.d.ts.map +1 -1
  3. package/dist/src/cloud-cli/applications/configure.js +35 -28
  4. package/dist/src/cloud-cli/applications/configure.js.map +1 -1
  5. package/dist/src/cloud-cli/applications/delete-app.js +1 -1
  6. package/dist/src/cloud-cli/applications/delete-app.js.map +1 -1
  7. package/dist/src/cloud-cli/applications/deploy-app-code.d.ts.map +1 -1
  8. package/dist/src/cloud-cli/applications/deploy-app-code.js +10 -2
  9. package/dist/src/cloud-cli/applications/deploy-app-code.js.map +1 -1
  10. package/dist/src/cloud-cli/applications/get-app-logs.js +1 -1
  11. package/dist/src/cloud-cli/applications/get-app-logs.js.map +1 -1
  12. package/dist/src/cloud-cli/applications/list-apps.js +1 -1
  13. package/dist/src/cloud-cli/applications/list-apps.js.map +1 -1
  14. package/dist/src/cloud-cli/applications/register-app.js +1 -1
  15. package/dist/src/cloud-cli/applications/register-app.js.map +1 -1
  16. package/dist/src/cloud-cli/applications/update-app.d.ts.map +1 -1
  17. package/dist/src/cloud-cli/applications/update-app.js +3 -2
  18. package/dist/src/cloud-cli/applications/update-app.js.map +1 -1
  19. package/dist/src/cloud-cli/cli.js +6 -6
  20. package/dist/src/cloud-cli/cli.js.map +1 -1
  21. package/dist/src/cloud-cli/login.d.ts.map +1 -1
  22. package/dist/src/cloud-cli/login.js +3 -2
  23. package/dist/src/cloud-cli/login.js.map +1 -1
  24. package/dist/src/cloud-cli/register.js +1 -1
  25. package/dist/src/cloud-cli/register.js.map +1 -1
  26. package/dist/src/cloud-cli/userdb.d.ts +10 -2
  27. package/dist/src/cloud-cli/userdb.d.ts.map +1 -1
  28. package/dist/src/cloud-cli/userdb.js +63 -100
  29. package/dist/src/cloud-cli/userdb.js.map +1 -1
  30. package/dist/src/communicator.d.ts +1 -1
  31. package/dist/src/communicator.d.ts.map +1 -1
  32. package/dist/src/context.d.ts +1 -1
  33. package/dist/src/context.d.ts.map +1 -1
  34. package/dist/src/context.js +1 -1
  35. package/dist/src/context.js.map +1 -1
  36. package/dist/src/dbos-executor.d.ts +18 -7
  37. package/dist/src/dbos-executor.d.ts.map +1 -1
  38. package/dist/src/dbos-executor.js +155 -52
  39. package/dist/src/dbos-executor.js.map +1 -1
  40. package/dist/src/dbos-runtime/cli.d.ts +0 -1
  41. package/dist/src/dbos-runtime/cli.d.ts.map +1 -1
  42. package/dist/src/dbos-runtime/cli.js +14 -2
  43. package/dist/src/dbos-runtime/cli.js.map +1 -1
  44. package/dist/src/dbos-runtime/config.d.ts +0 -1
  45. package/dist/src/dbos-runtime/config.d.ts.map +1 -1
  46. package/dist/src/dbos-runtime/config.js +0 -1
  47. package/dist/src/dbos-runtime/config.js.map +1 -1
  48. package/dist/src/dbos-runtime/debug.d.ts +4 -0
  49. package/dist/src/dbos-runtime/debug.d.ts.map +1 -0
  50. package/dist/src/dbos-runtime/debug.js +23 -0
  51. package/dist/src/dbos-runtime/debug.js.map +1 -0
  52. package/dist/src/dbos-runtime/runtime.d.ts +1 -1
  53. package/dist/src/dbos-runtime/runtime.d.ts.map +1 -1
  54. package/dist/src/dbos-runtime/runtime.js +13 -14
  55. package/dist/src/dbos-runtime/runtime.js.map +1 -1
  56. package/dist/src/debugger/debug_workflow.js +6 -6
  57. package/dist/src/debugger/debug_workflow.js.map +1 -1
  58. package/dist/src/httpServer/server.d.ts +1 -1
  59. package/dist/src/httpServer/server.d.ts.map +1 -1
  60. package/dist/src/{dbos-runtime → staticAnalysis}/TypeParser.d.ts +4 -0
  61. package/dist/src/staticAnalysis/TypeParser.d.ts.map +1 -0
  62. package/dist/src/{dbos-runtime → staticAnalysis}/TypeParser.js +34 -1
  63. package/dist/src/staticAnalysis/TypeParser.js.map +1 -0
  64. package/dist/src/{dbos-runtime → staticAnalysis}/openApi.d.ts.map +1 -1
  65. package/dist/src/{dbos-runtime → staticAnalysis}/openApi.js +1 -31
  66. package/dist/src/staticAnalysis/openApi.js.map +1 -0
  67. package/dist/src/staticAnalysis/tsDiagUtil.d.ts.map +1 -0
  68. package/dist/src/staticAnalysis/tsDiagUtil.js.map +1 -0
  69. package/dist/src/system_database.d.ts +20 -9
  70. package/dist/src/system_database.d.ts.map +1 -1
  71. package/dist/src/system_database.js +36 -41
  72. package/dist/src/system_database.js.map +1 -1
  73. package/dist/src/telemetry/collector.d.ts +5 -5
  74. package/dist/src/telemetry/collector.d.ts.map +1 -1
  75. package/dist/src/telemetry/collector.js +5 -17
  76. package/dist/src/telemetry/collector.js.map +1 -1
  77. package/dist/src/telemetry/exporters.d.ts +11 -24
  78. package/dist/src/telemetry/exporters.d.ts.map +1 -1
  79. package/dist/src/telemetry/exporters.js +42 -129
  80. package/dist/src/telemetry/exporters.js.map +1 -1
  81. package/dist/src/telemetry/index.d.ts +6 -2
  82. package/dist/src/telemetry/index.d.ts.map +1 -1
  83. package/dist/src/telemetry/index.js +16 -0
  84. package/dist/src/telemetry/index.js.map +1 -1
  85. package/dist/src/telemetry/logs.d.ts +35 -11
  86. package/dist/src/telemetry/logs.d.ts.map +1 -1
  87. package/dist/src/telemetry/logs.js +158 -53
  88. package/dist/src/telemetry/logs.js.map +1 -1
  89. package/dist/src/telemetry/traces.d.ts +1 -6
  90. package/dist/src/telemetry/traces.d.ts.map +1 -1
  91. package/dist/src/telemetry/traces.js +2 -34
  92. package/dist/src/telemetry/traces.js.map +1 -1
  93. package/dist/src/testing/testing_runtime.d.ts +1 -1
  94. package/dist/src/testing/testing_runtime.js +1 -1
  95. package/dist/src/transaction.d.ts +1 -1
  96. package/dist/src/transaction.d.ts.map +1 -1
  97. package/dist/src/workflow.d.ts +2 -0
  98. package/dist/src/workflow.d.ts.map +1 -1
  99. package/dist/src/workflow.js +18 -13
  100. package/dist/src/workflow.js.map +1 -1
  101. package/examples/hello/dbos-config.yaml +0 -1
  102. package/package.json +3 -2
  103. package/dist/src/dbos-runtime/TypeParser.d.ts.map +0 -1
  104. package/dist/src/dbos-runtime/TypeParser.js.map +0 -1
  105. package/dist/src/dbos-runtime/openApi.js.map +0 -1
  106. package/dist/src/dbos-runtime/tsDiagUtil.d.ts.map +0 -1
  107. package/dist/src/dbos-runtime/tsDiagUtil.js.map +0 -1
  108. package/dist/src/telemetry/signals.d.ts +0 -20
  109. package/dist/src/telemetry/signals.d.ts.map +0 -1
  110. package/dist/src/telemetry/signals.js +0 -11
  111. package/dist/src/telemetry/signals.js.map +0 -1
  112. /package/dist/src/{dbos-runtime → staticAnalysis}/openApi.d.ts +0 -0
  113. /package/dist/src/{dbos-runtime → staticAnalysis}/tsDiagUtil.d.ts +0 -0
  114. /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.PostgresExporter = exports.POSTGRES_EXPORTER = exports.JaegerExporter = exports.JAEGER_EXPORTER = void 0;
4
- const pg_1 = require("pg");
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
- const traces_1 = require("./traces");
11
- exports.JAEGER_EXPORTER = "JaegerExporter";
12
- class JaegerExporter {
13
- exporter;
14
- constructor(endpoint = "http://localhost:4318/v1/traces") {
15
- this.exporter = new exporter_trace_otlp_http_1.OTLPTraceExporter({
16
- url: endpoint,
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 (signal.traceSpan) {
24
- exportSpans.push(signal.traceSpan);
31
+ if ((0, _1.isTraceSignal)(signal)) {
32
+ exportSpans.push(signal);
25
33
  }
26
- });
27
- this.exporter.export(exportSpans, (results) => {
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
- resolve();
33
- });
34
- }
35
- }
36
- exports.JaegerExporter = JaegerExporter;
37
- exports.POSTGRES_EXPORTER = "PostgresExporter";
38
- class PostgresExporter {
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
- // Trim last comma and line feed
92
- createSignalTableQuery = createSignalTableQuery.slice(0, -2).concat("\n);");
93
- await this.pgClient.query(createSignalTableQuery);
94
- }
95
- }
96
- async destroy() {
97
- await this.pgClient.end();
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
- try {
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.PostgresExporter = PostgresExporter;
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":";;;AAAA,2BAAuE;AACvE,mCAAiC;AACjC,gDAAiF;AACjF,sCAAuD;AAEvD,sFAA4E;AAE5E,8CAAqE;AACrE,qCAAwC;AAS3B,QAAA,eAAe,GAAG,gBAAgB,CAAC;AAChD,MAAa,cAAc;IACR,QAAQ,CAAoB;IAC7C,YAAY,WAAmB,iCAAiC;QAC9D,IAAI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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 { TracerConfig } from "./traces";
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
- traces?: TracerConfig;
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,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB"}
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
- export interface WinstonLogger extends IWinstonLogger {
9
- addContextMetadata: boolean;
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: object;
15
- constructor(globalLogger: WinstonLogger, ctx: DBOSContext);
16
- info(message: string): void;
17
- debug(message: string): void;
18
- warn(message: string): void;
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 declare function createGlobalLogger(config?: LoggerConfig): WinstonLogger;
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;AAErF,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAGD,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AAKD,qBAAa,MAAM;IAGL,OAAO,CAAC,QAAQ,CAAC,YAAY;IAAiB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAD9E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAM;gBACF,YAAY,EAAE,aAAa,EAAmB,GAAG,EAAE,WAAW;IAW3F,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI5B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAM3B,KAAK,CAAC,UAAU,EAAE,GAAG,GAAG,IAAI;CAY7B;AAED,wBAAgB,kBAAkB,CAAC,MAAM,CAA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EAAE,QAAQ,CAAC,EAAE,kBAAkB,GAAG,IAAI;IASzD,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,kBAAkB,GAAG,IAAI;IAUxD,KAAK,CAAC,UAAU,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,kBAAkB,GAAG,UAAU,GAAG,IAAI;CAIzE;AAED,oBAAoB;AAEpB,oBAAoB;AAGpB,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.createGlobalLogger = exports.Logger = void 0;
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
- /* This is a wrapper around a global Winston logger. It holds a reference to the global logger.
7
- * This class is expected to be instantiated by new DBOSContext such that they can share context information.
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
- // Eventually this object will implement one of our TelemetrySignal interface
13
- metadata = {};
72
+ metadata;
14
73
  constructor(globalLogger, ctx) {
15
74
  this.globalLogger = globalLogger;
16
75
  this.ctx = ctx;
17
- if (this.globalLogger.addContextMetadata) {
18
- this.metadata = {
19
- workflowUUID: this.ctx.workflowUUID,
20
- authenticatedUser: this.ctx.authenticatedUser,
21
- traceId: this.ctx.span.spanContext().traceId,
22
- spanId: this.ctx.span.spanContext().spanId,
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
- info(message) {
27
- this.globalLogger.info(message, this.metadata);
28
- }
29
- debug(message) {
30
- this.globalLogger.debug(message, this.metadata);
31
- }
32
- warn(message) {
33
- this.globalLogger.warn(message, this.metadata);
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
- alert(message) {
39
- this.globalLogger.alert(message, this.metadata);
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
- crit(message) {
42
- this.globalLogger.crit(message, this.metadata);
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, cause: inputError.cause });
115
+ this.globalLogger.error(inputError.message, { ...this.metadata, stack: inputError.stack });
49
116
  }
50
117
  else if (typeof inputError === "string") {
51
- const e = new Error();
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.toString());
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
- function createGlobalLogger(config) {
63
- const logger = (0, winston_1.createLogger)({
64
- format: consoleFormat,
65
- transports: [
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, ...args } = info;
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}]: ${messageString} ${Object.keys(args).length ? "\n" + JSON.stringify(args, null, 2) : ""} ${stack ? "\n" + formattedStack : ""}`;
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;AAc3E;;IAEI;AACJ,MAAa,MAAM;IAGY;IAA8C;IAF3E,6EAA6E;IACpE,QAAQ,GAAW,EAAE,CAAC;IAC/B,YAA6B,YAA2B,EAAmB,GAAgB;QAA9D,iBAAY,GAAZ,YAAY,CAAe;QAAmB,QAAG,GAAH,GAAG,CAAa;QACzF,IAAI,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE;YACxC,IAAI,CAAC,QAAQ,GAAG;gBACd,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,YAAY;gBACnC,iBAAiB,EAAE,IAAI,CAAC,GAAG,CAAC,i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Ac,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 { ReadableSpan, Span } from "@opentelemetry/sdk-trace-base";
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,EAAuB,YAAY,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAExF,OAAsB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAG5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGjD,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACn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