@watchtowerobservability/node 0.7.8 → 0.8.0

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 (45) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +5 -7
  3. package/dist/cjs/buffer.d.ts +0 -3
  4. package/dist/cjs/filter.d.ts +0 -1
  5. package/dist/cjs/index.d.ts +1 -4
  6. package/dist/cjs/index.js +30 -2
  7. package/dist/cjs/integrations/next-build.d.ts +9 -2
  8. package/dist/cjs/integrations/next-build.js +46 -4
  9. package/dist/cjs/integrations/next-edge.d.ts +9 -0
  10. package/dist/cjs/integrations/next-edge.js +10 -0
  11. package/dist/cjs/load.d.ts +7 -2
  12. package/dist/cjs/load.js +14 -4
  13. package/dist/cjs/metrics.d.ts +0 -2
  14. package/dist/cjs/next-doctor-cli.js +11 -3
  15. package/dist/cjs/next-doctor.d.ts +9 -1
  16. package/dist/cjs/next-doctor.js +43 -3
  17. package/dist/cjs/next-filter.d.ts +0 -1
  18. package/dist/cjs/origin.d.ts +0 -1
  19. package/dist/cjs/redact.d.ts +0 -1
  20. package/dist/cjs/sampling.d.ts +0 -1
  21. package/dist/cjs/scrub.d.ts +0 -1
  22. package/dist/cjs/version.d.ts +1 -1
  23. package/dist/cjs/version.js +1 -1
  24. package/dist/esm/buffer.d.ts +0 -3
  25. package/dist/esm/filter.d.ts +0 -1
  26. package/dist/esm/index.d.ts +1 -4
  27. package/dist/esm/index.js +30 -2
  28. package/dist/esm/integrations/next-build.d.ts +9 -2
  29. package/dist/esm/integrations/next-build.js +45 -4
  30. package/dist/esm/integrations/next-edge.d.ts +9 -0
  31. package/dist/esm/integrations/next-edge.js +4 -0
  32. package/dist/esm/load.d.ts +7 -2
  33. package/dist/esm/load.js +13 -4
  34. package/dist/esm/metrics.d.ts +0 -2
  35. package/dist/esm/next-doctor-cli.js +12 -4
  36. package/dist/esm/next-doctor.d.ts +9 -1
  37. package/dist/esm/next-doctor.js +41 -3
  38. package/dist/esm/next-filter.d.ts +0 -1
  39. package/dist/esm/origin.d.ts +0 -1
  40. package/dist/esm/redact.d.ts +0 -1
  41. package/dist/esm/sampling.d.ts +0 -1
  42. package/dist/esm/scrub.d.ts +0 -1
  43. package/dist/esm/version.d.ts +1 -1
  44. package/dist/esm/version.js +1 -1
  45. package/package.json +21 -49
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.0 (2026-11-16)
4
+
5
+ - `init()` never throws. A missing OpenTelemetry package, a missing key or any startup error logs one `[watchtower] telemetry is OFF` warning (listing every missing package and the install command), leaves every helper a no-op and returns a no-op client, so the app boots. Under pnpm this fixes the crash at the first import of `main.ts`.
6
+ - The OpenTelemetry SDK packages (`context-async-hooks`, `core`, the three OTLP exporters, `otlp-transformer`, `resources`, `sdk-logs`, `sdk-metrics`, `sdk-trace`) are now `dependencies`, not optional peers: `pnpm add @watchtowerobservability/node` is enough. The `instrumentation-*` packages and `winston-transport` stay optional peers.
7
+ - `@watchtowerobservability/node/next` has `edge-light`, `worker` and `browser` conditions pointing at a no-op stub with no `node:*` imports, so `export { register } from '@watchtowerobservability/node/next'` in `instrumentation.ts` builds with no bundler config.
8
+ - Fix (ESM under pnpm): the SDK now looks for its OpenTelemetry packages from its own location in the ESM build too (it only did in CommonJS), which is where pnpm puts its dependencies.
9
+ - Next.js standalone: the SDK names its OpenTelemetry packages literally (`tracedPackages`, never called), so Next's file tracer copies them with their pnpm links. Verified with a pnpm workspace where the app depends only on `@watchtowerobservability/node`, an edge middleware, and `.next/standalone` copied out of the project: `next build` passes and `server.js` starts with no missing-package warning.
10
+
11
+ ## 0.7.9 (2026-11-16)
12
+
13
+ - Fix (Next.js standalone, pnpm and monorepos; B22, WT-13): `withWatchtower` listed `node_modules/@opentelemetry/**` globs in `outputFileTracingIncludes`. Under pnpm those copied each peer as a plain folder without its own dependencies, or matched nothing when the `.pnpm` store sits at the workspace root, so `init` failed with `missing @opentelemetry/resources`. It now walks the SDK's dependency closure from the app at config time and lists each package's real store folder plus the pnpm links to it, which Next recreates as links. Verified with a pnpm workspace (`apps/web`, `outputFileTracingRoot` at the root, `output: 'standalone'`, peers as direct deps of the app, no peer imports in `instrumentation`): `server.js` starts with no missing-package warning and `wt-next-doctor` exits 0. Your own `outputFileTracingIncludes` are kept. New export: `tracingIncludes(ids, cwd)`.
14
+ - `wt-next-doctor` also looks in the app's own `node_modules` (`.next/standalone/<app path>/node_modules`), then loads the SDK (as ESM, the way Next does) and each peer from the standalone `server.js`, and exits 1 naming any that fail, not only the ones whose folder is missing.
15
+
3
16
  ## 0.7.8 (2026-11-16)
4
17
 
5
18
  - Fix: on a non-cloud VM the OpenTelemetry resource detectors probed `169.254.169.254` and the 10 s timeout surfaced as a `UND_ERR_CONNECT_TIMEOUT` issue. When `OTEL_NODE_RESOURCE_DETECTORS` is unset, `init()` now sets it to `env,host,os,process`, adding `aws`, `gcp` or `azure` only when an environment variable shows that cloud (for example `AWS_REGION`, `K_SERVICE`, `WEBSITE_SITE_NAME`). Set `OTEL_NODE_RESOURCE_DETECTORS` yourself to override. Call `init()` (or use the `register` preload) before your own `NodeSDK` starts.
package/README.md CHANGED
@@ -7,12 +7,10 @@
7
7
  Published on npm:
8
8
 
9
9
  ```sh
10
- npm install @watchtowerobservability/node @opentelemetry/context-async-hooks @opentelemetry/core \
11
- @opentelemetry/exporter-logs-otlp-http @opentelemetry/exporter-metrics-otlp-http @opentelemetry/exporter-trace-otlp-http \
12
- @opentelemetry/otlp-transformer @opentelemetry/resources @opentelemetry/sdk-logs @opentelemetry/sdk-metrics @opentelemetry/sdk-trace
10
+ npm install @watchtowerobservability/node # or: pnpm add @watchtowerobservability/node
13
11
  ```
14
12
 
15
- `@opentelemetry/api` is the only hard dependency; the OpenTelemetry SDK packages above are optional peers (so your app controls their versions) and are loaded by `init`, which throws an error naming the missing ones.
13
+ The OpenTelemetry SDK packages are regular dependencies, so that is enough. `init()` never throws: if a package is missing or startup fails it logs one warning, leaves telemetry off and returns a no-op client. In Next.js, `export { register } from '@watchtowerobservability/node/next'` builds with no bundler config (edge and browser builds get a no-op stub).
16
14
 
17
15
  Optional auto-instrumentation peers (installed ones are used, see below):
18
16
  `npm install @opentelemetry/instrumentation @opentelemetry/instrumentation-http @opentelemetry/instrumentation-undici @opentelemetry/instrumentation-pg @opentelemetry/instrumentation-ioredis`.
@@ -52,7 +50,7 @@ silence it with `instrumentLog: false` or `WT_INSTRUMENT_LOG=0`.
52
50
 
53
51
  Start the preload in the start command: `node --import @watchtowerobservability/node/register app.js` (or `node -r ...` for CommonJS).
54
52
  Do not use `NODE_OPTIONS=--import ...`: it leaks into healthchecks and `pnpm` itself, which cannot resolve the package from the image root.
55
- OpenTelemetry peers are looked up from the SDK's location, then the working directory, then the directory of the entry script, so in a pnpm
53
+ OpenTelemetry packages are looked up from the SDK's location, then the working directory, then the directory of the entry script, so in a pnpm
56
54
  monorepo the app that runs the script is enough.
57
55
 
58
56
  `wt.checkin('nightly-report', async () => { ... })` wraps a cron or scheduler job in check-ins to the monitor with that slug
@@ -116,9 +114,9 @@ registered it re-sends the signal so the exit is unchanged. Under `next start`,
116
114
  the server and calls `process.exit`; our flush starts first (the `register` hook runs before) and gets the time the server takes
117
115
  to close, so a very slow export can still be cut.
118
116
 
