@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.
Files changed (63) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/LICENSE +202 -0
  3. package/README.md +294 -2
  4. package/dist/attach.d.ts +1 -0
  5. package/dist/attach.js +24 -0
  6. package/dist/attach.js.map +1 -0
  7. package/dist/callsite.d.ts +109 -0
  8. package/dist/callsite.js +565 -0
  9. package/dist/callsite.js.map +1 -0
  10. package/dist/coexist.d.ts +183 -0
  11. package/dist/coexist.js +587 -0
  12. package/dist/coexist.js.map +1 -0
  13. package/dist/config.d.ts +75 -0
  14. package/dist/config.js +182 -0
  15. package/dist/config.js.map +1 -0
  16. package/dist/drizzle.d.ts +21 -0
  17. package/dist/drizzle.js +127 -0
  18. package/dist/drizzle.js.map +1 -0
  19. package/dist/esm.mjs +57 -0
  20. package/dist/esmhook.d.ts +52 -0
  21. package/dist/esmhook.js +158 -0
  22. package/dist/esmhook.js.map +1 -0
  23. package/dist/iitm-hook.mjs +83 -0
  24. package/dist/index.d.ts +12 -0
  25. package/dist/index.js +52 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/intake.d.ts +40 -0
  28. package/dist/intake.js +164 -0
  29. package/dist/intake.js.map +1 -0
  30. package/dist/keys.d.ts +20 -0
  31. package/dist/keys.js +33 -0
  32. package/dist/keys.js.map +1 -0
  33. package/dist/notices.d.ts +2 -0
  34. package/dist/notices.js +21 -0
  35. package/dist/notices.js.map +1 -0
  36. package/dist/otlp.d.ts +75 -0
  37. package/dist/otlp.js +449 -0
  38. package/dist/otlp.js.map +1 -0
  39. package/dist/pg.d.ts +16 -0
  40. package/dist/pg.js +170 -0
  41. package/dist/pg.js.map +1 -0
  42. package/dist/pgpool.d.ts +20 -0
  43. package/dist/pgpool.js +99 -0
  44. package/dist/pgpool.js.map +1 -0
  45. package/dist/postgresjs.d.ts +60 -0
  46. package/dist/postgresjs.js +400 -0
  47. package/dist/postgresjs.js.map +1 -0
  48. package/dist/privacy.d.ts +38 -0
  49. package/dist/privacy.js +161 -0
  50. package/dist/privacy.js.map +1 -0
  51. package/dist/processor.d.ts +197 -0
  52. package/dist/processor.js +494 -0
  53. package/dist/processor.js.map +1 -0
  54. package/dist/register.d.ts +1 -0
  55. package/dist/register.js +12 -0
  56. package/dist/register.js.map +1 -0
  57. package/dist/sampler.d.ts +30 -0
  58. package/dist/sampler.js +101 -0
  59. package/dist/sampler.js.map +1 -0
  60. package/dist/sdk.d.ts +129 -0
  61. package/dist/sdk.js +606 -0
  62. package/dist/sdk.js.map +1 -0
  63. package/package.json +72 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processor.js","sourceRoot":"","sources":["../src/processor.ts"],"names":[],"mappings":";;;AA2GA,4BAEC;AAwBD,kCAaC;AAQD,8BAMC;AAGD,gCAEC;AA6CD,4BAQC;AAOD,kDAGC;AAmOD,sCA6BC;AAYD,oCAMC;AAgBD,oBAsBC;AA5hBD,uEAAuE;AACvE,iEAAiE;AACjE,sEAAsE;AACtE,yCAAyC;AACzC,EAAE;AACF,sEAAsE;AACtE,uEAAuE;AACvE,uEAAuE;AACvE,qEAAqE;AACrE,qEAAqE;AACrE,iEAAiE;AACjE,EAAE;AACF,mEAAmE;AACnE,yEAAyE;AACzE,sEAAsE;AACtE,iEAAiE;AACjE,4CAA0M;AAI1M,+CAA+F;AAC/F,uCAAgE;AAChE,6CAAsI;AAEtI,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,C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kBAAkB,EAAE,IAAI,CAAC,kBAAkB;QAC3C,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;KAC1C,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,UAAsB;IACxC,OAAO,UAAU,CAAC,WAAW,CAAC,KAAK,SAAS,IAAI,UAAU,CAAC,gBAAgB,CAAC,KAAK,SAAS,CAAC;AAC7F,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAChC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,MAAM,GAAG,KAAgC,CAAC;IAChD,OAAO,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC5E,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // The --require entry: starts tracing as a side effect of being loaded.
