@watchtowerobservability/node 0.7.5 → 0.7.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.
- package/CHANGELOG.md +5 -2
- package/dist/cjs/integrations/next-build.d.ts +6 -0
- package/dist/cjs/integrations/next-build.js +25 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/integrations/next-build.d.ts +6 -0
- package/dist/esm/integrations/next-build.js +23 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.6 (2026-11-15)
|
|
4
|
+
|
|
5
|
+
- Next.js: `withWatchtower` now keeps every OpenTelemetry instrumentation package the SDK loads (`instrumentation-http`, `-undici`, `-runtime-node`, `-pg`, `-mysql2`, `-ioredis`) in `serverExternalPackages`. Bundled, they extended an undefined `InstrumentationBase` and a standalone build failed every request with `Class extends value undefined`. A test keeps the list in step with `package.json`.
|
|
6
|
+
- Next.js next to Sentry: when `@sentry/nextjs` or `@sentry/node` is in the app's `package.json` (or `sentry: true`), `withWatchtower` no longer externalises `@opentelemetry/api` and `@opentelemetry/instrumentation`. Sentry's nested OTel copies stay bundled and imported them; externalised, its bundled `HttpInstrumentation` extended `undefined` and every request failed in the instrumentation hook.
|
|
7
|
+
|
|
3
8
|
## 0.7.5 (2026-11-15)
|
|
4
9
|
|
|
5
10
|
- Telemetry that is off is now visible: the `register` preload prints `[watchtower] telemetry is OFF: <reason>` when `WT_INGEST_KEY` is unset or the SDK cannot start, and the first helper call that is dropped (`log`, `observe`, `checkin` ...) prints it once more with the reason.
|
|
@@ -33,8 +38,6 @@
|
|
|
33
38
|
- Behaviour change: datastore `requireParent` now defaults to true only when HTTP server instrumentation is active, so queue workers (BullMQ) record their queries as root spans. `WATCHTOWER_DB_REQUIRE_PARENT=0/1` still overrides.
|
|
34
39
|
- `instrumentPostgres()` logs one warning when `postgres` is installed but `diagnostics_channel.tracingChannel` is unavailable (needs `postgres@>=4`).
|
|
35
40
|
|
|
36
|
-
## 0.7.5
|
|
37
|
-
|
|
38
41
|
- `wt-next-sourcemaps` / `uploadSourcemaps()` send the maps in one `POST /v1/projects/{prj}/artifacts/bundle?release=` request per ~120 MB (tar.gz plus a manifest) instead of one request per map. A server without the bundle route is detected and the batch falls back to the concurrent, gzipped single uploads (429/5xx retried with backoff). The final line is still `{uploaded, skipped, failed}`; a failed map is logged with its reason. Re-posting the same bytes returns 200 and counts as `skipped`.
|
|
39
42
|
|
|
40
43
|
## 0.7.4
|
|
@@ -31,7 +31,13 @@ export interface WatchtowerNextOptions {
|
|
|
31
31
|
});
|
|
32
32
|
/** Release: injected as `NEXT_PUBLIC_WT_RELEASE` (read by `<WatchtowerRUM>`). Default WT_RELEASE, then the git sha of the CI/host env. */
|
|
33
33
|
release?: string;
|
|
34
|
+
/** Sentry is in the app (default: `@sentry/nextjs` or `@sentry/node` in package.json): keep the OTel packages it shares bundled. */
|
|
35
|
+
sentry?: boolean;
|
|
34
36
|
}
|
|
37
|
+
/** Is a Sentry Node/Next SDK installed in the app being built? */
|
|
38
|
+
export declare function hasSentry(cwd?: string): boolean;
|
|
39
|
+
/** The `serverExternalPackages` withWatchtower adds; `sentry` drops the packages a bundled Sentry shares. */
|
|
40
|
+
export declare function externalPackages(sentry: boolean): string[];
|
|
35
41
|
/**
|
|
36
42
|
* `module.exports = withWatchtower(nextConfig, { sourcemaps: true })`. Makes `output: 'standalone'` work with no other
|
|
37
43
|
* config: the node SDK and its OpenTelemetry peers go into `serverExternalPackages` and (npm and pnpm layouts) into
|
|
@@ -33,6 +33,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.hasSentry = hasSentry;
|
|
37
|
+
exports.externalPackages = externalPackages;
|
|
36
38
|
exports.withWatchtower = withWatchtower;
|
|
37
39
|
exports.makeTar = makeTar;
|
|
38
40
|
exports.uploadSourcemaps = uploadSourcemaps;
|
|
@@ -45,10 +47,32 @@ const next_debugid_js_1 = require("./next-debugid.js");
|
|
|
45
47
|
const OTEL = [
|
|
46
48
|
'@opentelemetry/api', '@opentelemetry/context-async-hooks', '@opentelemetry/core', '@opentelemetry/exporter-logs-otlp-http',
|
|
47
49
|
'@opentelemetry/exporter-metrics-otlp-http', '@opentelemetry/exporter-trace-otlp-http', '@opentelemetry/instrumentation',
|
|
50
|
+
// every instrumentation too, so none of ours is bundled against an external base class
|
|
51
|
+
'@opentelemetry/instrumentation-http', '@opentelemetry/instrumentation-ioredis', '@opentelemetry/instrumentation-mysql2',
|
|
52
|
+
'@opentelemetry/instrumentation-pg', '@opentelemetry/instrumentation-runtime-node', '@opentelemetry/instrumentation-undici',
|
|
48
53
|
'@opentelemetry/otlp-transformer', '@opentelemetry/resources', '@opentelemetry/sdk-logs', '@opentelemetry/sdk-metrics',
|
|
49
54
|
'@opentelemetry/sdk-trace',
|
|
50
55
|
];
|
|
51
56
|
const EXTERNAL = ['@watchtowerobservability/node', ...OTEL];
|
|
57
|
+
// Packages Sentry's own nested OTel copies import. Sentry stays bundled, so externalising these made its bundled
|
|
58
|
+
// `HttpInstrumentation` extend an `InstrumentationBase` that resolved to undefined (B9b). With Sentry present they stay
|
|
59
|
+
// bundled for Sentry, while ours (external) still resolve them from node_modules at run time.
|
|
60
|
+
const SHARED_WITH_SENTRY = new Set(['@opentelemetry/api', '@opentelemetry/instrumentation']);
|
|
61
|
+
/** Is a Sentry Node/Next SDK installed in the app being built? */
|
|
62
|
+
function hasSentry(cwd = process.cwd()) {
|
|
63
|
+
try {
|
|
64
|
+
const pkg = JSON.parse(fs.readFileSync(nodePath.join(cwd, 'package.json'), 'utf8'));
|
|
65
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
66
|
+
return Object.keys(deps).some((n) => n === '@sentry/nextjs' || n === '@sentry/node');
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/** The `serverExternalPackages` withWatchtower adds; `sentry` drops the packages a bundled Sentry shares. */
|
|
73
|
+
function externalPackages(sentry) {
|
|
74
|
+
return sentry ? EXTERNAL.filter((n) => !SHARED_WITH_SENTRY.has(n)) : EXTERNAL;
|
|
75
|
+
}
|
|
52
76
|
const SHA_ENV = ['WT_RELEASE', 'GITHUB_SHA', 'CI_COMMIT_SHA', 'VERCEL_GIT_COMMIT_SHA', 'SOURCE_VERSION', 'BUILD_SHA', 'RENDER_GIT_COMMIT', 'HEROKU_SLUG_COMMIT'];
|
|
53
77
|
const INCLUDE = ['@watchtowerobservability/node', '@opentelemetry'].flatMap((p) => [`./node_modules/${p}/**/*`, `./node_modules/.pnpm/${p.replace('/', '+')}*/**/*`]);
|
|
54
78
|
/**
|
|
@@ -66,7 +90,7 @@ function withWatchtower(config = {}, opts = {}) {
|
|
|
66
90
|
inc['/*'] = [...new Set([...(inc['/*'] ?? []), ...INCLUDE])];
|
|
67
91
|
const out = {
|
|
68
92
|
...c,
|
|
69
|
-
serverExternalPackages: [...new Set([...(c.serverExternalPackages ?? []), ...
|
|
93
|
+
serverExternalPackages: [...new Set([...(c.serverExternalPackages ?? []), ...externalPackages(opts.sentry ?? hasSentry())])],
|
|
70
94
|
outputFileTracingIncludes: inc,
|
|
71
95
|
};
|
|
72
96
|
if (release)
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -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.
|
|
2
|
+
export declare const VERSION = "0.7.6";
|
package/dist/cjs/version.js
CHANGED
|
@@ -31,7 +31,13 @@ export interface WatchtowerNextOptions {
|
|
|
31
31
|
});
|
|
32
32
|
/** Release: injected as `NEXT_PUBLIC_WT_RELEASE` (read by `<WatchtowerRUM>`). Default WT_RELEASE, then the git sha of the CI/host env. */
|
|
33
33
|
release?: string;
|
|
34
|
+
/** Sentry is in the app (default: `@sentry/nextjs` or `@sentry/node` in package.json): keep the OTel packages it shares bundled. */
|
|
35
|
+
sentry?: boolean;
|
|
34
36
|
}
|
|
37
|
+
/** Is a Sentry Node/Next SDK installed in the app being built? */
|
|
38
|
+
export declare function hasSentry(cwd?: string): boolean;
|
|
39
|
+
/** The `serverExternalPackages` withWatchtower adds; `sentry` drops the packages a bundled Sentry shares. */
|
|
40
|
+
export declare function externalPackages(sentry: boolean): string[];
|
|
35
41
|
/**
|
|
36
42
|
* `module.exports = withWatchtower(nextConfig, { sourcemaps: true })`. Makes `output: 'standalone'` work with no other
|
|
37
43
|
* config: the node SDK and its OpenTelemetry peers go into `serverExternalPackages` and (npm and pnpm layouts) into
|
|
@@ -7,10 +7,32 @@ import { injectDebugIds } from './next-debugid.js';
|
|
|
7
7
|
const OTEL = [
|
|
8
8
|
'@opentelemetry/api', '@opentelemetry/context-async-hooks', '@opentelemetry/core', '@opentelemetry/exporter-logs-otlp-http',
|
|
9
9
|
'@opentelemetry/exporter-metrics-otlp-http', '@opentelemetry/exporter-trace-otlp-http', '@opentelemetry/instrumentation',
|
|
10
|
+
// every instrumentation too, so none of ours is bundled against an external base class
|
|
11
|
+
'@opentelemetry/instrumentation-http', '@opentelemetry/instrumentation-ioredis', '@opentelemetry/instrumentation-mysql2',
|
|
12
|
+
'@opentelemetry/instrumentation-pg', '@opentelemetry/instrumentation-runtime-node', '@opentelemetry/instrumentation-undici',
|
|
10
13
|
'@opentelemetry/otlp-transformer', '@opentelemetry/resources', '@opentelemetry/sdk-logs', '@opentelemetry/sdk-metrics',
|
|
11
14
|
'@opentelemetry/sdk-trace',
|
|
12
15
|
];
|
|
13
16
|
const EXTERNAL = ['@watchtowerobservability/node', ...OTEL];
|
|
17
|
+
// Packages Sentry's own nested OTel copies import. Sentry stays bundled, so externalising these made its bundled
|
|
18
|
+
// `HttpInstrumentation` extend an `InstrumentationBase` that resolved to undefined (B9b). With Sentry present they stay
|
|
19
|
+
// bundled for Sentry, while ours (external) still resolve them from node_modules at run time.
|
|
20
|
+
const SHARED_WITH_SENTRY = new Set(['@opentelemetry/api', '@opentelemetry/instrumentation']);
|
|
21
|
+
/** Is a Sentry Node/Next SDK installed in the app being built? */
|
|
22
|
+
export function hasSentry(cwd = process.cwd()) {
|
|
23
|
+
try {
|
|
24
|
+
const pkg = JSON.parse(fs.readFileSync(nodePath.join(cwd, 'package.json'), 'utf8'));
|
|
25
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
26
|
+
return Object.keys(deps).some((n) => n === '@sentry/nextjs' || n === '@sentry/node');
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** The `serverExternalPackages` withWatchtower adds; `sentry` drops the packages a bundled Sentry shares. */
|
|
33
|
+
export function externalPackages(sentry) {
|
|
34
|
+
return sentry ? EXTERNAL.filter((n) => !SHARED_WITH_SENTRY.has(n)) : EXTERNAL;
|
|
35
|
+
}
|
|
14
36
|
const SHA_ENV = ['WT_RELEASE', 'GITHUB_SHA', 'CI_COMMIT_SHA', 'VERCEL_GIT_COMMIT_SHA', 'SOURCE_VERSION', 'BUILD_SHA', 'RENDER_GIT_COMMIT', 'HEROKU_SLUG_COMMIT'];
|
|
15
37
|
const INCLUDE = ['@watchtowerobservability/node', '@opentelemetry'].flatMap((p) => [`./node_modules/${p}/**/*`, `./node_modules/.pnpm/${p.replace('/', '+')}*/**/*`]);
|
|
16
38
|
/**
|
|
@@ -28,7 +50,7 @@ export function withWatchtower(config = {}, opts = {}) {
|
|
|
28
50
|
inc['/*'] = [...new Set([...(inc['/*'] ?? []), ...INCLUDE])];
|
|
29
51
|
const out = {
|
|
30
52
|
...c,
|
|
31
|
-
serverExternalPackages: [...new Set([...(c.serverExternalPackages ?? []), ...
|
|
53
|
+
serverExternalPackages: [...new Set([...(c.serverExternalPackages ?? []), ...externalPackages(opts.sentry ?? hasSentry())])],
|
|
32
54
|
outputFileTracingIncludes: inc,
|
|
33
55
|
};
|
|
34
56
|
if (release)
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -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.
|
|
2
|
+
export declare const VERSION = "0.7.6";
|
package/dist/esm/version.js
CHANGED
|
@@ -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.
|
|
2
|
+
export const VERSION = '0.7.6';
|