@rootcat/node 0.0.0-stage → 0.2.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.
- package/CHANGELOG.md +83 -0
- package/LICENSE +202 -0
- package/README.md +294 -2
- package/dist/attach.d.ts +1 -0
- package/dist/attach.js +24 -0
- package/dist/attach.js.map +1 -0
- package/dist/callsite.d.ts +109 -0
- package/dist/callsite.js +565 -0
- package/dist/callsite.js.map +1 -0
- package/dist/coexist.d.ts +183 -0
- package/dist/coexist.js +587 -0
- package/dist/coexist.js.map +1 -0
- package/dist/config.d.ts +75 -0
- package/dist/config.js +182 -0
- package/dist/config.js.map +1 -0
- package/dist/drizzle.d.ts +21 -0
- package/dist/drizzle.js +127 -0
- package/dist/drizzle.js.map +1 -0
- package/dist/esm.mjs +57 -0
- package/dist/esmhook.d.ts +52 -0
- package/dist/esmhook.js +158 -0
- package/dist/esmhook.js.map +1 -0
- package/dist/iitm-hook.mjs +83 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/intake.d.ts +40 -0
- package/dist/intake.js +164 -0
- package/dist/intake.js.map +1 -0
- package/dist/keys.d.ts +20 -0
- package/dist/keys.js +33 -0
- package/dist/keys.js.map +1 -0
- package/dist/notices.d.ts +2 -0
- package/dist/notices.js +21 -0
- package/dist/notices.js.map +1 -0
- package/dist/otlp.d.ts +75 -0
- package/dist/otlp.js +449 -0
- package/dist/otlp.js.map +1 -0
- package/dist/pg.d.ts +16 -0
- package/dist/pg.js +170 -0
- package/dist/pg.js.map +1 -0
- package/dist/pgpool.d.ts +20 -0
- package/dist/pgpool.js +99 -0
- package/dist/pgpool.js.map +1 -0
- package/dist/postgresjs.d.ts +60 -0
- package/dist/postgresjs.js +400 -0
- package/dist/postgresjs.js.map +1 -0
- package/dist/privacy.d.ts +38 -0
- package/dist/privacy.js +161 -0
- package/dist/privacy.js.map +1 -0
- package/dist/processor.d.ts +197 -0
- package/dist/processor.js +494 -0
- package/dist/processor.js.map +1 -0
- package/dist/register.d.ts +1 -0
- package/dist/register.js +12 -0
- package/dist/register.js.map +1 -0
- package/dist/sampler.d.ts +30 -0
- package/dist/sampler.js +101 -0
- package/dist/sampler.js.map +1 -0
- package/dist/sdk.d.ts +129 -0
- package/dist/sdk.js +606 -0
- package/dist/sdk.js.map +1 -0
- package/package.json +72 -4
package/dist/sdk.js
ADDED
|
@@ -0,0 +1,606 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.instrumentationNames = exports.signalFlushMillis = exports.spanLimits = exports.batchDelayMillis = exports.batchMaxExportSize = exports.batchMaxQueueSize = exports.exporterConcurrency = exports.exporterTimeoutMillis = void 0;
|
|
37
|
+
exports.redisStatement = redisStatement;
|
|
38
|
+
exports.curatedInstrumentations = curatedInstrumentations;
|
|
39
|
+
exports.prismaInstrumentation = prismaInstrumentation;
|
|
40
|
+
exports.current = current;
|
|
41
|
+
exports.start = start;
|
|
42
|
+
exports.rootcatSpanProcessors = rootcatSpanProcessors;
|
|
43
|
+
exports.startAlongside = startAlongside;
|
|
44
|
+
exports.otlpExporter = otlpExporter;
|
|
45
|
+
// The SDK: one tracer provider with the call-site processor and a batching
|
|
46
|
+
// OTLP/HTTP (protobuf) exporter to the host agent, the curated
|
|
47
|
+
// instrumentations, and a bounded flush at exit. Nothing here may throw
|
|
48
|
+
// into the application: start() reports a failure on stderr in one line
|
|
49
|
+
// and returns undefined. It starts once per process, however many copies
|
|
50
|
+
// of the package or entries load it.
|
|
51
|
+
const api_1 = require("@opentelemetry/api");
|
|
52
|
+
const instrumentation_1 = require("@opentelemetry/instrumentation");
|
|
53
|
+
const instrumentation_http_1 = require("@opentelemetry/instrumentation-http");
|
|
54
|
+
const instrumentation_ioredis_1 = require("@opentelemetry/instrumentation-ioredis");
|
|
55
|
+
const instrumentation_mongodb_1 = require("@opentelemetry/instrumentation-mongodb");
|
|
56
|
+
const instrumentation_mysql2_1 = require("@opentelemetry/instrumentation-mysql2");
|
|
57
|
+
const instrumentation_redis_1 = require("@opentelemetry/instrumentation-redis");
|
|
58
|
+
const instrumentation_undici_1 = require("@opentelemetry/instrumentation-undici");
|
|
59
|
+
const resources_1 = require("@opentelemetry/resources");
|
|
60
|
+
const sdk_trace_base_1 = require("@opentelemetry/sdk-trace-base");
|
|
61
|
+
const sdk_trace_node_1 = require("@opentelemetry/sdk-trace-node");
|
|
62
|
+
const node_module_1 = require("node:module");
|
|
63
|
+
const path = __importStar(require("node:path"));
|
|
64
|
+
const coexist_js_1 = require("./coexist.js");
|
|
65
|
+
const config_js_1 = require("./config.js");
|
|
66
|
+
const drizzle_js_1 = require("./drizzle.js");
|
|
67
|
+
const esmhook_js_1 = require("./esmhook.js");
|
|
68
|
+
const intake_js_1 = require("./intake.js");
|
|
69
|
+
const notices_js_1 = require("./notices.js");
|
|
70
|
+
const otlp_js_1 = require("./otlp.js");
|
|
71
|
+
const pg_js_1 = require("./pg.js");
|
|
72
|
+
const pgpool_js_1 = require("./pgpool.js");
|
|
73
|
+
const postgresjs_js_1 = require("./postgresjs.js");
|
|
74
|
+
const processor_js_1 = require("./processor.js");
|
|
75
|
+
const sampler_js_1 = require("./sampler.js");
|
|
76
|
+
/**
|
|
77
|
+
* Exporter bounds, fixed: sized for a loopback intake that takes 1 MiB
|
|
78
|
+
* per request (512 protobuf spans are a few hundred KiB) and four
|
|
79
|
+
* uploads per sender. The queue holds 4096 ended spans; past that the
|
|
80
|
+
* newest are dropped, and the drop is reported once on stderr.
|
|
81
|
+
*/
|
|
82
|
+
exports.exporterTimeoutMillis = 2000;
|
|
83
|
+
exports.exporterConcurrency = 2;
|
|
84
|
+
exports.batchMaxQueueSize = 4096;
|
|
85
|
+
exports.batchMaxExportSize = 512;
|
|
86
|
+
exports.batchDelayMillis = 10_000;
|
|
87
|
+
/**
|
|
88
|
+
* spanLimits bound every span, so a batch of them can be split into
|
|
89
|
+
* requests the agent accepts and nothing the application records (a
|
|
90
|
+
* statement from any driver, an exception stack) grows without bound:
|
|
91
|
+
* each attribute value at most 4 KiB, 64 attributes, 8 events of 8
|
|
92
|
+
* attributes. The largest possible span then encodes to about half a MiB.
|
|
93
|
+
*/
|
|
94
|
+
exports.spanLimits = {
|
|
95
|
+
attributeValueLengthLimit: 4096,
|
|
96
|
+
attributeCountLimit: 64,
|
|
97
|
+
eventCountLimit: 8,
|
|
98
|
+
attributePerEventCountLimit: 8,
|
|
99
|
+
linkCountLimit: 8,
|
|
100
|
+
attributePerLinkCountLimit: 8,
|
|
101
|
+
};
|
|
102
|
+
/** signalFlushMillis bounds the flush attempted on SIGTERM and SIGINT. */
|
|
103
|
+
exports.signalFlushMillis = 2000;
|
|
104
|
+
/** instrumentationNames are the names ROOTCAT_DISABLE accepts. */
|
|
105
|
+
exports.instrumentationNames = ['http', 'undici', 'pg', 'postgres', 'drizzle', 'mysql2', 'mongodb', 'ioredis', 'redis', 'prisma'];
|
|
106
|
+
/** redisStatement records the command name and the argument count only. */
|
|
107
|
+
function redisStatement(command, args) {
|
|
108
|
+
const count = Array.isArray(args) ? args.length : 0;
|
|
109
|
+
return count === 0 ? command : `${command} [${count} args]`;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* curatedInstrumentations builds the instrumentation set the config
|
|
113
|
+
* allows; sampling is the call-site gate they share with the processor.
|
|
114
|
+
*/
|
|
115
|
+
function curatedInstrumentations(config, sampling = new processor_js_1.CallSiteSampling(config.callsiteSample, config.sampleRatio), beside = false, http = true) {
|
|
116
|
+
const want = (name) => !config.disabled.has(name);
|
|
117
|
+
const list = [];
|
|
118
|
+
if (http && want('http')) {
|
|
119
|
+
list.push(new instrumentation_http_1.HttpInstrumentation({}));
|
|
120
|
+
}
|
|
121
|
+
if (want('undici')) {
|
|
122
|
+
// Beside Sentry, whose fetch instrumentation propagates first, the
|
|
123
|
+
// instrumentation adds no second set of headers (see propagatedOnce).
|
|
124
|
+
list.push(beside ? (0, coexist_js_1.propagatedOnce)(new instrumentation_undici_1.UndiciInstrumentation({})) : new instrumentation_undici_1.UndiciInstrumentation({}));
|
|
125
|
+
}
|
|
126
|
+
if (want('pg')) {
|
|
127
|
+
list.push(new pg_js_1.PgInstrumentation({ sampling, depth: config.callsiteDepth }));
|
|
128
|
+
list.push(new pgpool_js_1.PgPoolEntryInstrumentation({ depth: config.callsiteDepth, sampling }));
|
|
129
|
+
}
|
|
130
|
+
if (want('postgres')) {
|
|
131
|
+
list.push(new postgresjs_js_1.PostgresJsInstrumentation({ sampling }));
|
|
132
|
+
}
|
|
133
|
+
if (want('drizzle')) {
|
|
134
|
+
list.push(new drizzle_js_1.DrizzleEntryInstrumentation({ depth: config.callsiteDepth, sampling }));
|
|
135
|
+
}
|
|
136
|
+
if (want('mysql2')) {
|
|
137
|
+
list.push(new instrumentation_mysql2_1.MySQL2Instrumentation({ maskStatement: true }));
|
|
138
|
+
}
|
|
139
|
+
if (want('mongodb')) {
|
|
140
|
+
list.push(new instrumentation_mongodb_1.MongoDBInstrumentation({ enhancedDatabaseReporting: false }));
|
|
141
|
+
}
|
|
142
|
+
// Redis commands are traced inside a traced operation only: a queue
|
|
143
|
+
// (BullMQ) polls Redis all the time outside any, which would otherwise
|
|
144
|
+
// be a trace per poll.
|
|
145
|
+
if (want('ioredis')) {
|
|
146
|
+
list.push(new instrumentation_ioredis_1.IORedisInstrumentation({ dbStatementSerializer: redisStatement, requireParentSpan: true }));
|
|
147
|
+
}
|
|
148
|
+
if (want('redis')) {
|
|
149
|
+
list.push(new instrumentation_redis_1.RedisInstrumentation({ dbStatementSerializer: redisStatement, requireParentSpan: true }));
|
|
150
|
+
}
|
|
151
|
+
if (want('prisma')) {
|
|
152
|
+
const prisma = prismaInstrumentation(config.cwd);
|
|
153
|
+
if (prisma) {
|
|
154
|
+
list.push(prisma);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// No wrapper of another SDK is ever removed; beside one, none is wrapped over.
|
|
158
|
+
return list.map((instrumentation) => (0, coexist_js_1.guardWrappers)(instrumentation, beside));
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* prismaInstrumentation loads @prisma/instrumentation from the application
|
|
162
|
+
* when the application has it (Prisma ships it beside its client, and its
|
|
163
|
+
* version must match the client's), and nothing otherwise.
|
|
164
|
+
*/
|
|
165
|
+
function prismaInstrumentation(cwd) {
|
|
166
|
+
try {
|
|
167
|
+
const requireFromApp = (0, node_module_1.createRequire)(path.join(cwd, 'package.json'));
|
|
168
|
+
const mod = requireFromApp('@prisma/instrumentation');
|
|
169
|
+
if (typeof mod?.PrismaInstrumentation === 'function') {
|
|
170
|
+
return new mod.PrismaInstrumentation({});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
// not installed, or not loadable: no Prisma spans
|
|
175
|
+
}
|
|
176
|
+
return undefined;
|
|
177
|
+
}
|
|
178
|
+
/** startedKey holds the running SDK on globalThis, shared by every copy of the package. */
|
|
179
|
+
const startedKey = Symbol.for('rootcat.node.started');
|
|
180
|
+
const holder = globalThis;
|
|
181
|
+
/** current returns the running SDK, if any. */
|
|
182
|
+
function current() {
|
|
183
|
+
return holder[startedKey] ?? undefined;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* start reads the configuration and starts the SDK once per process. A
|
|
187
|
+
* later call (the import line and NODE_OPTIONS both, or a second copy of
|
|
188
|
+
* the package) returns the first result. It never throws.
|
|
189
|
+
*/
|
|
190
|
+
function start(options = {}) {
|
|
191
|
+
if (holder[startedKey] !== undefined) {
|
|
192
|
+
return holder[startedKey] ?? undefined;
|
|
193
|
+
}
|
|
194
|
+
try {
|
|
195
|
+
const started = startOnce(options);
|
|
196
|
+
if (started === notYet) {
|
|
197
|
+
return undefined; // a later call, after Sentry.init, may start
|
|
198
|
+
}
|
|
199
|
+
holder[startedKey] = started ?? null;
|
|
200
|
+
return started;
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
204
|
+
process.stderr.write(`rootcat: tracing not started: ${reason.slice(0, 200)}\n`);
|
|
205
|
+
return undefined;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/** notYet is startOnce's answer when a later call (after Sentry.init) may start. */
|
|
209
|
+
const notYet = Symbol('rootcat.notYet');
|
|
210
|
+
function startOnce(options) {
|
|
211
|
+
const config = (0, config_js_1.readConfig)(options.env ?? process.env, options.cwd ?? process.cwd(), () => (0, intake_js_1.discoverIntake)());
|
|
212
|
+
if (!config.enabled) {
|
|
213
|
+
return undefined;
|
|
214
|
+
}
|
|
215
|
+
const existing = (0, coexist_js_1.existingSetup)();
|
|
216
|
+
if (existing?.registered) {
|
|
217
|
+
// Another tracer registered the global provider and context manager:
|
|
218
|
+
// the package registers neither. Beside it when it records nothing,
|
|
219
|
+
// inside it (through rootcatSpanProcessors()) when it traces.
|
|
220
|
+
if (options.late) {
|
|
221
|
+
process.stderr.write('rootcat: startAlongside() ran before the tracer was set up; started a tick later, so modules loaded before then may be untraced (call startAlongside() after Sentry.init)\n');
|
|
222
|
+
}
|
|
223
|
+
return existing.tracing ? startInside(config, options, existing) : startBeside(config, options, existing);
|
|
224
|
+
}
|
|
225
|
+
if (existing) {
|
|
226
|
+
// A Sentry client without a registered provider: Sentry.init ran with
|
|
227
|
+
// skipOpenTelemetrySetup, and the application sets up OpenTelemetry
|
|
228
|
+
// itself (with Sentry's context manager), which must come first.
|
|
229
|
+
process.stderr.write('rootcat: Sentry was initialised without its OpenTelemetry setup (skipOpenTelemetrySetup) and no provider is registered yet; @rootcat/node does not start\n');
|
|
230
|
+
return notYet;
|
|
231
|
+
}
|
|
232
|
+
const dependency = (0, coexist_js_1.tracerDependency)(config.cwd);
|
|
233
|
+
if (dependency && !options.alongside) {
|
|
234
|
+
// Started before that tracer (the import line first, NODE_OPTIONS),
|
|
235
|
+
// the package would take the global provider and context manager from
|
|
236
|
+
// it, and Sentry's scopes (request isolation) depend on its own.
|
|
237
|
+
process.stderr.write(`rootcat: this application uses ${dependency}, which is not initialised yet; call startAlongside() from @rootcat/node/attach after it initialises (see "Alongside another tracer" in the README)\n`);
|
|
238
|
+
return notYet;
|
|
239
|
+
}
|
|
240
|
+
if (dependency) {
|
|
241
|
+
// startAlongside() before the tracer it is meant to run alongside
|
|
242
|
+
// (called above Sentry.init, say). Registering anything globally now
|
|
243
|
+
// would take the context manager from Sentry and break its request
|
|
244
|
+
// isolation. The package starts beside it at once, which registers
|
|
245
|
+
// nothing globally and patches the drivers before the application
|
|
246
|
+
// loads them, and settles once the current module has run: beside
|
|
247
|
+
// Sentry for errors only it stays; otherwise it undoes itself and
|
|
248
|
+
// starts inside a tracing Sentry, or not at all.
|
|
249
|
+
const provisional = startBeside(config, options, { kind: 'sentry', registered: false, tracing: false, debug: false, processors: undefined }, true);
|
|
250
|
+
setImmediate(() => settle(provisional, options)).unref();
|
|
251
|
+
return provisional;
|
|
252
|
+
}
|
|
253
|
+
api_1.diag.setLogger(config.debug ? new api_1.DiagConsoleLogger() : new QuietLogger(), config.debug ? api_1.DiagLogLevel.DEBUG : api_1.DiagLogLevel.WARN);
|
|
254
|
+
const resource = rootcatResource(config);
|
|
255
|
+
const sampling = new processor_js_1.CallSiteSampling(config.callsiteSample, config.sampleRatio);
|
|
256
|
+
const callSites = new processor_js_1.CallSiteProcessor({ sampling, depth: config.callsiteDepth, statement: config.statement });
|
|
257
|
+
const spanProcessors = [callSites, ...(options.spanProcessors ?? [exportingProcessor(config, options)])];
|
|
258
|
+
const provider = new sdk_trace_node_1.NodeTracerProvider({ resource, spanProcessors, spanLimits: exports.spanLimits, sampler: options.sampler ?? new sampler_js_1.RootcatSampler(config.sampleRatio) });
|
|
259
|
+
provider.register();
|
|
260
|
+
// A capture from the processor starts below the SDK's startSpan, where
|
|
261
|
+
// the instrumentation that called it is.
|
|
262
|
+
callSites.above = tracerStartSpan(provider);
|
|
263
|
+
const esmHook = esmHookFor(config, options);
|
|
264
|
+
const instrumentations = options.instrumentations ?? curatedInstrumentations(config, sampling);
|
|
265
|
+
(0, instrumentation_1.registerInstrumentations)({ tracerProvider: provider, instrumentations });
|
|
266
|
+
patchBuiltins();
|
|
267
|
+
const shutdown = () => provider.shutdown().catch(() => undefined);
|
|
268
|
+
const detach = options.hooks !== false ? installHooks(provider) : () => undefined;
|
|
269
|
+
say(config, `tracing ${config.serviceName} to ${config.url} (traces ${config.sampleRatio}, call sites 1 in ${config.callsiteSample}; ES module hook ${esmHook})`);
|
|
270
|
+
return { config, mode: 'own', provider, callSites, esmHook, instrumentations, shutdown, detach };
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* settle decides, a tick after startAlongside() came before the tracer,
|
|
274
|
+
* what the provisional start beside it becomes: it stays beside a Sentry
|
|
275
|
+
* that set up OpenTelemetry for errors only; otherwise it is undone (its
|
|
276
|
+
* instrumentations disabled, which removes only the package's own
|
|
277
|
+
* wrappers, its provider shut down) and the package starts inside a
|
|
278
|
+
* tracing Sentry, or not at all. Each outcome is one line on stderr.
|
|
279
|
+
*/
|
|
280
|
+
function settle(provisional, options) {
|
|
281
|
+
try {
|
|
282
|
+
const existing = (0, coexist_js_1.existingSetup)();
|
|
283
|
+
if (existing?.registered && !existing.tracing) {
|
|
284
|
+
// Beside it is: the http instrumentation is made and goes in now.
|
|
285
|
+
if (deferredHttp.has(provisional) && provisional.provider) {
|
|
286
|
+
const http = (0, coexist_js_1.guardWrappers)(new instrumentation_http_1.HttpInstrumentation({}), true);
|
|
287
|
+
(0, instrumentation_1.registerInstrumentations)({ tracerProvider: provisional.provider, instrumentations: [http] });
|
|
288
|
+
provisional.instrumentations.push(http);
|
|
289
|
+
patchBuiltins();
|
|
290
|
+
}
|
|
291
|
+
process.stderr.write('rootcat: startAlongside() ran before Sentry.init; it registered nothing globally and runs beside Sentry (call startAlongside() after Sentry.init)\n');
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
for (const instrumentation of provisional.instrumentations) {
|
|
295
|
+
instrumentation.disable();
|
|
296
|
+
}
|
|
297
|
+
provisional.detach();
|
|
298
|
+
void provisional.shutdown();
|
|
299
|
+
processor_js_1.parentPolicy.transparentForeign = false;
|
|
300
|
+
holder[startedKey] = undefined;
|
|
301
|
+
if (existing?.registered) {
|
|
302
|
+
start({ ...options, late: true });
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
// Stopped: nothing of the package runs any more. The loader hook
|
|
306
|
+
// cannot be removed, so it passes every module through; a processor
|
|
307
|
+
// already given to a provider (rootcatSpanProcessors()) goes inert,
|
|
308
|
+
// and one asked for later is not made.
|
|
309
|
+
holder[startedKey] = null;
|
|
310
|
+
holder[stoppedKey] = true;
|
|
311
|
+
(0, esmhook_js_1.quietESMHook)();
|
|
312
|
+
holder[pendingKey]?.processor.stop();
|
|
313
|
+
process.stderr.write('rootcat: startAlongside() found Sentry not initialised, then or a tick later; @rootcat/node stopped: no spans, no processor, the loader hook idle (call startAlongside() after Sentry.init)\n');
|
|
314
|
+
}
|
|
315
|
+
catch {
|
|
316
|
+
// never reaches the application
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* startBeside runs the package's own provider beside a tracer that
|
|
321
|
+
* records nothing (Sentry for errors only): the same instrumentations,
|
|
322
|
+
* sampler decisions and processors as on its own, but the provider is
|
|
323
|
+
* not registered (the owner's stays the global one, with its context
|
|
324
|
+
* manager and propagator) and spans are recorded without the sampled flag
|
|
325
|
+
* (see RecordOnlySampler), so nothing the owner reads or sends changes.
|
|
326
|
+
* The owner's provider never sees these spans.
|
|
327
|
+
*/
|
|
328
|
+
function startBeside(config, options, existing, provisional = false) {
|
|
329
|
+
if (!existing.debug) {
|
|
330
|
+
// The owner sets the diagnostic logger only in its debug mode;
|
|
331
|
+
// otherwise the package's quiet one (the full-queue notice) takes the
|
|
332
|
+
// empty place.
|
|
333
|
+
api_1.diag.setLogger(config.debug ? new api_1.DiagConsoleLogger() : new QuietLogger(), config.debug ? api_1.DiagLogLevel.DEBUG : api_1.DiagLogLevel.WARN);
|
|
334
|
+
}
|
|
335
|
+
const resource = rootcatResource(config);
|
|
336
|
+
const sampling = new processor_js_1.CallSiteSampling(config.callsiteSample, config.sampleRatio);
|
|
337
|
+
const callSites = new processor_js_1.CallSiteProcessor({ sampling, depth: config.callsiteDepth, statement: config.statement, keepHostKeys: true });
|
|
338
|
+
const exporting = options.spanProcessors ?? [exportingProcessor(config, options)];
|
|
339
|
+
const spanProcessors = [new coexist_js_1.UrlSource(), callSites, ...exporting.map((processor) => new coexist_js_1.FlaggedExport(processor))];
|
|
340
|
+
processor_js_1.parentPolicy.transparentForeign = true;
|
|
341
|
+
const provider = new sdk_trace_node_1.NodeTracerProvider({ resource, spanProcessors, spanLimits: exports.spanLimits, sampler: options.sampler ?? new sampler_js_1.RecordOnlySampler(config.sampleRatio) });
|
|
342
|
+
callSites.above = tracerStartSpan(provider);
|
|
343
|
+
// Provisional (registered before Sentry's, so inside it): with
|
|
344
|
+
// import-in-the-middle copies apart, a module the package's hook marks
|
|
345
|
+
// would reach only the package's instrumentations, Sentry's (with
|
|
346
|
+
// tracing on) never: the hook then watches only Drizzle's query
|
|
347
|
+
// classes, which Sentry does not instrument.
|
|
348
|
+
const include = provisional && !(0, coexist_js_1.sentryLoaderShared)(config.cwd) ? esmhook_js_1.drizzleModules : undefined;
|
|
349
|
+
const esmHook = esmHookFor(config, options, esmhook_js_1.ownedModules, include);
|
|
350
|
+
// Provisional (before the tracer is set up): the http instrumentation
|
|
351
|
+
// is not even made until settle(). Made, it is enabled at once and
|
|
352
|
+
// falls back to the global provider, Sentry's once Sentry.init has
|
|
353
|
+
// run, and Sentry.init itself requires http: inside a tracing Sentry
|
|
354
|
+
// it would add a second span to every request and outgoing call.
|
|
355
|
+
const deferHttp = provisional && options.instrumentations === undefined && !config.disabled.has('http');
|
|
356
|
+
const now = options.instrumentations ?? curatedInstrumentations(config, sampling, true, !deferHttp);
|
|
357
|
+
(0, instrumentation_1.registerInstrumentations)({ tracerProvider: provider, instrumentations: now });
|
|
358
|
+
if (!provisional) {
|
|
359
|
+
patchBuiltins();
|
|
360
|
+
}
|
|
361
|
+
const shutdown = () => provider.shutdown().catch(() => undefined);
|
|
362
|
+
const detach = options.hooks !== false ? installHooks(provider) : () => undefined;
|
|
363
|
+
say(config, `tracing ${config.serviceName} to ${config.url} beside the ${existing.kind} tracer (which records nothing; traces ${config.sampleRatio}, call sites 1 in ${config.callsiteSample}; ES module hook ${esmHook})`);
|
|
364
|
+
const started = { config, mode: 'beside', provider, callSites, esmHook, instrumentations: now, shutdown, detach };
|
|
365
|
+
if (deferHttp) {
|
|
366
|
+
deferredHttp.add(started);
|
|
367
|
+
}
|
|
368
|
+
return started;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* startInside finishes the setup inside a tracer that records spans: the
|
|
372
|
+
* processor rootcatSpanProcessors() gave its provider receives its spans;
|
|
373
|
+
* here only the entry wrappers that carry call sites to them are
|
|
374
|
+
* registered (the owner instruments the libraries itself, so the package
|
|
375
|
+
* adds no span). Without the processor in the owner's provider, nothing
|
|
376
|
+
* starts. For an owner whose options cannot be read (not Sentry), the
|
|
377
|
+
* processor having been built is taken as given to it.
|
|
378
|
+
*/
|
|
379
|
+
function startInside(config, options, existing) {
|
|
380
|
+
const pending = holder[pendingKey];
|
|
381
|
+
if (!pending || existing.processors === false) {
|
|
382
|
+
process.stderr.write(existing.kind === 'sentry'
|
|
383
|
+
? 'rootcat: Sentry traces in this process (tracesSampleRate is set); its spans reach Rootcat only through Sentry.init({ openTelemetrySpanProcessors: rootcatSpanProcessors() }); @rootcat/node does not start\n'
|
|
384
|
+
: 'rootcat: another OpenTelemetry SDK is already registered in this process; its spans reach Rootcat only through its span processors (rootcatSpanProcessors() from @rootcat/node/attach); @rootcat/node does not start\n');
|
|
385
|
+
return undefined;
|
|
386
|
+
}
|
|
387
|
+
const { callSites, processor } = pending;
|
|
388
|
+
// The owner's tracer is the global one; a capture starts below its startSpan.
|
|
389
|
+
callSites.above = tracerStartSpan(api_1.trace.getTracerProvider());
|
|
390
|
+
const esmHook = esmHookFor(config, options, esmhook_js_1.drizzleModules);
|
|
391
|
+
const instrumentations = options.instrumentations ?? carryingInstrumentations(config, callSites);
|
|
392
|
+
(0, instrumentation_1.registerInstrumentations)({ instrumentations });
|
|
393
|
+
const shutdown = () => processor.shutdown().catch(() => undefined);
|
|
394
|
+
const detach = options.hooks !== false ? installHooks(processor) : () => undefined;
|
|
395
|
+
say(config, `tracing ${config.serviceName} to ${config.url} inside the ${existing.kind} tracer (its sample; traces ${config.sampleRatio} of it, call sites 1 in ${config.callsiteSample}; ES module hook ${esmHook})`);
|
|
396
|
+
return { config, mode: 'inside', provider: undefined, callSites, esmHook, instrumentations, shutdown, detach };
|
|
397
|
+
}
|
|
398
|
+
/** pendingKey holds rootcatSpanProcessors()'s result on globalThis. */
|
|
399
|
+
const pendingKey = Symbol.for('rootcat.node.providerProcessors');
|
|
400
|
+
/** stoppedKey marks a package that stopped (see settle). */
|
|
401
|
+
const stoppedKey = Symbol.for('rootcat.node.stopped');
|
|
402
|
+
/** deferredHttp marks a provisional start whose http instrumentation settle() makes. */
|
|
403
|
+
const deferredHttp = new WeakSet();
|
|
404
|
+
/**
|
|
405
|
+
* rootcatSpanProcessors returns the processor for another tracer's
|
|
406
|
+
* provider (Sentry.init's openTelemetrySpanProcessors, NodeSDK's
|
|
407
|
+
* spanProcessors): when that tracer records spans, it receives them and
|
|
408
|
+
* exports a copy of each (with its call site, under the privacy rules)
|
|
409
|
+
* to the host agent; the tracer's own spans and what it sends are
|
|
410
|
+
* unchanged. When the tracer records nothing (Sentry for errors only), it
|
|
411
|
+
* receives nothing and startAlongside() runs the package beside it
|
|
412
|
+
* instead. It never throws; disabled, it returns an empty list.
|
|
413
|
+
*/
|
|
414
|
+
function rootcatSpanProcessors(options = {}) {
|
|
415
|
+
try {
|
|
416
|
+
if (holder[stoppedKey] === true) {
|
|
417
|
+
return []; // the package stopped (see settle)
|
|
418
|
+
}
|
|
419
|
+
const existing = holder[pendingKey];
|
|
420
|
+
if (existing) {
|
|
421
|
+
return [existing.processor];
|
|
422
|
+
}
|
|
423
|
+
const config = (0, config_js_1.readConfig)(options.env ?? process.env, options.cwd ?? process.cwd(), () => (0, intake_js_1.discoverIntake)());
|
|
424
|
+
if (!config.enabled) {
|
|
425
|
+
return [];
|
|
426
|
+
}
|
|
427
|
+
// The owner decides which traces are recorded; the trace ratio applies
|
|
428
|
+
// at export (InProviderProcessor), so the entry wrappers never decide.
|
|
429
|
+
const sampling = new processor_js_1.CallSiteSampling(config.callsiteSample, 1);
|
|
430
|
+
const callSites = new processor_js_1.CallSiteProcessor({ sampling, depth: config.callsiteDepth, statement: config.statement, readOnly: true });
|
|
431
|
+
const exporting = options.spanProcessors ?? [exportingProcessor(config, options)];
|
|
432
|
+
const processor = new coexist_js_1.InProviderProcessor(callSites, exporting, rootcatResource(config), config.sampleRatio);
|
|
433
|
+
holder[pendingKey] = { config, callSites, processor };
|
|
434
|
+
return [processor];
|
|
435
|
+
}
|
|
436
|
+
catch (error) {
|
|
437
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
438
|
+
process.stderr.write(`rootcat: no span processor: ${reason.slice(0, 200)}\n`);
|
|
439
|
+
return [];
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* startAlongside starts the package after another tracer set up
|
|
444
|
+
* OpenTelemetry (Sentry.init, an app's NodeSDK): beside it when it
|
|
445
|
+
* records nothing (Sentry for errors only, or disabled with enabled:
|
|
446
|
+
* false, which still sets up its OpenTelemetry), inside it when it
|
|
447
|
+
* records spans (with rootcatSpanProcessors() in its provider), and on
|
|
448
|
+
* its own when nothing was set up (Sentry not initialised here, no DSN):
|
|
449
|
+
* if a Sentry client appears right after, the order was wrong and stderr
|
|
450
|
+
* says so. It never throws.
|
|
451
|
+
*/
|
|
452
|
+
function startAlongside(options = {}) {
|
|
453
|
+
return start({ ...options, alongside: true });
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* carryingInstrumentations are the entry wrappers that only carry call
|
|
457
|
+
* sites, for another tracer's spans: the pg pool's and Drizzle's
|
|
458
|
+
* captures, and postgres.js's origins, given to the database span the
|
|
459
|
+
* tracer starts for each query.
|
|
460
|
+
*/
|
|
461
|
+
function carryingInstrumentations(config, callSites) {
|
|
462
|
+
const want = (name) => !config.disabled.has(name);
|
|
463
|
+
const sampling = callSites.sampling;
|
|
464
|
+
const list = [];
|
|
465
|
+
if (want('pg')) {
|
|
466
|
+
list.push(new pgpool_js_1.PgPoolEntryInstrumentation({ depth: config.callsiteDepth, sampling, connect: false }));
|
|
467
|
+
}
|
|
468
|
+
if (want('postgres')) {
|
|
469
|
+
list.push(new postgresjs_js_1.PostgresJsInstrumentation({
|
|
470
|
+
sampling,
|
|
471
|
+
spans: false,
|
|
472
|
+
onSite: (site) => {
|
|
473
|
+
const span = (0, coexist_js_1.activeDatabaseSpan)();
|
|
474
|
+
if (span) {
|
|
475
|
+
callSites.assign(span, site);
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
}));
|
|
479
|
+
}
|
|
480
|
+
if (want('drizzle')) {
|
|
481
|
+
list.push(new drizzle_js_1.DrizzleEntryInstrumentation({ depth: config.callsiteDepth, sampling }));
|
|
482
|
+
}
|
|
483
|
+
return list.map((instrumentation) => (0, coexist_js_1.guardWrappers)(instrumentation, false));
|
|
484
|
+
}
|
|
485
|
+
/** rootcatResource is the package's resource: the SDK's identity and the service's. */
|
|
486
|
+
function rootcatResource(config) {
|
|
487
|
+
// defaultResource is the SDK's own identity (telemetry.sdk.*); no
|
|
488
|
+
// detector runs, so no command line, environment or host facts travel.
|
|
489
|
+
return (0, resources_1.defaultResource)().merge((0, resources_1.resourceFromAttributes)({
|
|
490
|
+
'service.name': config.serviceName,
|
|
491
|
+
...(config.serviceVersion !== '' ? { 'service.version': config.serviceVersion } : {}),
|
|
492
|
+
...(config.environment !== '' ? { 'deployment.environment.name': config.environment } : {}),
|
|
493
|
+
}));
|
|
494
|
+
}
|
|
495
|
+
/** tracerStartSpan is the startSpan of a provider's tracers, where SDK frames end. */
|
|
496
|
+
function tracerStartSpan(provider) {
|
|
497
|
+
return Object.getPrototypeOf(provider.getTracer('@rootcat/node')).startSpan;
|
|
498
|
+
}
|
|
499
|
+
function esmHookFor(config, options, takeOver, include) {
|
|
500
|
+
return options.esmHook === false
|
|
501
|
+
? 'off'
|
|
502
|
+
: (0, esmhook_js_1.registerESMHook)((reason) => {
|
|
503
|
+
if (config.debug) {
|
|
504
|
+
process.stderr.write(`rootcat: ES module hook: ${reason.slice(0, 300)}\n`);
|
|
505
|
+
}
|
|
506
|
+
}, takeOver, include);
|
|
507
|
+
}
|
|
508
|
+
function say(config, line) {
|
|
509
|
+
if (config.debug) {
|
|
510
|
+
process.stderr.write(`rootcat: ${line}\n`);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
/** otlpExporter builds the package's OTLP/HTTP protobuf exporter (see otlp.ts). */
|
|
514
|
+
function otlpExporter(url) {
|
|
515
|
+
return new otlp_js_1.ProtobufExporter({ url, timeoutMillis: exports.exporterTimeoutMillis, concurrency: exports.exporterConcurrency });
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* QuietLogger keeps the SDK silent except for one line when the span
|
|
519
|
+
* queue overflowed, so an operator learns that spans were dropped
|
|
520
|
+
* without the exporter's errors ever reaching the application's logs.
|
|
521
|
+
*/
|
|
522
|
+
class QuietLogger {
|
|
523
|
+
error() { }
|
|
524
|
+
warn(message) {
|
|
525
|
+
if (/maxQueueSize/.test(message)) {
|
|
526
|
+
(0, notices_js_1.sayOnce)('queue-full', 'spans were dropped: the queue was full (the intake is slow or down)');
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
info() { }
|
|
530
|
+
debug() { }
|
|
531
|
+
verbose() { }
|
|
532
|
+
}
|
|
533
|
+
function exportingProcessor(config, options) {
|
|
534
|
+
const exporter = options.exporter ?? otlpExporter(config.url);
|
|
535
|
+
return new sdk_trace_base_1.BatchSpanProcessor(exporter, {
|
|
536
|
+
maxQueueSize: exports.batchMaxQueueSize,
|
|
537
|
+
maxExportBatchSize: exports.batchMaxExportSize,
|
|
538
|
+
scheduledDelayMillis: exports.batchDelayMillis,
|
|
539
|
+
exportTimeoutMillis: exports.exporterTimeoutMillis,
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* installHooks flushes pending spans when the event loop drains and, when
|
|
544
|
+
* the process is the only listener for SIGTERM or SIGINT, flushes within
|
|
545
|
+
* signalFlushMillis and then re-raises the signal with its default
|
|
546
|
+
* disposition. An application with its own signal handlers keeps them;
|
|
547
|
+
* the flush then runs beside them, bounded, without delaying exit. A
|
|
548
|
+
* process.exit() call ends the process before any flush can run: the
|
|
549
|
+
* spans of its last batch interval are lost.
|
|
550
|
+
*/
|
|
551
|
+
function installHooks(provider) {
|
|
552
|
+
const beforeExit = () => {
|
|
553
|
+
provider.forceFlush().catch(() => undefined);
|
|
554
|
+
};
|
|
555
|
+
process.once('beforeExit', beforeExit);
|
|
556
|
+
const installed = [];
|
|
557
|
+
for (const signal of ['SIGTERM', 'SIGINT']) {
|
|
558
|
+
const listener = () => {
|
|
559
|
+
const flush = Promise.race([provider.forceFlush(), delay(exports.signalFlushMillis)]).catch(() => undefined);
|
|
560
|
+
const others = process.listeners(signal).filter((l) => l !== listener);
|
|
561
|
+
if (others.length > 0) {
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
flush.finally(() => {
|
|
565
|
+
process.removeListener(signal, listener);
|
|
566
|
+
process.kill(process.pid, signal);
|
|
567
|
+
});
|
|
568
|
+
};
|
|
569
|
+
process.on(signal, listener);
|
|
570
|
+
installed.push([signal, listener]);
|
|
571
|
+
}
|
|
572
|
+
return () => {
|
|
573
|
+
process.removeListener('beforeExit', beforeExit);
|
|
574
|
+
for (const [signal, listener] of installed) {
|
|
575
|
+
process.removeListener(signal, listener);
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
function delay(ms) {
|
|
580
|
+
return new Promise((resolve) => {
|
|
581
|
+
const timer = setTimeout(resolve, ms);
|
|
582
|
+
timer.unref();
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* patchBuiltins requires node:http and node:https once the
|
|
587
|
+
* instrumentations are registered, so the CommonJS hook patches the
|
|
588
|
+
* builtin modules' shared exports (http.Server.prototype.emit,
|
|
589
|
+
* http.request) whatever loads them later. An ES module application
|
|
590
|
+
* imports them through the loader, where the package's hook does not
|
|
591
|
+
* wrap builtins: before, they were patched only when another SDK's hook
|
|
592
|
+
* wrapped node:http through the same import-in-the-middle copy (npm
|
|
593
|
+
* dedupes Sentry's and the package's), and not at all with copies apart
|
|
594
|
+
* (pnpm), so no server span was recorded.
|
|
595
|
+
*/
|
|
596
|
+
function patchBuiltins() {
|
|
597
|
+
try {
|
|
598
|
+
const load = (0, node_module_1.createRequire)(__filename);
|
|
599
|
+
load('http');
|
|
600
|
+
load('https');
|
|
601
|
+
}
|
|
602
|
+
catch {
|
|
603
|
+
// an instrumentation without them still records the rest
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
//# sourceMappingURL=sdk.js.map
|
package/dist/sdk.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqHA,wCAGC;AAMD,0DAiDC;AAOD,sDAWC;AAOD,0BAEC;AAOD,sBAgBC;AAwOD,sDA0BC;AAYD,wCAEC;AAuED,oCAEC;AA1jBD,2EAA2E;AAC3E,+DAA+D;AAC/D,wEAAwE;AACxE,wEAAwE;AACxE,yEAAyE;AACzE,qCAAqC;AACrC,4CAAmG;AACnG,oEAAgG;AAChG,8EAA0E;AAC1E,oFAAgF;AAChF,oFAAgF;AAChF,kFAA8E;AAC9E,gFAA4E;AAC5E,kFAA8E;AAC9E,wDAAmF;AACnF,kEAAwH;AACxH,kEAAmE;AACnE,6CAA4C;AAC5C,gDAAkC;AAClC,6CAAyM;AACzM,2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