@rootcat/node 0.1.0 → 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/README.md +88 -7
- package/dist/attach.d.ts +1 -0
- package/dist/attach.js +24 -0
- package/dist/attach.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/drizzle.js +4 -1
- package/dist/drizzle.js.map +1 -1
- package/dist/esm.mjs +32 -16
- package/dist/esmhook.d.ts +42 -2
- package/dist/esmhook.js +84 -10
- package/dist/esmhook.js.map +1 -1
- package/dist/iitm-hook.mjs +83 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/keys.d.ts +11 -0
- package/dist/keys.js +19 -1
- package/dist/keys.js.map +1 -1
- package/dist/pg.js +8 -3
- package/dist/pg.js.map +1 -1
- package/dist/pgpool.d.ts +7 -0
- package/dist/pgpool.js +19 -5
- package/dist/pgpool.js.map +1 -1
- package/dist/postgresjs.d.ts +27 -0
- package/dist/postgresjs.js +131 -3
- package/dist/postgresjs.js.map +1 -1
- package/dist/privacy.d.ts +3 -3
- package/dist/privacy.js +16 -2
- package/dist/privacy.js.map +1 -1
- package/dist/processor.d.ts +106 -3
- package/dist/processor.js +278 -36
- package/dist/processor.js.map +1 -1
- package/dist/sampler.d.ts +18 -0
- package/dist/sampler.js +50 -1
- package/dist/sampler.js.map +1 -1
- package/dist/sdk.d.ts +43 -2
- package/dist/sdk.js +333 -32
- package/dist/sdk.js.map +1 -1
- package/package.json +10 -3
package/dist/processor.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CallSiteProcessor = exports.codeFunction = exports.codeLineno = exports.codeFilepath = exports.CallSiteSampling = exports.callSiteContextKey = void 0;
|
|
3
|
+
exports.CallSiteProcessor = exports.codeFunction = exports.codeLineno = exports.codeFilepath = exports.parentPolicy = exports.droppedMark = exports.CallSiteSampling = exports.callSiteContextKey = void 0;
|
|
4
|
+
exports.recorded = recorded;
|
|
5
|
+
exports.localParent = localParent;
|
|
4
6
|
exports.unsampled = unsampled;
|
|
5
7
|
exports.runCarried = runCarried;
|
|
6
8
|
exports.eligible = eligible;
|
|
9
|
+
exports.clientOperationByOp = clientOperationByOp;
|
|
10
|
+
exports.routeFromHost = routeFromHost;
|
|
11
|
+
exports.exportedName = exportedName;
|
|
12
|
+
exports.view = view;
|
|
7
13
|
// CallSiteProcessor: a span processor that, when a client span starts,
|
|
8
14
|
// records the application frame that caused it as code.filepath,
|
|
9
15
|
// code.lineno and code.function, and applies the privacy rules to the
|
|
@@ -15,6 +21,11 @@ exports.eligible = eligible;
|
|
|
15
21
|
// pool hands queries to a client on nextTick, where the stack is the
|
|
16
22
|
// pool's); else the parent span's call site (an ORM's operation span
|
|
17
23
|
// started in application code, its driver span on a later tick).
|
|
24
|
+
//
|
|
25
|
+
// In another SDK's provider (Sentry's, with Sentry tracing on) the
|
|
26
|
+
// processor is read-only: it finds the call site the same way but writes
|
|
27
|
+
// nothing on the span, which that SDK sends on; the package exports a
|
|
28
|
+
// copy with the site and the privacy rules applied (exportView).
|
|
18
29
|
const api_1 = require("@opentelemetry/api");
|
|
19
30
|
const callsite_js_1 = require("./callsite.js");
|
|
20
31
|
const keys_js_1 = require("./keys.js");
|
|
@@ -53,7 +64,7 @@ class CallSiteSampling {
|
|
|
53
64
|
/**
|
|
54
65
|
* carry is what an entry wrapper calls before the operation it wraps:
|
|
55
66
|
* it returns the context to run the operation in, or undefined to run
|
|
56
|
-
* it as it is. Under an
|
|
67
|
+
* it as it is. Under an unrecorded span nothing happens. Outside any
|
|
57
68
|
* span with a ratio below 1, the trace decision is made here (the
|
|
58
69
|
* sampler follows it), and an unsampled operation captures nothing. A
|
|
59
70
|
* site already carried by an outer layer of the same operation stands,
|
|
@@ -63,11 +74,11 @@ class CallSiteSampling {
|
|
|
63
74
|
*/
|
|
64
75
|
carry(capture, override = false) {
|
|
65
76
|
const active = api_1.context.active();
|
|
66
|
-
const
|
|
77
|
+
const local = localParent(active);
|
|
67
78
|
let ctx = active;
|
|
68
79
|
// A remote parent (an incoming traceparent) decides nothing: see the sampler.
|
|
69
|
-
if (
|
|
70
|
-
if ((
|
|
80
|
+
if (local) {
|
|
81
|
+
if (!recorded(local)) {
|
|
71
82
|
return undefined;
|
|
72
83
|
}
|
|
73
84
|
}
|
|
@@ -93,16 +104,60 @@ class CallSiteSampling {
|
|
|
93
104
|
}
|
|
94
105
|
}
|
|
95
106
|
exports.CallSiteSampling = CallSiteSampling;
|
|
107
|
+
/**
|
|
108
|
+
* recorded reports whether a span in this process is part of a recorded
|
|
109
|
+
* trace: it is recording (beside an errors-only Sentry the package
|
|
110
|
+
* records spans without the sampled flag, see RecordOnlySampler), or it
|
|
111
|
+
* carries the flag (a span context an application wrapped itself, to
|
|
112
|
+
* continue a trace from a queued job).
|
|
113
|
+
*/
|
|
114
|
+
function recorded(span) {
|
|
115
|
+
return span.isRecording() || (span.spanContext().traceFlags & api_1.TraceFlags.SAMPLED) !== 0;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* droppedMark is the trace-state key on the spans the package itself
|
|
119
|
+
* decided not to record beside Sentry (see RecordOnlySampler), so they
|
|
120
|
+
* can be told from another SDK's unrecorded spans.
|
|
121
|
+
*/
|
|
122
|
+
exports.droppedMark = 'rootcat';
|
|
123
|
+
/**
|
|
124
|
+
* parentPolicy says how an unrecorded parent from another SDK counts.
|
|
125
|
+
* Beside an errors-only Sentry every span on Sentry's provider is
|
|
126
|
+
* unrecorded (Next.js starts its own through it), and the package's spans
|
|
127
|
+
* below one must not be lost: such a parent is passed through, as if the
|
|
128
|
+
* span had none, and the trace ratio decides on its trace id. Set once,
|
|
129
|
+
* when the package starts beside Sentry.
|
|
130
|
+
*/
|
|
131
|
+
exports.parentPolicy = { transparentForeign: false };
|
|
132
|
+
/**
|
|
133
|
+
* localParent is the span in ctx when it was started in this process
|
|
134
|
+
* (not a parent from an incoming header), and counts as one (see
|
|
135
|
+
* parentPolicy).
|
|
136
|
+
*/
|
|
137
|
+
function localParent(ctx) {
|
|
138
|
+
const span = api_1.trace.getSpan(ctx);
|
|
139
|
+
if (!span) {
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
const spanContext = span.spanContext();
|
|
143
|
+
if (!api_1.trace.isSpanContextValid(spanContext) || spanContext.isRemote) {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
if (exports.parentPolicy.transparentForeign && !recorded(span) && spanContext.traceState?.get(exports.droppedMark) === undefined) {
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
return span;
|
|
150
|
+
}
|
|
96
151
|
/**
|
|
97
152
|
* unsampled reports whether a span started under ctx would not be
|
|
98
|
-
* recorded (an
|
|
153
|
+
* recorded (an unrecorded parent, or a root an entry wrapper decided
|
|
99
154
|
* against): the drivers then run untouched, without even a
|
|
100
155
|
* non-recording span or a context of their own.
|
|
101
156
|
*/
|
|
102
157
|
function unsampled(ctx) {
|
|
103
|
-
const
|
|
104
|
-
if (
|
|
105
|
-
return (
|
|
158
|
+
const local = localParent(ctx);
|
|
159
|
+
if (local) {
|
|
160
|
+
return !recorded(local);
|
|
106
161
|
}
|
|
107
162
|
return ctx.getValue(keys_js_1.rootDecisionKey) === false;
|
|
108
163
|
}
|
|
@@ -118,20 +173,26 @@ exports.codeFunction = 'code.function';
|
|
|
118
173
|
* eligible reports whether a span is a client operation worth a call
|
|
119
174
|
* site: client and producer spans, anything carrying db.system, and the
|
|
120
175
|
* operation spans of the ORMs that start their work in application code.
|
|
176
|
+
* A processor runs for recorded spans only, so every span here exports.
|
|
121
177
|
*/
|
|
122
178
|
function eligible(span) {
|
|
123
|
-
if (!span.spanContext().traceFlags) {
|
|
124
|
-
return false; // not sampled: nothing will export it
|
|
125
|
-
}
|
|
126
179
|
if (span.kind === api_1.SpanKind.CLIENT || span.kind === api_1.SpanKind.PRODUCER) {
|
|
127
180
|
return true;
|
|
128
181
|
}
|
|
129
|
-
|
|
130
|
-
if (attributes['db.system'] !== undefined || attributes['db.system.name'] !== undefined) {
|
|
182
|
+
if (isDatabase(span.attributes)) {
|
|
131
183
|
return true;
|
|
132
184
|
}
|
|
133
185
|
return span.name.startsWith('drizzle.') || span.name.startsWith('prisma:client:');
|
|
134
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* clientOperationByOp reports whether a Sentry span is a client
|
|
189
|
+
* operation by its op, the one attribute Sentry sets when it starts a
|
|
190
|
+
* span (its postgres.js span gets db.system.name only after the start).
|
|
191
|
+
*/
|
|
192
|
+
function clientOperationByOp(span) {
|
|
193
|
+
const op = span.attributes['sentry.op'];
|
|
194
|
+
return typeof op === 'string' && /^(db|cache|http\.client|queue\.publish)\b/.test(op);
|
|
195
|
+
}
|
|
135
196
|
/** CallSiteProcessor implements SpanProcessor. */
|
|
136
197
|
class CallSiteProcessor {
|
|
137
198
|
sampling;
|
|
@@ -140,6 +201,8 @@ class CallSiteProcessor {
|
|
|
140
201
|
isApp;
|
|
141
202
|
/** above is where a processor capture starts (the SDK tracer startSpan); set once the provider exists. */
|
|
142
203
|
above;
|
|
204
|
+
readOnly;
|
|
205
|
+
keepHostKeys;
|
|
143
206
|
sites = new WeakMap();
|
|
144
207
|
/** captured counts spans given a call site (tests and the benchmark). */
|
|
145
208
|
captured = 0;
|
|
@@ -149,14 +212,36 @@ class CallSiteProcessor {
|
|
|
149
212
|
this.statement = options.statement;
|
|
150
213
|
this.isApp = options.isApp ?? callsite_js_1.isAppFile;
|
|
151
214
|
this.above = options.above;
|
|
215
|
+
this.readOnly = options.readOnly === true;
|
|
216
|
+
this.keepHostKeys = options.keepHostKeys === true;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* assign gives a started span a call site found after its start (a
|
|
220
|
+
* driver's own origin, read once another SDK's span exists); it
|
|
221
|
+
* replaces any the processor found at the start.
|
|
222
|
+
*/
|
|
223
|
+
assign(span, site) {
|
|
224
|
+
if (!this.sites.has(span)) {
|
|
225
|
+
this.captured++;
|
|
226
|
+
}
|
|
227
|
+
this.sites.set(span, site);
|
|
228
|
+
if (!this.readOnly) {
|
|
229
|
+
stamp(span, site);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/** siteOf is the call site the processor holds for a span. */
|
|
233
|
+
siteOf(span) {
|
|
234
|
+
return this.sites.get(span);
|
|
152
235
|
}
|
|
153
236
|
onStart(span, parentContext) {
|
|
154
237
|
try {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
238
|
+
if (!this.readOnly) {
|
|
239
|
+
const changes = (0, privacy_js_1.scrubbed)(span.attributes, this.statement);
|
|
240
|
+
if (changes) {
|
|
241
|
+
span.setAttributes(changes);
|
|
242
|
+
}
|
|
158
243
|
}
|
|
159
|
-
if (!this.sampling.on || !eligible(span)) {
|
|
244
|
+
if (!this.sampling.on || !(eligible(span) || (this.readOnly && clientOperationByOp(span)))) {
|
|
160
245
|
return;
|
|
161
246
|
}
|
|
162
247
|
const site = this.locate(parentContext);
|
|
@@ -165,10 +250,8 @@ class CallSiteProcessor {
|
|
|
165
250
|
}
|
|
166
251
|
this.sites.set(span, site);
|
|
167
252
|
this.captured++;
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if (site.function !== '') {
|
|
171
|
-
span.setAttribute(exports.codeFunction, site.function);
|
|
253
|
+
if (!this.readOnly) {
|
|
254
|
+
stamp(span, site);
|
|
172
255
|
}
|
|
173
256
|
}
|
|
174
257
|
catch {
|
|
@@ -196,30 +279,23 @@ class CallSiteProcessor {
|
|
|
196
279
|
return (0, callsite_js_1.captureCallSite)(this.depth, this.isApp, this.above);
|
|
197
280
|
}
|
|
198
281
|
onEnd(span) {
|
|
282
|
+
if (this.readOnly) {
|
|
283
|
+
return; // exportView makes the copy the package sends
|
|
284
|
+
}
|
|
199
285
|
try {
|
|
200
286
|
// The span is ended; the exporter reads these same objects, so the
|
|
201
287
|
// rules hold for attributes and events set after the start as well.
|
|
288
|
+
const attributes = span.attributes;
|
|
202
289
|
const changes = (0, privacy_js_1.scrubbed)(span.attributes, this.statement);
|
|
203
290
|
if (changes) {
|
|
204
|
-
const attributes = span.attributes;
|
|
205
291
|
for (const [key, value] of Object.entries(changes)) {
|
|
206
292
|
attributes[key] = value;
|
|
207
293
|
}
|
|
208
294
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
const attributes = event.attributes;
|
|
212
|
-
const stack = attributes?.['exception.stacktrace'];
|
|
213
|
-
if (typeof stack === 'string') {
|
|
214
|
-
// A recorded exception's stack opens with its message line, which
|
|
215
|
-
// a database server may fill with the input that failed; the
|
|
216
|
-
// frames alone say where it happened.
|
|
217
|
-
attributes['exception.stacktrace'] = (0, privacy_js_1.framesOnly)(stack);
|
|
218
|
-
}
|
|
219
|
-
if (event.name === 'exception' && typeof attributes?.['exception.message'] === 'string') {
|
|
220
|
-
exceptionMessage = attributes['exception.message'];
|
|
221
|
-
}
|
|
295
|
+
if (!this.keepHostKeys) {
|
|
296
|
+
routeFromHost(span.name, attributes);
|
|
222
297
|
}
|
|
298
|
+
const exceptionMessage = scrubEvents(span.events);
|
|
223
299
|
// A database span's status message is the server's text, which can
|
|
224
300
|
// quote the input that failed; the instrumentation's own exception
|
|
225
301
|
// message (the pg one says only the class and SQLSTATE) stands in.
|
|
@@ -231,6 +307,44 @@ class CallSiteProcessor {
|
|
|
231
307
|
// never reaches the app
|
|
232
308
|
}
|
|
233
309
|
}
|
|
310
|
+
/**
|
|
311
|
+
* exportView is the span as the package exports it from a read-only
|
|
312
|
+
* processor: a copy of its attributes, events and status with the
|
|
313
|
+
* privacy rules and the call site applied, under the package's
|
|
314
|
+
* resource. The span itself is not touched.
|
|
315
|
+
*/
|
|
316
|
+
exportView(span, resource) {
|
|
317
|
+
const attributes = { ...span.attributes };
|
|
318
|
+
const changes = (0, privacy_js_1.scrubbed)(attributes, this.statement);
|
|
319
|
+
if (changes) {
|
|
320
|
+
Object.assign(attributes, changes);
|
|
321
|
+
}
|
|
322
|
+
const source = routeFromHost(span.name, attributes);
|
|
323
|
+
const site = this.sites.get(span);
|
|
324
|
+
if (site) {
|
|
325
|
+
attributes[exports.codeFilepath] = (0, callsite_js_1.displayPath)(site.file);
|
|
326
|
+
attributes[exports.codeLineno] = site.line;
|
|
327
|
+
if (site.function !== '') {
|
|
328
|
+
attributes[exports.codeFunction] = site.function;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
const events = span.events.map((event) => ({ ...event, attributes: event.attributes ? { ...event.attributes } : undefined }));
|
|
332
|
+
const exceptionMessage = scrubEvents(events);
|
|
333
|
+
let status = span.status;
|
|
334
|
+
if (status.code === api_1.SpanStatusCode.ERROR && isDatabase(attributes) && status.message) {
|
|
335
|
+
status = { code: status.code, message: exceptionMessage ?? 'database error' };
|
|
336
|
+
}
|
|
337
|
+
// A database span another SDK named after its statement (Sentry's
|
|
338
|
+
// postgres.js span, whose own sanitizer misses $$ and E'' literals)
|
|
339
|
+
// is named as the statement attribute is kept.
|
|
340
|
+
const name = isDatabase(attributes) ? this.statementName(span.name) : exportedName(span.name, source);
|
|
341
|
+
return view(span, { name, attributes: attributes, events, status, ...(resource ? { resource } : {}) });
|
|
342
|
+
}
|
|
343
|
+
/** statementName is a statement-shaped span name under the statement rule. */
|
|
344
|
+
statementName(name) {
|
|
345
|
+
const bounded = name.length > privacy_js_1.maxStatementLength ? name.slice(0, privacy_js_1.maxStatementLength) : name;
|
|
346
|
+
return this.statement === 'off' ? (0, privacy_js_1.statementKeyword)(bounded) : (0, privacy_js_1.maskLiterals)(bounded);
|
|
347
|
+
}
|
|
234
348
|
shutdown() {
|
|
235
349
|
return Promise.resolve();
|
|
236
350
|
}
|
|
@@ -239,6 +353,134 @@ class CallSiteProcessor {
|
|
|
239
353
|
}
|
|
240
354
|
}
|
|
241
355
|
exports.CallSiteProcessor = CallSiteProcessor;
|
|
356
|
+
/** stamp writes a call site on a span. */
|
|
357
|
+
function stamp(span, site) {
|
|
358
|
+
span.setAttribute(exports.codeFilepath, (0, callsite_js_1.displayPath)(site.file));
|
|
359
|
+
span.setAttribute(exports.codeLineno, site.line);
|
|
360
|
+
if (site.function !== '') {
|
|
361
|
+
span.setAttribute(exports.codeFunction, site.function);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* scrubEvents applies the stack rule to recorded exceptions (in place)
|
|
366
|
+
* and returns the last exception message. A recorded exception's stack
|
|
367
|
+
* opens with its message line, which a database server may fill with the
|
|
368
|
+
* input that failed; the frames alone say where it happened.
|
|
369
|
+
*/
|
|
370
|
+
function scrubEvents(events) {
|
|
371
|
+
let exceptionMessage;
|
|
372
|
+
for (const event of events) {
|
|
373
|
+
const attributes = event.attributes;
|
|
374
|
+
const stack = attributes?.['exception.stacktrace'];
|
|
375
|
+
if (typeof stack === 'string') {
|
|
376
|
+
attributes['exception.stacktrace'] = (0, privacy_js_1.framesOnly)(stack);
|
|
377
|
+
}
|
|
378
|
+
if (event.name === 'exception' && typeof attributes?.['exception.message'] === 'string') {
|
|
379
|
+
exceptionMessage = attributes['exception.message'];
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
return exceptionMessage;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* dropped reports the keys never exported: Sentry's bookkeeping
|
|
386
|
+
* (sentry.*), and request and response headers, which Sentry's http
|
|
387
|
+
* instrumentation records on its spans (cookies and authorization travel
|
|
388
|
+
* there) and the package's own never does.
|
|
389
|
+
*/
|
|
390
|
+
function dropped(key) {
|
|
391
|
+
const first = key.charCodeAt(0);
|
|
392
|
+
if (first === 115 /* s */) {
|
|
393
|
+
return key.startsWith('sentry.');
|
|
394
|
+
}
|
|
395
|
+
if (first === 99 /* c */) {
|
|
396
|
+
return key === 'cache.key'; // Sentry's cache spans: the keys
|
|
397
|
+
}
|
|
398
|
+
if (first === 114 /* r */) {
|
|
399
|
+
return key === 'rootcat.source'; // a source kept aside (see UrlSource)
|
|
400
|
+
}
|
|
401
|
+
return first === 104 /* h */ && (key.startsWith('http.request.header.') || key.startsWith('http.response.header.'));
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* routeFromHost drops the keys never exported and turns what a Sentry
|
|
405
|
+
* framework instrumentation wrote on the active span into the package's own
|
|
406
|
+
* vocabulary. @sentry/hono renames the server span to "GET /users/:id"
|
|
407
|
+
* once the route is known (sentry.source "route"): the template becomes
|
|
408
|
+
* http.route.
|
|
409
|
+
*/
|
|
410
|
+
function routeFromHost(name, attributes) {
|
|
411
|
+
let source;
|
|
412
|
+
let any = false;
|
|
413
|
+
for (const key in attributes) {
|
|
414
|
+
if (dropped(key)) {
|
|
415
|
+
any = true;
|
|
416
|
+
if (key === 'sentry.source' && source === undefined) {
|
|
417
|
+
source = attributes[key];
|
|
418
|
+
}
|
|
419
|
+
if (key === 'rootcat.source') {
|
|
420
|
+
source = attributes[key]; // what another SDK set, kept aside
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
if (!any) {
|
|
425
|
+
return undefined;
|
|
426
|
+
}
|
|
427
|
+
for (const key of Object.keys(attributes)) {
|
|
428
|
+
if (dropped(key)) {
|
|
429
|
+
delete attributes[key];
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
if (source === 'route' && attributes['http.route'] === undefined) {
|
|
433
|
+
const space = name.indexOf(' ');
|
|
434
|
+
if (space > 0 && name.charCodeAt(space + 1) === 47 /* / */) {
|
|
435
|
+
attributes['http.route'] = name.slice(space + 1, space + 1 + 256);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
return source;
|
|
439
|
+
}
|
|
440
|
+
/** methodAndTarget matches a span name of an HTTP method and a path or URL. */
|
|
441
|
+
const methodAndTarget = /^(GET|HEAD|POST|PUT|PATCH|DELETE|OPTIONS|CONNECT|TRACE) (\S+)$/;
|
|
442
|
+
/**
|
|
443
|
+
* exportedName is the name a span is exported under. Another SDK's HTTP
|
|
444
|
+
* span is named by the method and the path or URL it served or called
|
|
445
|
+
* (Sentry's: "GET /reset/3f9c...", "GET https://api.example.com/u/42"):
|
|
446
|
+
* the target is masked as an attribute URL is, unless the name is a
|
|
447
|
+
* route template a framework set (sentry.source "route").
|
|
448
|
+
*/
|
|
449
|
+
function exportedName(name, source) {
|
|
450
|
+
if (source === 'route') {
|
|
451
|
+
return name;
|
|
452
|
+
}
|
|
453
|
+
const match = methodAndTarget.exec(name);
|
|
454
|
+
return match ? `${match[1]} ${(0, privacy_js_1.maskPath)(match[2])}` : name;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* view is a ReadableSpan with the span's fields except the given ones,
|
|
458
|
+
* and always flagged sampled: the package exports only spans it chose to
|
|
459
|
+
* record, whatever flag they carry inside the process.
|
|
460
|
+
*/
|
|
461
|
+
function view(span, overrides = {}) {
|
|
462
|
+
const spanContext = span.spanContext();
|
|
463
|
+
const flagged = (spanContext.traceFlags & api_1.TraceFlags.SAMPLED) !== 0 ? spanContext : { ...spanContext, traceFlags: spanContext.traceFlags | api_1.TraceFlags.SAMPLED };
|
|
464
|
+
return {
|
|
465
|
+
name: overrides.name ?? span.name,
|
|
466
|
+
kind: span.kind,
|
|
467
|
+
spanContext: () => flagged,
|
|
468
|
+
parentSpanContext: span.parentSpanContext,
|
|
469
|
+
startTime: span.startTime,
|
|
470
|
+
endTime: span.endTime,
|
|
471
|
+
status: overrides.status ?? span.status,
|
|
472
|
+
attributes: overrides.attributes ?? span.attributes,
|
|
473
|
+
links: span.links,
|
|
474
|
+
events: overrides.events ?? span.events,
|
|
475
|
+
duration: span.duration,
|
|
476
|
+
ended: span.ended,
|
|
477
|
+
resource: overrides.resource ?? span.resource,
|
|
478
|
+
instrumentationScope: span.instrumentationScope,
|
|
479
|
+
droppedAttributesCount: span.droppedAttributesCount,
|
|
480
|
+
droppedEventsCount: span.droppedEventsCount,
|
|
481
|
+
droppedLinksCount: span.droppedLinksCount,
|
|
482
|
+
};
|
|
483
|
+
}
|
|
242
484
|
function isDatabase(attributes) {
|
|
243
485
|
return attributes['db.system'] !== undefined || attributes['db.system.name'] !== undefined;
|
|
244
486
|
}
|
package/dist/processor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processor.js","sourceRoot":"","sources":["../src/processor.ts"],"names":[],"mappings":";;;AAmGA,8BAMC;AAGD,gCAEC;AA6BD,4BAYC;AAvJD,uEAAuE;AACvE,iEAAiE;AACjE,sEAAsE;AACtE,yCAAyC;AACzC,EAAE;AACF,sEAAsE;AACtE,uEAAuE;AACvE,uEAAuE;AACvE,qEAAqE;AACrE,qEAAqE;AACrE,iEAAiE;AACjE,4CAAyH;AAEzH,+CAA+F;AAC/F,uCAAgE;AAChE,6CAAwE;AAExE,qCAA+C;AAAtC,6GAAA,kBAAkB,OAAA;AAE3B;;;;;GAKG;AACH,MAAa,gBAAgB;IAC3B,+EAA+E;IAC/E,MAAM,CAAS;IACf,kFAAkF;IAClF,KAAK,CAAS;IACN,OAAO,GAAG,CAAC,CAAC;IAEpB,kEAAkE;IAClE,YAAY,MAAc,EAAE,KAAK,GAAG,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QAC9C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,gEAAgE;IAChE,IAAI;QACF,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,OAAO,IAA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O,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC5E,CAAC"}
|
package/dist/sampler.d.ts
CHANGED
|
@@ -10,3 +10,21 @@ export declare class RootcatSampler implements Sampler {
|
|
|
10
10
|
}
|
|
11
11
|
/** rootcatSampler builds the sampler for a ratio between 0 and 1. */
|
|
12
12
|
export declare function rootcatSampler(ratio: number): Sampler;
|
|
13
|
+
/**
|
|
14
|
+
* RecordOnlySampler is the sampler beside an errors-only Sentry. It takes
|
|
15
|
+
* the same decisions as RootcatSampler but records a span without setting
|
|
16
|
+
* its sampled flag, and a child follows whether its parent is recorded.
|
|
17
|
+
* Sentry reads the active span to fill the sentry-trace and baggage
|
|
18
|
+
* headers of outgoing requests and the trace context of its error events:
|
|
19
|
+
* with the flag unset, those say what they said before Rootcat was added
|
|
20
|
+
* (no sampling decision), so a downstream service that traces with Sentry
|
|
21
|
+
* does not start keeping every trace this one sends it. The package's
|
|
22
|
+
* exporter flags what it sends (see view in processor.ts).
|
|
23
|
+
*/
|
|
24
|
+
export declare class RecordOnlySampler implements Sampler {
|
|
25
|
+
readonly ratio: number;
|
|
26
|
+
private readonly inner;
|
|
27
|
+
constructor(ratio: number);
|
|
28
|
+
shouldSample(context: Context, traceId: string, spanName: string, spanKind: SpanKind, attributes: Attributes, links: Link[]): SamplingResult;
|
|
29
|
+
toString(): string;
|
|
30
|
+
}
|
package/dist/sampler.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RootcatSampler = void 0;
|
|
3
|
+
exports.RecordOnlySampler = exports.RootcatSampler = void 0;
|
|
4
4
|
exports.rootcatSampler = rootcatSampler;
|
|
5
5
|
// The sampler: parent-based, with a trace-id ratio at the root
|
|
6
6
|
// (ROOTCAT_SAMPLE, 1 by default) and for a parent from outside the
|
|
@@ -10,7 +10,9 @@ exports.rootcatSampler = rootcatSampler;
|
|
|
10
10
|
// the sampler refuses is never recording: no processor runs for it.
|
|
11
11
|
const api_1 = require("@opentelemetry/api");
|
|
12
12
|
const sdk_trace_base_1 = require("@opentelemetry/sdk-trace-base");
|
|
13
|
+
const core_1 = require("@opentelemetry/core");
|
|
13
14
|
const keys_js_1 = require("./keys.js");
|
|
15
|
+
const processor_js_1 = require("./processor.js");
|
|
14
16
|
const sampled = { decision: sdk_trace_base_1.SamplingDecision.RECORD_AND_SAMPLED };
|
|
15
17
|
const dropped = { decision: sdk_trace_base_1.SamplingDecision.NOT_RECORD };
|
|
16
18
|
/** RootcatSampler is the ratio sampler that honours a wrapper's root decision. */
|
|
@@ -49,4 +51,51 @@ exports.RootcatSampler = RootcatSampler;
|
|
|
49
51
|
function rootcatSampler(ratio) {
|
|
50
52
|
return new RootcatSampler(ratio);
|
|
51
53
|
}
|
|
54
|
+
const recorded = { decision: sdk_trace_base_1.SamplingDecision.RECORD };
|
|
55
|
+
/**
|
|
56
|
+
* markedDropped is a refusal the package's own: the unrecorded span
|
|
57
|
+
* carries droppedMark in its trace state, so its children are refused too
|
|
58
|
+
* rather than passed through as another SDK's.
|
|
59
|
+
*/
|
|
60
|
+
const markedDropped = { decision: sdk_trace_base_1.SamplingDecision.NOT_RECORD, traceState: new core_1.TraceState().set(processor_js_1.droppedMark, '0') };
|
|
61
|
+
/**
|
|
62
|
+
* RecordOnlySampler is the sampler beside an errors-only Sentry. It takes
|
|
63
|
+
* the same decisions as RootcatSampler but records a span without setting
|
|
64
|
+
* its sampled flag, and a child follows whether its parent is recorded.
|
|
65
|
+
* Sentry reads the active span to fill the sentry-trace and baggage
|
|
66
|
+
* headers of outgoing requests and the trace context of its error events:
|
|
67
|
+
* with the flag unset, those say what they said before Rootcat was added
|
|
68
|
+
* (no sampling decision), so a downstream service that traces with Sentry
|
|
69
|
+
* does not start keeping every trace this one sends it. The package's
|
|
70
|
+
* exporter flags what it sends (see view in processor.ts).
|
|
71
|
+
*/
|
|
72
|
+
class RecordOnlySampler {
|
|
73
|
+
ratio;
|
|
74
|
+
inner;
|
|
75
|
+
constructor(ratio) {
|
|
76
|
+
this.ratio = ratio;
|
|
77
|
+
this.inner = new RootcatSampler(ratio);
|
|
78
|
+
}
|
|
79
|
+
shouldSample(context, traceId, spanName, spanKind, attributes, links) {
|
|
80
|
+
// localParent passes through another SDK's unrecorded span (Sentry's,
|
|
81
|
+
// Next.js's through Sentry's provider): the span is then decided as a
|
|
82
|
+
// root, by the ratio on its trace id.
|
|
83
|
+
const parent = (0, processor_js_1.localParent)(context);
|
|
84
|
+
if (parent) {
|
|
85
|
+
return parent.isRecording() || (parent.spanContext().traceFlags & api_1.TraceFlags.SAMPLED) !== 0 ? recorded : markedDropped;
|
|
86
|
+
}
|
|
87
|
+
// A remote parent goes to the inner sampler as it is (it decides by
|
|
88
|
+
// the ratio, ignoring its flag); a passed-through one is removed.
|
|
89
|
+
const asRoot = api_1.trace.getSpanContext(context)?.isRemote ? context : api_1.trace.deleteSpan(context);
|
|
90
|
+
const result = this.inner.shouldSample(asRoot, traceId, spanName, spanKind, attributes, links);
|
|
91
|
+
if (result.decision === sdk_trace_base_1.SamplingDecision.RECORD_AND_SAMPLED) {
|
|
92
|
+
return { ...result, decision: sdk_trace_base_1.SamplingDecision.RECORD };
|
|
93
|
+
}
|
|
94
|
+
return result.decision === sdk_trace_base_1.SamplingDecision.NOT_RECORD ? markedDropped : result;
|
|
95
|
+
}
|
|
96
|
+
toString() {
|
|
97
|
+
return `RecordOnlySampler(${this.ratio})`;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.RecordOnlySampler = RecordOnlySampler;
|
|
52
101
|
//# sourceMappingURL=sampler.js.map
|
package/dist/sampler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sampler.js","sourceRoot":"","sources":["../src/sampler.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"sampler.js","sourceRoot":"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AC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC;QACzH,CAAC;QACD,oEAAoE;QACpE,kEAAkE;QAClE,MAAM,MAAM,GAAG,WAAK,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAC7F,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QAC/F,IAAI,MAAM,CAAC,QAAQ,KAAK,iCAAgB,CAAC,kBAAkB,EAAE,CAAC;YAC5D,OAAO,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE,iCAAgB,CAAC,MAAM,EAAE,CAAC;QAC1D,CAAC;QACD,OAAO,MAAM,CAAC,QAAQ,KAAK,iCAAgB,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC;IAClF,CAAC;IAED,QAAQ;QACN,OAAO,qBAAqB,IAAI,CAAC,KAAK,GAAG,CAAC;IAC5C,CAAC;CACF;AA5BD,8CA4BC"}
|
package/dist/sdk.d.ts
CHANGED
|
@@ -32,10 +32,20 @@ export declare const spanLimits: {
|
|
|
32
32
|
};
|
|
33
33
|
/** signalFlushMillis bounds the flush attempted on SIGTERM and SIGINT. */
|
|
34
34
|
export declare const signalFlushMillis = 2000;
|
|
35
|
+
/**
|
|
36
|
+
* Mode says where the package's spans come from: its own provider,
|
|
37
|
+
* registered globally ('own'); its own provider beside another tracer
|
|
38
|
+
* that records nothing (Sentry for errors only), not registered
|
|
39
|
+
* ('beside'); or that tracer's provider, when it records spans
|
|
40
|
+
* ('inside').
|
|
41
|
+
*/
|
|
42
|
+
export type Mode = 'own' | 'beside' | 'inside';
|
|
35
43
|
/** Started is a running SDK. */
|
|
36
44
|
export interface Started {
|
|
37
45
|
config: Config;
|
|
38
|
-
|
|
46
|
+
mode: Mode;
|
|
47
|
+
/** provider is the package's own provider; undefined inside another tracer's. */
|
|
48
|
+
provider: NodeTracerProvider | undefined;
|
|
39
49
|
callSites: CallSiteProcessor;
|
|
40
50
|
/** esmHook says whether the module loader hook is registered. */
|
|
41
51
|
esmHook: ESMHook;
|
|
@@ -43,6 +53,8 @@ export interface Started {
|
|
|
43
53
|
instrumentations: Instrumentation[];
|
|
44
54
|
/** shutdown flushes and stops; it resolves within the exporter timeout. */
|
|
45
55
|
shutdown(): Promise<void>;
|
|
56
|
+
/** detach removes the exit and signal handlers the start installed. */
|
|
57
|
+
detach(): void;
|
|
46
58
|
}
|
|
47
59
|
/** StartOptions override the environment (tests). */
|
|
48
60
|
export interface StartOptions {
|
|
@@ -60,6 +72,13 @@ export interface StartOptions {
|
|
|
60
72
|
instrumentations?: Instrumentation[];
|
|
61
73
|
/** hooks installs the exit and signal handlers; default true. */
|
|
62
74
|
hooks?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* alongside says the caller is startAlongside(), which a refusal to
|
|
77
|
+
* start names in its message.
|
|
78
|
+
*/
|
|
79
|
+
alongside?: boolean;
|
|
80
|
+
/** late marks startAlongside()'s second look, a tick after a call that came before the tracer. */
|
|
81
|
+
late?: boolean;
|
|
63
82
|
}
|
|
64
83
|
/** instrumentationNames are the names ROOTCAT_DISABLE accepts. */
|
|
65
84
|
export declare const instrumentationNames: readonly ["http", "undici", "pg", "postgres", "drizzle", "mysql2", "mongodb", "ioredis", "redis", "prisma"];
|
|
@@ -69,7 +88,7 @@ export declare function redisStatement(command: string, args: unknown[]): string
|
|
|
69
88
|
* curatedInstrumentations builds the instrumentation set the config
|
|
70
89
|
* allows; sampling is the call-site gate they share with the processor.
|
|
71
90
|
*/
|
|
72
|
-
export declare function curatedInstrumentations(config: Config, sampling?: CallSiteSampling): Instrumentation[];
|
|
91
|
+
export declare function curatedInstrumentations(config: Config, sampling?: CallSiteSampling, beside?: boolean, http?: boolean): Instrumentation[];
|
|
73
92
|
/**
|
|
74
93
|
* prismaInstrumentation loads @prisma/instrumentation from the application
|
|
75
94
|
* when the application has it (Prisma ships it beside its client, and its
|
|
@@ -84,5 +103,27 @@ export declare function current(): Started | undefined;
|
|
|
84
103
|
* the package) returns the first result. It never throws.
|
|
85
104
|
*/
|
|
86
105
|
export declare function start(options?: StartOptions): Started | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* rootcatSpanProcessors returns the processor for another tracer's
|
|
108
|
+
* provider (Sentry.init's openTelemetrySpanProcessors, NodeSDK's
|
|
109
|
+
* spanProcessors): when that tracer records spans, it receives them and
|
|
110
|
+
* exports a copy of each (with its call site, under the privacy rules)
|
|
111
|
+
* to the host agent; the tracer's own spans and what it sends are
|
|
112
|
+
* unchanged. When the tracer records nothing (Sentry for errors only), it
|
|
113
|
+
* receives nothing and startAlongside() runs the package beside it
|
|
114
|
+
* instead. It never throws; disabled, it returns an empty list.
|
|
115
|
+
*/
|
|
116
|
+
export declare function rootcatSpanProcessors(options?: StartOptions): SpanProcessor[];
|
|
117
|
+
/**
|
|
118
|
+
* startAlongside starts the package after another tracer set up
|
|
119
|
+
* OpenTelemetry (Sentry.init, an app's NodeSDK): beside it when it
|
|
120
|
+
* records nothing (Sentry for errors only, or disabled with enabled:
|
|
121
|
+
* false, which still sets up its OpenTelemetry), inside it when it
|
|
122
|
+
* records spans (with rootcatSpanProcessors() in its provider), and on
|
|
123
|
+
* its own when nothing was set up (Sentry not initialised here, no DSN):
|
|
124
|
+
* if a Sentry client appears right after, the order was wrong and stderr
|
|
125
|
+
* says so. It never throws.
|
|
126
|
+
*/
|
|
127
|
+
export declare function startAlongside(options?: StartOptions): Started | undefined;
|
|
87
128
|
/** otlpExporter builds the package's OTLP/HTTP protobuf exporter (see otlp.ts). */
|
|
88
129
|
export declare function otlpExporter(url: string): SpanExporter;
|