@nextdog/node 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/console-patch.d.ts.map +1 -1
- package/dist/console-patch.js +4 -3
- package/dist/console-patch.js.map +1 -1
- package/dist/exporter.d.ts +5 -1
- package/dist/exporter.d.ts.map +1 -1
- package/dist/exporter.js +42 -4
- package/dist/exporter.js.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/instrument-db.d.ts +17 -0
- package/dist/instrument-db.d.ts.map +1 -0
- package/dist/instrument-db.js +231 -0
- package/dist/instrument-db.js.map +1 -0
- package/dist/instrument-fetch.d.ts +7 -0
- package/dist/instrument-fetch.d.ts.map +1 -0
- package/dist/instrument-fetch.js +107 -0
- package/dist/instrument-fetch.js.map +1 -0
- package/dist/instrumentation.d.ts +21 -0
- package/dist/instrumentation.d.ts.map +1 -0
- package/dist/instrumentation.js +39 -0
- package/dist/instrumentation.js.map +1 -0
- package/dist/request-capture.d.ts +6 -0
- package/dist/request-capture.d.ts.map +1 -1
- package/dist/request-capture.js +172 -9
- package/dist/request-capture.js.map +1 -1
- package/dist/sidecar.d.ts +73 -1
- package/dist/sidecar.d.ts.map +1 -1
- package/dist/sidecar.js +180 -22
- package/dist/sidecar.js.map +1 -1
- package/package.json +6 -4
package/dist/sidecar.js
CHANGED
|
@@ -1,23 +1,69 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { join, dirname } from 'node:path';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { mkdir, open, readFile, writeFile } from 'node:fs/promises';
|
|
5
4
|
import { createRequire } from 'node:module';
|
|
5
|
+
import { homedir } from 'node:os';
|
|
6
|
+
import { dirname, join, parse as parsePath } from 'node:path';
|
|
7
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
8
|
+
import { NEXTDOG_HEALTH_MARKER } from '@nextdog/core';
|
|
6
9
|
const NEXTDOG_DIR = join(homedir(), '.nextdog');
|
|
7
10
|
const PID_FILE = join(NEXTDOG_DIR, 'nextdog.pid');
|
|
8
11
|
const LOG_FILE = join(NEXTDOG_DIR, 'sidecar.log');
|
|
9
|
-
|
|
12
|
+
const PROBE_TIMEOUT_MS = 2000;
|
|
13
|
+
/**
|
|
14
|
+
* Single source of truth for reading and classifying `${url}/health`. Both
|
|
15
|
+
* {@link isHealthy} and {@link isForeignOccupant} are thin views over this so
|
|
16
|
+
* the fetch/timeout/JSON/marker logic lives in exactly one place.
|
|
17
|
+
*
|
|
18
|
+
* @internal exported for testing.
|
|
19
|
+
*/
|
|
20
|
+
export async function probeHealth(url) {
|
|
10
21
|
try {
|
|
11
22
|
const controller = new AbortController();
|
|
12
|
-
const timeout = setTimeout(() => controller.abort(),
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
23
|
+
const timeout = setTimeout(() => controller.abort(), PROBE_TIMEOUT_MS);
|
|
24
|
+
let res;
|
|
25
|
+
try {
|
|
26
|
+
res = await fetch(`${url}/health`, { signal: controller.signal });
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
clearTimeout(timeout);
|
|
30
|
+
}
|
|
31
|
+
if (!res.ok)
|
|
32
|
+
return 'absent';
|
|
33
|
+
let body;
|
|
34
|
+
try {
|
|
35
|
+
body = await res.json();
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return 'foreign'; // 2xx, but not even JSON — something else holds the port.
|
|
39
|
+
}
|
|
40
|
+
const marked = typeof body === 'object' &&
|
|
41
|
+
body !== null &&
|
|
42
|
+
body.service === NEXTDOG_HEALTH_MARKER;
|
|
43
|
+
return marked ? 'nextdog' : 'foreign';
|
|
16
44
|
}
|
|
17
45
|
catch {
|
|
18
|
-
return
|
|
46
|
+
return 'absent'; // connection refused / aborted — port is free, not foreign.
|
|
19
47
|
}
|
|
20
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Whether `${url}/health` is answered by a genuine NextDog sidecar. A 2xx alone
|
|
51
|
+
* is NOT enough: the body must be JSON carrying the `service: "nextdog"`
|
|
52
|
+
* signature, so we never silently ship telemetry to a foreign process (#17).
|
|
53
|
+
*
|
|
54
|
+
* @internal exported for testing.
|
|
55
|
+
*/
|
|
56
|
+
export async function isHealthy(url) {
|
|
57
|
+
return (await probeHealth(url)) === 'nextdog';
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Whether `${url}/health` is answered by a process that is NOT a NextDog
|
|
61
|
+
* sidecar (a 2xx lacking the signature). Distinguishes "foreign occupant" from
|
|
62
|
+
* "nothing listening" — the latter returns false.
|
|
63
|
+
*/
|
|
64
|
+
async function isForeignOccupant(url) {
|
|
65
|
+
return (await probeHealth(url)) === 'foreign';
|
|
66
|
+
}
|
|
21
67
|
async function isProcessRunning(pid) {
|
|
22
68
|
try {
|
|
23
69
|
process.kill(pid, 0);
|
|
@@ -37,21 +83,102 @@ async function readPid() {
|
|
|
37
83
|
return null;
|
|
38
84
|
}
|
|
39
85
|
}
|
|
40
|
-
|
|
41
|
-
|
|
86
|
+
/**
|
|
87
|
+
* A `file://` URL points at a real on-disk location only if none of its path
|
|
88
|
+
* segments is a bundler-virtual placeholder. Turbopack rewrites a bundled
|
|
89
|
+
* module's `import.meta.url` to a virtual URL carrying a literal `[project]`
|
|
90
|
+
* segment (and similar `[...]` markers), so `createRequire()` on that URL
|
|
91
|
+
* resolves dependencies to non-existent `[project]/node_modules/...` paths.
|
|
92
|
+
* See issue #15.
|
|
93
|
+
*
|
|
94
|
+
* @internal exported for testing.
|
|
95
|
+
*/
|
|
96
|
+
export function isRealFileUrl(url) {
|
|
97
|
+
if (!url.startsWith('file:'))
|
|
98
|
+
return false;
|
|
99
|
+
let p;
|
|
42
100
|
try {
|
|
43
|
-
|
|
44
|
-
return join(dirname(corePkgPath), 'dist', 'cli.js');
|
|
101
|
+
p = fileURLToPath(url);
|
|
45
102
|
}
|
|
46
103
|
catch {
|
|
47
|
-
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
// Reject any virtual `[...]` path segment (e.g. Turbopack's `[project]`).
|
|
107
|
+
return !/\[[^/\\]+\]/.test(p);
|
|
108
|
+
}
|
|
109
|
+
function coreCliFromPackageJson(corePkgPath) {
|
|
110
|
+
return join(dirname(corePkgPath), 'dist', 'cli.js');
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Resolve the absolute path to the `@nextdog/core` CLI (`dist/cli.js`) in a way
|
|
114
|
+
* that works regardless of the bundler the host dev server uses.
|
|
115
|
+
*
|
|
116
|
+
* Resolution order, returning the first candidate that exists on disk:
|
|
117
|
+
* 1. `createRequire(anchorUrl)` — the module's own `import.meta.url`, but only
|
|
118
|
+
* when it is a real on-disk URL (skipped under Turbopack's virtual URL).
|
|
119
|
+
* 2. `createRequire(<projectRoot>/package.json)` — resolves through the real
|
|
120
|
+
* `node_modules` graph of the user's project, independent of any bundler.
|
|
121
|
+
* 3. A direct walk up the `node_modules` chain from the project root.
|
|
122
|
+
*
|
|
123
|
+
* Each candidate is validated against the filesystem before being returned, so
|
|
124
|
+
* a bundler that hands us a plausible-but-wrong path never makes it through.
|
|
125
|
+
*
|
|
126
|
+
* @internal exported for testing.
|
|
127
|
+
*/
|
|
128
|
+
export function resolveCoreCliPath(opts = {}) {
|
|
129
|
+
const anchorUrl = opts.anchorUrl ?? import.meta.url;
|
|
130
|
+
const projectRoot = opts.projectRoot ?? process.cwd();
|
|
131
|
+
const tried = [];
|
|
132
|
+
const tryRequire = (fromUrl) => {
|
|
133
|
+
let req;
|
|
48
134
|
try {
|
|
49
|
-
|
|
135
|
+
req = createRequire(fromUrl);
|
|
50
136
|
}
|
|
51
137
|
catch {
|
|
52
|
-
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
for (const spec of ['@nextdog/core/package.json', '@nextdog/core/dist/cli.js']) {
|
|
141
|
+
try {
|
|
142
|
+
const resolved = req.resolve(spec);
|
|
143
|
+
const cli = spec.endsWith('package.json') ? coreCliFromPackageJson(resolved) : resolved;
|
|
144
|
+
tried.push(cli);
|
|
145
|
+
if (existsSync(cli))
|
|
146
|
+
return cli;
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
// not resolvable from this anchor — try the next spec/anchor
|
|
150
|
+
}
|
|
53
151
|
}
|
|
152
|
+
return undefined;
|
|
153
|
+
};
|
|
154
|
+
// 1. The module's own location — but only if it's a real, non-virtual URL.
|
|
155
|
+
// Under Turbopack this is virtual and is skipped so we don't resolve to a
|
|
156
|
+
// bogus `[project]/node_modules/...` path.
|
|
157
|
+
if (isRealFileUrl(anchorUrl)) {
|
|
158
|
+
const fromAnchor = tryRequire(anchorUrl);
|
|
159
|
+
if (fromAnchor)
|
|
160
|
+
return fromAnchor;
|
|
54
161
|
}
|
|
162
|
+
// 2. Resolve through the real project root's module graph. `process.cwd()` is
|
|
163
|
+
// the user's project directory and is never virtualized by a bundler.
|
|
164
|
+
const fromProject = tryRequire(pathToFileURL(join(projectRoot, 'package.json')).href);
|
|
165
|
+
if (fromProject)
|
|
166
|
+
return fromProject;
|
|
167
|
+
// 3. Last-resort: walk up node_modules from the project root and probe for an
|
|
168
|
+
// installed @nextdog/core (covers hoisted and nested layouts).
|
|
169
|
+
let dir = projectRoot;
|
|
170
|
+
for (;;) {
|
|
171
|
+
const cli = join(dir, 'node_modules', '@nextdog', 'core', 'dist', 'cli.js');
|
|
172
|
+
tried.push(cli);
|
|
173
|
+
if (existsSync(cli))
|
|
174
|
+
return cli;
|
|
175
|
+
const parent = parsePath(dir).dir;
|
|
176
|
+
if (parent === dir)
|
|
177
|
+
break;
|
|
178
|
+
dir = parent;
|
|
179
|
+
}
|
|
180
|
+
throw new Error('@nextdog/core not found. Make sure it is installed: npm install @nextdog/core' +
|
|
181
|
+
(tried.length ? ` (looked in: ${tried.join(', ')})` : ''));
|
|
55
182
|
}
|
|
56
183
|
async function spawnSidecar(url) {
|
|
57
184
|
const coreCliPath = resolveCoreCliPath();
|
|
@@ -71,28 +198,49 @@ async function spawnSidecar(url) {
|
|
|
71
198
|
}
|
|
72
199
|
// Wait for the sidecar to become healthy (up to 3 seconds)
|
|
73
200
|
for (let i = 0; i < 6; i++) {
|
|
74
|
-
await new Promise(r => setTimeout(r, 500));
|
|
201
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
75
202
|
if (await isHealthy(url))
|
|
76
203
|
return;
|
|
77
204
|
}
|
|
78
205
|
console.warn(`[nextdog] sidecar spawned (PID ${child.pid}) but health check not passing yet`);
|
|
79
206
|
console.warn(`[nextdog] check ${LOG_FILE} for sidecar logs`);
|
|
80
207
|
}
|
|
208
|
+
/** Track ports we've already warned about so the foreign-occupant notice fires once. */
|
|
209
|
+
const warnedForeignPorts = new Set();
|
|
210
|
+
function warnForeignOccupant(url) {
|
|
211
|
+
if (warnedForeignPorts.has(url))
|
|
212
|
+
return;
|
|
213
|
+
warnedForeignPorts.add(url);
|
|
214
|
+
console.warn(`[nextdog] ${url} is already in use by a process that is NOT a NextDog sidecar ` +
|
|
215
|
+
`(its /health response lacks the NextDog signature).`);
|
|
216
|
+
console.warn(`[nextdog] refusing to adopt it — no telemetry will be sent and no dashboard will start. ` +
|
|
217
|
+
`Free the port, or set NEXTDOG_URL to a different port.`);
|
|
218
|
+
}
|
|
219
|
+
/** Exposed for tests so each case starts from a clean warning state. */
|
|
220
|
+
export function _resetForeignOccupantWarnings() {
|
|
221
|
+
warnedForeignPorts.clear();
|
|
222
|
+
}
|
|
81
223
|
export async function ensureSidecar(url) {
|
|
82
224
|
// Already running and healthy — fast path
|
|
83
225
|
if (await isHealthy(url))
|
|
84
|
-
return;
|
|
226
|
+
return { ready: true, foreignOccupant: false };
|
|
227
|
+
// The port answers 2xx but without the NextDog signature: a foreign process
|
|
228
|
+
// holds it. Do not adopt it; warn once and tell the caller to skip telemetry.
|
|
229
|
+
if (await isForeignOccupant(url)) {
|
|
230
|
+
warnForeignOccupant(url);
|
|
231
|
+
return { ready: false, foreignOccupant: true };
|
|
232
|
+
}
|
|
85
233
|
// PID file exists and process is alive — wait for it to become healthy
|
|
86
234
|
const pid = await readPid();
|
|
87
|
-
if (pid && await isProcessRunning(pid)) {
|
|
235
|
+
if (pid && (await isProcessRunning(pid))) {
|
|
88
236
|
for (let i = 0; i < 4; i++) {
|
|
89
|
-
await new Promise(r => setTimeout(r, 500));
|
|
237
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
90
238
|
if (await isHealthy(url))
|
|
91
|
-
return;
|
|
239
|
+
return { ready: true, foreignOccupant: false };
|
|
92
240
|
}
|
|
93
241
|
console.warn(`[nextdog] sidecar process ${pid} is running but not responding at ${url}`);
|
|
94
242
|
console.warn(`[nextdog] check ${LOG_FILE} for sidecar logs`);
|
|
95
|
-
return;
|
|
243
|
+
return { ready: false, foreignOccupant: false };
|
|
96
244
|
}
|
|
97
245
|
// No sidecar running — spawn one
|
|
98
246
|
try {
|
|
@@ -101,6 +249,16 @@ export async function ensureSidecar(url) {
|
|
|
101
249
|
catch (err) {
|
|
102
250
|
console.warn('[nextdog] failed to spawn sidecar:', err.message);
|
|
103
251
|
console.warn('[nextdog] you can start it manually with: npx nextdog');
|
|
252
|
+
return { ready: false, foreignOccupant: false };
|
|
253
|
+
}
|
|
254
|
+
// Confirm the thing now answering is genuinely our sidecar (a foreign process
|
|
255
|
+
// could have bound the port in the race window).
|
|
256
|
+
if (await isHealthy(url))
|
|
257
|
+
return { ready: true, foreignOccupant: false };
|
|
258
|
+
if (await isForeignOccupant(url)) {
|
|
259
|
+
warnForeignOccupant(url);
|
|
260
|
+
return { ready: false, foreignOccupant: true };
|
|
104
261
|
}
|
|
262
|
+
return { ready: false, foreignOccupant: false };
|
|
105
263
|
}
|
|
106
264
|
//# sourceMappingURL=sidecar.js.map
|
package/dist/sidecar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidecar.js","sourceRoot":"","sources":["../src/sidecar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"sidecar.js","sourceRoot":"","sources":["../src/sidecar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,UAAU,CAAC,CAAC;AAChD,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;AAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;AAElD,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAa9B;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAW;IAC3C,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;QACzC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,gBAAgB,CAAC,CAAC;QACvE,IAAI,GAAa,CAAC;QAClB,IAAI,CAAC;YACH,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QACjC,mBAAmB,CAAC,GAAG,CAAC,CAAC;QACzB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;IACjD,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;AAClD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextdog/node",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Shared Node.js instrumentation for NextDog — OTel exporter, sidecar, console capture",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"./sidecar": "./dist/sidecar.js",
|
|
12
12
|
"./console-patch": "./dist/console-patch.js",
|
|
13
13
|
"./request-capture": "./dist/request-capture.js",
|
|
14
|
-
"./request-context": "./dist/request-context.js"
|
|
14
|
+
"./request-context": "./dist/request-context.js",
|
|
15
|
+
"./instrumentation": "./dist/instrumentation.js"
|
|
15
16
|
},
|
|
16
17
|
"files": [
|
|
17
18
|
"dist"
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
"@opentelemetry/sdk-trace-node": "^1",
|
|
25
26
|
"@opentelemetry/resources": "^1",
|
|
26
27
|
"@opentelemetry/semantic-conventions": "^1",
|
|
27
|
-
"@nextdog/core": "1.
|
|
28
|
+
"@nextdog/core": "1.1.1"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"@types/node": "^25",
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
],
|
|
47
48
|
"scripts": {
|
|
48
49
|
"build": "tsc",
|
|
49
|
-
"test": "vitest run --passWithNoTests"
|
|
50
|
+
"test": "vitest run --passWithNoTests",
|
|
51
|
+
"typecheck": "tsc --noEmit"
|
|
50
52
|
}
|
|
51
53
|
}
|