@blaxel/telemetry 0.2.2 → 0.2.3-dev.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -2
- package/dist/json_logger.js +18 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.blaxelTelemetry = void 0;
|
|
4
|
-
// import { settings } from "@blaxel/core";
|
|
5
|
-
// import { setJsonLogger } from "./json_logger";
|
|
6
4
|
const legacy_logger_1 = require("./legacy_logger");
|
|
7
5
|
const telemetry_1 = require("./telemetry");
|
|
8
6
|
Object.defineProperty(exports, "blaxelTelemetry", { enumerable: true, get: function () { return telemetry_1.blaxelTelemetry; } });
|
|
9
7
|
telemetry_1.blaxelTelemetry.initialize();
|
|
8
|
+
// if (settings.loggerType === "http") {
|
|
10
9
|
(0, legacy_logger_1.setLegacyLogger)();
|
package/dist/json_logger.js
CHANGED
|
@@ -34,6 +34,15 @@ exports.originalLogger = {
|
|
|
34
34
|
debug: console.debug,
|
|
35
35
|
log: console.log,
|
|
36
36
|
};
|
|
37
|
+
const traceIdName = core_1.env.BL_LOGGER_TRACE_ID || 'trace_id';
|
|
38
|
+
const spanIdName = core_1.env.BL_LOGGER_SPAN_ID || 'span_id';
|
|
39
|
+
const labelsName = core_1.env.BL_LOGGER_LABELS || 'labels';
|
|
40
|
+
const traceIdPrefix = core_1.env.BL_LOGGER_TRACE_ID_PREFIX || '';
|
|
41
|
+
const spanIdPrefix = core_1.env.BL_LOGGER_SPAN_ID_PREFIX || '';
|
|
42
|
+
const taskIndex = core_1.env.BL_TASK_KEY || 'TASK_INDEX';
|
|
43
|
+
const taskPrefix = core_1.env.BL_TASK_PREFIX || '';
|
|
44
|
+
const executionKey = core_1.env.BL_EXECUTION_KEY || 'BL_EXECUTION_ID';
|
|
45
|
+
const executionPrefix = core_1.env.BL_EXECUTION_PREFIX || '';
|
|
37
46
|
// Format a log message with appropriate color and prefix
|
|
38
47
|
function formatLogMessage(severity, message, args) {
|
|
39
48
|
const messageStr = typeof message === "string" ? message : (0, core_1.stringify)(message, 2);
|
|
@@ -43,15 +52,20 @@ function formatLogMessage(severity, message, args) {
|
|
|
43
52
|
message: msg,
|
|
44
53
|
severity
|
|
45
54
|
};
|
|
55
|
+
logEntry[labelsName] = {};
|
|
46
56
|
const currentSpan = api_1.trace.getActiveSpan();
|
|
47
57
|
if (currentSpan) {
|
|
48
58
|
const { traceId, spanId } = currentSpan.spanContext();
|
|
49
|
-
const traceIdName = core_1.env.BL_LOGGER_TRACE_ID || 'trace_id';
|
|
50
|
-
const spanIdName = core_1.env.BL_LOGGER_SPAN_ID || 'span_id';
|
|
51
|
-
const traceIdPrefix = core_1.env.BL_LOGGER_TRACE_ID_PREFIX || '';
|
|
52
|
-
const spanIdPrefix = core_1.env.BL_LOGGER_SPAN_ID_PREFIX || '';
|
|
53
59
|
logEntry[traceIdName] = `${traceIdPrefix}${traceId}`;
|
|
54
60
|
logEntry[spanIdName] = `${spanIdPrefix}${spanId}`;
|
|
55
61
|
}
|
|
62
|
+
const taskId = core_1.env[taskIndex] || null;
|
|
63
|
+
if (taskId) {
|
|
64
|
+
logEntry[labelsName]['blaxel-task'] = `${taskPrefix}${taskId}`;
|
|
65
|
+
}
|
|
66
|
+
const executionId = core_1.env[executionKey] || null;
|
|
67
|
+
if (executionId) {
|
|
68
|
+
logEntry[labelsName]['blaxel-execution'] = `${executionPrefix}${executionId.split('-').pop()}`;
|
|
69
|
+
}
|
|
56
70
|
return JSON.stringify(logEntry);
|
|
57
71
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaxel/telemetry",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3-dev.62",
|
|
4
4
|
"description": "Blaxel SDK for TypeScript",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Blaxel, INC (https://blaxel.ai)",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@opentelemetry/sdk-trace-base": "^2.0.0",
|
|
72
72
|
"@opentelemetry/sdk-trace-node": "^2.0.0",
|
|
73
73
|
"ai": "^4.3.13",
|
|
74
|
-
"@blaxel/core": "0.2.
|
|
74
|
+
"@blaxel/core": "0.2.3-dev.62"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@eslint/js": "^9.26.0",
|