@moostjs/otel 0.6.18 → 0.6.20

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
@@ -5,11 +5,11 @@ let _moostjs_event_http = require("@moostjs/event-http");
5
5
  let _opentelemetry_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
6
6
 
7
7
  //#region packages/otel/src/context.ts
8
- /** Event context key storing the root OpenTelemetry span. */ const otelSpanKey = (0, moost.key)("otel.span");
9
- /** Event context key storing the resolved route path for span naming. */ const otelRouteKey = (0, moost.key)("otel.route");
10
- /** Event context key storing the event start time (epoch ms) for duration metrics. */ const otelStartTimeKey = (0, moost.key)("otel.startTime");
11
- /** Event context key storing custom span attributes set via `useOtelContext().customSpanAttr()`. */ const customSpanAttrsKey = (0, moost.key)("customSpanAttrs");
12
- /** Event context key storing custom metric attributes set via `useOtelContext().customMetricAttr()`. */ const customMetricAttrsKey = (0, moost.key)("customMetricAttrs");
8
+ /** Event context key storing the root OpenTelemetry span. */ const otelSpanKey = (0, moost.globalKey)("otel.span");
9
+ /** Event context key storing the resolved route path for span naming. */ const otelRouteKey = (0, moost.globalKey)("otel.route");
10
+ /** Event context key storing the event start time (epoch ms) for duration metrics. */ const otelStartTimeKey = (0, moost.globalKey)("otel.startTime");
11
+ /** Event context key storing custom span attributes set via `useOtelContext().customSpanAttr()`. */ const customSpanAttrsKey = (0, moost.globalKey)("customSpanAttrs");
12
+ /** Event context key storing custom metric attributes set via `useOtelContext().customMetricAttr()`. */ const customMetricAttrsKey = (0, moost.globalKey)("customMetricAttrs");
13
13
  const spanStack = [];
14
14
  /**
15
15
  * Provides OpenTelemetry tracing utilities scoped to the current event.
@@ -61,10 +61,6 @@ const spanStack = [];
61
61
  };
62
62
  return {
63
63
  trace: _opentelemetry_api.trace,
64
- withChildSpan: (name, cb, opts) => {
65
- const span = _opentelemetry_api.trace.getTracer("moost-tracer").startSpan(name, opts);
66
- return () => _opentelemetry_api.context.with(_opentelemetry_api.trace.setSpan(_opentelemetry_api.context.active(), span), cb);
67
- },
68
64
  getSpan,
69
65
  getSpanContext,
70
66
  getPropagationHeaders,
package/dist/index.d.ts CHANGED
@@ -25,7 +25,6 @@ declare const customMetricAttrsKey: moost.Key<Record<string, string | number>>;
25
25
  */
26
26
  declare function useOtelContext(ctx?: EventContext): {
27
27
  trace: _opentelemetry_api.TraceAPI;
28
- withChildSpan: <T>(name: string, cb: (...a: any[]) => T, opts?: SpanOptions) => () => T;
29
28
  getSpan: () => Span | undefined;
30
29
  getSpanContext: () => _opentelemetry_api.SpanContext | undefined;
31
30
  getPropagationHeaders: () => {
package/dist/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  import { SpanKind, SpanStatusCode, context, metrics, trace } from "@opentelemetry/api";
2
- import { ContextInjector, current, eventTypeKey, getConstructor, getMoostMate, key, replaceContextInjector, useControllerContext } from "moost";
2
+ import { ContextInjector, current, eventTypeKey, getConstructor, getMoostMate, globalKey, replaceContextInjector, useControllerContext } from "moost";
3
3
  import { httpKind } from "@moostjs/event-http";
4
4
  import { BatchSpanProcessor, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
5
5
 
6
6
  //#region packages/otel/src/context.ts
7
- /** Event context key storing the root OpenTelemetry span. */ const otelSpanKey = key("otel.span");
8
- /** Event context key storing the resolved route path for span naming. */ const otelRouteKey = key("otel.route");
9
- /** Event context key storing the event start time (epoch ms) for duration metrics. */ const otelStartTimeKey = key("otel.startTime");
10
- /** Event context key storing custom span attributes set via `useOtelContext().customSpanAttr()`. */ const customSpanAttrsKey = key("customSpanAttrs");
11
- /** Event context key storing custom metric attributes set via `useOtelContext().customMetricAttr()`. */ const customMetricAttrsKey = key("customMetricAttrs");
7
+ /** Event context key storing the root OpenTelemetry span. */ const otelSpanKey = globalKey("otel.span");
8
+ /** Event context key storing the resolved route path for span naming. */ const otelRouteKey = globalKey("otel.route");
9
+ /** Event context key storing the event start time (epoch ms) for duration metrics. */ const otelStartTimeKey = globalKey("otel.startTime");
10
+ /** Event context key storing custom span attributes set via `useOtelContext().customSpanAttr()`. */ const customSpanAttrsKey = globalKey("customSpanAttrs");
11
+ /** Event context key storing custom metric attributes set via `useOtelContext().customMetricAttr()`. */ const customMetricAttrsKey = globalKey("customMetricAttrs");
12
12
  const spanStack = [];
13
13
  /**
14
14
  * Provides OpenTelemetry tracing utilities scoped to the current event.
@@ -60,10 +60,6 @@ const spanStack = [];
60
60
  };
61
61
  return {
62
62
  trace,
63
- withChildSpan: (name, cb, opts) => {
64
- const span = trace.getTracer("moost-tracer").startSpan(name, opts);
65
- return () => context.with(trace.setSpan(context.active(), span), cb);
66
- },
67
63
  getSpan,
68
64
  getSpanContext,
69
65
  getPropagationHeaders,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moostjs/otel",
3
- "version": "0.6.18",
3
+ "version": "0.6.20",
4
4
  "description": "@moostjs/otel",
5
5
  "keywords": [
6
6
  "composables",
@@ -46,8 +46,8 @@
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@wooksjs/event-core": "^0.7.16",
49
- "@moostjs/event-http": "^0.6.18",
50
- "moost": "^0.6.18"
49
+ "moost": "^0.6.20",
50
+ "@moostjs/event-http": "^0.6.20"
51
51
  },
52
52
  "scripts": {
53
53
  "pub": "pnpm publish --access public",