autotel-adapters 3.1.4 → 3.1.6

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.
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_integration = require("./integration-iP3dwlqn.cjs");
2
+ const require_integration = require("./integration-Dan_PNIh.cjs");
3
3
  const require_core = require("./core.cjs");
4
4
  let autotel = require("autotel");
5
5
 
@@ -1,4 +1,4 @@
1
- import { a as defineFrameworkIntegration, n as buildTracedOptions, o as runWithIntegratedHandle, t as applyLoggerEnrichment } from "./integration-DB9Hccx-.js";
1
+ import { a as defineFrameworkIntegration, n as buildTracedOptions, o as runWithIntegratedHandle, t as applyLoggerEnrichment } from "./integration-CFMzJi4W.js";
2
2
  import { createUseLogger, getHeader } from "./core.js";
3
3
  import { createDrainPipeline, createStructuredError, parseError } from "autotel";
4
4
 
package/dist/core.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_integration = require("./integration-iP3dwlqn.cjs");
2
+ const require_integration = require("./integration-Dan_PNIh.cjs");
3
3
  let autotel = require("autotel");
4
4
  let autotel_edge = require("autotel-edge");
5
5
 
@@ -27,6 +27,7 @@ function createUseLogger(options) {
27
27
  */
28
28
  function createRequestRunner(storage) {
29
29
  return function runRequest(spanName, enrich, handler, options) {
30
+ if (options?.route) (0, autotel.setHttpServerRoute)(options.route, { keepExisting: true });
30
31
  if (options?.path && !(0, autotel_edge.shouldInstrumentPath)(options.path, options)) return Promise.resolve(handler());
31
32
  const loggerOptions = require_integration.mergeRequestLoggerOptions(options?.requestLoggerOptions, options?.waitUntil);
32
33
  return autotel.trace.run(spanName, async (ctx) => {
package/dist/core.d.cts CHANGED
@@ -12,6 +12,11 @@ export interface RequestRunnerOptions extends RouteAdapterOptions {
12
12
  requestLoggerOptions?: RequestLoggerOptions;
13
13
  /** HTTP route used for include/exclude filtering. */
14
14
  path?: string;
15
+ /**
16
+ * Matched route template, such as `/users/:id`, handed to the HTTP server
17
+ * span unless a fuller one is already recorded there.
18
+ */
19
+ route?: string;
15
20
  /** Emit one wide event automatically when the handler settles. Default `true`. */
16
21
  autoEmit?: boolean;
17
22
  /** Fields merged into the wide event at emit time (e.g. response status). */
package/dist/core.d.ts CHANGED
@@ -12,6 +12,11 @@ export interface RequestRunnerOptions extends RouteAdapterOptions {
12
12
  requestLoggerOptions?: RequestLoggerOptions;
13
13
  /** HTTP route used for include/exclude filtering. */
14
14
  path?: string;
15
+ /**
16
+ * Matched route template, such as `/users/:id`, handed to the HTTP server
17
+ * span unless a fuller one is already recorded there.
18
+ */
19
+ route?: string;
15
20
  /** Emit one wide event automatically when the handler settles. Default `true`. */
16
21
  autoEmit?: boolean;
17
22
  /** Fields merged into the wide event at emit time (e.g. response status). */
package/dist/core.js CHANGED
@@ -1,5 +1,5 @@
1
- import { f as markServerError, h as shouldInstrumentPath, l as applyKeep, m as mergeRequestLoggerOptions, s as toRouteAdapterOptions } from "./integration-DB9Hccx-.js";
2
- import { getRequestLogger, trace } from "autotel";
1
+ import { f as markServerError, h as shouldInstrumentPath, l as applyKeep, m as mergeRequestLoggerOptions, s as toRouteAdapterOptions } from "./integration-CFMzJi4W.js";
2
+ import { getRequestLogger, setHttpServerRoute, trace } from "autotel";
3
3
 
4
4
  //#region src/core.ts
5
5
  function createUseLogger(options) {
@@ -25,6 +25,7 @@ function createUseLogger(options) {
25
25
  */
26
26
  function createRequestRunner(storage) {
27
27
  return function runRequest(spanName, enrich, handler, options) {
28
+ if (options?.route) setHttpServerRoute(options.route, { keepExisting: true });
28
29
  if (options?.path && !shouldInstrumentPath(options.path, options)) return Promise.resolve(handler());
29
30
  const loggerOptions = mergeRequestLoggerOptions(options?.requestLoggerOptions, options?.waitUntil);
30
31
  return trace.run(spanName, async (ctx) => {
package/dist/elysia.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_integration = require("./integration-iP3dwlqn.cjs");
2
+ const require_integration = require("./integration-Dan_PNIh.cjs");
3
3
  const require_toolkit_storage = require("./toolkit/storage.cjs");
4
4
  const require_core = require("./core.cjs");
5
5
  let autotel = require("autotel");
package/dist/elysia.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as defineFrameworkIntegration, o as runWithIntegratedHandle, t as applyLoggerEnrichment } from "./integration-DB9Hccx-.js";
1
+ import { a as defineFrameworkIntegration, o as runWithIntegratedHandle, t as applyLoggerEnrichment } from "./integration-CFMzJi4W.js";
2
2
  import { createLoggerStorage } from "./toolkit/storage.js";
3
3
  import { getHeader } from "./core.js";
4
4
  import { createDrainPipeline, createStructuredError, parseError } from "autotel";
package/dist/express.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_integration = require("./integration-iP3dwlqn.cjs");
2
+ const require_integration = require("./integration-Dan_PNIh.cjs");
3
3
  const require_core = require("./core.cjs");
4
4
  let autotel = require("autotel");
5
5
  let node_async_hooks = require("node:async_hooks");
@@ -64,6 +64,7 @@ function withAutotel(handler, options) {
64
64
  }, () => handler(req, res, next), {
65
65
  ...require_integration.toRouteAdapterOptions(options),
66
66
  path: route,
67
+ route: req.baseUrl ? void 0 : routeTemplate(req),
67
68
  requestLoggerOptions: options?.requestLoggerOptions,
68
69
  autoEmit: options?.autoEmit,
69
70
  finalize: () => res.statusCode ? { "http.response.status_code": res.statusCode } : void 0
@@ -10,6 +10,7 @@ export interface ExpressRequestLike {
10
10
  route?: {
11
11
  path?: string;
12
12
  };
13
+ baseUrl?: string;
13
14
  headers?: Record<string, string | string[] | undefined>;
14
15
  }
15
16
  export interface ExpressResponseLike {
package/dist/express.d.ts CHANGED
@@ -10,6 +10,7 @@ export interface ExpressRequestLike {
10
10
  route?: {
11
11
  path?: string;
12
12
  };
13
+ baseUrl?: string;
13
14
  headers?: Record<string, string | string[] | undefined>;
14
15
  }
15
16
  export interface ExpressResponseLike {
package/dist/express.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as defaultSpanName, s as toRouteAdapterOptions } from "./integration-DB9Hccx-.js";
1
+ import { i as defaultSpanName, s as toRouteAdapterOptions } from "./integration-CFMzJi4W.js";
2
2
  import { createRequestRunner, createUseLogger } from "./core.js";
3
3
  import { createDrainPipeline, createStructuredError, parseError } from "autotel";
4
4
  import { AsyncLocalStorage } from "node:async_hooks";
@@ -63,6 +63,7 @@ function withAutotel(handler, options) {
63
63
  }, () => handler(req, res, next), {
64
64
  ...toRouteAdapterOptions(options),
65
65
  path: route,
66
+ route: req.baseUrl ? void 0 : routeTemplate(req),
66
67
  requestLoggerOptions: options?.requestLoggerOptions,
67
68
  autoEmit: options?.autoEmit,
68
69
  finalize: () => res.statusCode ? { "http.response.status_code": res.statusCode } : void 0
package/dist/fastify.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_integration = require("./integration-iP3dwlqn.cjs");
2
+ const require_integration = require("./integration-Dan_PNIh.cjs");
3
3
  const require_core = require("./core.cjs");
4
4
  let autotel = require("autotel");
5
5
  let node_async_hooks = require("node:async_hooks");
@@ -53,6 +53,7 @@ function withAutotel(handler, options) {
53
53
  }, () => handler(request, reply), {
54
54
  ...require_integration.toRouteAdapterOptions(options),
55
55
  path: route,
56
+ route: routeTemplate(request),
56
57
  requestLoggerOptions: options?.requestLoggerOptions,
57
58
  autoEmit: options?.autoEmit,
58
59
  finalize: () => reply.statusCode ? { "http.response.status_code": reply.statusCode } : void 0
package/dist/fastify.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as defaultSpanName, s as toRouteAdapterOptions } from "./integration-DB9Hccx-.js";
1
+ import { i as defaultSpanName, s as toRouteAdapterOptions } from "./integration-CFMzJi4W.js";
2
2
  import { createRequestRunner, createUseLogger } from "./core.js";
3
3
  import { createDrainPipeline, createStructuredError, parseError } from "autotel";
4
4
  import { AsyncLocalStorage } from "node:async_hooks";
@@ -52,6 +52,7 @@ function withAutotel(handler, options) {
52
52
  }, () => handler(request, reply), {
53
53
  ...toRouteAdapterOptions(options),
54
54
  path: route,
55
+ route: routeTemplate(request),
55
56
  requestLoggerOptions: options?.requestLoggerOptions,
56
57
  autoEmit: options?.autoEmit,
57
58
  finalize: () => reply.statusCode ? { "http.response.status_code": reply.statusCode } : void 0
package/dist/hono.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_integration = require("./integration-iP3dwlqn.cjs");
2
+ const require_integration = require("./integration-Dan_PNIh.cjs");
3
3
  const require_toolkit_storage = require("./toolkit/storage.cjs");
4
4
  const require_core = require("./core.cjs");
5
5
  let autotel = require("autotel");
package/dist/hono.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as defineFrameworkIntegration, t as applyLoggerEnrichment } from "./integration-DB9Hccx-.js";
1
+ import { a as defineFrameworkIntegration, t as applyLoggerEnrichment } from "./integration-CFMzJi4W.js";
2
2
  import { createLoggerStorage } from "./toolkit/storage.js";
3
3
  import { createUseLogger } from "./core.js";
4
4
  import { createDrainPipeline, createStructuredError, parseError } from "autotel";
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_integration = require("./integration-iP3dwlqn.cjs");
2
+ const require_integration = require("./integration-Dan_PNIh.cjs");
3
3
  const require_core = require("./core.cjs");
4
4
  const require_next = require("./next.cjs");
5
5
  const require_nitro = require("./nitro.cjs");
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { s as toRouteAdapterOptions } from "./integration-DB9Hccx-.js";
1
+ import { s as toRouteAdapterOptions } from "./integration-CFMzJi4W.js";
2
2
  import { createRequestRunner, createUseLogger, getHeader, resolveAdapterConfig, shouldProbeRuntime } from "./core.js";
3
3
  import { withAutotel } from "./next.js";
4
4
  import { withAutotelEventHandler } from "./nitro.js";
@@ -1,5 +1,5 @@
1
1
  import { createStorageForkLifecycle } from "./toolkit/storage.js";
2
- import { AUTOTEL_SAMPLING_TAIL_EVALUATED, AUTOTEL_SAMPLING_TAIL_KEEP, SpanStatusCode, createNoopRequestLogger, forceKeep, getRequestLogger, recordStructuredError, trace } from "autotel";
2
+ import { AUTOTEL_SAMPLING_TAIL_EVALUATED, AUTOTEL_SAMPLING_TAIL_KEEP, SpanStatusCode, createNoopRequestLogger, forceKeep, getRequestLogger, recordStructuredError, setHttpServerRoute, trace } from "autotel";
3
3
  import { getServiceForPath, matchesRoutePattern, shouldInstrumentPath } from "autotel-edge";
4
4
 
5
5
  //#region src/toolkit/deferred-drain.ts
@@ -344,6 +344,7 @@ function buildHandle(spec, ctx, traceCtx, options = {}, defaultNamed = false) {
344
344
  "http.route": extracted.route,
345
345
  "http.request.id": extracted.requestId
346
346
  });
347
+ if (extracted.route) setHttpServerRoute(extracted.route, { keepExisting: true });
347
348
  if (spec.storage) attachForkToLogger(log, spec.forkLifecycle ?? createStorageForkLifecycle(spec.storage));
348
349
  spec.attachLogger(ctx, log);
349
350
  const result = createMiddlewareLogger(log, middlewareOptions, traceCtx);
@@ -358,6 +359,7 @@ function buildHandle(spec, ctx, traceCtx, options = {}, defaultNamed = false) {
358
359
  setRoute: (route) => {
359
360
  if (!route) return;
360
361
  log.set({ "http.route": route });
362
+ setHttpServerRoute(route);
361
363
  if (defaultNamed) traceCtx.updateName(defaultSpanName(extracted.method, route));
362
364
  }
363
365
  };
@@ -344,6 +344,7 @@ function buildHandle(spec, ctx, traceCtx, options = {}, defaultNamed = false) {
344
344
  "http.route": extracted.route,
345
345
  "http.request.id": extracted.requestId
346
346
  });
347
+ if (extracted.route) (0, autotel.setHttpServerRoute)(extracted.route, { keepExisting: true });
347
348
  if (spec.storage) attachForkToLogger(log, spec.forkLifecycle ?? require_toolkit_storage.createStorageForkLifecycle(spec.storage));
348
349
  spec.attachLogger(ctx, log);
349
350
  const result = createMiddlewareLogger(log, middlewareOptions, traceCtx);
@@ -358,6 +359,7 @@ function buildHandle(spec, ctx, traceCtx, options = {}, defaultNamed = false) {
358
359
  setRoute: (route) => {
359
360
  if (!route) return;
360
361
  log.set({ "http.route": route });
362
+ (0, autotel.setHttpServerRoute)(route);
361
363
  if (defaultNamed) traceCtx.updateName(defaultSpanName(extracted.method, route));
362
364
  }
363
365
  };
package/dist/nestjs.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_integration = require("./integration-iP3dwlqn.cjs");
2
+ const require_integration = require("./integration-Dan_PNIh.cjs");
3
3
  const require_toolkit_storage = require("./toolkit/storage.cjs");
4
4
  let autotel = require("autotel");
5
5
  let rxjs = require("rxjs");
package/dist/nestjs.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as defineFrameworkIntegration, t as applyLoggerEnrichment } from "./integration-DB9Hccx-.js";
1
+ import { a as defineFrameworkIntegration, t as applyLoggerEnrichment } from "./integration-CFMzJi4W.js";
2
2
  import { createLoggerStorage } from "./toolkit/storage.js";
3
3
  import { createDrainPipeline, createStructuredError, parseError } from "autotel";
4
4
  import { Observable, from, isObservable } from "rxjs";
package/dist/next.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_integration = require("./integration-iP3dwlqn.cjs");
2
+ const require_integration = require("./integration-Dan_PNIh.cjs");
3
3
  const require_toolkit_storage = require("./toolkit/storage.cjs");
4
4
  const require_core = require("./core.cjs");
5
5
  let autotel = require("autotel");
package/dist/next.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as defineFrameworkIntegration, n as buildTracedOptions, o as runWithIntegratedHandle, t as applyLoggerEnrichment } from "./integration-DB9Hccx-.js";
1
+ import { a as defineFrameworkIntegration, n as buildTracedOptions, o as runWithIntegratedHandle, t as applyLoggerEnrichment } from "./integration-CFMzJi4W.js";
2
2
  import { createLoggerStorage } from "./toolkit/storage.js";
3
3
  import { createUseLogger, getHeader } from "./core.js";
4
4
  import { createDrainPipeline, createStructuredError, getRequestLogger, parseError, trace } from "autotel";
package/dist/nitro.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_integration = require("./integration-iP3dwlqn.cjs");
2
+ const require_integration = require("./integration-Dan_PNIh.cjs");
3
3
  const require_toolkit_storage = require("./toolkit/storage.cjs");
4
4
  const require_core = require("./core.cjs");
5
5
  let autotel = require("autotel");
package/dist/nitro.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as defineFrameworkIntegration, n as buildTracedOptions, o as runWithIntegratedHandle, t as applyLoggerEnrichment } from "./integration-DB9Hccx-.js";
1
+ import { a as defineFrameworkIntegration, n as buildTracedOptions, o as runWithIntegratedHandle, t as applyLoggerEnrichment } from "./integration-CFMzJi4W.js";
2
2
  import { createLoggerStorage } from "./toolkit/storage.js";
3
3
  import { createUseLogger } from "./core.js";
4
4
  import { createDrainPipeline, createStructuredError, parseError } from "autotel";
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_integration = require("./integration-iP3dwlqn.cjs");
2
+ const require_integration = require("./integration-Dan_PNIh.cjs");
3
3
  const require_toolkit_storage = require("./toolkit/storage.cjs");
4
4
  let autotel = require("autotel");
5
5
 
package/dist/sveltekit.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as defineFrameworkIntegration, o as runWithIntegratedHandle, t as applyLoggerEnrichment } from "./integration-DB9Hccx-.js";
1
+ import { a as defineFrameworkIntegration, o as runWithIntegratedHandle, t as applyLoggerEnrichment } from "./integration-CFMzJi4W.js";
2
2
  import { createLoggerStorage } from "./toolkit/storage.js";
3
3
  import { createDrainPipeline, createStructuredError, parseError } from "autotel";
4
4
 
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_integration = require("../integration-iP3dwlqn.cjs");
2
+ const require_integration = require("../integration-Dan_PNIh.cjs");
3
3
  const require_toolkit_storage = require("./storage.cjs");
4
4
  let autotel_edge = require("autotel-edge");
5
5
 
@@ -1,4 +1,4 @@
1
- import { _ as isStreamingResponse, a as defineFrameworkIntegration, c as attachForkToLogger, d as getServiceForPath, g as bindStreamingResponseLifecycle, h as shouldInstrumentPath, m as mergeRequestLoggerOptions, n as buildTracedOptions, o as runWithIntegratedHandle, p as matchesRoutePattern, r as completeIntegratedRequest, s as toRouteAdapterOptions, t as applyLoggerEnrichment, u as createMiddlewareLogger, v as shouldDeferEmitForResponse, y as extendDeferredDrain } from "../integration-DB9Hccx-.js";
1
+ import { _ as isStreamingResponse, a as defineFrameworkIntegration, c as attachForkToLogger, d as getServiceForPath, g as bindStreamingResponseLifecycle, h as shouldInstrumentPath, m as mergeRequestLoggerOptions, n as buildTracedOptions, o as runWithIntegratedHandle, p as matchesRoutePattern, r as completeIntegratedRequest, s as toRouteAdapterOptions, t as applyLoggerEnrichment, u as createMiddlewareLogger, v as shouldDeferEmitForResponse, y as extendDeferredDrain } from "../integration-CFMzJi4W.js";
2
2
  import { createLoggerStorage, createStorageForkLifecycle } from "./storage.js";
3
3
 
4
4
  export { applyLoggerEnrichment, attachForkToLogger, bindStreamingResponseLifecycle, buildTracedOptions, completeIntegratedRequest, createLoggerStorage, createMiddlewareLogger, createStorageForkLifecycle, defineFrameworkIntegration, extendDeferredDrain, getServiceForPath, isStreamingResponse, matchesRoutePattern, mergeRequestLoggerOptions, runWithIntegratedHandle, shouldDeferEmitForResponse, shouldInstrumentPath, toRouteAdapterOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autotel-adapters",
3
- "version": "3.1.4",
3
+ "version": "3.1.6",
4
4
  "description": "Framework adapters and composable DX helpers for autotel",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -91,8 +91,8 @@
91
91
  "NOTICE"
92
92
  ],
93
93
  "dependencies": {
94
- "autotel": "8.8.1",
95
- "autotel-edge": "6.1.4"
94
+ "autotel": "9.0.0",
95
+ "autotel-edge": "7.0.1"
96
96
  },
97
97
  "peerDependencies": {
98
98
  "hono": ">=4.13.13",