@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
package/dist/otlp.d.ts ADDED
@@ -0,0 +1,75 @@
1
+ import type { HrTime } from '@opentelemetry/api';
2
+ import { type ExportResult } from '@opentelemetry/core';
3
+ import type { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';
4
+ /** Writer appends protobuf fields to a growing buffer. */
5
+ export declare class Writer {
6
+ buf: Buffer;
7
+ pos: number;
8
+ constructor(size?: number);
9
+ private ensure;
10
+ varint(value: number): void;
11
+ tag(field: number, type: number): void;
12
+ /** begin opens a length-delimited field and returns where its length goes. */
13
+ begin(field: number): number;
14
+ /** end closes the field begin opened, widening its length when needed. */
15
+ end(at: number): void;
16
+ string(field: number, value: string): void;
17
+ bytesHex(field: number, hex: string): void;
18
+ fixed64Time(field: number, time: HrTime): void;
19
+ double(field: number, value: number): void;
20
+ int64(field: number, value: number): void;
21
+ /** finish returns the bytes written (a view of the buffer). */
22
+ finish(): Buffer;
23
+ }
24
+ /**
25
+ * encodeTraces writes one ExportTraceServiceRequest for spans that share a
26
+ * resource (the SDK's one resource), grouped by instrumentation scope.
27
+ */
28
+ export declare function encodeTraces(spans: readonly ReadableSpan[], w?: Writer): Buffer;
29
+ /**
30
+ * maxRequestBytes keeps every request under the agent's 1 MiB intake
31
+ * bound, with room for the transport's own framing.
32
+ */
33
+ export declare const maxRequestBytes: number;
34
+ /**
35
+ * encodeWithin encodes spans into requests of at most limit bytes,
36
+ * halving a batch until each part fits. A single span that does not fit
37
+ * on its own (which the span limits make all but impossible) is dropped,
38
+ * and counted in dropped.
39
+ */
40
+ export declare function encodeWithin(spans: readonly ReadableSpan[], limit?: number): {
41
+ bodies: Buffer[];
42
+ dropped: number;
43
+ };
44
+ /** ProtobufExporterOptions bounds the exporter. */
45
+ export interface ProtobufExporterOptions {
46
+ url: string;
47
+ timeoutMillis: number;
48
+ /** concurrency is how many exports may be in flight; past it a batch is dropped. */
49
+ concurrency: number;
50
+ /** maxRequestBytes bounds one request (tests lower it). */
51
+ maxRequestBytes?: number;
52
+ }
53
+ /**
54
+ * ProtobufExporter posts encoded batches to the intake, split into
55
+ * requests under maxRequestBytes and sent one after another. A batch that
56
+ * cannot be sent (the intake is down, slow past the timeout, answers an
57
+ * error, or two exports are already in flight) is dropped and reported as
58
+ * failed to the batch processor; nothing is retried. A request the intake
59
+ * refuses as too large (413) is said once on stderr.
60
+ */
61
+ export declare class ProtobufExporter implements SpanExporter {
62
+ private readonly url;
63
+ private readonly agent;
64
+ private readonly timeoutMillis;
65
+ private readonly concurrency;
66
+ private readonly maxRequestBytes;
67
+ private inFlight;
68
+ private stopped;
69
+ constructor(options: ProtobufExporterOptions);
70
+ export(spans: ReadableSpan[], done: (result: ExportResult) => void): void;
71
+ /** post sends one request and settles with its outcome. */
72
+ private post;
73
+ shutdown(): Promise<void>;
74
+ forceFlush(): Promise<void>;
75
+ }
package/dist/otlp.js ADDED
@@ -0,0 +1,449 @@
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.ProtobufExporter = exports.maxRequestBytes = exports.Writer = void 0;
37
+ exports.encodeTraces = encodeTraces;
38
+ exports.encodeWithin = encodeWithin;
39
+ // The exporter: OTLP/HTTP protobuf to the host agent, encoded here. The
40
+ // upstream exporter builds an intermediate object tree per span and then
41
+ // encodes it with a general protobuf library (about 13 µs per span on the
42
+ // benchmark machine); this writes the same ExportTraceServiceRequest
43
+ // straight from the SDK's ended spans into one buffer. Only the fields the
44
+ // agent reads and the SDK fills are written: resource and scope identity,
45
+ // ids, name, kind, times, attributes, events and status; links are not
46
+ // sent. Nested messages are written with a one-byte length placeholder
47
+ // that is widened in place when the message turns out longer.
48
+ //
49
+ // Field numbers are those of opentelemetry/proto/trace/v1/trace.proto,
50
+ // common/v1/common.proto and collector/trace/v1/trace_service.proto.
51
+ const http = __importStar(require("node:http"));
52
+ const https = __importStar(require("node:https"));
53
+ const core_1 = require("@opentelemetry/core");
54
+ const notices_js_1 = require("./notices.js");
55
+ const varintType = 0;
56
+ const fixed64Type = 1;
57
+ const lengthType = 2;
58
+ /** Writer appends protobuf fields to a growing buffer. */
59
+ class Writer {
60
+ buf;
61
+ pos = 0;
62
+ constructor(size = 64 * 1024) {
63
+ this.buf = Buffer.allocUnsafe(size);
64
+ }
65
+ ensure(n) {
66
+ if (this.pos + n <= this.buf.length) {
67
+ return;
68
+ }
69
+ let size = this.buf.length * 2;
70
+ while (size < this.pos + n) {
71
+ size *= 2;
72
+ }
73
+ const next = Buffer.allocUnsafe(size);
74
+ this.buf.copy(next, 0, 0, this.pos);
75
+ this.buf = next;
76
+ }
77
+ varint(value) {
78
+ this.ensure(10);
79
+ let v = value;
80
+ while (v > 0x7f) {
81
+ this.buf[this.pos++] = (v % 128) | 0x80;
82
+ v = Math.floor(v / 128);
83
+ }
84
+ this.buf[this.pos++] = v;
85
+ }
86
+ tag(field, type) {
87
+ this.varint(field * 8 + type);
88
+ }
89
+ /** begin opens a length-delimited field and returns where its length goes. */
90
+ begin(field) {
91
+ this.tag(field, lengthType);
92
+ this.ensure(1);
93
+ const at = this.pos;
94
+ this.pos += 1;
95
+ return at;
96
+ }
97
+ /** end closes the field begin opened, widening its length when needed. */
98
+ end(at) {
99
+ const length = this.pos - at - 1;
100
+ const width = varintWidth(length);
101
+ if (width > 1) {
102
+ this.ensure(width - 1);
103
+ this.buf.copyWithin(at + width, at + 1, this.pos);
104
+ this.pos += width - 1;
105
+ }
106
+ let v = length;
107
+ let p = at;
108
+ while (v > 0x7f) {
109
+ this.buf[p++] = (v % 128) | 0x80;
110
+ v = Math.floor(v / 128);
111
+ }
112
+ this.buf[p] = v;
113
+ }
114
+ string(field, value) {
115
+ const at = this.begin(field);
116
+ this.ensure(value.length * 3);
117
+ this.pos += this.buf.write(value, this.pos, 'utf8');
118
+ this.end(at);
119
+ }
120
+ bytesHex(field, hex) {
121
+ this.tag(field, lengthType);
122
+ const n = hex.length >>> 1;
123
+ this.varint(n);
124
+ this.ensure(n);
125
+ this.pos += this.buf.write(hex, this.pos, 'hex');
126
+ }
127
+ fixed64Time(field, time) {
128
+ this.tag(field, fixed64Type);
129
+ this.ensure(8);
130
+ // nanoseconds since the epoch exceed 2^53: computed exactly
131
+ this.buf.writeBigUInt64LE(BigInt(time[0]) * 1000000000n + BigInt(time[1]), this.pos);
132
+ this.pos += 8;
133
+ }
134
+ double(field, value) {
135
+ this.tag(field, fixed64Type);
136
+ this.ensure(8);
137
+ this.buf.writeDoubleLE(value, this.pos);
138
+ this.pos += 8;
139
+ }
140
+ int64(field, value) {
141
+ this.tag(field, varintType);
142
+ if (value >= 0) {
143
+ this.varint(value);
144
+ return;
145
+ }
146
+ // A negative int64 is its two's complement, ten bytes.
147
+ this.ensure(10);
148
+ let v = BigInt.asUintN(64, BigInt(value));
149
+ while (v > 0x7fn) {
150
+ this.buf[this.pos++] = Number(v & 0x7fn) | 0x80;
151
+ v >>= 7n;
152
+ }
153
+ this.buf[this.pos++] = Number(v);
154
+ }
155
+ /** finish returns the bytes written (a view of the buffer). */
156
+ finish() {
157
+ return this.buf.subarray(0, this.pos);
158
+ }
159
+ }
160
+ exports.Writer = Writer;
161
+ function varintWidth(value) {
162
+ let width = 1;
163
+ let v = value;
164
+ while (v > 0x7f) {
165
+ v = Math.floor(v / 128);
166
+ width++;
167
+ }
168
+ return width;
169
+ }
170
+ /** writeAnyValue writes an AnyValue for an attribute value. */
171
+ function writeAnyValue(w, field, value) {
172
+ const at = w.begin(field);
173
+ if (typeof value === 'string') {
174
+ w.string(1, value);
175
+ }
176
+ else if (typeof value === 'boolean') {
177
+ w.tag(2, varintType);
178
+ w.varint(value ? 1 : 0);
179
+ }
180
+ else if (typeof value === 'number') {
181
+ if (Number.isSafeInteger(value)) {
182
+ w.int64(3, value);
183
+ }
184
+ else {
185
+ w.double(4, value);
186
+ }
187
+ }
188
+ else if (Array.isArray(value)) {
189
+ const array = w.begin(5);
190
+ for (const item of value) {
191
+ if (item !== null && item !== undefined) {
192
+ writeAnyValue(w, 1, item);
193
+ }
194
+ }
195
+ w.end(array);
196
+ }
197
+ w.end(at);
198
+ }
199
+ function writeAttributes(w, field, attributes) {
200
+ for (const key in attributes) {
201
+ const value = attributes[key];
202
+ if (value === undefined || value === null) {
203
+ continue;
204
+ }
205
+ const at = w.begin(field);
206
+ w.string(1, key);
207
+ writeAnyValue(w, 2, value);
208
+ w.end(at);
209
+ }
210
+ }
211
+ function writeSpan(w, span) {
212
+ const at = w.begin(2); // ScopeSpans.spans
213
+ const context = span.spanContext();
214
+ w.bytesHex(1, context.traceId);
215
+ w.bytesHex(2, context.spanId);
216
+ const traceState = context.traceState?.serialize();
217
+ if (traceState) {
218
+ w.string(3, traceState);
219
+ }
220
+ const parent = span.parentSpanContext;
221
+ if (parent && parent.spanId) {
222
+ w.bytesHex(4, parent.spanId);
223
+ }
224
+ w.string(5, span.name);
225
+ w.tag(6, varintType);
226
+ w.varint(span.kind + 1); // the API counts from INTERNAL = 0, OTLP from 1
227
+ w.fixed64Time(7, span.startTime);
228
+ w.fixed64Time(8, span.endTime);
229
+ writeAttributes(w, 9, span.attributes);
230
+ if (span.droppedAttributesCount > 0) {
231
+ w.tag(10, varintType);
232
+ w.varint(span.droppedAttributesCount);
233
+ }
234
+ for (const event of span.events) {
235
+ const e = w.begin(11);
236
+ w.fixed64Time(1, event.time);
237
+ w.string(2, event.name);
238
+ if (event.attributes) {
239
+ writeAttributes(w, 3, event.attributes);
240
+ }
241
+ w.end(e);
242
+ }
243
+ if (span.droppedEventsCount > 0) {
244
+ w.tag(12, varintType);
245
+ w.varint(span.droppedEventsCount);
246
+ }
247
+ if (span.status.code !== 0 || span.status.message) {
248
+ const s = w.begin(15);
249
+ if (span.status.message) {
250
+ w.string(2, span.status.message);
251
+ }
252
+ if (span.status.code !== 0) {
253
+ w.tag(3, varintType);
254
+ w.varint(span.status.code);
255
+ }
256
+ w.end(s);
257
+ }
258
+ w.end(at);
259
+ }
260
+ /**
261
+ * encodeTraces writes one ExportTraceServiceRequest for spans that share a
262
+ * resource (the SDK's one resource), grouped by instrumentation scope.
263
+ */
264
+ function encodeTraces(spans, w = new Writer()) {
265
+ if (spans.length === 0) {
266
+ return Buffer.alloc(0);
267
+ }
268
+ const byScope = new Map();
269
+ for (const span of spans) {
270
+ const scope = span.instrumentationScope;
271
+ const key = scope.name + '\0' + (scope.version ?? '');
272
+ let group = byScope.get(key);
273
+ if (!group) {
274
+ group = { name: scope.name, version: scope.version, spans: [] };
275
+ byScope.set(key, group);
276
+ }
277
+ group.spans.push(span);
278
+ }
279
+ const resourceSpans = w.begin(1);
280
+ const resource = w.begin(1);
281
+ writeAttributes(w, 1, spans[0].resource.attributes);
282
+ w.end(resource);
283
+ for (const group of byScope.values()) {
284
+ const scopeSpans = w.begin(2);
285
+ const scope = w.begin(1);
286
+ w.string(1, group.name);
287
+ if (group.version) {
288
+ w.string(2, group.version);
289
+ }
290
+ w.end(scope);
291
+ for (const span of group.spans) {
292
+ writeSpan(w, span);
293
+ }
294
+ w.end(scopeSpans);
295
+ }
296
+ w.end(resourceSpans);
297
+ return w.finish();
298
+ }
299
+ /**
300
+ * maxRequestBytes keeps every request under the agent's 1 MiB intake
301
+ * bound, with room for the transport's own framing.
302
+ */
303
+ exports.maxRequestBytes = 900 * 1024;
304
+ /**
305
+ * encodeWithin encodes spans into requests of at most limit bytes,
306
+ * halving a batch until each part fits. A single span that does not fit
307
+ * on its own (which the span limits make all but impossible) is dropped,
308
+ * and counted in dropped.
309
+ */
310
+ function encodeWithin(spans, limit = exports.maxRequestBytes) {
311
+ const bodies = [];
312
+ let dropped = 0;
313
+ const pending = [spans];
314
+ while (pending.length > 0) {
315
+ const part = pending.shift();
316
+ if (part.length === 0) {
317
+ continue;
318
+ }
319
+ const body = encodeTraces(part);
320
+ if (body.length <= limit) {
321
+ bodies.push(body);
322
+ continue;
323
+ }
324
+ if (part.length === 1) {
325
+ dropped++;
326
+ continue;
327
+ }
328
+ const half = Math.ceil(part.length / 2);
329
+ pending.unshift(part.slice(0, half), part.slice(half));
330
+ }
331
+ return { bodies, dropped };
332
+ }
333
+ /** maxResponseBytes bounds what is read of the intake's answer. */
334
+ const maxResponseBytes = 64 * 1024;
335
+ /**
336
+ * ProtobufExporter posts encoded batches to the intake, split into
337
+ * requests under maxRequestBytes and sent one after another. A batch that
338
+ * cannot be sent (the intake is down, slow past the timeout, answers an
339
+ * error, or two exports are already in flight) is dropped and reported as
340
+ * failed to the batch processor; nothing is retried. A request the intake
341
+ * refuses as too large (413) is said once on stderr.
342
+ */
343
+ class ProtobufExporter {
344
+ url;
345
+ agent;
346
+ timeoutMillis;
347
+ concurrency;
348
+ maxRequestBytes;
349
+ inFlight = 0;
350
+ stopped = false;
351
+ constructor(options) {
352
+ this.url = new URL(options.url);
353
+ this.timeoutMillis = options.timeoutMillis;
354
+ this.concurrency = options.concurrency;
355
+ this.maxRequestBytes = options.maxRequestBytes ?? exports.maxRequestBytes;
356
+ const Agent = this.url.protocol === 'https:' ? https.Agent : http.Agent;
357
+ this.agent = new Agent({ keepAlive: true, maxSockets: options.concurrency });
358
+ }
359
+ export(spans, done) {
360
+ if (this.stopped || spans.length === 0) {
361
+ done({ code: this.stopped ? core_1.ExportResultCode.FAILED : core_1.ExportResultCode.SUCCESS });
362
+ return;
363
+ }
364
+ if (this.inFlight >= this.concurrency) {
365
+ done({ code: core_1.ExportResultCode.FAILED, error: new Error('too many exports in flight') });
366
+ return;
367
+ }
368
+ let bodies;
369
+ try {
370
+ const encoded = encodeWithin(spans, this.maxRequestBytes);
371
+ bodies = encoded.bodies;
372
+ if (encoded.dropped > 0) {
373
+ (0, notices_js_1.sayOnce)('span-too-large', 'a span larger than the intake accepts was dropped');
374
+ }
375
+ }
376
+ catch (error) {
377
+ done({ code: core_1.ExportResultCode.FAILED, error: error });
378
+ return;
379
+ }
380
+ this.inFlight++;
381
+ const sendAll = async () => {
382
+ for (const body of bodies) {
383
+ await this.post(body);
384
+ }
385
+ };
386
+ sendAll().then(() => {
387
+ this.inFlight--;
388
+ done({ code: core_1.ExportResultCode.SUCCESS });
389
+ }, (error) => {
390
+ this.inFlight--;
391
+ done({ code: core_1.ExportResultCode.FAILED, error });
392
+ });
393
+ }
394
+ /** post sends one request and settles with its outcome. */
395
+ post(body) {
396
+ return new Promise((resolve, reject) => {
397
+ const send = this.url.protocol === 'https:' ? https.request : http.request;
398
+ let settled = false;
399
+ const finish = (error) => {
400
+ if (settled) {
401
+ return;
402
+ }
403
+ settled = true;
404
+ if (error) {
405
+ reject(error);
406
+ }
407
+ else {
408
+ resolve();
409
+ }
410
+ };
411
+ const request = send(this.url, { method: 'POST', agent: this.agent, timeout: this.timeoutMillis, headers: { 'content-type': 'application/x-protobuf', 'content-length': body.length } }, (response) => {
412
+ let read = 0;
413
+ response.on('data', (chunk) => {
414
+ read += chunk.length;
415
+ if (read > maxResponseBytes) {
416
+ response.destroy();
417
+ }
418
+ });
419
+ response.on('end', () => {
420
+ const status = response.statusCode ?? 0;
421
+ if (status === 413) {
422
+ (0, notices_js_1.sayOnce)('intake-413', `the intake refused a request of ${body.length} bytes as too large (HTTP 413); its spans were dropped`);
423
+ }
424
+ finish(status >= 200 && status < 300 ? undefined : new Error(`intake answered ${status}`));
425
+ });
426
+ response.on('error', (error) => finish(error));
427
+ });
428
+ const timer = setTimeout(() => request.destroy(new Error('export timed out')), this.timeoutMillis);
429
+ timer.unref();
430
+ request.on('timeout', () => request.destroy(new Error('export timed out')));
431
+ request.on('error', (error) => finish(error));
432
+ request.on('close', () => {
433
+ clearTimeout(timer);
434
+ finish(new Error('connection closed'));
435
+ });
436
+ request.end(body);
437
+ });
438
+ }
439
+ shutdown() {
440
+ this.stopped = true;
441
+ this.agent.destroy();
442
+ return Promise.resolve();
443
+ }
444
+ forceFlush() {
445
+ return Promise.resolve();
446
+ }
447
+ }
448
+ exports.ProtobufExporter = ProtobufExporter;
449
+ //# sourceMappingURL=otlp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otlp.js","sourceRoot":"","sources":["../src/otlp.ts"],"names":[],"mappings":";;;;;;;;;;;;;;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CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACrB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,UAAU;QACR,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;CACF;AAlHD,4CAkHC"}
package/dist/pg.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { InstrumentationBase, type InstrumentationConfig, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';
2
+ import { type CallSiteSampling } from './processor.js';
3
+ /** PgOptions configures the instrumentation. */
4
+ export interface PgOptions extends InstrumentationConfig {
5
+ /** sampling gates the call-site capture made where the app calls client.query. */
6
+ sampling: CallSiteSampling;
7
+ depth: number;
8
+ isApp?: (file: string) => boolean;
9
+ }
10
+ export declare class PgInstrumentation extends InstrumentationBase<PgOptions> {
11
+ constructor(options: PgOptions);
12
+ protected init(): InstrumentationNodeModuleDefinition;
13
+ private readonly wrapQuery;
14
+ private startQuerySpan;
15
+ private endQuerySpan;
16
+ }