@moostjs/otel 0.6.42 → 0.6.44

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.cjs CHANGED
@@ -64,7 +64,7 @@ const spanStack = [];
64
64
  getSpan,
65
65
  getSpanContext,
66
66
  getPropagationHeaders,
67
- registerSpan: (span) => _ctx.set(otelSpanKey, span),
67
+ registerSpan: (span) => _ctx.setOwn(otelSpanKey, span),
68
68
  pushSpan,
69
69
  customSpanAttr,
70
70
  customMetricAttr
@@ -241,6 +241,10 @@ const tracer = _opentelemetry_api.trace.getTracer("moost-tracer");
241
241
  if (method === "WF_STEP") return;
242
242
  if (method === "__SYSTEM__") return;
243
243
  const ctx = (0, moost.current)();
244
+ if (!ctx.hasOwn(otelSpanKey) && ctx.has(otelSpanKey)) {
245
+ if (name !== "Controller:registered") ctx.set(otelRouteKey, route);
246
+ return;
247
+ }
244
248
  const { getSpan } = useOtelContext(ctx);
245
249
  if (name === "Handler:not_found") {
246
250
  const chm = this.getControllerHandlerMeta();
package/dist/index.mjs CHANGED
@@ -63,7 +63,7 @@ const spanStack = [];
63
63
  getSpan,
64
64
  getSpanContext,
65
65
  getPropagationHeaders,
66
- registerSpan: (span) => _ctx.set(otelSpanKey, span),
66
+ registerSpan: (span) => _ctx.setOwn(otelSpanKey, span),
67
67
  pushSpan,
68
68
  customSpanAttr,
69
69
  customMetricAttr
@@ -240,6 +240,10 @@ const tracer = trace.getTracer("moost-tracer");
240
240
  if (method === "WF_STEP") return;
241
241
  if (method === "__SYSTEM__") return;
242
242
  const ctx = current();
243
+ if (!ctx.hasOwn(otelSpanKey) && ctx.has(otelSpanKey)) {
244
+ if (name !== "Controller:registered") ctx.set(otelRouteKey, route);
245
+ return;
246
+ }
243
247
  const { getSpan } = useOtelContext(ctx);
244
248
  if (name === "Handler:not_found") {
245
249
  const chm = this.getControllerHandlerMeta();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moostjs/otel",
3
- "version": "0.6.42",
3
+ "version": "0.6.44",
4
4
  "description": "@moostjs/otel",
5
5
  "keywords": [
6
6
  "composables",
@@ -45,9 +45,9 @@
45
45
  "vitest": "3.2.7"
46
46
  },
47
47
  "peerDependencies": {
48
- "@wooksjs/event-core": "^0.7.25",
49
- "@moostjs/event-http": "^0.6.42",
50
- "moost": "^0.6.42"
48
+ "@wooksjs/event-core": "^0.7.26",
49
+ "@moostjs/event-http": "^0.6.44",
50
+ "moost": "^0.6.44"
51
51
  },
52
52
  "scripts": {
53
53
  "pub": "pnpm publish --access public",