119
- Install the OpenTelemetry peers above in the app itself (with pnpm, as direct dependencies). The SDK loads peers at run time through `createRequire`, which webpack does not follow, so a build prints no "Module not found" warning for peers you did not install. Next's standalone file tracer does not follow them either.
117
+ The SDK loads its OpenTelemetry packages at run time through `createRequire`, which webpack does not follow, so a build prints no "Module not found" warning for peers you did not install. Next's standalone file tracer does not follow them either.
120
118
 
121
- Standalone recipe: wrap the config, `module.exports = withWatchtower(nextConfig)` (from `@watchtowerobservability/node/next-build`, or `@watchtowerobservability/next`). It adds the SDK and its OpenTelemetry peers to `serverExternalPackages` and `outputFileTracingIncludes` (npm and pnpm layouts). By hand, add the same packages to `serverExternalPackages` and `outputFileTracingIncludes: { '/*': ['./node_modules/@opentelemetry/**', './node_modules/@watchtowerobservability/node/**'] }`. If a peer is missing at run time, `init` logs one warning naming it; after `next build`, `npx wt-next-doctor` lists what `.next/standalone/node_modules` lacks and exits 1.
119
+ Standalone recipe: wrap the config, `module.exports = withWatchtower(nextConfig)` (from `@watchtowerobservability/node/next-build`, or `@watchtowerobservability/next`). It adds the SDK and its OpenTelemetry packages to `serverExternalPackages`, and to `outputFileTracingIncludes` each of them with its dependencies and pnpm links, resolved from the app (npm, pnpm, monorepos with `outputFileTracingRoot` at the workspace root). By hand, add the same packages to `serverExternalPackages` and import each peer literally in `instrumentation.ts`; plain `node_modules/@opentelemetry/**` include globs do not work under pnpm, since they copy each peer without its dependencies. If a peer is missing at run time, `init` logs one warning naming it; after `next build`, `npx wt-next-doctor` checks that `.next/standalone` holds the SDK and its peers and that each one loads from `server.js`, and exits 1 otherwise.
122
120
 
123
121
  Bundling with esbuild or webpack (ESM or CommonJS output) works without warnings; mark the peers you use as externals (or ship `node_modules`), because they are resolved at run time. Declarations name optional peers behind `// @ts-ignore`, so `skipLibCheck: false` builds compile without them installed.
124
122
 
