@rootcat/node 0.0.0-stage → 0.1.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/LICENSE +202 -0
- package/README.md +213 -2
- package/dist/callsite.d.ts +109 -0
- package/dist/callsite.js +565 -0
- package/dist/callsite.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 +124 -0
- package/dist/drizzle.js.map +1 -0
- package/dist/esm.mjs +41 -0
- package/dist/esmhook.d.ts +12 -0
- package/dist/esmhook.js +84 -0
- package/dist/esmhook.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +50 -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 +9 -0
- package/dist/keys.js +15 -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 +165 -0
- package/dist/pg.js.map +1 -0
- package/dist/pgpool.d.ts +13 -0
- package/dist/pgpool.js +85 -0
- package/dist/pgpool.js.map +1 -0
- package/dist/postgresjs.d.ts +33 -0
- package/dist/postgresjs.js +272 -0
- package/dist/postgresjs.js.map +1 -0
- package/dist/privacy.d.ts +38 -0
- package/dist/privacy.js +147 -0
- package/dist/privacy.js.map +1 -0
- package/dist/processor.d.ts +94 -0
- package/dist/processor.js +252 -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 +12 -0
- package/dist/sampler.js +52 -0
- package/dist/sampler.js.map +1 -0
- package/dist/sdk.d.ts +88 -0
- package/dist/sdk.js +305 -0
- package/dist/sdk.js.map +1 -0
- package/package.json +65 -4
package/dist/sdk.js
ADDED
|
@@ -0,0 +1,305 @@
|
|
|
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.otlpExporter = otlpExporter;
|
|
43
|
+
// The SDK: one tracer provider with the call-site processor and a batching
|
|
44
|
+
// OTLP/HTTP (protobuf) exporter to the host agent, the curated
|
|
45
|
+
// instrumentations, and a bounded flush at exit. Nothing here may throw
|
|
46
|
+
// into the application: start() reports a failure on stderr in one line
|
|
47
|
+
// and returns undefined. It starts once per process, however many copies
|
|
48
|
+
// of the package or entries load it.
|
|
49
|
+
const api_1 = require("@opentelemetry/api");
|
|
50
|
+
const instrumentation_1 = require("@opentelemetry/instrumentation");
|
|
51
|
+
const instrumentation_http_1 = require("@opentelemetry/instrumentation-http");
|
|
52
|
+
const instrumentation_ioredis_1 = require("@opentelemetry/instrumentation-ioredis");
|
|
53
|
+
const instrumentation_mongodb_1 = require("@opentelemetry/instrumentation-mongodb");
|
|
54
|
+
const instrumentation_mysql2_1 = require("@opentelemetry/instrumentation-mysql2");
|
|
55
|
+
const instrumentation_redis_1 = require("@opentelemetry/instrumentation-redis");
|
|
56
|
+
const instrumentation_undici_1 = require("@opentelemetry/instrumentation-undici");
|
|
57
|
+
const resources_1 = require("@opentelemetry/resources");
|
|
58
|
+
const sdk_trace_base_1 = require("@opentelemetry/sdk-trace-base");
|
|
59
|
+
const sdk_trace_node_1 = require("@opentelemetry/sdk-trace-node");
|
|
60
|
+
const node_module_1 = require("node:module");
|
|
61
|
+
const path = __importStar(require("node:path"));
|
|
62
|
+
const config_js_1 = require("./config.js");
|
|
63
|
+
const drizzle_js_1 = require("./drizzle.js");
|
|
64
|
+
const esmhook_js_1 = require("./esmhook.js");
|
|
65
|
+
const intake_js_1 = require("./intake.js");
|
|
66
|
+
const notices_js_1 = require("./notices.js");
|
|
67
|
+
const otlp_js_1 = require("./otlp.js");
|
|
68
|
+
const pg_js_1 = require("./pg.js");
|
|
69
|
+
const pgpool_js_1 = require("./pgpool.js");
|
|
70
|
+
const postgresjs_js_1 = require("./postgresjs.js");
|
|
71
|
+
const processor_js_1 = require("./processor.js");
|
|
72
|
+
const sampler_js_1 = require("./sampler.js");
|
|
73
|
+
/**
|
|
74
|
+
* Exporter bounds, fixed: sized for a loopback intake that takes 1 MiB
|
|
75
|
+
* per request (512 protobuf spans are a few hundred KiB) and four
|
|
76
|
+
* uploads per sender. The queue holds 4096 ended spans; past that the
|
|
77
|
+
* newest are dropped, and the drop is reported once on stderr.
|
|
78
|
+
*/
|
|
79
|
+
exports.exporterTimeoutMillis = 2000;
|
|
80
|
+
exports.exporterConcurrency = 2;
|
|
81
|
+
exports.batchMaxQueueSize = 4096;
|
|
82
|
+
exports.batchMaxExportSize = 512;
|
|
83
|
+
exports.batchDelayMillis = 10_000;
|
|
84
|
+
/**
|
|
85
|
+
* spanLimits bound every span, so a batch of them can be split into
|
|
86
|
+
* requests the agent accepts and nothing the application records (a
|
|
87
|
+
* statement from any driver, an exception stack) grows without bound:
|
|
88
|
+
* each attribute value at most 4 KiB, 64 attributes, 8 events of 8
|
|
89
|
+
* attributes. The largest possible span then encodes to about half a MiB.
|
|
90
|
+
*/
|
|
91
|
+
exports.spanLimits = {
|
|
92
|
+
attributeValueLengthLimit: 4096,
|
|
93
|
+
attributeCountLimit: 64,
|
|
94
|
+
eventCountLimit: 8,
|
|
95
|
+
attributePerEventCountLimit: 8,
|
|
96
|
+
linkCountLimit: 8,
|
|
97
|
+
attributePerLinkCountLimit: 8,
|
|
98
|
+
};
|
|
99
|
+
/** signalFlushMillis bounds the flush attempted on SIGTERM and SIGINT. */
|
|
100
|
+
exports.signalFlushMillis = 2000;
|
|
101
|
+
/** instrumentationNames are the names ROOTCAT_DISABLE accepts. */
|
|
102
|
+
exports.instrumentationNames = ['http', 'undici', 'pg', 'postgres', 'drizzle', 'mysql2', 'mongodb', 'ioredis', 'redis', 'prisma'];
|
|
103
|
+
/** redisStatement records the command name and the argument count only. */
|
|
104
|
+
function redisStatement(command, args) {
|
|
105
|
+
const count = Array.isArray(args) ? args.length : 0;
|
|
106
|
+
return count === 0 ? command : `${command} [${count} args]`;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* curatedInstrumentations builds the instrumentation set the config
|
|
110
|
+
* allows; sampling is the call-site gate they share with the processor.
|
|
111
|
+
*/
|
|
112
|
+
function curatedInstrumentations(config, sampling = new processor_js_1.CallSiteSampling(config.callsiteSample, config.sampleRatio)) {
|
|
113
|
+
const want = (name) => !config.disabled.has(name);
|
|
114
|
+
const list = [];
|
|
115
|
+
if (want('http')) {
|
|
116
|
+
list.push(new instrumentation_http_1.HttpInstrumentation({}));
|
|
117
|
+
}
|
|
118
|
+
if (want('undici')) {
|
|
119
|
+
list.push(new instrumentation_undici_1.UndiciInstrumentation({}));
|
|
120
|
+
}
|
|
121
|
+
if (want('pg')) {
|
|
122
|
+
list.push(new pg_js_1.PgInstrumentation({ sampling, depth: config.callsiteDepth }));
|
|
123
|
+
list.push(new pgpool_js_1.PgPoolEntryInstrumentation({ depth: config.callsiteDepth, sampling }));
|
|
124
|
+
}
|
|
125
|
+
if (want('postgres')) {
|
|
126
|
+
list.push(new postgresjs_js_1.PostgresJsInstrumentation({ sampling }));
|
|
127
|
+
}
|
|
128
|
+
if (want('drizzle')) {
|
|
129
|
+
list.push(new drizzle_js_1.DrizzleEntryInstrumentation({ depth: config.callsiteDepth, sampling }));
|
|
130
|
+
}
|
|
131
|
+
if (want('mysql2')) {
|
|
132
|
+
list.push(new instrumentation_mysql2_1.MySQL2Instrumentation({ maskStatement: true }));
|
|
133
|
+
}
|
|
134
|
+
if (want('mongodb')) {
|
|
135
|
+
list.push(new instrumentation_mongodb_1.MongoDBInstrumentation({ enhancedDatabaseReporting: false }));
|
|
136
|
+
}
|
|
137
|
+
if (want('ioredis')) {
|
|
138
|
+
list.push(new instrumentation_ioredis_1.IORedisInstrumentation({ dbStatementSerializer: redisStatement }));
|
|
139
|
+
}
|
|
140
|
+
if (want('redis')) {
|
|
141
|
+
list.push(new instrumentation_redis_1.RedisInstrumentation({ dbStatementSerializer: redisStatement }));
|
|
142
|
+
}
|
|
143
|
+
if (want('prisma')) {
|
|
144
|
+
const prisma = prismaInstrumentation(config.cwd);
|
|
145
|
+
if (prisma) {
|
|
146
|
+
list.push(prisma);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return list;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* prismaInstrumentation loads @prisma/instrumentation from the application
|
|
153
|
+
* when the application has it (Prisma ships it beside its client, and its
|
|
154
|
+
* version must match the client's), and nothing otherwise.
|
|
155
|
+
*/
|
|
156
|
+
function prismaInstrumentation(cwd) {
|
|
157
|
+
try {
|
|
158
|
+
const requireFromApp = (0, node_module_1.createRequire)(path.join(cwd, 'package.json'));
|
|
159
|
+
const mod = requireFromApp('@prisma/instrumentation');
|
|
160
|
+
if (typeof mod?.PrismaInstrumentation === 'function') {
|
|
161
|
+
return new mod.PrismaInstrumentation({});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
// not installed, or not loadable: no Prisma spans
|
|
166
|
+
}
|
|
167
|
+
return undefined;
|
|
168
|
+
}
|
|
169
|
+
/** startedKey holds the running SDK on globalThis, shared by every copy of the package. */
|
|
170
|
+
const startedKey = Symbol.for('rootcat.node.started');
|
|
171
|
+
const holder = globalThis;
|
|
172
|
+
/** current returns the running SDK, if any. */
|
|
173
|
+
function current() {
|
|
174
|
+
return holder[startedKey] ?? undefined;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* start reads the configuration and starts the SDK once per process. A
|
|
178
|
+
* later call (the import line and NODE_OPTIONS both, or a second copy of
|
|
179
|
+
* the package) returns the first result. It never throws.
|
|
180
|
+
*/
|
|
181
|
+
function start(options = {}) {
|
|
182
|
+
if (holder[startedKey] !== undefined) {
|
|
183
|
+
return holder[startedKey] ?? undefined;
|
|
184
|
+
}
|
|
185
|
+
try {
|
|
186
|
+
const started = startOnce(options);
|
|
187
|
+
holder[startedKey] = started ?? null;
|
|
188
|
+
return started;
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
192
|
+
process.stderr.write(`rootcat: tracing not started: ${reason.slice(0, 200)}\n`);
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function startOnce(options) {
|
|
197
|
+
const config = (0, config_js_1.readConfig)(options.env ?? process.env, options.cwd ?? process.cwd(), () => (0, intake_js_1.discoverIntake)());
|
|
198
|
+
if (!config.enabled) {
|
|
199
|
+
return undefined;
|
|
200
|
+
}
|
|
201
|
+
if (!(api_1.trace.getTracerProvider() instanceof api_1.ProxyTracerProvider)) {
|
|
202
|
+
// Another OpenTelemetry SDK (Sentry 8 and later, an app's own NodeSDK)
|
|
203
|
+
// registered first: a second provider would fight it for the global
|
|
204
|
+
// context manager and patch the same modules twice.
|
|
205
|
+
process.stderr.write('rootcat: another OpenTelemetry SDK is already registered in this process; @rootcat/node does not start\n');
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
208
|
+
api_1.diag.setLogger(config.debug ? new api_1.DiagConsoleLogger() : new QuietLogger(), config.debug ? api_1.DiagLogLevel.DEBUG : api_1.DiagLogLevel.WARN);
|
|
209
|
+
// defaultResource is the SDK's own identity (telemetry.sdk.*); no
|
|
210
|
+
// detector runs, so no command line, environment or host facts travel.
|
|
211
|
+
const resource = (0, resources_1.defaultResource)().merge((0, resources_1.resourceFromAttributes)({
|
|
212
|
+
'service.name': config.serviceName,
|
|
213
|
+
...(config.serviceVersion !== '' ? { 'service.version': config.serviceVersion } : {}),
|
|
214
|
+
...(config.environment !== '' ? { 'deployment.environment.name': config.environment } : {}),
|
|
215
|
+
}));
|
|
216
|
+
const sampling = new processor_js_1.CallSiteSampling(config.callsiteSample, config.sampleRatio);
|
|
217
|
+
const callSites = new processor_js_1.CallSiteProcessor({ sampling, depth: config.callsiteDepth, statement: config.statement });
|
|
218
|
+
const spanProcessors = [callSites, ...(options.spanProcessors ?? [exportingProcessor(config, options)])];
|
|
219
|
+
const provider = new sdk_trace_node_1.NodeTracerProvider({ resource, spanProcessors, spanLimits: exports.spanLimits, sampler: options.sampler ?? new sampler_js_1.RootcatSampler(config.sampleRatio) });
|
|
220
|
+
provider.register();
|
|
221
|
+
// A capture from the processor starts below the SDK's startSpan, where
|
|
222
|
+
// the instrumentation that called it is.
|
|
223
|
+
callSites.above = Object.getPrototypeOf(provider.getTracer('@rootcat/node')).startSpan;
|
|
224
|
+
const esmHook = options.esmHook === false
|
|
225
|
+
? 'off'
|
|
226
|
+
: (0, esmhook_js_1.registerESMHook)((reason) => {
|
|
227
|
+
if (config.debug) {
|
|
228
|
+
process.stderr.write(`rootcat: ES module hook: ${reason.slice(0, 300)}\n`);
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
const instrumentations = options.instrumentations ?? curatedInstrumentations(config, sampling);
|
|
232
|
+
(0, instrumentation_1.registerInstrumentations)({ tracerProvider: provider, instrumentations });
|
|
233
|
+
const shutdown = () => provider.shutdown().catch(() => undefined);
|
|
234
|
+
if (options.hooks !== false) {
|
|
235
|
+
installHooks(provider);
|
|
236
|
+
}
|
|
237
|
+
if (config.debug) {
|
|
238
|
+
process.stderr.write(`rootcat: tracing ${config.serviceName} to ${config.url} (traces ${config.sampleRatio}, call sites 1 in ${config.callsiteSample}; ES module hook ${esmHook})\n`);
|
|
239
|
+
}
|
|
240
|
+
return { config, provider, callSites, esmHook, instrumentations, shutdown };
|
|
241
|
+
}
|
|
242
|
+
/** otlpExporter builds the package's OTLP/HTTP protobuf exporter (see otlp.ts). */
|
|
243
|
+
function otlpExporter(url) {
|
|
244
|
+
return new otlp_js_1.ProtobufExporter({ url, timeoutMillis: exports.exporterTimeoutMillis, concurrency: exports.exporterConcurrency });
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* QuietLogger keeps the SDK silent except for one line when the span
|
|
248
|
+
* queue overflowed, so an operator learns that spans were dropped
|
|
249
|
+
* without the exporter's errors ever reaching the application's logs.
|
|
250
|
+
*/
|
|
251
|
+
class QuietLogger {
|
|
252
|
+
error() { }
|
|
253
|
+
warn(message) {
|
|
254
|
+
if (/maxQueueSize/.test(message)) {
|
|
255
|
+
(0, notices_js_1.sayOnce)('queue-full', 'spans were dropped: the queue was full (the intake is slow or down)');
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
info() { }
|
|
259
|
+
debug() { }
|
|
260
|
+
verbose() { }
|
|
261
|
+
}
|
|
262
|
+
function exportingProcessor(config, options) {
|
|
263
|
+
const exporter = options.exporter ?? otlpExporter(config.url);
|
|
264
|
+
return new sdk_trace_base_1.BatchSpanProcessor(exporter, {
|
|
265
|
+
maxQueueSize: exports.batchMaxQueueSize,
|
|
266
|
+
maxExportBatchSize: exports.batchMaxExportSize,
|
|
267
|
+
scheduledDelayMillis: exports.batchDelayMillis,
|
|
268
|
+
exportTimeoutMillis: exports.exporterTimeoutMillis,
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* installHooks flushes pending spans when the event loop drains and, when
|
|
273
|
+
* the process is the only listener for SIGTERM or SIGINT, flushes within
|
|
274
|
+
* signalFlushMillis and then re-raises the signal with its default
|
|
275
|
+
* disposition. An application with its own signal handlers keeps them;
|
|
276
|
+
* the flush then runs beside them, bounded, without delaying exit. A
|
|
277
|
+
* process.exit() call ends the process before any flush can run: the
|
|
278
|
+
* spans of its last batch interval are lost.
|
|
279
|
+
*/
|
|
280
|
+
function installHooks(provider) {
|
|
281
|
+
process.once('beforeExit', () => {
|
|
282
|
+
provider.forceFlush().catch(() => undefined);
|
|
283
|
+
});
|
|
284
|
+
for (const signal of ['SIGTERM', 'SIGINT']) {
|
|
285
|
+
const listener = () => {
|
|
286
|
+
const flush = Promise.race([provider.forceFlush(), delay(exports.signalFlushMillis)]).catch(() => undefined);
|
|
287
|
+
const others = process.listeners(signal).filter((l) => l !== listener);
|
|
288
|
+
if (others.length > 0) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
flush.finally(() => {
|
|
292
|
+
process.removeListener(signal, listener);
|
|
293
|
+
process.kill(process.pid, signal);
|
|
294
|
+
});
|
|
295
|
+
};
|
|
296
|
+
process.on(signal, listener);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function delay(ms) {
|
|
300
|
+
return new Promise((resolve) => {
|
|
301
|
+
const timer = setTimeout(resolve, ms);
|
|
302
|
+
timer.unref();
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
//# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgGA,wCAGC;AAMD,0DAsCC;AAOD,sDAWC;AAOD,0BAEC;AAOD,sBAaC;AAuDD,oCAEC;AAvPD,2EAA2E;AAC3E,+DAA+D;AAC/D,wEAAwE;AACxE,wEAAwE;AACxE,yEAAyE;AACzE,qCAAqC;AACrC,4CAAwH;AACxH,oEAAgG;AAChG,8EAA0E;AAC1E,oFAAgF;AAChF,oFAAgF;AAChF,kFAA8E;AAC9E,gFAA4E;AAC5E,kFAA8E;AAC9E,wDAAmF;AACnF,kEAAwH;AACxH,kEAAmE;AACnE,6CAA4C;AAC5C,gDAAkC;AAClC,2CAAsD;AACtD,6CAA2D;AAC3D,6CAA6D;AAC7D,2CAA6C;AAC7C,6CAAuC;AACvC,uC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,CAAU,EAAE,CAAC;QACpD,MAAM,QAAQ,GAAG,GAAG,EAAE;YACpB,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,KAAK,CAAC,yBAAiB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YACrG,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC;YACvE,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACtB,OAAO;YACT,CAAC;YACD,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;gBACjB,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;gBACzC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YACpC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QACF,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC/B,CAAC;AACH,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACtC,KAAK,CAAC,KAAK,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,67 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rootcat/node",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Zero-code OpenTelemetry tracing for Node services that report to the Rootcat host agent, with the line of application code behind every database and HTTP client span.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/kelvinguchu/rootcat.git",
|
|
9
|
+
"directory": "packages/node"
|
|
10
|
+
},
|
|
11
|
+
"main": "./dist/register.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/register.js"
|
|
17
|
+
},
|
|
18
|
+
"./esm": "./dist/esm.mjs",
|
|
19
|
+
"./sdk": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"default": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./package.json": "./package.json"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"README.md",
|
|
28
|
+
"LICENSE"
|
|
29
|
+
],
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=18.19.0"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc -p tsconfig.json && node scripts/copy-esm.mjs",
|
|
35
|
+
"build:fixtures": "tsc -p test/fixtures/ts/tsconfig.json && tsc -p test/fixtures/ts-inline/tsconfig.json",
|
|
36
|
+
"prepack": "npm run build",
|
|
37
|
+
"setup:next": "node scripts/setup-next.mjs",
|
|
38
|
+
"pretest": "npm run build && npm run build:fixtures",
|
|
39
|
+
"test": "node --test --test-concurrency=1 test/*.test.mts",
|
|
40
|
+
"bench": "node --test test/bench.test.mts",
|
|
41
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@jridgewell/trace-mapping": "0.3.31",
|
|
45
|
+
"@opentelemetry/api": "1.9.1",
|
|
46
|
+
"@opentelemetry/core": "2.12.0",
|
|
47
|
+
"@opentelemetry/instrumentation": "0.223.0",
|
|
48
|
+
"@opentelemetry/instrumentation-http": "0.223.0",
|
|
49
|
+
"@opentelemetry/instrumentation-ioredis": "0.71.0",
|
|
50
|
+
"@opentelemetry/instrumentation-mongodb": "0.76.0",
|
|
51
|
+
"@opentelemetry/instrumentation-mysql2": "0.69.0",
|
|
52
|
+
"@opentelemetry/instrumentation-redis": "0.71.0",
|
|
53
|
+
"@opentelemetry/instrumentation-undici": "0.33.0",
|
|
54
|
+
"@opentelemetry/resources": "2.12.0",
|
|
55
|
+
"@opentelemetry/sdk-trace-base": "2.12.0",
|
|
56
|
+
"@opentelemetry/sdk-trace-node": "2.12.0"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@opentelemetry/otlp-transformer": "0.223.0",
|
|
60
|
+
"@types/node": "24.10.1",
|
|
61
|
+
"@types/pg": "8.15.6",
|
|
62
|
+
"drizzle-orm": "0.45.2",
|
|
63
|
+
"pg": "8.23.1",
|
|
64
|
+
"postgres": "3.4.9",
|
|
65
|
+
"typescript": "5.9.3"
|
|
66
|
+
}
|
|
67
|
+
}
|