4
+ // NODE_OPTIONS="--require @rootcat/node"
5
+ // The module loader hooks thread runs the same preloads as the main
6
+ // thread; tracing belongs to the main thread only.
7
+ const node_worker_threads_1 = require("node:worker_threads");
8
+ const sdk_js_1 = require("./sdk.js");
9
+ if (node_worker_threads_1.isMainThread) {
10
+ (0, sdk_js_1.start)();
11
+ }
12
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":";;AAAA,wEAAwE;AACxE,2CAA2C;AAC3C,oEAAoE;AACpE,mDAAmD;AACnD,6DAAmD;AACnD,qCAAiC;AAEjC,IAAI,kCAAY,EAAE,CAAC;IACjB,IAAA,cAAK,GAAE,CAAC;AACV,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { type Attributes, type Context, type Link, type SpanKind } from '@opentelemetry/api';
2
+ import { type Sampler, type SamplingResult } from '@opentelemetry/sdk-trace-base';
3
+ /** RootcatSampler is the ratio sampler that honours a wrapper's root decision. */
4
+ export declare class RootcatSampler implements Sampler {
5
+ readonly ratio: number;
6
+ private readonly inner;
7
+ constructor(ratio: number);
8
+ shouldSample(context: Context, traceId: string, spanName: string, spanKind: SpanKind, attributes: Attributes, links: Link[]): SamplingResult;
9
+ toString(): string;
10
+ }
11
+ /** rootcatSampler builds the sampler for a ratio between 0 and 1. */
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
+ }
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RecordOnlySampler = exports.RootcatSampler = void 0;
4
+ exports.rootcatSampler = rootcatSampler;
5
+ // The sampler: parent-based, with a trace-id ratio at the root
6
+ // (ROOTCAT_SAMPLE, 1 by default) and for a parent from outside the
7
+ // process, whose sampled flag is not trusted. A root span whose context carries a
8
+ // decision an entry wrapper already made (see CallSiteSampling.carry)
9
+ // follows it, so the wrapper's capture and the span's fate agree. A span
10
+ // the sampler refuses is never recording: no processor runs for it.
11
+ const api_1 = require("@opentelemetry/api");
12
+ const sdk_trace_base_1 = require("@opentelemetry/sdk-trace-base");
13
+ const core_1 = require("@opentelemetry/core");
14
+ const keys_js_1 = require("./keys.js");
15
+ const processor_js_1 = require("./processor.js");
16
+ const sampled = { decision: sdk_trace_base_1.SamplingDecision.RECORD_AND_SAMPLED };
17
+ const dropped = { decision: sdk_trace_base_1.SamplingDecision.NOT_RECORD };
18
+ /** RootcatSampler is the ratio sampler that honours a wrapper's root decision. */
19
+ class RootcatSampler {
20
+ ratio;
21
+ inner;
22
+ constructor(ratio) {
23
+ this.ratio = ratio;
24
+ // A parent from outside the process (an incoming traceparent) does not
25
+ // decide: anyone on the internet could otherwise force full tracing of
26
+ // their requests with the sampled flag, or hide them with 00. The
27
+ // ratio decides on the trace id, which the request keeps, so the trace
28
+ // still joins its caller's.
29
+ const root = ratio >= 1 ? new sdk_trace_base_1.AlwaysOnSampler() : new sdk_trace_base_1.TraceIdRatioBasedSampler(ratio);
30
+ this.inner = new sdk_trace_base_1.ParentBasedSampler({ root, remoteParentSampled: root, remoteParentNotSampled: root });
31
+ }
32
+ shouldSample(context, traceId, spanName, spanKind, attributes, links) {
33
+ const parent = api_1.trace.getSpanContext(context);
34
+ if (!parent || !api_1.trace.isSpanContextValid(parent) || parent.isRemote) {
35
+ const decided = context.getValue(keys_js_1.rootDecisionKey);
36
+ if (decided === true) {
37
+ return sampled;
38
+ }
39
+ if (decided === false) {
40
+ return dropped;
41
+ }
42
+ }
43
+ return this.inner.shouldSample(context, traceId, spanName, spanKind, attributes, links);
44
+ }
45
+ toString() {
46
+ return `RootcatSampler(${this.ratio})`;
47
+ }
48
+ }
49
+ exports.RootcatSampler = RootcatSampler;
50
+ /** rootcatSampler builds the sampler for a ratio between 0 and 1. */
51
+ function rootcatSampler(ratio) {
52
+ return new RootcatSampler(ratio);
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;
101
+ //# sourceMappingURL=sampler.js.map
@@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W,EAAE,CAAC,UAAU,GAAG,gBAAU,CAAC,OAAO,CAAC,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 ADDED
@@ -0,0 +1,129 @@
1
+ import { type Instrumentation } from '@opentelemetry/instrumentation';
2
+ import { type Sampler, type SpanExporter, type SpanProcessor } from '@opentelemetry/sdk-trace-base';
3
+ import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
4
+ import { type Config } from './config.js';
5
+ import { type ESMHook } from './esmhook.js';
6
+ import { CallSiteProcessor, CallSiteSampling } from './processor.js';
7
+ /**
8
+ * Exporter bounds, fixed: sized for a loopback intake that takes 1 MiB
9
+ * per request (512 protobuf spans are a few hundred KiB) and four
10
+ * uploads per sender. The queue holds 4096 ended spans; past that the
11
+ * newest are dropped, and the drop is reported once on stderr.
12
+ */
13
+ export declare const exporterTimeoutMillis = 2000;
14
+ export declare const exporterConcurrency = 2;
15
+ export declare const batchMaxQueueSize = 4096;
16
+ export declare const batchMaxExportSize = 512;
17
+ export declare const batchDelayMillis = 10000;
18
+ /**
19
+ * spanLimits bound every span, so a batch of them can be split into
20
+ * requests the agent accepts and nothing the application records (a
21
+ * statement from any driver, an exception stack) grows without bound:
22
+ * each attribute value at most 4 KiB, 64 attributes, 8 events of 8
23
+ * attributes. The largest possible span then encodes to about half a MiB.
24
+ */
25
+ export declare const spanLimits: {
26
+ attributeValueLengthLimit: number;
27
+ attributeCountLimit: number;
28
+ eventCountLimit: number;
29
+ attributePerEventCountLimit: number;
30
+ linkCountLimit: number;
31
+ attributePerLinkCountLimit: number;
32
+ };
33
+ /** signalFlushMillis bounds the flush attempted on SIGTERM and SIGINT. */
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';
43
+ /** Started is a running SDK. */
44
+ export interface Started {
45
+ config: Config;
46
+ mode: Mode;
47
+ /** provider is the package's own provider; undefined inside another tracer's. */
48
+ provider: NodeTracerProvider | undefined;
49
+ callSites: CallSiteProcessor;
50
+ /** esmHook says whether the module loader hook is registered. */
51
+ esmHook: ESMHook;
52
+ /** instrumentations are the ones registered (the benchmark disables and enables them). */
53
+ instrumentations: Instrumentation[];
54
+ /** shutdown flushes and stops; it resolves within the exporter timeout. */
55
+ shutdown(): Promise<void>;
56
+ /** detach removes the exit and signal handlers the start installed. */
57
+ detach(): void;
58
+ }
59
+ /** StartOptions override the environment (tests). */
60
+ export interface StartOptions {
61
+ env?: NodeJS.ProcessEnv;
62
+ cwd?: string;
63
+ /** spanProcessors replace the exporting processor (tests pass an in-memory one). */
64
+ spanProcessors?: SpanProcessor[];
65
+ /** exporter replaces the OTLP exporter behind the batching processor. */
66
+ exporter?: SpanExporter;
67
+ /** sampler replaces the default sampler. */
68
+ sampler?: Sampler;
69
+ /** esmHook false skips the module loader hook (the benchmark measures its cost). */
70
+ esmHook?: boolean;
71
+ /** instrumentations replace the curated set (tests). */
72
+ instrumentations?: Instrumentation[];
73
+ /** hooks installs the exit and signal handlers; default true. */
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;
82
+ }
83
+ /** instrumentationNames are the names ROOTCAT_DISABLE accepts. */
84
+ export declare const instrumentationNames: readonly ["http", "undici", "pg", "postgres", "drizzle", "mysql2", "mongodb", "ioredis", "redis", "prisma"];
85
+ /** redisStatement records the command name and the argument count only. */
86
+ export declare function redisStatement(command: string, args: unknown[]): string;
87
+ /**
88
+ * curatedInstrumentations builds the instrumentation set the config
89
+ * allows; sampling is the call-site gate they share with the processor.
90
+ */
91
+ export declare function curatedInstrumentations(config: Config, sampling?: CallSiteSampling, beside?: boolean, http?: boolean): Instrumentation[];
92
+ /**
93
+ * prismaInstrumentation loads @prisma/instrumentation from the application
94
+ * when the application has it (Prisma ships it beside its client, and its
95
+ * version must match the client's), and nothing otherwise.
96
+ */
97
+ export declare function prismaInstrumentation(cwd: string): Instrumentation | undefined;
98
+ /** current returns the running SDK, if any. */
99
+ export declare function current(): Started | undefined;
100
+ /**
101
+ * start reads the configuration and starts the SDK once per process. A
102
+ * later call (the import line and NODE_OPTIONS both, or a second copy of
103
+ * the package) returns the first result. It never throws.
104
+ */
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;
128
+ /** otlpExporter builds the package's OTLP/HTTP protobuf exporter (see otlp.ts). */
129
+ export declare function otlpExporter(url: string): SpanExporter;