@blaxel/telemetry 0.2.0-preview2 → 0.2.0-preview4

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.
@@ -39,19 +39,19 @@ function formatLogMessage(severity, message, args) {
39
39
  const messageStr = typeof message === "string" ? message : (0, core_1.stringify)(message, 2);
40
40
  const argsStr = args.map(arg => typeof arg === "string" ? arg : (0, core_1.stringify)(arg, 2)).join(" ");
41
41
  let msg = `${messageStr}${argsStr ? " " + argsStr : ""}`;
42
- return JSON.stringify({
42
+ const logEntry = {
43
43
  message: msg,
44
- severity,
45
- labels: getLabels()
46
- });
47
- }
48
- function getLabels() {
44
+ severity
45
+ };
49
46
  const currentSpan = api_1.trace.getActiveSpan();
50
47
  if (currentSpan) {
51
48
  const { traceId, spanId } = currentSpan.spanContext();
52
- return {
53
- "trace-id": traceId,
54
- "span-id": spanId
55
- };
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
+ logEntry[traceIdName] = `${traceIdPrefix}${traceId}`;
54
+ logEntry[spanIdName] = `${spanIdPrefix}${spanId}`;
56
55
  }
56
+ return JSON.stringify(logEntry);
57
57
  }
package/dist/telemetry.js CHANGED
@@ -122,10 +122,7 @@ class TelemetryManager {
122
122
  setupSignalHandler() {
123
123
  const signals = ["SIGINT", "SIGTERM", "uncaughtException", "exit"];
124
124
  for (const signal of signals) {
125
- process.on(signal, (error) => {
126
- if (signal !== "exit") {
127
- core_1.logger.error(error);
128
- }
125
+ process.on(signal, () => {
129
126
  this.shutdownApp().catch((error) => {
130
127
  core_1.logger.debug("Fatal error during shutdown:", error);
131
128
  process.exit(0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaxel/telemetry",
3
- "version": "0.2.0-preview2",
3
+ "version": "0.2.0-preview4",
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.0-preview2"
74
+ "@blaxel/core": "0.2.0-preview4"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@eslint/js": "^9.26.0",
@@ -81,6 +81,7 @@
81
81
  },
82
82
  "scripts": {
83
83
  "build": "tsc",
84
+ "dev": "tsc --watch",
84
85
  "lint": "eslint src/"
85
86
  }
86
87
  }