@agentuity/runtime 0.1.13 → 0.1.14
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/package.json +8 -8
- package/src/_config.ts +13 -0
- package/src/_standalone.ts +167 -19
- package/src/index.ts +1 -0
- package/dist/_config.d.ts +0 -90
- package/dist/_config.d.ts.map +0 -1
- package/dist/_config.js +0 -135
- package/dist/_config.js.map +0 -1
- package/dist/_context.d.ts +0 -76
- package/dist/_context.d.ts.map +0 -1
- package/dist/_context.js +0 -147
- package/dist/_context.js.map +0 -1
- package/dist/_events.d.ts +0 -64
- package/dist/_events.d.ts.map +0 -1
- package/dist/_events.js +0 -92
- package/dist/_events.js.map +0 -1
- package/dist/_idle.d.ts +0 -7
- package/dist/_idle.d.ts.map +0 -1
- package/dist/_idle.js +0 -10
- package/dist/_idle.js.map +0 -1
- package/dist/_metadata.d.ts +0 -117
- package/dist/_metadata.d.ts.map +0 -1
- package/dist/_metadata.js +0 -246
- package/dist/_metadata.js.map +0 -1
- package/dist/_process-protection.d.ts +0 -25
- package/dist/_process-protection.d.ts.map +0 -1
- package/dist/_process-protection.js +0 -65
- package/dist/_process-protection.js.map +0 -1
- package/dist/_server.d.ts +0 -46
- package/dist/_server.d.ts.map +0 -1
- package/dist/_server.js +0 -85
- package/dist/_server.js.map +0 -1
- package/dist/_services.d.ts +0 -21
- package/dist/_services.d.ts.map +0 -1
- package/dist/_services.js +0 -248
- package/dist/_services.js.map +0 -1
- package/dist/_standalone.d.ts +0 -168
- package/dist/_standalone.d.ts.map +0 -1
- package/dist/_standalone.js +0 -441
- package/dist/_standalone.js.map +0 -1
- package/dist/_tokens.d.ts +0 -12
- package/dist/_tokens.d.ts.map +0 -1
- package/dist/_tokens.js +0 -96
- package/dist/_tokens.js.map +0 -1
- package/dist/_util.d.ts +0 -16
- package/dist/_util.d.ts.map +0 -1
- package/dist/_util.js +0 -54
- package/dist/_util.js.map +0 -1
- package/dist/_validation.d.ts +0 -89
- package/dist/_validation.d.ts.map +0 -1
- package/dist/_validation.js +0 -29
- package/dist/_validation.js.map +0 -1
- package/dist/_waituntil.d.ts +0 -18
- package/dist/_waituntil.d.ts.map +0 -1
- package/dist/_waituntil.js +0 -97
- package/dist/_waituntil.js.map +0 -1
- package/dist/agent.d.ts +0 -1210
- package/dist/agent.d.ts.map +0 -1
- package/dist/agent.js +0 -903
- package/dist/agent.js.map +0 -1
- package/dist/app.d.ts +0 -322
- package/dist/app.d.ts.map +0 -1
- package/dist/app.js +0 -160
- package/dist/app.js.map +0 -1
- package/dist/bun-s3-patch.d.ts +0 -37
- package/dist/bun-s3-patch.d.ts.map +0 -1
- package/dist/bun-s3-patch.js +0 -139
- package/dist/bun-s3-patch.js.map +0 -1
- package/dist/cors.d.ts +0 -42
- package/dist/cors.d.ts.map +0 -1
- package/dist/cors.js +0 -117
- package/dist/cors.js.map +0 -1
- package/dist/devmode.d.ts +0 -3
- package/dist/devmode.d.ts.map +0 -1
- package/dist/devmode.js +0 -167
- package/dist/devmode.js.map +0 -1
- package/dist/eval.d.ts +0 -91
- package/dist/eval.d.ts.map +0 -1
- package/dist/eval.js +0 -16
- package/dist/eval.js.map +0 -1
- package/dist/handlers/cron.d.ts +0 -47
- package/dist/handlers/cron.d.ts.map +0 -1
- package/dist/handlers/cron.js +0 -49
- package/dist/handlers/cron.js.map +0 -1
- package/dist/handlers/index.d.ts +0 -5
- package/dist/handlers/index.d.ts.map +0 -1
- package/dist/handlers/index.js +0 -5
- package/dist/handlers/index.js.map +0 -1
- package/dist/handlers/sse.d.ts +0 -91
- package/dist/handlers/sse.d.ts.map +0 -1
- package/dist/handlers/sse.js +0 -213
- package/dist/handlers/sse.js.map +0 -1
- package/dist/handlers/stream.d.ts +0 -52
- package/dist/handlers/stream.d.ts.map +0 -1
- package/dist/handlers/stream.js +0 -116
- package/dist/handlers/stream.js.map +0 -1
- package/dist/handlers/websocket.d.ts +0 -49
- package/dist/handlers/websocket.d.ts.map +0 -1
- package/dist/handlers/websocket.js +0 -143
- package/dist/handlers/websocket.js.map +0 -1
- package/dist/index.d.ts +0 -71
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -58
- package/dist/index.js.map +0 -1
- package/dist/logger/console.d.ts +0 -70
- package/dist/logger/console.d.ts.map +0 -1
- package/dist/logger/console.js +0 -274
- package/dist/logger/console.js.map +0 -1
- package/dist/logger/index.d.ts +0 -3
- package/dist/logger/index.d.ts.map +0 -1
- package/dist/logger/index.js +0 -3
- package/dist/logger/index.js.map +0 -1
- package/dist/logger/internal.d.ts +0 -79
- package/dist/logger/internal.d.ts.map +0 -1
- package/dist/logger/internal.js +0 -133
- package/dist/logger/internal.js.map +0 -1
- package/dist/logger/logger.d.ts +0 -41
- package/dist/logger/logger.d.ts.map +0 -1
- package/dist/logger/logger.js +0 -2
- package/dist/logger/logger.js.map +0 -1
- package/dist/logger/user.d.ts +0 -8
- package/dist/logger/user.d.ts.map +0 -1
- package/dist/logger/user.js +0 -7
- package/dist/logger/user.js.map +0 -1
- package/dist/logger/util.d.ts +0 -11
- package/dist/logger/util.d.ts.map +0 -1
- package/dist/logger/util.js +0 -77
- package/dist/logger/util.js.map +0 -1
- package/dist/middleware.d.ts +0 -112
- package/dist/middleware.d.ts.map +0 -1
- package/dist/middleware.js +0 -507
- package/dist/middleware.js.map +0 -1
- package/dist/otel/config.d.ts +0 -19
- package/dist/otel/config.d.ts.map +0 -1
- package/dist/otel/config.js +0 -26
- package/dist/otel/config.js.map +0 -1
- package/dist/otel/console.d.ts +0 -33
- package/dist/otel/console.d.ts.map +0 -1
- package/dist/otel/console.js +0 -86
- package/dist/otel/console.js.map +0 -1
- package/dist/otel/exporters/index.d.ts +0 -4
- package/dist/otel/exporters/index.d.ts.map +0 -1
- package/dist/otel/exporters/index.js +0 -4
- package/dist/otel/exporters/index.js.map +0 -1
- package/dist/otel/exporters/jsonl-log-exporter.d.ts +0 -36
- package/dist/otel/exporters/jsonl-log-exporter.d.ts.map +0 -1
- package/dist/otel/exporters/jsonl-log-exporter.js +0 -103
- package/dist/otel/exporters/jsonl-log-exporter.js.map +0 -1
- package/dist/otel/exporters/jsonl-metric-exporter.d.ts +0 -40
- package/dist/otel/exporters/jsonl-metric-exporter.d.ts.map +0 -1
- package/dist/otel/exporters/jsonl-metric-exporter.js +0 -104
- package/dist/otel/exporters/jsonl-metric-exporter.js.map +0 -1
- package/dist/otel/exporters/jsonl-trace-exporter.d.ts +0 -36
- package/dist/otel/exporters/jsonl-trace-exporter.d.ts.map +0 -1
- package/dist/otel/exporters/jsonl-trace-exporter.js +0 -111
- package/dist/otel/exporters/jsonl-trace-exporter.js.map +0 -1
- package/dist/otel/fetch.d.ts +0 -12
- package/dist/otel/fetch.d.ts.map +0 -1
- package/dist/otel/fetch.js +0 -82
- package/dist/otel/fetch.js.map +0 -1
- package/dist/otel/http.d.ts +0 -16
- package/dist/otel/http.d.ts.map +0 -1
- package/dist/otel/http.js +0 -44
- package/dist/otel/http.js.map +0 -1
- package/dist/otel/logger.d.ts +0 -37
- package/dist/otel/logger.d.ts.map +0 -1
- package/dist/otel/logger.js +0 -268
- package/dist/otel/logger.js.map +0 -1
- package/dist/otel/otel.d.ts +0 -65
- package/dist/otel/otel.d.ts.map +0 -1
- package/dist/otel/otel.js +0 -261
- package/dist/otel/otel.js.map +0 -1
- package/dist/router.d.ts +0 -100
- package/dist/router.d.ts.map +0 -1
- package/dist/router.js +0 -163
- package/dist/router.js.map +0 -1
- package/dist/services/evalrun/composite.d.ts +0 -21
- package/dist/services/evalrun/composite.d.ts.map +0 -1
- package/dist/services/evalrun/composite.js +0 -26
- package/dist/services/evalrun/composite.js.map +0 -1
- package/dist/services/evalrun/http.d.ts +0 -24
- package/dist/services/evalrun/http.d.ts.map +0 -1
- package/dist/services/evalrun/http.js +0 -86
- package/dist/services/evalrun/http.js.map +0 -1
- package/dist/services/evalrun/index.d.ts +0 -5
- package/dist/services/evalrun/index.d.ts.map +0 -1
- package/dist/services/evalrun/index.js +0 -5
- package/dist/services/evalrun/index.js.map +0 -1
- package/dist/services/evalrun/json.d.ts +0 -21
- package/dist/services/evalrun/json.d.ts.map +0 -1
- package/dist/services/evalrun/json.js +0 -38
- package/dist/services/evalrun/json.js.map +0 -1
- package/dist/services/evalrun/local.d.ts +0 -19
- package/dist/services/evalrun/local.d.ts.map +0 -1
- package/dist/services/evalrun/local.js +0 -22
- package/dist/services/evalrun/local.js.map +0 -1
- package/dist/services/local/_db.d.ts +0 -4
- package/dist/services/local/_db.d.ts.map +0 -1
- package/dist/services/local/_db.js +0 -123
- package/dist/services/local/_db.js.map +0 -1
- package/dist/services/local/_router.d.ts +0 -3
- package/dist/services/local/_router.d.ts.map +0 -1
- package/dist/services/local/_router.js +0 -28
- package/dist/services/local/_router.js.map +0 -1
- package/dist/services/local/_util.d.ts +0 -18
- package/dist/services/local/_util.d.ts.map +0 -1
- package/dist/services/local/_util.js +0 -44
- package/dist/services/local/_util.js.map +0 -1
- package/dist/services/local/index.d.ts +0 -7
- package/dist/services/local/index.d.ts.map +0 -1
- package/dist/services/local/index.js +0 -7
- package/dist/services/local/index.js.map +0 -1
- package/dist/services/local/keyvalue.d.ts +0 -17
- package/dist/services/local/keyvalue.d.ts.map +0 -1
- package/dist/services/local/keyvalue.js +0 -125
- package/dist/services/local/keyvalue.js.map +0 -1
- package/dist/services/local/stream.d.ts +0 -12
- package/dist/services/local/stream.d.ts.map +0 -1
- package/dist/services/local/stream.js +0 -262
- package/dist/services/local/stream.js.map +0 -1
- package/dist/services/local/vector.d.ts +0 -17
- package/dist/services/local/vector.d.ts.map +0 -1
- package/dist/services/local/vector.js +0 -303
- package/dist/services/local/vector.js.map +0 -1
- package/dist/services/sandbox/http.d.ts +0 -13
- package/dist/services/sandbox/http.d.ts.map +0 -1
- package/dist/services/sandbox/http.js +0 -130
- package/dist/services/sandbox/http.js.map +0 -1
- package/dist/services/sandbox/index.d.ts +0 -2
- package/dist/services/sandbox/index.d.ts.map +0 -1
- package/dist/services/sandbox/index.js +0 -2
- package/dist/services/sandbox/index.js.map +0 -1
- package/dist/services/session/composite.d.ts +0 -21
- package/dist/services/session/composite.d.ts.map +0 -1
- package/dist/services/session/composite.js +0 -26
- package/dist/services/session/composite.js.map +0 -1
- package/dist/services/session/http.d.ts +0 -34
- package/dist/services/session/http.d.ts.map +0 -1
- package/dist/services/session/http.js +0 -80
- package/dist/services/session/http.js.map +0 -1
- package/dist/services/session/index.d.ts +0 -5
- package/dist/services/session/index.d.ts.map +0 -1
- package/dist/services/session/index.js +0 -5
- package/dist/services/session/index.js.map +0 -1
- package/dist/services/session/json.d.ts +0 -22
- package/dist/services/session/json.d.ts.map +0 -1
- package/dist/services/session/json.js +0 -35
- package/dist/services/session/json.js.map +0 -1
- package/dist/services/session/local.d.ts +0 -19
- package/dist/services/session/local.d.ts.map +0 -1
- package/dist/services/session/local.js +0 -23
- package/dist/services/session/local.js.map +0 -1
- package/dist/services/thread/local.d.ts +0 -20
- package/dist/services/thread/local.d.ts.map +0 -1
- package/dist/services/thread/local.js +0 -158
- package/dist/services/thread/local.js.map +0 -1
- package/dist/session.d.ts +0 -734
- package/dist/session.d.ts.map +0 -1
- package/dist/session.js +0 -1139
- package/dist/session.js.map +0 -1
- package/dist/validator.d.ts +0 -142
- package/dist/validator.d.ts.map +0 -1
- package/dist/validator.js +0 -149
- package/dist/validator.js.map +0 -1
- package/dist/web.d.ts +0 -8
- package/dist/web.d.ts.map +0 -1
- package/dist/web.js +0 -66
- package/dist/web.js.map +0 -1
- package/dist/workbench.d.ts +0 -17
- package/dist/workbench.d.ts.map +0 -1
- package/dist/workbench.js +0 -507
- package/dist/workbench.js.map +0 -1
package/dist/otel/console.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { SeverityNumber } from '@opentelemetry/api-logs';
|
|
2
|
-
import { ExportResultCode } from '@opentelemetry/core';
|
|
3
|
-
import { __originalConsole } from './logger';
|
|
4
|
-
/**
|
|
5
|
-
* Console implementation of the LogRecordExporter interface
|
|
6
|
-
* Uses __originalConsole to avoid infinite loop when console is patched
|
|
7
|
-
*/
|
|
8
|
-
export class ConsoleLogRecordExporter {
|
|
9
|
-
dumpRecords = false;
|
|
10
|
-
constructor(dumpRecords) {
|
|
11
|
-
this.dumpRecords = dumpRecords;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Exports log records to the console
|
|
15
|
-
*
|
|
16
|
-
* @param logs - The log records to export
|
|
17
|
-
* @param resultCallback - Callback function to report the export result
|
|
18
|
-
*/
|
|
19
|
-
export(logs, resultCallback) {
|
|
20
|
-
for (const log of logs) {
|
|
21
|
-
if (this.dumpRecords) {
|
|
22
|
-
__originalConsole.log('[LOG]', {
|
|
23
|
-
body: log.body,
|
|
24
|
-
severityNumber: log.severityNumber,
|
|
25
|
-
severityText: log.severityText,
|
|
26
|
-
timestamp: log.hrTime,
|
|
27
|
-
attributes: log.attributes,
|
|
28
|
-
resource: log.resource.attributes,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
const severity = log.severityNumber ? SeverityNumber[log.severityNumber] : 'INFO';
|
|
33
|
-
const msg = `[${severity}] ${log.body}`;
|
|
34
|
-
switch (log.severityNumber) {
|
|
35
|
-
case SeverityNumber.DEBUG:
|
|
36
|
-
__originalConsole.debug(msg);
|
|
37
|
-
break;
|
|
38
|
-
case SeverityNumber.INFO:
|
|
39
|
-
__originalConsole.info(msg);
|
|
40
|
-
break;
|
|
41
|
-
case SeverityNumber.WARN:
|
|
42
|
-
__originalConsole.warn(msg);
|
|
43
|
-
break;
|
|
44
|
-
case SeverityNumber.ERROR:
|
|
45
|
-
__originalConsole.error(msg);
|
|
46
|
-
break;
|
|
47
|
-
default:
|
|
48
|
-
__originalConsole.log(msg);
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Shuts down the exporter
|
|
57
|
-
*
|
|
58
|
-
* @returns A promise that resolves when shutdown is complete
|
|
59
|
-
*/
|
|
60
|
-
shutdown() {
|
|
61
|
-
return Promise.resolve();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Console implementation of the SpanExporter interface
|
|
66
|
-
* Uses __originalConsole to avoid infinite loop when console is patched
|
|
67
|
-
*/
|
|
68
|
-
export class DebugSpanExporter {
|
|
69
|
-
export(spans, resultCallback) {
|
|
70
|
-
for (const span of spans) {
|
|
71
|
-
__originalConsole.log('[SPAN]', {
|
|
72
|
-
name: span.name,
|
|
73
|
-
traceId: span.spanContext().traceId,
|
|
74
|
-
spanId: span.spanContext().spanId,
|
|
75
|
-
duration: span.duration,
|
|
76
|
-
status: span.status,
|
|
77
|
-
attributes: span.attributes,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
81
|
-
}
|
|
82
|
-
shutdown() {
|
|
83
|
-
return Promise.resolve();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=console.js.map
|
package/dist/otel/console.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"console.js","sourceRoot":"","sources":["../../src/otel/console.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAqB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C;;;GAGG;AACH,MAAM,OAAO,wBAAwB;IAC5B,WAAW,GAAG,KAAK,CAAC;IAE5B,YAAY,WAAoB;QAC/B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IAChC,CAAC;IACD;;;;;OAKG;IACH,MAAM,CAAC,IAAyB,EAAE,cAA8C;QAC/E,KAAK,MAAM,GAAG,IAAI,IAAI,E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;QACP,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;CACD;AAED;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IAC7B,MAAM,CAAC,KAAqB,EAAE,cAA8C;QAC3E,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YAC1B,iBAAiB,CAAC,GAAG,CAAC,QAAQ,EAAE;gBAC/B,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO;gBACnC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM;gBACjC,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,UAAU,EAAE,IAAI,CAAC,UAAU;aAC3B,CAAC,CAAC;QACJ,CAAC;QACD,cAAc,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,QAAQ;QACP,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;CACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/otel/exporters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/otel/exporters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { type ExportResult } from '@opentelemetry/core';
|
|
2
|
-
import type { LogRecordExporter, ReadableLogRecord } from '@opentelemetry/sdk-logs';
|
|
3
|
-
/**
|
|
4
|
-
* JSONL implementation of the LogRecordExporter interface
|
|
5
|
-
* Writes logs to a timestamped JSONL file
|
|
6
|
-
*/
|
|
7
|
-
export declare class JSONLLogExporter implements LogRecordExporter {
|
|
8
|
-
private currentFile;
|
|
9
|
-
private readonly basePath;
|
|
10
|
-
private readonly filePrefix;
|
|
11
|
-
/**
|
|
12
|
-
* Creates a new JSONL log record exporter
|
|
13
|
-
* @param basePath - Directory to store the JSONL files
|
|
14
|
-
*/
|
|
15
|
-
constructor(basePath: string);
|
|
16
|
-
private ensureDirectory;
|
|
17
|
-
private getOrCreateFile;
|
|
18
|
-
/**
|
|
19
|
-
* Exports log records to a JSONL file
|
|
20
|
-
*
|
|
21
|
-
* @param logs - The log records to export
|
|
22
|
-
* @param resultCallback - Callback function to report the export result
|
|
23
|
-
*/
|
|
24
|
-
export(logs: ReadableLogRecord[], resultCallback: (result: ExportResult) => void): void;
|
|
25
|
-
/**
|
|
26
|
-
* Shuts down the exporter
|
|
27
|
-
*
|
|
28
|
-
* @returns A promise that resolves when shutdown is complete
|
|
29
|
-
*/
|
|
30
|
-
shutdown(): Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* Forces a flush of any pending data
|
|
33
|
-
*/
|
|
34
|
-
forceFlush(): Promise<void>;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=jsonl-log-exporter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonl-log-exporter.d.ts","sourceRoot":"","sources":["../../../src/otel/exporters/jsonl-log-exporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAoB,MAAM,qBAAqB,CAAC;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAKpF;;;GAGG;AACH,qBAAa,gBAAiB,YAAW,iBAAiB;IACzD,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IAEpC;;;OAGG;gBACS,QAAQ,EAAE,MAAM;IAM5B,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,eAAe;IAavB;;;;;OAKG;IACH,MAAM,CAAC,IAAI,EAAE,iBAAiB,EAAE,EAAE,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI;IA+CvF;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAGjC"}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { ExportResultCode } from '@opentelemetry/core';
|
|
2
|
-
import { existsSync, appendFileSync, mkdirSync } from 'node:fs';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { randomUUID } from 'node:crypto';
|
|
5
|
-
/**
|
|
6
|
-
* JSONL implementation of the LogRecordExporter interface
|
|
7
|
-
* Writes logs to a timestamped JSONL file
|
|
8
|
-
*/
|
|
9
|
-
export class JSONLLogExporter {
|
|
10
|
-
currentFile = null;
|
|
11
|
-
basePath;
|
|
12
|
-
filePrefix;
|
|
13
|
-
/**
|
|
14
|
-
* Creates a new JSONL log record exporter
|
|
15
|
-
* @param basePath - Directory to store the JSONL files
|
|
16
|
-
*/
|
|
17
|
-
constructor(basePath) {
|
|
18
|
-
this.basePath = basePath;
|
|
19
|
-
this.filePrefix = 'otel-log';
|
|
20
|
-
this.ensureDirectory();
|
|
21
|
-
}
|
|
22
|
-
ensureDirectory() {
|
|
23
|
-
if (!existsSync(this.basePath)) {
|
|
24
|
-
mkdirSync(this.basePath, { recursive: true });
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
getOrCreateFile() {
|
|
28
|
-
// If current file exists, use it
|
|
29
|
-
if (this.currentFile && existsSync(this.currentFile)) {
|
|
30
|
-
return this.currentFile;
|
|
31
|
-
}
|
|
32
|
-
this.currentFile = join(this.basePath, `${this.filePrefix}-${Date.now()}.${randomUUID()}.jsonl`);
|
|
33
|
-
return this.currentFile;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Exports log records to a JSONL file
|
|
37
|
-
*
|
|
38
|
-
* @param logs - The log records to export
|
|
39
|
-
* @param resultCallback - Callback function to report the export result
|
|
40
|
-
*/
|
|
41
|
-
export(logs, resultCallback) {
|
|
42
|
-
try {
|
|
43
|
-
if (logs.length === 0) {
|
|
44
|
-
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const file = this.getOrCreateFile();
|
|
48
|
-
const lines = [];
|
|
49
|
-
for (const log of logs) {
|
|
50
|
-
const record = {
|
|
51
|
-
timestamp: log.hrTime,
|
|
52
|
-
observedTimestamp: log.hrTimeObserved,
|
|
53
|
-
severityNumber: log.severityNumber,
|
|
54
|
-
severityText: log.severityText,
|
|
55
|
-
body: log.body,
|
|
56
|
-
attributes: log.attributes,
|
|
57
|
-
resource: log.resource.attributes,
|
|
58
|
-
instrumentationScope: log.instrumentationScope,
|
|
59
|
-
spanContext: log.spanContext,
|
|
60
|
-
};
|
|
61
|
-
lines.push(JSON.stringify(record));
|
|
62
|
-
}
|
|
63
|
-
const payload = `${lines.join('\n')}\n`;
|
|
64
|
-
try {
|
|
65
|
-
appendFileSync(file, payload, 'utf-8');
|
|
66
|
-
}
|
|
67
|
-
catch (err) {
|
|
68
|
-
// File may have been deleted, reset and retry once
|
|
69
|
-
const code = err.code;
|
|
70
|
-
if (code === 'ENOENT') {
|
|
71
|
-
this.currentFile = null;
|
|
72
|
-
const newFile = this.getOrCreateFile();
|
|
73
|
-
appendFileSync(newFile, payload, 'utf-8');
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
throw err;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
resultCallback({
|
|
83
|
-
code: ExportResultCode.FAILED,
|
|
84
|
-
error: error instanceof Error ? error : new Error(String(error)),
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Shuts down the exporter
|
|
90
|
-
*
|
|
91
|
-
* @returns A promise that resolves when shutdown is complete
|
|
92
|
-
*/
|
|
93
|
-
async shutdown() {
|
|
94
|
-
this.currentFile = null;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Forces a flush of any pending data
|
|
98
|
-
*/
|
|
99
|
-
async forceFlush() {
|
|
100
|
-
// No-op for file-based exporter as writes are synchronous
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=jsonl-log-exporter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonl-log-exporter.js","sourceRoot":"","sources":["../../../src/otel/exporters/jsonl-log-exporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE1E,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IACpB,WAAW,GAAkB,IAAI,CAAC;IACzB,QAAQ,CAAS;IACjB,UAAU,CAAS;IAEpC;;;OAGG;IACH,YAAY,QAAgB;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,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D,CAAC;CACD"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { type ExportResult } from '@opentelemetry/core';
|
|
2
|
-
import { type PushMetricExporter, type ResourceMetrics, AggregationTemporality, InstrumentType } from '@opentelemetry/sdk-metrics';
|
|
3
|
-
/**
|
|
4
|
-
* JSONL implementation of the PushMetricExporter interface
|
|
5
|
-
* Writes metrics to a timestamped JSONL file
|
|
6
|
-
*/
|
|
7
|
-
export declare class JSONLMetricExporter implements PushMetricExporter {
|
|
8
|
-
private currentFile;
|
|
9
|
-
private readonly basePath;
|
|
10
|
-
private readonly filePrefix;
|
|
11
|
-
/**
|
|
12
|
-
* Creates a new JSONL metric exporter
|
|
13
|
-
* @param basePath - Directory to store the JSONL files
|
|
14
|
-
*/
|
|
15
|
-
constructor(basePath: string);
|
|
16
|
-
private ensureDirectory;
|
|
17
|
-
private getOrCreateFile;
|
|
18
|
-
/**
|
|
19
|
-
* Exports metrics to a JSONL file
|
|
20
|
-
*
|
|
21
|
-
* @param metrics - The resource metrics to export
|
|
22
|
-
* @param resultCallback - Callback function to report the export result
|
|
23
|
-
*/
|
|
24
|
-
export(metrics: ResourceMetrics, resultCallback: (result: ExportResult) => void): void;
|
|
25
|
-
/**
|
|
26
|
-
* Shuts down the exporter
|
|
27
|
-
*
|
|
28
|
-
* @returns A promise that resolves when shutdown is complete
|
|
29
|
-
*/
|
|
30
|
-
shutdown(): Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* Forces a flush of any pending data
|
|
33
|
-
*/
|
|
34
|
-
forceFlush(): Promise<void>;
|
|
35
|
-
/**
|
|
36
|
-
* Selects the aggregation temporality for the given instrument type
|
|
37
|
-
*/
|
|
38
|
-
selectAggregationTemporality?(_instrumentType: InstrumentType): AggregationTemporality;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=jsonl-metric-exporter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonl-metric-exporter.d.ts","sourceRoot":"","sources":["../../../src/otel/exporters/jsonl-metric-exporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAoB,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,sBAAsB,EACtB,cAAc,EACd,MAAM,4BAA4B,CAAC;AAKpC;;;GAGG;AACH,qBAAa,mBAAoB,YAAW,kBAAkB;IAC7D,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IAEpC;;;OAGG;gBACS,QAAQ,EAAE,MAAM;IAM5B,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,eAAe;IAavB;;;;;OAKG;IACH,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI;IAyCtF;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAIjC;;OAEG;IACH,4BAA4B,CAAC,CAAC,eAAe,EAAE,cAAc,GAAG,sBAAsB;CAItF"}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { ExportResultCode } from '@opentelemetry/core';
|
|
2
|
-
import { AggregationTemporality, } from '@opentelemetry/sdk-metrics';
|
|
3
|
-
import { existsSync, appendFileSync, mkdirSync } from 'node:fs';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
import { randomUUID } from 'node:crypto';
|
|
6
|
-
/**
|
|
7
|
-
* JSONL implementation of the PushMetricExporter interface
|
|
8
|
-
* Writes metrics to a timestamped JSONL file
|
|
9
|
-
*/
|
|
10
|
-
export class JSONLMetricExporter {
|
|
11
|
-
currentFile = null;
|
|
12
|
-
basePath;
|
|
13
|
-
filePrefix;
|
|
14
|
-
/**
|
|
15
|
-
* Creates a new JSONL metric exporter
|
|
16
|
-
* @param basePath - Directory to store the JSONL files
|
|
17
|
-
*/
|
|
18
|
-
constructor(basePath) {
|
|
19
|
-
this.basePath = basePath;
|
|
20
|
-
this.filePrefix = 'otel-metric';
|
|
21
|
-
this.ensureDirectory();
|
|
22
|
-
}
|
|
23
|
-
ensureDirectory() {
|
|
24
|
-
if (!existsSync(this.basePath)) {
|
|
25
|
-
mkdirSync(this.basePath, { recursive: true });
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
getOrCreateFile() {
|
|
29
|
-
// If current file exists, use it
|
|
30
|
-
if (this.currentFile && existsSync(this.currentFile)) {
|
|
31
|
-
return this.currentFile;
|
|
32
|
-
}
|
|
33
|
-
this.currentFile = join(this.basePath, `${this.filePrefix}-${Date.now()}.${randomUUID()}.jsonl`);
|
|
34
|
-
return this.currentFile;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Exports metrics to a JSONL file
|
|
38
|
-
*
|
|
39
|
-
* @param metrics - The resource metrics to export
|
|
40
|
-
* @param resultCallback - Callback function to report the export result
|
|
41
|
-
*/
|
|
42
|
-
export(metrics, resultCallback) {
|
|
43
|
-
try {
|
|
44
|
-
const file = this.getOrCreateFile();
|
|
45
|
-
const record = {
|
|
46
|
-
resource: metrics.resource.attributes,
|
|
47
|
-
scopeMetrics: metrics.scopeMetrics.map((sm) => ({
|
|
48
|
-
scope: sm.scope,
|
|
49
|
-
metrics: sm.metrics.map((m) => ({
|
|
50
|
-
descriptor: m.descriptor,
|
|
51
|
-
dataPointType: m.dataPointType,
|
|
52
|
-
dataPoints: m.dataPoints,
|
|
53
|
-
aggregationTemporality: m.aggregationTemporality,
|
|
54
|
-
})),
|
|
55
|
-
})),
|
|
56
|
-
};
|
|
57
|
-
const line = JSON.stringify(record) + '\n';
|
|
58
|
-
try {
|
|
59
|
-
appendFileSync(file, line, 'utf-8');
|
|
60
|
-
}
|
|
61
|
-
catch (err) {
|
|
62
|
-
// File may have been deleted, reset and retry once
|
|
63
|
-
const code = err.code;
|
|
64
|
-
if (code === 'ENOENT') {
|
|
65
|
-
this.currentFile = null;
|
|
66
|
-
const newFile = this.getOrCreateFile();
|
|
67
|
-
appendFileSync(newFile, line, 'utf-8');
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
throw err;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
resultCallback({
|
|
77
|
-
code: ExportResultCode.FAILED,
|
|
78
|
-
error: error instanceof Error ? error : new Error(String(error)),
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Shuts down the exporter
|
|
84
|
-
*
|
|
85
|
-
* @returns A promise that resolves when shutdown is complete
|
|
86
|
-
*/
|
|
87
|
-
async shutdown() {
|
|
88
|
-
this.currentFile = null;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Forces a flush of any pending data
|
|
92
|
-
*/
|
|
93
|
-
async forceFlush() {
|
|
94
|
-
// No-op for file-based exporter as writes are synchronous
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Selects the aggregation temporality for the given instrument type
|
|
98
|
-
*/
|
|
99
|
-
selectAggregationTemporality(_instrumentType) {
|
|
100
|
-
// Default to cumulative temporality
|
|
101
|
-
return AggregationTemporality.CUMULATIVE;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
//# sourceMappingURL=jsonl-metric-exporter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonl-metric-exporter.js","sourceRoot":"","sources":["../../../src/otel/exporters/jsonl-metric-exporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAGN,sBAAsB,GAEtB,MAAM,4BAA4B,CAAC;AACpC,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aAChE,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ;QACb,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU;QACf,0DAA0D;IAC3D,CAAC;IAED;;OAEG;IACH,4BAA4B,CAAE,eAA+B;QAC5D,oCAAoC;QACpC,OAAO,sBAAsB,CAAC,UAAU,CAAC;IAC1C,CAAC;CACD"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { type ExportResult } from '@opentelemetry/core';
|
|
2
|
-
import type { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
3
|
-
/**
|
|
4
|
-
* JSONL implementation of the SpanExporter interface
|
|
5
|
-
* Writes traces to a timestamped JSONL file
|
|
6
|
-
*/
|
|
7
|
-
export declare class JSONLTraceExporter implements SpanExporter {
|
|
8
|
-
private currentFile;
|
|
9
|
-
private readonly basePath;
|
|
10
|
-
private readonly filePrefix;
|
|
11
|
-
/**
|
|
12
|
-
* Creates a new JSONL trace exporter
|
|
13
|
-
* @param basePath - Directory to store the JSONL files
|
|
14
|
-
*/
|
|
15
|
-
constructor(basePath: string);
|
|
16
|
-
private ensureDirectory;
|
|
17
|
-
private getOrCreateFile;
|
|
18
|
-
/**
|
|
19
|
-
* Exports spans to a JSONL file
|
|
20
|
-
*
|
|
21
|
-
* @param spans - The spans to export
|
|
22
|
-
* @param resultCallback - Callback function to report the export result
|
|
23
|
-
*/
|
|
24
|
-
export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void;
|
|
25
|
-
/**
|
|
26
|
-
* Shuts down the exporter
|
|
27
|
-
*
|
|
28
|
-
* @returns A promise that resolves when shutdown is complete
|
|
29
|
-
*/
|
|
30
|
-
shutdown(): Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* Forces a flush of any pending data
|
|
33
|
-
*/
|
|
34
|
-
forceFlush(): Promise<void>;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=jsonl-trace-exporter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonl-trace-exporter.d.ts","sourceRoot":"","sources":["../../../src/otel/exporters/jsonl-trace-exporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAoB,MAAM,qBAAqB,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAKhF;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,YAAY;IACtD,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IAEpC;;;OAGG;gBACS,QAAQ,EAAE,MAAM;IAM5B,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,eAAe;IAavB;;;;;OAKG;IACH,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI;IAuDnF;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAGjC"}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { ExportResultCode } from '@opentelemetry/core';
|
|
2
|
-
import { existsSync, appendFileSync, mkdirSync } from 'node:fs';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { randomUUID } from 'node:crypto';
|
|
5
|
-
/**
|
|
6
|
-
* JSONL implementation of the SpanExporter interface
|
|
7
|
-
* Writes traces to a timestamped JSONL file
|
|
8
|
-
*/
|
|
9
|
-
export class JSONLTraceExporter {
|
|
10
|
-
currentFile = null;
|
|
11
|
-
basePath;
|
|
12
|
-
filePrefix;
|
|
13
|
-
/**
|
|
14
|
-
* Creates a new JSONL trace exporter
|
|
15
|
-
* @param basePath - Directory to store the JSONL files
|
|
16
|
-
*/
|
|
17
|
-
constructor(basePath) {
|
|
18
|
-
this.basePath = basePath;
|
|
19
|
-
this.filePrefix = 'otel-trace';
|
|
20
|
-
this.ensureDirectory();
|
|
21
|
-
}
|
|
22
|
-
ensureDirectory() {
|
|
23
|
-
if (!existsSync(this.basePath)) {
|
|
24
|
-
mkdirSync(this.basePath, { recursive: true });
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
getOrCreateFile() {
|
|
28
|
-
// If current file exists, use it
|
|
29
|
-
if (this.currentFile && existsSync(this.currentFile)) {
|
|
30
|
-
return this.currentFile;
|
|
31
|
-
}
|
|
32
|
-
this.currentFile = join(this.basePath, `${this.filePrefix}-${Date.now()}.${randomUUID()}.jsonl`);
|
|
33
|
-
return this.currentFile;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Exports spans to a JSONL file
|
|
37
|
-
*
|
|
38
|
-
* @param spans - The spans to export
|
|
39
|
-
* @param resultCallback - Callback function to report the export result
|
|
40
|
-
*/
|
|
41
|
-
export(spans, resultCallback) {
|
|
42
|
-
try {
|
|
43
|
-
if (spans.length === 0) {
|
|
44
|
-
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const file = this.getOrCreateFile();
|
|
48
|
-
const lines = [];
|
|
49
|
-
for (const span of spans) {
|
|
50
|
-
const record = {
|
|
51
|
-
traceId: span.spanContext().traceId,
|
|
52
|
-
spanId: span.spanContext().spanId,
|
|
53
|
-
traceState: span.spanContext().traceState?.serialize(),
|
|
54
|
-
name: span.name,
|
|
55
|
-
kind: span.kind,
|
|
56
|
-
startTime: span.startTime,
|
|
57
|
-
endTime: span.endTime,
|
|
58
|
-
attributes: span.attributes,
|
|
59
|
-
status: span.status,
|
|
60
|
-
events: span.events,
|
|
61
|
-
links: span.links,
|
|
62
|
-
resource: span.resource.attributes,
|
|
63
|
-
droppedAttributesCount: span.droppedAttributesCount,
|
|
64
|
-
droppedEventsCount: span.droppedEventsCount,
|
|
65
|
-
droppedLinksCount: span.droppedLinksCount,
|
|
66
|
-
duration: span.duration,
|
|
67
|
-
ended: span.ended,
|
|
68
|
-
};
|
|
69
|
-
lines.push(JSON.stringify(record));
|
|
70
|
-
}
|
|
71
|
-
const payload = `${lines.join('\n')}\n`;
|
|
72
|
-
try {
|
|
73
|
-
appendFileSync(file, payload, 'utf-8');
|
|
74
|
-
}
|
|
75
|
-
catch (err) {
|
|
76
|
-
// File may have been deleted, reset and retry once
|
|
77
|
-
const code = err.code;
|
|
78
|
-
if (code === 'ENOENT') {
|
|
79
|
-
this.currentFile = null;
|
|
80
|
-
const newFile = this.getOrCreateFile();
|
|
81
|
-
appendFileSync(newFile, payload, 'utf-8');
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
throw err;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
resultCallback({
|
|
91
|
-
code: ExportResultCode.FAILED,
|
|
92
|
-
error: error instanceof Error ? error : new Error(String(error)),
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Shuts down the exporter
|
|
98
|
-
*
|
|
99
|
-
* @returns A promise that resolves when shutdown is complete
|
|
100
|
-
*/
|
|
101
|
-
async shutdown() {
|
|
102
|
-
this.currentFile = null;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Forces a flush of any pending data
|
|
106
|
-
*/
|
|
107
|
-
async forceFlush() {
|
|
108
|
-
// No-op for file-based exporter as writes are synchronous
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
//# sourceMappingURL=jsonl-trace-exporter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonl-trace-exporter.js","sourceRoot":"","sources":["../../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EAAE,OAAO,CAAC,CAAC;YACxC,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACd,mDAAmD;gBACnD,MAAM,IAAI,GAAI,GAA6B,CAAC,IAAI,CAAC;gBACjD,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;oBACvB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;oBACxB,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;oBACvC,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;gBAC3C,CAAC;qBAAM,CAAC;oBACP,MAAM,GAAG,CAAC;gBACX,CAAC;YACF,CAAC;YAED,cAAc,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC;QACpD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,cAAc,CAAC;gBACd,IAAI,EAAE,gBAAgB,CAAC,MAAM;gBAC7B,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;aAChE,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ;QACb,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU;QACf,0DAA0D;IAC3D,CAAC;CACD"}
|
package/dist/otel/fetch.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reference to the original fetch function before instrumentation
|
|
3
|
-
*/
|
|
4
|
-
export declare const __originalFetch: typeof fetch;
|
|
5
|
-
/**
|
|
6
|
-
* Instruments the global fetch function with OpenTelemetry tracing
|
|
7
|
-
*
|
|
8
|
-
* Replaces the global fetch with an instrumented version that creates spans
|
|
9
|
-
* for each HTTP request and propagates trace context in headers
|
|
10
|
-
*/
|
|
11
|
-
export declare function instrumentFetch(): void;
|
|
12
|
-
//# sourceMappingURL=fetch.d.ts.map
|
package/dist/otel/fetch.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/otel/fetch.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,eAAe,cAAQ,CAAC;AAErC;;;;;GAKG;AACH,wBAAgB,eAAe,SA2F9B"}
|