@@ -1,8 +1,5 @@
1
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
2
1
  import type { SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace';
3
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
4
2
  import type { LogRecordExporter, ReadableLogRecord } from '@opentelemetry/sdk-logs';
5
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
6
3
  import type { AggregationTemporality, InstrumentType, PushMetricExporter, ResourceMetrics } from '@opentelemetry/sdk-metrics';
7
4
  type Done = Parameters<SpanExporter['export']>[1];
8
5
  /** What the spool wraps: a span, log record or metric exporter; `B` is one export batch. */
@@ -1,4 +1,3 @@
1
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
2
1
  import type { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace';
3
2
  export declare function filterExporter(inner: SpanExporter, keep: (s: ReadableSpan) => boolean): SpanExporter;
4
3
  /**
@@ -1,13 +1,9 @@
1
1
  import { inspect } from 'node:util';
2
2
  import { metrics, trace } from '@opentelemetry/api';
3
3
  import type { Tracer } from '@opentelemetry/api';
4
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
5
4
  import type { Resource } from '@opentelemetry/resources';
6
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
7
5
  import type { ReadableSpan, TracerProvider } from '@opentelemetry/sdk-trace';
8
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
9
6
  import type { LoggerProvider } from '@opentelemetry/sdk-logs';
10
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
11
7
  import type { MeterProvider } from '@opentelemetry/sdk-metrics';
12
8
  import type { RedactHook } from './redact.js';
13
9
  import type { RedactPreset } from './redact-presets.js';
@@ -208,6 +204,7 @@ export declare class Client implements InitStatus {
208
204
  observe<A extends unknown[], R>(name: string, fn: (...a: A) => R): (...a: A) => R;
209
205
  shutdown(): Promise<void>;
210
206
  }
207
+ /** Never throws: when a peer is missing, the key is absent or startup fails, it warns once, leaves telemetry off and returns a no-op client. */
211
208
  export declare function init(opts: InitOptions): Client;
212
209
  /** Why telemetry is off (set by the preload when it cannot start); shown on the first dropped helper call. */
213
210
  export declare const setOffReason: (r: string) => void;
package/dist/cjs/index.js CHANGED
@@ -404,11 +404,39 @@ function registerGlobals(c) {
404
404
  api_1.diag.warn(w);
405
405
  }
406
406
  }
407
+ /** A Client-shaped stand-in for when telemetry cannot start: every method does nothing, observe/checkin pass the function through. */
408
+ function offClient() {
409
+ const fns = {
410
+ observe: (_n, f) => f,
411
+ checkin: (_s, f) => Promise.resolve().then(f),
412
+ log: () => undefined,
413
+ toJSON: () => ({}),
414
+ evaluate: () => Promise.resolve([]),
415
+ evaluateResume: () => Promise.resolve([]),
416
+ };
417
+ const plain = { traces: 'disabled', metrics: 'disabled', logs: 'disabled', blocked: [], warnings: [], attached: false };
418
+ return new Proxy({}, { get: (_t, k) => (typeof k === 'symbol' || k === 'then' ? undefined : k in plain ? plain[k] : fns[k] ?? (() => Promise.resolve(undefined))) });
419
+ }
420
+ /** Never throws: when a peer is missing, the key is absent or startup fails, it warns once, leaves telemetry off and returns a no-op client. */
407
421
  function init(opts) {
408
- (0, env_js_1.defaultResourceDetectors)(); // before any NodeSDK reads OTEL_NODE_RESOURCE_DETECTORS
409
422
  const missing = (0, load_js_1.missingPeers)();
410
423
  if (missing.length)
411
- console.warn(`[watchtower] missing OpenTelemetry package(s): ${missing.join(', ')}. Next.js standalone: ${load_js_1.STANDALONE_HINT}. Otherwise: npm install ${missing.join(' ')}`);
424
+ return turnOff(`missing OpenTelemetry package(s): ${missing.join(', ')}. Next.js standalone: ${load_js_1.STANDALONE_HINT}. Otherwise: npm install ${missing.join(' ')}`);
425
+ try {
426
+ return start(opts);
427
+ }
428
+ catch (e) {
429
+ return turnOff(e?.message ?? String(e));
430
+ }
431
+ }
432
+ function turnOff(why) {
433
+ state.current = undefined;
434
+ (0, exports.setOffReason)(why);
435
+ console.warn(`[watchtower] telemetry is OFF: ${why}`);
436
+ return offClient();
437
+ }
438
+ function start(opts) {
439
+ (0, env_js_1.defaultResourceDetectors)(); // before any NodeSDK reads OTEL_NODE_RESOURCE_DETECTORS
412
440
  const nextMode = opts?.nextInternals ?? (process.env.NEXT_RUNTIME ? 'sample' : undefined);
413
441
  if (nextMode) {
414
442
  const own = (0, next_filter_js_1.nextInternalsFilter)(nextMode, opts?.nextInternalsRate);
@@ -38,10 +38,17 @@ export interface WatchtowerNextOptions {
38
38
  export declare function hasSentry(cwd?: string): boolean;
39
39
  /** The `serverExternalPackages` withWatchtower adds; `sentry` drops the packages a bundled Sentry shares. */
40
40
  export declare function externalPackages(sentry: boolean): string[];
41
+ /**
42
+ * `outputFileTracingIncludes` globs for `ids` and everything they depend on, relative to `cwd`: each package's real
43
+ * folder plus every pnpm symlink on the way to it, which Next recreates as links (what its tracer emits for a static
44
+ * import). A plain `node_modules/<pkg>/**` glob copies a pnpm link as a folder cut off from its dependencies (B22).
45
+ */
46
+ export declare function tracingIncludes(ids: string[], cwd?: string): string[];
41
47
  /**
42
48
  * `module.exports = withWatchtower(nextConfig, { sourcemaps: true })`. Makes `output: 'standalone'` work with no other
43
- * config: the node SDK and its OpenTelemetry peers go into `serverExternalPackages` and (npm and pnpm layouts) into
44
- * `outputFileTracingIncludes` for every route. Sets `NEXT_PUBLIC_WT_RELEASE`. With `sourcemaps` it turns on
49
+ * config: the node SDK and its OpenTelemetry peers go into `serverExternalPackages`, and `outputFileTracingIncludes`
50
+ * for every route lists each one with its dependencies and pnpm links (npm, pnpm, monorepos; see tracingIncludes), so
51
+ * the SDK starts whichever entry instrumentation imports. Sets `NEXT_PUBLIC_WT_RELEASE`. With `sourcemaps` it turns on
45
52
  * `productionBrowserSourceMaps` (webpack and Turbopack); `{ upload: true }` uploads and deletes them after the webpack
46
53
  * client build, otherwise run `wt-next-sourcemaps` after `next build` (`"build": "next build && wt-next-sourcemaps"`).
47
54
  */
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.hasSentry = hasSentry;
37
37
  exports.externalPackages = externalPackages;
38
+ exports.tracingIncludes = tracingIncludes;
38
39
  exports.withWatchtower = withWatchtower;
39
40
  exports.makeTar = makeTar;
40
41
  exports.uploadSourcemaps = uploadSourcemaps;
@@ -73,12 +74,53 @@ function hasSentry(cwd = process.cwd()) {
73
74
  function externalPackages(sentry) {
74
75
  return sentry ? EXTERNAL.filter((n) => !SHARED_WITH_SENTRY.has(n)) : EXTERNAL;
75
76
  }
77
+ /** Where Node finds package `id` from `from`: the lookup path (may be a pnpm symlink) and its real folder. */
78
+ function locate(id, from) {
79
+ for (let d = from;; d = nodePath.dirname(d)) {
80
+ const link = nodePath.join(d, 'node_modules', id);
81
+ if (fs.existsSync(nodePath.join(link, 'package.json')))
82
+ return { link, real: fs.realpathSync(link) };
83
+ if (nodePath.dirname(d) === d)
84
+ return undefined;
85
+ }
86
+ }
87
+ /**
88
+ * `outputFileTracingIncludes` globs for `ids` and everything they depend on, relative to `cwd`: each package's real
89
+ * folder plus every pnpm symlink on the way to it, which Next recreates as links (what its tracer emits for a static
90
+ * import). A plain `node_modules/<pkg>/**` glob copies a pnpm link as a folder cut off from its dependencies (B22).
91
+ */
92
+ function tracingIncludes(ids, cwd = process.cwd()) {
93
+ const out = new Set(), seen = new Set();
94
+ const rel = (p) => nodePath.relative(cwd, p).split(nodePath.sep).join('/').replace(/[()[\]{}*?!]/g, '\\$&');
95
+ const visit = (id, from) => {
96
+ const hit = locate(id, from);
97
+ if (!hit)
98
+ return; // an optional peer that is not installed
99
+ if (fs.lstatSync(hit.link).isSymbolicLink())
100
+ out.add(rel(hit.link));
101
+ if (seen.has(hit.real))
102
+ return;
103
+ seen.add(hit.real);
104
+ out.add(`${rel(hit.real)}/**/*`);
105
+ try {
106
+ const pkg = JSON.parse(fs.readFileSync(nodePath.join(hit.real, 'package.json'), 'utf8'));
107
+ // peers: only OpenTelemetry ones (the SDK's peers are in `ids` already; following `next` would copy all of it)
108
+ const peers = Object.keys(pkg.peerDependencies ?? {}).filter((n) => n.startsWith('@opentelemetry/'));
109
+ for (const dep of [...Object.keys({ ...pkg.dependencies, ...pkg.optionalDependencies }), ...peers])
110
+ visit(dep, hit.real);
111
+ }
112
+ catch { /* unreadable package.json: its own files are still included */ }
113
+ };
114
+ for (const id of ids)
115
+ visit(id, cwd);
116
+ return [...out];
117
+ }
76
118
  const SHA_ENV = ['WT_RELEASE', 'GITHUB_SHA', 'CI_COMMIT_SHA', 'VERCEL_GIT_COMMIT_SHA', 'SOURCE_VERSION', 'BUILD_SHA', 'RENDER_GIT_COMMIT', 'HEROKU_SLUG_COMMIT'];
77
- const INCLUDE = ['@watchtowerobservability/node', '@opentelemetry'].flatMap((p) => [`./node_modules/${p}/**/*`, `./node_modules/.pnpm/${p.replace('/', '+')}*/**/*`]);
78
119
  /**
79
120
  * `module.exports = withWatchtower(nextConfig, { sourcemaps: true })`. Makes `output: 'standalone'` work with no other
80
- * config: the node SDK and its OpenTelemetry peers go into `serverExternalPackages` and (npm and pnpm layouts) into
81
- * `outputFileTracingIncludes` for every route. Sets `NEXT_PUBLIC_WT_RELEASE`. With `sourcemaps` it turns on
121
+ * config: the node SDK and its OpenTelemetry peers go into `serverExternalPackages`, and `outputFileTracingIncludes`
122
+ * for every route lists each one with its dependencies and pnpm links (npm, pnpm, monorepos; see tracingIncludes), so
123
+ * the SDK starts whichever entry instrumentation imports. Sets `NEXT_PUBLIC_WT_RELEASE`. With `sourcemaps` it turns on
82
124
  * `productionBrowserSourceMaps` (webpack and Turbopack); `{ upload: true }` uploads and deletes them after the webpack
83
125
  * client build, otherwise run `wt-next-sourcemaps` after `next build` (`"build": "next build && wt-next-sourcemaps"`).
84
126
  */
@@ -87,7 +129,7 @@ function withWatchtower(config = {}, opts = {}) {
87
129
  const release = opts.release || SHA_ENV.map((k) => process.env[k]).find((v) => v && v !== 'unknown');
88
130
  const apply = (c) => {
89
131
  const inc = { ...c.outputFileTracingIncludes };
90
- inc['/*'] = [...new Set([...(inc['/*'] ?? []), ...INCLUDE])];
132
+ inc['/*'] = [...new Set([...(inc['/*'] ?? []), ...tracingIncludes(EXTERNAL)])];
91
133
  const out = {
92
134
  ...c,
93
135
  serverExternalPackages: [...new Set([...(c.serverExternalPackages ?? []), ...externalPackages(opts.sentry ?? hasSentry())])],
@@ -0,0 +1,9 @@
1
+ type Opts = Record<string, unknown>;
2
+ export type NextOptions = Opts;
3
+ export type SourcemapOptions = Opts;
4
+ export type TunnelOptions = Opts;
5
+ export declare const makeRegister: (_options?: NextOptions) => (() => Promise<void>);
6
+ export declare const register: () => Promise<void>;
7
+ export declare function onRequestError(_err?: unknown, _request?: unknown, _context?: unknown): Promise<void>;
8
+ export declare const withWatchtower: <T>(config: T, _opts?: Opts) => T;
9
+ export {};
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withWatchtower = exports.register = exports.makeRegister = void 0;
4
+ exports.onRequestError = onRequestError;
5
+ const makeRegister = (_options = {}) => async () => { };
6
+ exports.makeRegister = makeRegister;
7
+ exports.register = (0, exports.makeRegister)();
8
+ async function onRequestError(_err, _request, _context) { }
9
+ const withWatchtower = (config, _opts) => config;
10
+ exports.withWatchtower = withWatchtower;
@@ -2,8 +2,13 @@
2
2
  export declare function searchPaths(): string[];
3
3
  export declare function load(id: string): unknown;
4
4
  export declare const SDK_PEERS: string[];
5
- /** Load an OpenTelemetry SDK package (an optional peer); a missing one throws an error naming what to install. */
5
+ /** Load an OpenTelemetry SDK package (a dependency, loaded lazily); a missing one throws an error naming what to install. */
6
6
  export declare function need<T>(id: string): T;
7
- export declare const STANDALONE_HINT = "use withWatchtower() from @watchtowerobservability/next, or add them to serverExternalPackages and outputFileTracingIncludes in next.config";
7
+ export declare const STANDALONE_HINT = "use withWatchtower() from @watchtowerobservability/next (node SDK 0.7.9 or later) in next.config";
8
8
  /** Required OpenTelemetry peers that cannot be loaded from the SDK's location or the app root. */
9
9
  export declare function missingPeers(): string[];
10
+ /**
11
+ * Never called. Literal names so file tracers (Next's standalone nft) copy the SDK packages together with their pnpm
12
+ * links, which outputFileTracingIncludes cannot do. Safe for bundlers: these are dependencies, so always installed.
13
+ */
14
+ export declare const tracedPackages: () => Promise<unknown>[];
package/dist/cjs/load.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.STANDALONE_HINT = exports.SDK_PEERS = void 0;
6
+ exports.tracedPackages = exports.STANDALONE_HINT = exports.SDK_PEERS = void 0;
7
7
  exports.searchPaths = searchPaths;
8
8
  exports.load = load;
9
9
  exports.need = need;
@@ -14,7 +14,7 @@ const node_path_1 = __importDefault(require("node:path"));
14
14
  // Bundlers must NOT follow this: an optional peer the app did not install would make webpack warn "Module not found",
15
15
  // and a bare require call on a variable id is a "Critical dependency" warning. createRequire() is opaque to webpack/esbuild/Next's tracer,
16
16
  // so peers resolve at run time from the SDK's own location, then from the app root (cwd). Install the peers in the app
17
- // (pnpm: as direct dependencies); for a Next standalone build add them to outputFileTracingIncludes.
17
+ // (pnpm: as direct dependencies). A Next standalone build gets them through withWatchtower's tracingIncludes (next-build.ts).
18
18
  /** Where peers are searched, in order: the SDK's own location, the cwd, the entry script's directory (pnpm monorepo apps run from the repo root). */
19
19
  function searchPaths() {
20
20
  const entry = process.argv[1] ? `${node_path_1.default.dirname(node_path_1.default.resolve(process.argv[1]))}/` : '';
@@ -42,7 +42,7 @@ exports.SDK_PEERS = [
42
42
  '@opentelemetry/exporter-metrics-otlp-http', '@opentelemetry/exporter-trace-otlp-http', '@opentelemetry/otlp-transformer',
43
43
  '@opentelemetry/resources', '@opentelemetry/sdk-logs', '@opentelemetry/sdk-metrics', '@opentelemetry/sdk-trace',
44
44
  ];
45
- /** Load an OpenTelemetry SDK package (an optional peer); a missing one throws an error naming what to install. */
45
+ /** Load an OpenTelemetry SDK package (a dependency, loaded lazily); a missing one throws an error naming what to install. */
46
46
  function need(id) {
47
47
  try {
48
48
  return load(id);
@@ -54,7 +54,7 @@ function need(id) {
54
54
  throw e;
55
55
  }
56
56
  }
57
- exports.STANDALONE_HINT = 'use withWatchtower() from @watchtowerobservability/next, or add them to serverExternalPackages and outputFileTracingIncludes in next.config';
57
+ exports.STANDALONE_HINT = 'use withWatchtower() from @watchtowerobservability/next (node SDK 0.7.9 or later) in next.config';
58
58
  /** Required OpenTelemetry peers that cannot be loaded from the SDK's location or the app root. */
59
59
  function missingPeers() {
60
60
  return exports.SDK_PEERS.filter((id) => {
@@ -67,3 +67,13 @@ function missingPeers() {
67
67
  }
68
68
  });
69
69
  }
70
+ /**
71
+ * Never called. Literal names so file tracers (Next's standalone nft) copy the SDK packages together with their pnpm
72
+ * links, which outputFileTracingIncludes cannot do. Safe for bundlers: these are dependencies, so always installed.
73
+ */
74
+ const tracedPackages = () => [
75
+ import('@opentelemetry/context-async-hooks'), import('@opentelemetry/core'), import('@opentelemetry/exporter-logs-otlp-http'),
76
+ import('@opentelemetry/exporter-metrics-otlp-http'), import('@opentelemetry/exporter-trace-otlp-http'), import('@opentelemetry/otlp-transformer'),
77
+ import('@opentelemetry/resources'), import('@opentelemetry/sdk-logs'), import('@opentelemetry/sdk-metrics'), import('@opentelemetry/sdk-trace'),
78
+ ];
79
+ exports.tracedPackages = tracedPackages;
@@ -1,6 +1,4 @@
1
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
2
1
  import type { Resource } from '@opentelemetry/resources';
3
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
4
2
  import type { MeterProvider, PushMetricExporter } from '@opentelemetry/sdk-metrics';
5
3
  /** Explicit flag, else `WATCHTOWER_LOGS` / `WATCHTOWER_METRICS` (default on); `OTEL_*_EXPORTER=none` turns it off. */
6
4
  export declare function switchOn(name: string, otelExporterEnv: string, flag?: boolean): boolean;
@@ -1,15 +1,23 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- // `wt-next-doctor [dir]`: exit 1 when .next/standalone lacks the SDK or an OpenTelemetry peer (see next-doctor.ts).
4
+ // `wt-next-doctor [dir]`: exit 1 when .next/standalone lacks the SDK or an OpenTelemetry peer, or one of them does not
5
+ // load from the standalone server.js (see next-doctor.ts).
5
6
  const next_doctor_js_1 = require("./next-doctor.js");
6
7
  const load_js_1 = require("./load.js");
7
- const missing = (0, next_doctor_js_1.standaloneMissing)(process.argv[2]);
8
+ const dir = process.argv[2];
9
+ const missing = (0, next_doctor_js_1.standaloneMissing)(dir);
10
+ const server = missing && !missing.length ? (0, next_doctor_js_1.standaloneServer)(dir) : undefined;
11
+ const broken = server ? (0, next_doctor_js_1.standaloneUnloadable)(server) : [];
8
12
  if (!missing)
9
13
  console.log('[watchtower] no .next/standalone found; nothing to check');
10
14
  else if (missing.length) {
11
15
  console.error(`[watchtower] missing from .next/standalone/node_modules: ${missing.join(', ')}\n[watchtower] fix: ${load_js_1.STANDALONE_HINT}`);
12
16
  process.exit(1);
13
17
  }
18
+ else if (broken.length) {
19
+ console.error(`[watchtower] present but failing to load from ${server}:\n ${broken.join('\n ')}\n[watchtower] fix: ${load_js_1.STANDALONE_HINT}`);
20
+ process.exit(1);
21
+ }
14
22
  else
15
- console.log('[watchtower] standalone build includes the SDK and its OpenTelemetry peers');
23
+ console.log(`[watchtower] standalone build includes the SDK and its OpenTelemetry peers${server ? ', and they load' : ''}`);
@@ -1,2 +1,10 @@
1
- /** Packages missing from `<dir>/.next/standalone/node_modules`; undefined when there is no standalone build. */
1
+ /** Packages missing from `<dir>/.next/standalone/node_modules` (and the app's own, next to server.js); undefined when there is no standalone build. */
2
2
  export declare function standaloneMissing(dir?: string): string[] | undefined;
3
+ /** The standalone `server.js` (an app in a monorepo sits below `.next/standalone/<path>`); undefined when none. */
4
+ export declare function standaloneServer(dir?: string): string | undefined;
5
+ /**
6
+ * Import the SDK and load each peer the way the server will (from the SDK's location, then from server.js), in a child
7
+ * process; returns `id: error` for each that fails. Catches a peer copied without its own dependencies, which a
8
+ * folder check cannot see.
9
+ */
10
+ export declare function standaloneUnloadable(server: string): string[];
@@ -34,17 +34,57 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.standaloneMissing = standaloneMissing;
37
+ exports.standaloneServer = standaloneServer;
38
+ exports.standaloneUnloadable = standaloneUnloadable;
37
39
  // After `next build` with output 'standalone', check that the SDK and its OpenTelemetry peers were traced into
38
- // .next/standalone/node_modules (npm layout, or pnpm's .pnpm store). Exits 1 when any is missing.
40
+ // .next/standalone/node_modules (npm layout, or pnpm's .pnpm store), then load each one from the standalone server.js
41
+ // (wt-next-doctor exits 1 on either failure), so a peer copied without its own dependencies also fails.
42
+ const node_child_process_1 = require("node:child_process");
39
43
  const fs = __importStar(require("node:fs"));
40
44
  const nodePath = __importStar(require("node:path"));
41
45
  const load_js_1 = require("./load.js");
42
- /** Packages missing from `<dir>/.next/standalone/node_modules`; undefined when there is no standalone build. */
46
+ /** Packages missing from `<dir>/.next/standalone/node_modules` (and the app's own, next to server.js); undefined when there is no standalone build. */
43
47
  function standaloneMissing(dir = '.') {
44
48
  const nm = nodePath.join(dir, '.next', 'standalone', 'node_modules');
45
49
  if (!fs.existsSync(nodePath.join(dir, '.next', 'standalone')))
46
50
  return undefined;
47
51
  const pnpm = nodePath.join(nm, '.pnpm');
48
52
  const store = fs.existsSync(pnpm) ? fs.readdirSync(pnpm) : [];
49
- return ['@watchtowerobservability/node', ...load_js_1.SDK_PEERS].filter((id) => !fs.existsSync(nodePath.join(nm, id)) && !store.some((e) => e.startsWith(`${id.replace('/', '+')}@`)));
53
+ const server = standaloneServer(dir); // a monorepo app has its own node_modules next to server.js
54
+ const appNm = server ? nodePath.join(nodePath.dirname(server), 'node_modules') : nm;
55
+ return ['@watchtowerobservability/node', ...load_js_1.SDK_PEERS].filter((id) => !fs.existsSync(nodePath.join(nm, id)) && !fs.existsSync(nodePath.join(appNm, id)) && !store.some((e) => e.startsWith(`${id.replace('/', '+')}@`)));
56
+ }
57
+ /** The standalone `server.js` (an app in a monorepo sits below `.next/standalone/<path>`); undefined when none. */
58
+ function standaloneServer(dir = '.') {
59
+ const find = (d, depth) => {
60
+ if (fs.existsSync(nodePath.join(d, 'server.js')))
61
+ return nodePath.join(d, 'server.js');
62
+ if (depth === 0)
63
+ return undefined;
64
+ for (const e of fs.readdirSync(d, { withFileTypes: true })) {
65
+ if (!e.isDirectory() || e.name === 'node_modules' || e.name.startsWith('.'))
66
+ continue;
67
+ const hit = find(nodePath.join(d, e.name), depth - 1);
68
+ if (hit)
69
+ return hit;
70
+ }
71
+ return undefined;
72
+ };
73
+ const root = nodePath.join(dir, '.next', 'standalone');
74
+ return fs.existsSync(root) ? find(root, 4) : undefined;
75
+ }
76
+ /**
77
+ * Import the SDK and load each peer the way the server will (from the SDK's location, then from server.js), in a child
78
+ * process; returns `id: error` for each that fails. Catches a peer copied without its own dependencies, which a
79
+ * folder check cannot see.
80
+ */
81
+ function standaloneUnloadable(server) {
82
+ const abs = nodePath.resolve(server);
83
+ // ESM, as Next loads the external SDK (its CJS build is not traced); bare specifiers resolve from cwd
84
+ const code = `import { createRequire } from 'node:module'; const app = createRequire(${JSON.stringify(abs)}); const bad = [];
85
+ let sdk; try { await import('@watchtowerobservability/node'); sdk = createRequire(import.meta.resolve('@watchtowerobservability/node')); } catch (e) { bad.push('@watchtowerobservability/node: ' + e.message.split('\\n')[0]); }
86
+ for (const id of ${JSON.stringify(load_js_1.SDK_PEERS)}) { try { (sdk || app)(id); } catch (e) { try { app(id); } catch { bad.push(id + ': ' + e.message.split('\\n')[0]); } } }
87
+ process.stdout.write(JSON.stringify(bad)); process.exit(0);`;
88
+ const out = (0, node_child_process_1.execFileSync)(process.execPath, ['--input-type=module', '-e', code], { cwd: nodePath.dirname(abs), encoding: 'utf8' });
89
+ return JSON.parse(out);
50
90
  }
@@ -1,4 +1,3 @@
1
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
2
1
  import type { ReadableSpan } from '@opentelemetry/sdk-trace';
3
2
  /** Whether `span` is one of Next's internal spans (not a request, route handler, render, server action or fetch). */
4
3
  export declare function isNextInternal(span: ReadableSpan): boolean;
@@ -1,4 +1,3 @@
1
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
2
1
  import type { SpanProcessor } from '@opentelemetry/sdk-trace';
3
2
  export interface Frame {
4
3
  file: string;
@@ -1,4 +1,3 @@
1
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
2
1
  import type { SpanProcessor } from '@opentelemetry/sdk-trace';
3
2
  export type RedactHook = (key: string, value: unknown) => unknown;
4
3
  /** Hook keys for the non-attribute fields. Event attributes (incl. exception.message / exception.stacktrace) use their own keys. */
@@ -1,5 +1,4 @@
1
1
  import type { Attributes, Context, Link, SpanKind } from '@opentelemetry/api';
2
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
3
2
  import type { Sampler, SamplingResult } from '@opentelemetry/sdk-trace';
4
3
  export interface SamplingRule {
5
4
  name?: string;
@@ -1,4 +1,3 @@
1
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
2
1
  import type { SpanProcessor } from '@opentelemetry/sdk-trace';
3
2
  /**
4
3
  * A path segment that looks like a secret: UUID, hex run >= 16, JWT, digit run >= 16, or an opaque token (>= 16 chars of
@@ -1,2 +1,2 @@
1
1
  /** This package's version (test/distro.test.ts checks it against package.json); sent as `telemetry.distro.version`. */
2
- export declare const VERSION = "0.7.8";
2
+ export declare const VERSION = "0.8.0";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  /** This package's version (test/distro.test.ts checks it against package.json); sent as `telemetry.distro.version`. */
5
- exports.VERSION = '0.7.8';
5
+ exports.VERSION = '0.8.0';
@@ -1,8 +1,5 @@
1
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
2
1
  import type { SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace';
3
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
4
2
  import type { LogRecordExporter, ReadableLogRecord } from '@opentelemetry/sdk-logs';
5
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
6
3
  import type { AggregationTemporality, InstrumentType, PushMetricExporter, ResourceMetrics } from '@opentelemetry/sdk-metrics';
7
4
  type Done = Parameters<SpanExporter['export']>[1];
8
5
  /** What the spool wraps: a span, log record or metric exporter; `B` is one export batch. */
@@ -1,4 +1,3 @@
1
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
2
1
  import type { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace';
3
2
  export declare function filterExporter(inner: SpanExporter, keep: (s: ReadableSpan) => boolean): SpanExporter;
4
3
  /**
@@ -1,13 +1,9 @@
1
1
  import { inspect } from 'node:util';
2
2
  import { metrics, trace } from '@opentelemetry/api';
3
3
  import type { Tracer } from '@opentelemetry/api';
4
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
5
4
  import type { Resource } from '@opentelemetry/resources';
6
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
7
5
  import type { ReadableSpan, TracerProvider } from '@opentelemetry/sdk-trace';
8
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
9
6
  import type { LoggerProvider } from '@opentelemetry/sdk-logs';
10
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
11
7
  import type { MeterProvider } from '@opentelemetry/sdk-metrics';
12
8
  import type { RedactHook } from './redact.js';
13
9
  import type { RedactPreset } from './redact-presets.js';
@@ -208,6 +204,7 @@ export declare class Client implements InitStatus {
208
204
  observe<A extends unknown[], R>(name: string, fn: (...a: A) => R): (...a: A) => R;
209
205
  shutdown(): Promise<void>;
210
206
  }
207
+ /** Never throws: when a peer is missing, the key is absent or startup fails, it warns once, leaves telemetry off and returns a no-op client. */
211
208
  export declare function init(opts: InitOptions): Client;
212
209
  /** Why telemetry is off (set by the preload when it cannot start); shown on the first dropped helper call. */
213
210
  export declare const setOffReason: (r: string) => void;
package/dist/esm/index.js CHANGED
@@ -356,11 +356,39 @@ function registerGlobals(c) {
356
356
  diag.warn(w);
357
357
  }
358
358
  }
359
+ /** A Client-shaped stand-in for when telemetry cannot start: every method does nothing, observe/checkin pass the function through. */
360
+ function offClient() {
361
+ const fns = {
362
+ observe: (_n, f) => f,
363
+ checkin: (_s, f) => Promise.resolve().then(f),
364
+ log: () => undefined,
365
+ toJSON: () => ({}),
366
+ evaluate: () => Promise.resolve([]),
367
+ evaluateResume: () => Promise.resolve([]),
368
+ };
369
+ const plain = { traces: 'disabled', metrics: 'disabled', logs: 'disabled', blocked: [], warnings: [], attached: false };
370
+ return new Proxy({}, { get: (_t, k) => (typeof k === 'symbol' || k === 'then' ? undefined : k in plain ? plain[k] : fns[k] ?? (() => Promise.resolve(undefined))) });
371
+ }
372
+ /** Never throws: when a peer is missing, the key is absent or startup fails, it warns once, leaves telemetry off and returns a no-op client. */
359
373
  export function init(opts) {
360
- defaultResourceDetectors(); // before any NodeSDK reads OTEL_NODE_RESOURCE_DETECTORS
361
374
  const missing = missingPeers();
362
375
  if (missing.length)
363
- console.warn(`[watchtower] missing OpenTelemetry package(s): ${missing.join(', ')}. Next.js standalone: ${STANDALONE_HINT}. Otherwise: npm install ${missing.join(' ')}`);
376
+ return turnOff(`missing OpenTelemetry package(s): ${missing.join(', ')}. Next.js standalone: ${STANDALONE_HINT}. Otherwise: npm install ${missing.join(' ')}`);
377
+ try {
378
+ return start(opts);
379
+ }
380
+ catch (e) {
381
+ return turnOff(e?.message ?? String(e));
382
+ }
383
+ }
384
+ function turnOff(why) {
385
+ state.current = undefined;
386
+ setOffReason(why);
387
+ console.warn(`[watchtower] telemetry is OFF: ${why}`);
388
+ return offClient();
389
+ }
390
+ function start(opts) {
391
+ defaultResourceDetectors(); // before any NodeSDK reads OTEL_NODE_RESOURCE_DETECTORS
364
392
  const nextMode = opts?.nextInternals ?? (process.env.NEXT_RUNTIME ? 'sample' : undefined);
365
393
  if (nextMode) {
366
394
  const own = nextInternalsFilter(nextMode, opts?.nextInternalsRate);
@@ -38,10 +38,17 @@ export interface WatchtowerNextOptions {
38
38
  export declare function hasSentry(cwd?: string): boolean;
39
39
  /** The `serverExternalPackages` withWatchtower adds; `sentry` drops the packages a bundled Sentry shares. */
40
40
  export declare function externalPackages(sentry: boolean): string[];
41
+ /**
42
+ * `outputFileTracingIncludes` globs for `ids` and everything they depend on, relative to `cwd`: each package's real
43
+ * folder plus every pnpm symlink on the way to it, which Next recreates as links (what its tracer emits for a static
44
+ * import). A plain `node_modules/<pkg>/**` glob copies a pnpm link as a folder cut off from its dependencies (B22).
45
+ */
46
+ export declare function tracingIncludes(ids: string[], cwd?: string): string[];
41
47
  /**
42
48
  * `module.exports = withWatchtower(nextConfig, { sourcemaps: true })`. Makes `output: 'standalone'` work with no other
43
- * config: the node SDK and its OpenTelemetry peers go into `serverExternalPackages` and (npm and pnpm layouts) into
44
- * `outputFileTracingIncludes` for every route. Sets `NEXT_PUBLIC_WT_RELEASE`. With `sourcemaps` it turns on
49
+ * config: the node SDK and its OpenTelemetry peers go into `serverExternalPackages`, and `outputFileTracingIncludes`
50
+ * for every route lists each one with its dependencies and pnpm links (npm, pnpm, monorepos; see tracingIncludes), so
51
+ * the SDK starts whichever entry instrumentation imports. Sets `NEXT_PUBLIC_WT_RELEASE`. With `sourcemaps` it turns on
45
52
  * `productionBrowserSourceMaps` (webpack and Turbopack); `{ upload: true }` uploads and deletes them after the webpack
46
53
  * client build, otherwise run `wt-next-sourcemaps` after `next build` (`"build": "next build && wt-next-sourcemaps"`).
47
54
  */
@@ -33,12 +33,53 @@ export function hasSentry(cwd = process.cwd()) {
33
33
  export function externalPackages(sentry) {
34
34
  return sentry ? EXTERNAL.filter((n) => !SHARED_WITH_SENTRY.has(n)) : EXTERNAL;
35
35
  }
36
+ /** Where Node finds package `id` from `from`: the lookup path (may be a pnpm symlink) and its real folder. */
37
+ function locate(id, from) {
38
+ for (let d = from;; d = nodePath.dirname(d)) {
39
+ const link = nodePath.join(d, 'node_modules', id);
40
+ if (fs.existsSync(nodePath.join(link, 'package.json')))
41
+ return { link, real: fs.realpathSync(link) };
42
+ if (nodePath.dirname(d) === d)
43
+ return undefined;
44
+ }
45
+ }
46
+ /**
47
+ * `outputFileTracingIncludes` globs for `ids` and everything they depend on, relative to `cwd`: each package's real
48
+ * folder plus every pnpm symlink on the way to it, which Next recreates as links (what its tracer emits for a static
49
+ * import). A plain `node_modules/<pkg>/**` glob copies a pnpm link as a folder cut off from its dependencies (B22).
50
+ */
51
+ export function tracingIncludes(ids, cwd = process.cwd()) {
52
+ const out = new Set(), seen = new Set();
53
+ const rel = (p) => nodePath.relative(cwd, p).split(nodePath.sep).join('/').replace(/[()[\]{}*?!]/g, '\\$&');
54
+ const visit = (id, from) => {
55
+ const hit = locate(id, from);
56
+ if (!hit)
57
+ return; // an optional peer that is not installed
58
+ if (fs.lstatSync(hit.link).isSymbolicLink())
59
+ out.add(rel(hit.link));
60
+ if (seen.has(hit.real))
61
+ return;
62
+ seen.add(hit.real);
63
+ out.add(`${rel(hit.real)}/**/*`);
64
+ try {
65
+ const pkg = JSON.parse(fs.readFileSync(nodePath.join(hit.real, 'package.json'), 'utf8'));
66
+ // peers: only OpenTelemetry ones (the SDK's peers are in `ids` already; following `next` would copy all of it)
67
+ const peers = Object.keys(pkg.peerDependencies ?? {}).filter((n) => n.startsWith('@opentelemetry/'));
68
+ for (const dep of [...Object.keys({ ...pkg.dependencies, ...pkg.optionalDependencies }), ...peers])
69
+ visit(dep, hit.real);
70
+ }
71
+ catch { /* unreadable package.json: its own files are still included */ }
72
+ };
73
+ for (const id of ids)
74
+ visit(id, cwd);
75
+ return [...out];
76
+ }
36
77
  const SHA_ENV = ['WT_RELEASE', 'GITHUB_SHA', 'CI_COMMIT_SHA', 'VERCEL_GIT_COMMIT_SHA', 'SOURCE_VERSION', 'BUILD_SHA', 'RENDER_GIT_COMMIT', 'HEROKU_SLUG_COMMIT'];
37
- const INCLUDE = ['@watchtowerobservability/node', '@opentelemetry'].flatMap((p) => [`./node_modules/${p}/**/*`, `./node_modules/.pnpm/${p.replace('/', '+')}*/**/*`]);
38
78
  /**
39
79
  * `module.exports = withWatchtower(nextConfig, { sourcemaps: true })`. Makes `output: 'standalone'` work with no other
40
- * config: the node SDK and its OpenTelemetry peers go into `serverExternalPackages` and (npm and pnpm layouts) into
41
- * `outputFileTracingIncludes` for every route. Sets `NEXT_PUBLIC_WT_RELEASE`. With `sourcemaps` it turns on
80
+ * config: the node SDK and its OpenTelemetry peers go into `serverExternalPackages`, and `outputFileTracingIncludes`
81
+ * for every route lists each one with its dependencies and pnpm links (npm, pnpm, monorepos; see tracingIncludes), so
82
+ * the SDK starts whichever entry instrumentation imports. Sets `NEXT_PUBLIC_WT_RELEASE`. With `sourcemaps` it turns on
42
83
  * `productionBrowserSourceMaps` (webpack and Turbopack); `{ upload: true }` uploads and deletes them after the webpack
43
84
  * client build, otherwise run `wt-next-sourcemaps` after `next build` (`"build": "next build && wt-next-sourcemaps"`).
44
85
  */
@@ -47,7 +88,7 @@ export function withWatchtower(config = {}, opts = {}) {
47
88
  const release = opts.release || SHA_ENV.map((k) => process.env[k]).find((v) => v && v !== 'unknown');
48
89
  const apply = (c) => {
49
90
  const inc = { ...c.outputFileTracingIncludes };
50
- inc['/*'] = [...new Set([...(inc['/*'] ?? []), ...INCLUDE])];
91
+ inc['/*'] = [...new Set([...(inc['/*'] ?? []), ...tracingIncludes(EXTERNAL)])];
51
92
  const out = {
52
93
  ...c,
53
94
  serverExternalPackages: [...new Set([...(c.serverExternalPackages ?? []), ...externalPackages(opts.sentry ?? hasSentry())])],
@@ -0,0 +1,9 @@
1
+ type Opts = Record<string, unknown>;
2
+ export type NextOptions = Opts;
3
+ export type SourcemapOptions = Opts;
4
+ export type TunnelOptions = Opts;
5
+ export declare const makeRegister: (_options?: NextOptions) => (() => Promise<void>);
6
+ export declare const register: () => Promise<void>;
7
+ export declare function onRequestError(_err?: unknown, _request?: unknown, _context?: unknown): Promise<void>;
8
+ export declare const withWatchtower: <T>(config: T, _opts?: Opts) => T;
9
+ export {};
@@ -0,0 +1,4 @@
1
+ export const makeRegister = (_options = {}) => async () => { };
2
+ export const register = makeRegister();
3
+ export async function onRequestError(_err, _request, _context) { }
4
+ export const withWatchtower = (config, _opts) => config;
@@ -2,8 +2,13 @@
2
2
  export declare function searchPaths(): string[];
3
3
  export declare function load(id: string): unknown;
4
4
  export declare const SDK_PEERS: string[];
5
- /** Load an OpenTelemetry SDK package (an optional peer); a missing one throws an error naming what to install. */
5
+ /** Load an OpenTelemetry SDK package (a dependency, loaded lazily); a missing one throws an error naming what to install. */
6
6
  export declare function need<T>(id: string): T;
7
- export declare const STANDALONE_HINT = "use withWatchtower() from @watchtowerobservability/next, or add them to serverExternalPackages and outputFileTracingIncludes in next.config";
7
+ export declare const STANDALONE_HINT = "use withWatchtower() from @watchtowerobservability/next (node SDK 0.7.9 or later) in next.config";
8
8
  /** Required OpenTelemetry peers that cannot be loaded from the SDK's location or the app root. */
9
9
  export declare function missingPeers(): string[];
10
+ /**
11
+ * Never called. Literal names so file tracers (Next's standalone nft) copy the SDK packages together with their pnpm
12
+ * links, which outputFileTracingIncludes cannot do. Safe for bundlers: these are dependencies, so always installed.
13
+ */
14
+ export declare const tracedPackages: () => Promise<unknown>[];
package/dist/esm/load.js CHANGED
@@ -4,11 +4,11 @@ import nodePath from 'node:path';
4
4
  // Bundlers must NOT follow this: an optional peer the app did not install would make webpack warn "Module not found",
5
5
  // and a bare require call on a variable id is a "Critical dependency" warning. createRequire() is opaque to webpack/esbuild/Next's tracer,
6
6
  // so peers resolve at run time from the SDK's own location, then from the app root (cwd). Install the peers in the app
7
- // (pnpm: as direct dependencies); for a Next standalone build add them to outputFileTracingIncludes.
7
+ // (pnpm: as direct dependencies). A Next standalone build gets them through withWatchtower's tracingIncludes (next-build.ts).
8
8
  /** Where peers are searched, in order: the SDK's own location, the cwd, the entry script's directory (pnpm monorepo apps run from the repo root). */
9
9
  export function searchPaths() {
10
10
  const entry = process.argv[1] ? `${nodePath.dirname(nodePath.resolve(process.argv[1]))}/` : '';
11
- return [typeof __filename === 'string' ? __filename : '', `${process.cwd()}/`, entry].filter(Boolean);
11
+ return [String(new URL(import.meta.url)), `${process.cwd()}/`, entry].filter(Boolean);
12
12
  }
13
13
  function resolvers() {
14
14
  return searchPaths().map((f) => createRequire(f));
@@ -32,7 +32,7 @@ export const SDK_PEERS = [
32
32
  '@opentelemetry/exporter-metrics-otlp-http', '@opentelemetry/exporter-trace-otlp-http', '@opentelemetry/otlp-transformer',
33
33
  '@opentelemetry/resources', '@opentelemetry/sdk-logs', '@opentelemetry/sdk-metrics', '@opentelemetry/sdk-trace',
34
34
  ];
35
- /** Load an OpenTelemetry SDK package (an optional peer); a missing one throws an error naming what to install. */
35
+ /** Load an OpenTelemetry SDK package (a dependency, loaded lazily); a missing one throws an error naming what to install. */
36
36
  export function need(id) {
37
37
  try {
38
38
  return load(id);
@@ -44,7 +44,7 @@ export function need(id) {
44
44
  throw e;
45
45
  }
46
46
  }
47
- export const STANDALONE_HINT = 'use withWatchtower() from @watchtowerobservability/next, or add them to serverExternalPackages and outputFileTracingIncludes in next.config';
47
+ export const STANDALONE_HINT = 'use withWatchtower() from @watchtowerobservability/next (node SDK 0.7.9 or later) in next.config';
48
48
  /** Required OpenTelemetry peers that cannot be loaded from the SDK's location or the app root. */
49
49
  export function missingPeers() {
50
50
  return SDK_PEERS.filter((id) => {
@@ -57,3 +57,12 @@ export function missingPeers() {
57
57
  }
58
58
  });
59
59
  }
60
+ /**
61
+ * Never called. Literal names so file tracers (Next's standalone nft) copy the SDK packages together with their pnpm
62
+ * links, which outputFileTracingIncludes cannot do. Safe for bundlers: these are dependencies, so always installed.
63
+ */
64
+ export const tracedPackages = () => [
65
+ import('@opentelemetry/context-async-hooks'), import('@opentelemetry/core'), import('@opentelemetry/exporter-logs-otlp-http'),
66
+ import('@opentelemetry/exporter-metrics-otlp-http'), import('@opentelemetry/exporter-trace-otlp-http'), import('@opentelemetry/otlp-transformer'),
67
+ import('@opentelemetry/resources'), import('@opentelemetry/sdk-logs'), import('@opentelemetry/sdk-metrics'), import('@opentelemetry/sdk-trace'),
68
+ ];
@@ -1,6 +1,4 @@
1
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
2
1
  import type { Resource } from '@opentelemetry/resources';
3
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
4
2
  import type { MeterProvider, PushMetricExporter } from '@opentelemetry/sdk-metrics';
5
3
  /** Explicit flag, else `WATCHTOWER_LOGS` / `WATCHTOWER_METRICS` (default on); `OTEL_*_EXPORTER=none` turns it off. */
6
4
  export declare function switchOn(name: string, otelExporterEnv: string, flag?: boolean): boolean;
@@ -1,13 +1,21 @@
1
1
  #!/usr/bin/env node
2
- // `wt-next-doctor [dir]`: exit 1 when .next/standalone lacks the SDK or an OpenTelemetry peer (see next-doctor.ts).
3
- import { standaloneMissing } from './next-doctor.js';
2
+ // `wt-next-doctor [dir]`: exit 1 when .next/standalone lacks the SDK or an OpenTelemetry peer, or one of them does not
3
+ // load from the standalone server.js (see next-doctor.ts).
4
+ import { standaloneMissing, standaloneServer, standaloneUnloadable } from './next-doctor.js';
4
5
  import { STANDALONE_HINT } from './load.js';
5
- const missing = standaloneMissing(process.argv[2]);
6
+ const dir = process.argv[2];
7
+ const missing = standaloneMissing(dir);
8
+ const server = missing && !missing.length ? standaloneServer(dir) : undefined;
9
+ const broken = server ? standaloneUnloadable(server) : [];
6
10
  if (!missing)
7
11
  console.log('[watchtower] no .next/standalone found; nothing to check');
8
12
  else if (missing.length) {
9
13
  console.error(`[watchtower] missing from .next/standalone/node_modules: ${missing.join(', ')}\n[watchtower] fix: ${STANDALONE_HINT}`);
10
14
  process.exit(1);
11
15
  }
16
+ else if (broken.length) {
17
+ console.error(`[watchtower] present but failing to load from ${server}:\n ${broken.join('\n ')}\n[watchtower] fix: ${STANDALONE_HINT}`);
18
+ process.exit(1);
19
+ }
12
20
  else
13
- console.log('[watchtower] standalone build includes the SDK and its OpenTelemetry peers');
21
+ console.log(`[watchtower] standalone build includes the SDK and its OpenTelemetry peers${server ? ', and they load' : ''}`);
@@ -1,2 +1,10 @@
1
- /** Packages missing from `<dir>/.next/standalone/node_modules`; undefined when there is no standalone build. */
1
+ /** Packages missing from `<dir>/.next/standalone/node_modules` (and the app's own, next to server.js); undefined when there is no standalone build. */
2
2
  export declare function standaloneMissing(dir?: string): string[] | undefined;
3
+ /** The standalone `server.js` (an app in a monorepo sits below `.next/standalone/<path>`); undefined when none. */
4
+ export declare function standaloneServer(dir?: string): string | undefined;
5
+ /**
6
+ * Import the SDK and load each peer the way the server will (from the SDK's location, then from server.js), in a child
7
+ * process; returns `id: error` for each that fails. Catches a peer copied without its own dependencies, which a
8
+ * folder check cannot see.
9
+ */
10
+ export declare function standaloneUnloadable(server: string): string[];
@@ -1,14 +1,52 @@
1
1
  // After `next build` with output 'standalone', check that the SDK and its OpenTelemetry peers were traced into
2
- // .next/standalone/node_modules (npm layout, or pnpm's .pnpm store). Exits 1 when any is missing.
2
+ // .next/standalone/node_modules (npm layout, or pnpm's .pnpm store), then load each one from the standalone server.js
3
+ // (wt-next-doctor exits 1 on either failure), so a peer copied without its own dependencies also fails.
4
+ import { execFileSync } from 'node:child_process';
3
5
  import * as fs from 'node:fs';
4
6
  import * as nodePath from 'node:path';
5
7
  import { SDK_PEERS } from './load.js';
6
- /** Packages missing from `<dir>/.next/standalone/node_modules`; undefined when there is no standalone build. */
8
+ /** Packages missing from `<dir>/.next/standalone/node_modules` (and the app's own, next to server.js); undefined when there is no standalone build. */
7
9
  export function standaloneMissing(dir = '.') {
8
10
  const nm = nodePath.join(dir, '.next', 'standalone', 'node_modules');
9
11
  if (!fs.existsSync(nodePath.join(dir, '.next', 'standalone')))
10
12
  return undefined;
11
13
  const pnpm = nodePath.join(nm, '.pnpm');
12
14
  const store = fs.existsSync(pnpm) ? fs.readdirSync(pnpm) : [];
13
- return ['@watchtowerobservability/node', ...SDK_PEERS].filter((id) => !fs.existsSync(nodePath.join(nm, id)) && !store.some((e) => e.startsWith(`${id.replace('/', '+')}@`)));
15
+ const server = standaloneServer(dir); // a monorepo app has its own node_modules next to server.js
16
+ const appNm = server ? nodePath.join(nodePath.dirname(server), 'node_modules') : nm;
17
+ return ['@watchtowerobservability/node', ...SDK_PEERS].filter((id) => !fs.existsSync(nodePath.join(nm, id)) && !fs.existsSync(nodePath.join(appNm, id)) && !store.some((e) => e.startsWith(`${id.replace('/', '+')}@`)));
18
+ }
19
+ /** The standalone `server.js` (an app in a monorepo sits below `.next/standalone/<path>`); undefined when none. */
20
+ export function standaloneServer(dir = '.') {
21
+ const find = (d, depth) => {
22
+ if (fs.existsSync(nodePath.join(d, 'server.js')))
23
+ return nodePath.join(d, 'server.js');
24
+ if (depth === 0)
25
+ return undefined;
26
+ for (const e of fs.readdirSync(d, { withFileTypes: true })) {
27
+ if (!e.isDirectory() || e.name === 'node_modules' || e.name.startsWith('.'))
28
+ continue;
29
+ const hit = find(nodePath.join(d, e.name), depth - 1);
30
+ if (hit)
31
+ return hit;
32
+ }
33
+ return undefined;
34
+ };
35
+ const root = nodePath.join(dir, '.next', 'standalone');
36
+ return fs.existsSync(root) ? find(root, 4) : undefined;
37
+ }
38
+ /**
39
+ * Import the SDK and load each peer the way the server will (from the SDK's location, then from server.js), in a child
40
+ * process; returns `id: error` for each that fails. Catches a peer copied without its own dependencies, which a
41
+ * folder check cannot see.
42
+ */
43
+ export function standaloneUnloadable(server) {
44
+ const abs = nodePath.resolve(server);
45
+ // ESM, as Next loads the external SDK (its CJS build is not traced); bare specifiers resolve from cwd
46
+ const code = `import { createRequire } from 'node:module'; const app = createRequire(${JSON.stringify(abs)}); const bad = [];
47
+ let sdk; try { await import('@watchtowerobservability/node'); sdk = createRequire(import.meta.resolve('@watchtowerobservability/node')); } catch (e) { bad.push('@watchtowerobservability/node: ' + e.message.split('\\n')[0]); }
48
+ for (const id of ${JSON.stringify(SDK_PEERS)}) { try { (sdk || app)(id); } catch (e) { try { app(id); } catch { bad.push(id + ': ' + e.message.split('\\n')[0]); } } }
49
+ process.stdout.write(JSON.stringify(bad)); process.exit(0);`;
50
+ const out = execFileSync(process.execPath, ['--input-type=module', '-e', code], { cwd: nodePath.dirname(abs), encoding: 'utf8' });
51
+ return JSON.parse(out);
14
52
  }
@@ -1,4 +1,3 @@
1
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
2
1
  import type { ReadableSpan } from '@opentelemetry/sdk-trace';
3
2
  /** Whether `span` is one of Next's internal spans (not a request, route handler, render, server action or fetch). */
4
3
  export declare function isNextInternal(span: ReadableSpan): boolean;
@@ -1,4 +1,3 @@
1
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
2
1
  import type { SpanProcessor } from '@opentelemetry/sdk-trace';
3
2
  export interface Frame {
4
3
  file: string;
@@ -1,4 +1,3 @@
1
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
2
1
  import type { SpanProcessor } from '@opentelemetry/sdk-trace';
3
2
  export type RedactHook = (key: string, value: unknown) => unknown;
4
3
  /** Hook keys for the non-attribute fields. Event attributes (incl. exception.message / exception.stacktrace) use their own keys. */
@@ -1,5 +1,4 @@
1
1
  import type { Attributes, Context, Link, SpanKind } from '@opentelemetry/api';
2
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
3
2
  import type { Sampler, SamplingResult } from '@opentelemetry/sdk-trace';
4
3
  export interface SamplingRule {
5
4
  name?: string;
@@ -1,4 +1,3 @@
1
- // @ts-ignore optional peer: absent -> any (keeps skipLibCheck:false consumers compiling)
2
1
  import type { SpanProcessor } from '@opentelemetry/sdk-trace';
3
2
  /**
4
3
  * A path segment that looks like a secret: UUID, hex run >= 16, JWT, digit run >= 16, or an opaque token (>= 16 chars of
@@ -1,2 +1,2 @@
1
1
  /** This package's version (test/distro.test.ts checks it against package.json); sent as `telemetry.distro.version`. */
2
- export declare const VERSION = "0.7.8";
2
+ export declare const VERSION = "0.8.0";
@@ -1,2 +1,2 @@
1
1
  /** This package's version (test/distro.test.ts checks it against package.json); sent as `telemetry.distro.version`. */
2
- export const VERSION = '0.7.8';
2
+ export const VERSION = '0.8.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@watchtowerobservability/node",
3
- "version": "0.7.8",
3
+ "version": "0.8.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/watchtowerobservability/watchtower-node.git"
@@ -133,6 +133,18 @@
133
133
  }
134
134
  },
135
135
  "./next": {
136
+ "edge-light": {
137
+ "types": "./dist/esm/integrations/next-edge.d.ts",
138
+ "default": "./dist/esm/integrations/next-edge.js"
139
+ },
140
+ "worker": {
141
+ "types": "./dist/esm/integrations/next-edge.d.ts",
142
+ "default": "./dist/esm/integrations/next-edge.js"
143
+ },
144
+ "browser": {
145
+ "types": "./dist/esm/integrations/next-edge.d.ts",
146
+ "default": "./dist/esm/integrations/next-edge.js"
147
+ },
136
148
  "import": {
137
149
  "types": "./dist/esm/integrations/next.d.ts",
138
150
  "default": "./dist/esm/integrations/next.js"
@@ -425,14 +437,19 @@
425
437
  "smoke": "node scripts/smoke-pack.mjs"
426
438
  },
427
439
  "dependencies": {
428
- "@opentelemetry/api": "^1.10.0"
429
- },
430
- "peerDependencies": {
440
+ "@opentelemetry/api": "^1.10.0",
431
441
  "@opentelemetry/context-async-hooks": "^3.1.0",
432
442
  "@opentelemetry/core": "^3.1.0",
433
443
  "@opentelemetry/exporter-logs-otlp-http": "^0.301.0",
434
444
  "@opentelemetry/exporter-metrics-otlp-http": "^0.301.0",
435
445
  "@opentelemetry/exporter-trace-otlp-http": "^0.301.0",
446
+ "@opentelemetry/otlp-transformer": "^0.301.0",
447
+ "@opentelemetry/resources": "^3.1.0",
448
+ "@opentelemetry/sdk-logs": "^3.1.0",
449
+ "@opentelemetry/sdk-metrics": "^3.1.0",
450
+ "@opentelemetry/sdk-trace": "^3.1.0"
451
+ },
452
+ "peerDependencies": {
436
453
  "@opentelemetry/instrumentation": ">=0.200.0",
437
454
  "@opentelemetry/instrumentation-http": ">=0.200.0",
438
455
  "@opentelemetry/instrumentation-ioredis": ">=0.50.0",
@@ -440,29 +457,9 @@
440
457
  "@opentelemetry/instrumentation-pg": ">=0.50.0",
441
458
  "@opentelemetry/instrumentation-runtime-node": ">=0.38.0",
442
459
  "@opentelemetry/instrumentation-undici": ">=0.10.0",
443
- "@opentelemetry/otlp-transformer": "^0.301.0",
444
- "@opentelemetry/resources": "^3.1.0",
445
- "@opentelemetry/sdk-logs": "^3.1.0",
446
- "@opentelemetry/sdk-metrics": "^3.1.0",
447
- "@opentelemetry/sdk-trace": "^3.1.0",
448
460
  "winston-transport": "^4.0.0"
449
461
  },
450
462
  "peerDependenciesMeta": {
451
- "@opentelemetry/context-async-hooks": {
452
- "optional": true
453
- },
454
- "@opentelemetry/core": {
455
- "optional": true
456
- },
457
- "@opentelemetry/exporter-logs-otlp-http": {
458
- "optional": true
459
- },
460
- "@opentelemetry/exporter-metrics-otlp-http": {
461
- "optional": true
462
- },
463
- "@opentelemetry/exporter-trace-otlp-http": {
464
- "optional": true
465
- },
466
463
  "@opentelemetry/instrumentation": {
467
464
  "optional": true
468
465
  },
@@ -484,36 +481,11 @@
484
481
  "@opentelemetry/instrumentation-undici": {
485
482
  "optional": true
486
483
  },
487
- "@opentelemetry/otlp-transformer": {
488
- "optional": true
489
- },
490
- "@opentelemetry/resources": {
491
- "optional": true
492
- },
493
- "@opentelemetry/sdk-logs": {
494
- "optional": true
495
- },
496
- "@opentelemetry/sdk-metrics": {
497
- "optional": true
498
- },
499
- "@opentelemetry/sdk-trace": {
500
- "optional": true
501
- },
502
484
  "winston-transport": {
503
485
  "optional": true
504
486
  }
505
487
  },
506
488
  "devDependencies": {
507
- "@opentelemetry/context-async-hooks": "^3.1.0",
508
- "@opentelemetry/core": "^3.1.0",
509
- "@opentelemetry/exporter-logs-otlp-http": "^0.301.0",
510
- "@opentelemetry/exporter-metrics-otlp-http": "^0.301.0",
511
- "@opentelemetry/exporter-trace-otlp-http": "^0.301.0",
512
- "@opentelemetry/otlp-transformer": "^0.301.0",
513
- "@opentelemetry/resources": "^3.1.0",
514
- "@opentelemetry/sdk-logs": "^3.1.0",
515
- "@opentelemetry/sdk-metrics": "^3.1.0",
516
- "@opentelemetry/sdk-trace": "^3.1.0",
517
489
  "@types/node": "22.15.0",
518
490
  "typescript": "5.7.2",
519
491
  "vitest": "5.0.5",