@blaxel/telemetry 0.2.2-dev.54 → 0.2.2-dev.56

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.
Files changed (2) hide show
  1. package/dist/json_logger.js +16 -10
  2. package/package.json +2 -2
@@ -34,6 +34,13 @@ 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_EXECUTION_INDEX_KEY || 'TASK_INDEX';
43
+ const executionKey = core_1.env.BL_EXECUTION_KEY || 'BL_EXECUTION_ID';
37
44
  // Format a log message with appropriate color and prefix
38
45
  function formatLogMessage(severity, message, args) {
39
46
  const messageStr = typeof message === "string" ? message : (0, core_1.stringify)(message, 2);
@@ -43,21 +50,20 @@ function formatLogMessage(severity, message, args) {
43
50
  message: msg,
44
51
  severity
45
52
  };
53
+ logEntry[labelsName] = {};
46
54
  const currentSpan = api_1.trace.getActiveSpan();
47
55
  if (currentSpan) {
48
56
  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 labelsName = core_1.env.BL_LOGGER_LABELS || 'labels';
52
- const traceIdPrefix = core_1.env.BL_LOGGER_TRACE_ID_PREFIX || '';
53
- const spanIdPrefix = core_1.env.BL_LOGGER_SPAN_ID_PREFIX || '';
54
- const taskId = core_1.env.BL_TASK_ID || '';
55
57
  logEntry[traceIdName] = `${traceIdPrefix}${traceId}`;
56
58
  logEntry[spanIdName] = `${spanIdPrefix}${spanId}`;
57
- logEntry[labelsName] = {};
58
- if (taskId) {
59
- logEntry[labelsName].task_id = taskId;
60
- }
59
+ }
60
+ const taskId = core_1.env[taskIndex] || null;
61
+ if (taskId) {
62
+ logEntry[labelsName]['blaxel-task'] = taskId;
63
+ }
64
+ const executionId = core_1.env[executionKey] || null;
65
+ if (executionId) {
66
+ logEntry[labelsName]['blaxel-execution'] = executionId.split('-').pop();
61
67
  }
62
68
  return JSON.stringify(logEntry);
63
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaxel/telemetry",
3
- "version": "0.2.2-dev.54",
3
+ "version": "0.2.2-dev.56",
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.2-dev.54"
74
+ "@blaxel/core": "0.2.2-dev.56"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@eslint/js": "^9.26.0",