memorylens 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/README.md +79 -0
- package/dist/index-BZqWj0_R.d.mts +6 -0
- package/dist/index-BZqWj0_R.d.ts +6 -0
- package/dist/index.d.mts +171 -0
- package/dist/index.d.ts +171 -0
- package/dist/index.js +492 -0
- package/dist/index.mjs +447 -0
- package/dist/integrations/langchain/index.d.mts +9 -0
- package/dist/integrations/langchain/index.d.ts +9 -0
- package/dist/integrations/langchain/index.js +257 -0
- package/dist/integrations/langchain/index.mjs +237 -0
- package/package.json +46 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
BatchSpanProcessor: () => BatchSpanProcessor,
|
|
24
|
+
ConsoleExporter: () => ConsoleExporter,
|
|
25
|
+
ExportResult: () => ExportResult,
|
|
26
|
+
MutableSpan: () => MutableSpan,
|
|
27
|
+
OTLPExporter: () => OTLPExporter,
|
|
28
|
+
Sampler: () => Sampler,
|
|
29
|
+
SimpleSpanProcessor: () => SimpleSpanProcessor,
|
|
30
|
+
Tracer: () => Tracer,
|
|
31
|
+
TracerProvider: () => TracerProvider,
|
|
32
|
+
context: () => context,
|
|
33
|
+
getCurrentContext: () => getCurrentContext,
|
|
34
|
+
getTracer: () => getTracer,
|
|
35
|
+
init: () => init,
|
|
36
|
+
instrumentCompress: () => instrumentCompress,
|
|
37
|
+
instrumentRead: () => instrumentRead,
|
|
38
|
+
instrumentUpdate: () => instrumentUpdate,
|
|
39
|
+
instrumentWrite: () => instrumentWrite,
|
|
40
|
+
runWithContext: () => runWithContext,
|
|
41
|
+
shutdown: () => shutdown
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(index_exports);
|
|
44
|
+
|
|
45
|
+
// src/types.ts
|
|
46
|
+
var ExportResult = /* @__PURE__ */ ((ExportResult2) => {
|
|
47
|
+
ExportResult2[ExportResult2["SUCCESS"] = 0] = "SUCCESS";
|
|
48
|
+
ExportResult2[ExportResult2["FAILURE"] = 1] = "FAILURE";
|
|
49
|
+
return ExportResult2;
|
|
50
|
+
})(ExportResult || {});
|
|
51
|
+
|
|
52
|
+
// src/context.ts
|
|
53
|
+
var import_node_async_hooks = require("async_hooks");
|
|
54
|
+
var contextStorage = new import_node_async_hooks.AsyncLocalStorage();
|
|
55
|
+
function runWithContext(ctx, fn) {
|
|
56
|
+
return contextStorage.run(ctx, fn);
|
|
57
|
+
}
|
|
58
|
+
function getCurrentContext() {
|
|
59
|
+
return contextStorage.getStore();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// src/tracer.ts
|
|
63
|
+
var import_node_crypto = require("crypto");
|
|
64
|
+
|
|
65
|
+
// src/sampler.ts
|
|
66
|
+
var Sampler = class {
|
|
67
|
+
rate;
|
|
68
|
+
constructor(rate = 1) {
|
|
69
|
+
if (rate < 0 || rate > 1) {
|
|
70
|
+
throw new Error(`Sample rate must be between 0.0 and 1.0, got ${rate}`);
|
|
71
|
+
}
|
|
72
|
+
this.rate = rate;
|
|
73
|
+
}
|
|
74
|
+
shouldSample() {
|
|
75
|
+
if (this.rate === 1) return true;
|
|
76
|
+
if (this.rate === 0) return false;
|
|
77
|
+
return Math.random() < this.rate;
|
|
78
|
+
}
|
|
79
|
+
getRate() {
|
|
80
|
+
return this.rate;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// src/tracer.ts
|
|
85
|
+
var MutableSpan = class {
|
|
86
|
+
traceId;
|
|
87
|
+
spanId;
|
|
88
|
+
operation;
|
|
89
|
+
parentSpanId;
|
|
90
|
+
status = "ok";
|
|
91
|
+
startTime;
|
|
92
|
+
endTime = 0;
|
|
93
|
+
agentId;
|
|
94
|
+
sessionId;
|
|
95
|
+
userId;
|
|
96
|
+
inputContent = null;
|
|
97
|
+
outputContent = null;
|
|
98
|
+
attributes;
|
|
99
|
+
constructor(options) {
|
|
100
|
+
this.traceId = (0, import_node_crypto.randomUUID)().replace(/-/g, "");
|
|
101
|
+
this.spanId = (0, import_node_crypto.randomUUID)().replace(/-/g, "").substring(0, 16);
|
|
102
|
+
this.operation = options.operation;
|
|
103
|
+
this.parentSpanId = options.parentSpanId ?? null;
|
|
104
|
+
const ctx = getCurrentContext();
|
|
105
|
+
this.agentId = options.agentId !== void 0 ? options.agentId : ctx?.agentId ?? null;
|
|
106
|
+
this.sessionId = options.sessionId !== void 0 ? options.sessionId : ctx?.sessionId ?? null;
|
|
107
|
+
this.userId = options.userId !== void 0 ? options.userId : ctx?.userId ?? null;
|
|
108
|
+
this.attributes = { ...options.attributes };
|
|
109
|
+
this.startTime = Date.now();
|
|
110
|
+
}
|
|
111
|
+
setAttribute(key, value) {
|
|
112
|
+
this.attributes[key] = value;
|
|
113
|
+
}
|
|
114
|
+
setContent(input, output) {
|
|
115
|
+
if (input !== void 0) this.inputContent = input;
|
|
116
|
+
if (output !== void 0) this.outputContent = output;
|
|
117
|
+
}
|
|
118
|
+
setStatus(status) {
|
|
119
|
+
this.status = status;
|
|
120
|
+
}
|
|
121
|
+
setError(error) {
|
|
122
|
+
this.status = "error";
|
|
123
|
+
if (error instanceof Error) {
|
|
124
|
+
this.attributes["error.type"] = error.constructor.name;
|
|
125
|
+
this.attributes["error.message"] = error.message;
|
|
126
|
+
} else {
|
|
127
|
+
this.attributes["error.type"] = "Error";
|
|
128
|
+
this.attributes["error.message"] = String(error);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
end() {
|
|
132
|
+
this.endTime = Date.now();
|
|
133
|
+
return {
|
|
134
|
+
spanId: this.spanId,
|
|
135
|
+
traceId: this.traceId,
|
|
136
|
+
parentSpanId: this.parentSpanId,
|
|
137
|
+
operation: this.operation,
|
|
138
|
+
status: this.status,
|
|
139
|
+
startTime: this.startTime,
|
|
140
|
+
endTime: this.endTime,
|
|
141
|
+
durationMs: this.endTime - this.startTime,
|
|
142
|
+
agentId: this.agentId,
|
|
143
|
+
sessionId: this.sessionId,
|
|
144
|
+
userId: this.userId,
|
|
145
|
+
inputContent: this.inputContent,
|
|
146
|
+
outputContent: this.outputContent,
|
|
147
|
+
attributes: { ...this.attributes }
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
var Tracer = class {
|
|
152
|
+
name;
|
|
153
|
+
provider;
|
|
154
|
+
constructor(name, provider) {
|
|
155
|
+
this.name = name;
|
|
156
|
+
this.provider = provider;
|
|
157
|
+
}
|
|
158
|
+
getName() {
|
|
159
|
+
return this.name;
|
|
160
|
+
}
|
|
161
|
+
startSpan(operation, attributes) {
|
|
162
|
+
const ctx = getCurrentContext();
|
|
163
|
+
return new MutableSpan({
|
|
164
|
+
operation,
|
|
165
|
+
agentId: ctx?.agentId ?? null,
|
|
166
|
+
sessionId: ctx?.sessionId ?? null,
|
|
167
|
+
userId: ctx?.userId ?? null,
|
|
168
|
+
attributes
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
endSpan(span) {
|
|
172
|
+
const finished = span.end();
|
|
173
|
+
for (const processor of this.provider.processors) {
|
|
174
|
+
processor.onEnd(finished);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
var TracerProvider = class _TracerProvider {
|
|
179
|
+
static instance = null;
|
|
180
|
+
processors = [];
|
|
181
|
+
sampler = new Sampler(1);
|
|
182
|
+
serviceName = "memorylens";
|
|
183
|
+
static get() {
|
|
184
|
+
if (!_TracerProvider.instance) {
|
|
185
|
+
_TracerProvider.instance = new _TracerProvider();
|
|
186
|
+
}
|
|
187
|
+
return _TracerProvider.instance;
|
|
188
|
+
}
|
|
189
|
+
static reset() {
|
|
190
|
+
if (_TracerProvider.instance) {
|
|
191
|
+
for (const p of _TracerProvider.instance.processors) {
|
|
192
|
+
p.shutdown().catch(() => {
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
_TracerProvider.instance = null;
|
|
197
|
+
}
|
|
198
|
+
addProcessor(processor) {
|
|
199
|
+
this.processors.push(processor);
|
|
200
|
+
}
|
|
201
|
+
getTracer(name) {
|
|
202
|
+
return new Tracer(name, this);
|
|
203
|
+
}
|
|
204
|
+
async shutdown() {
|
|
205
|
+
for (const p of this.processors) {
|
|
206
|
+
await p.shutdown();
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
// src/processor.ts
|
|
212
|
+
var SimpleSpanProcessor = class {
|
|
213
|
+
exporter;
|
|
214
|
+
constructor(exporter) {
|
|
215
|
+
this.exporter = exporter;
|
|
216
|
+
}
|
|
217
|
+
onStart(_span) {
|
|
218
|
+
}
|
|
219
|
+
onEnd(span) {
|
|
220
|
+
this.exporter.export([span]);
|
|
221
|
+
}
|
|
222
|
+
async shutdown() {
|
|
223
|
+
await this.exporter.shutdown();
|
|
224
|
+
}
|
|
225
|
+
async forceFlush(_timeoutMs) {
|
|
226
|
+
return true;
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
var BatchSpanProcessor = class {
|
|
230
|
+
exporter;
|
|
231
|
+
queue = [];
|
|
232
|
+
maxBatchSize;
|
|
233
|
+
scheduleDelayMs;
|
|
234
|
+
maxQueueSize;
|
|
235
|
+
timer = null;
|
|
236
|
+
isShutdown = false;
|
|
237
|
+
constructor(exporter, options) {
|
|
238
|
+
this.exporter = exporter;
|
|
239
|
+
this.maxBatchSize = options?.maxBatchSize ?? 512;
|
|
240
|
+
this.scheduleDelayMs = options?.scheduleDelayMs ?? 5e3;
|
|
241
|
+
this.maxQueueSize = options?.maxQueueSize ?? 2048;
|
|
242
|
+
this.scheduleFlush();
|
|
243
|
+
}
|
|
244
|
+
onStart(_span) {
|
|
245
|
+
}
|
|
246
|
+
onEnd(span) {
|
|
247
|
+
if (this.isShutdown) return;
|
|
248
|
+
if (this.queue.length < this.maxQueueSize) {
|
|
249
|
+
this.queue.push(span);
|
|
250
|
+
}
|
|
251
|
+
if (this.queue.length >= this.maxBatchSize) {
|
|
252
|
+
this.flush();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
async shutdown() {
|
|
256
|
+
this.isShutdown = true;
|
|
257
|
+
if (this.timer) clearTimeout(this.timer);
|
|
258
|
+
await this.flush();
|
|
259
|
+
await this.exporter.shutdown();
|
|
260
|
+
}
|
|
261
|
+
async forceFlush(_timeoutMs) {
|
|
262
|
+
await this.flush();
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
async flush() {
|
|
266
|
+
if (this.queue.length === 0) return;
|
|
267
|
+
const batch = this.queue.splice(0, this.maxBatchSize);
|
|
268
|
+
await this.exporter.export(batch);
|
|
269
|
+
}
|
|
270
|
+
scheduleFlush() {
|
|
271
|
+
this.timer = setTimeout(async () => {
|
|
272
|
+
await this.flush();
|
|
273
|
+
if (!this.isShutdown) this.scheduleFlush();
|
|
274
|
+
}, this.scheduleDelayMs);
|
|
275
|
+
if (this.timer && typeof this.timer === "object" && "unref" in this.timer) {
|
|
276
|
+
this.timer.unref();
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
// src/exporters/console.ts
|
|
282
|
+
var ConsoleExporter = class {
|
|
283
|
+
async export(spans) {
|
|
284
|
+
for (const span of spans) {
|
|
285
|
+
console.log(
|
|
286
|
+
JSON.stringify(
|
|
287
|
+
{
|
|
288
|
+
spanId: span.spanId,
|
|
289
|
+
traceId: span.traceId,
|
|
290
|
+
parentSpanId: span.parentSpanId,
|
|
291
|
+
operation: span.operation,
|
|
292
|
+
status: span.status,
|
|
293
|
+
startTime: span.startTime,
|
|
294
|
+
endTime: span.endTime,
|
|
295
|
+
durationMs: span.durationMs,
|
|
296
|
+
agentId: span.agentId,
|
|
297
|
+
sessionId: span.sessionId,
|
|
298
|
+
userId: span.userId,
|
|
299
|
+
inputContent: span.inputContent,
|
|
300
|
+
outputContent: span.outputContent,
|
|
301
|
+
attributes: span.attributes
|
|
302
|
+
},
|
|
303
|
+
null,
|
|
304
|
+
2
|
|
305
|
+
)
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
return 0 /* SUCCESS */;
|
|
309
|
+
}
|
|
310
|
+
async shutdown() {
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
// src/exporters/otlp.ts
|
|
315
|
+
var OTLPExporter = class {
|
|
316
|
+
endpoint;
|
|
317
|
+
constructor(options) {
|
|
318
|
+
this.endpoint = options?.endpoint ?? process.env["OTEL_EXPORTER_OTLP_ENDPOINT"] ?? "http://localhost:8000/v1/traces";
|
|
319
|
+
}
|
|
320
|
+
async export(spans) {
|
|
321
|
+
if (spans.length === 0) return 0 /* SUCCESS */;
|
|
322
|
+
const body = this.buildOTLPPayload(spans);
|
|
323
|
+
try {
|
|
324
|
+
const response = await fetch(this.endpoint, {
|
|
325
|
+
method: "POST",
|
|
326
|
+
headers: { "Content-Type": "application/json" },
|
|
327
|
+
body: JSON.stringify(body)
|
|
328
|
+
});
|
|
329
|
+
if (!response.ok) {
|
|
330
|
+
return 1 /* FAILURE */;
|
|
331
|
+
}
|
|
332
|
+
return 0 /* SUCCESS */;
|
|
333
|
+
} catch {
|
|
334
|
+
return 1 /* FAILURE */;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
async shutdown() {
|
|
338
|
+
}
|
|
339
|
+
buildOTLPPayload(spans) {
|
|
340
|
+
return {
|
|
341
|
+
resourceSpans: [
|
|
342
|
+
{
|
|
343
|
+
resource: {
|
|
344
|
+
attributes: [
|
|
345
|
+
{
|
|
346
|
+
key: "service.name",
|
|
347
|
+
value: {
|
|
348
|
+
stringValue: process.env["OTEL_SERVICE_NAME"] ?? "memorylens"
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
]
|
|
352
|
+
},
|
|
353
|
+
scopeSpans: [
|
|
354
|
+
{
|
|
355
|
+
scope: { name: "memorylens", version: "0.1.0" },
|
|
356
|
+
spans: spans.map((span) => this.spanToOTLP(span))
|
|
357
|
+
}
|
|
358
|
+
]
|
|
359
|
+
}
|
|
360
|
+
]
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
spanToOTLP(span) {
|
|
364
|
+
const startTimeUnixNano = String(span.startTime * 1e6);
|
|
365
|
+
const endTimeUnixNano = String(span.endTime * 1e6);
|
|
366
|
+
const attributes = [{ key: "memory.operation", value: { stringValue: span.operation } }];
|
|
367
|
+
if (span.agentId) attributes.push({ key: "agent.id", value: { stringValue: span.agentId } });
|
|
368
|
+
if (span.sessionId)
|
|
369
|
+
attributes.push({ key: "session.id", value: { stringValue: span.sessionId } });
|
|
370
|
+
if (span.userId) attributes.push({ key: "user.id", value: { stringValue: span.userId } });
|
|
371
|
+
if (span.inputContent)
|
|
372
|
+
attributes.push({ key: "memory.input", value: { stringValue: span.inputContent } });
|
|
373
|
+
if (span.outputContent)
|
|
374
|
+
attributes.push({ key: "memory.output", value: { stringValue: span.outputContent } });
|
|
375
|
+
for (const [key, val] of Object.entries(span.attributes)) {
|
|
376
|
+
attributes.push({ key, value: { stringValue: String(val) } });
|
|
377
|
+
}
|
|
378
|
+
return {
|
|
379
|
+
traceId: span.traceId,
|
|
380
|
+
spanId: span.spanId,
|
|
381
|
+
parentSpanId: span.parentSpanId ?? void 0,
|
|
382
|
+
name: span.operation,
|
|
383
|
+
kind: 1,
|
|
384
|
+
// SPAN_KIND_INTERNAL
|
|
385
|
+
startTimeUnixNano,
|
|
386
|
+
endTimeUnixNano,
|
|
387
|
+
attributes,
|
|
388
|
+
status: {
|
|
389
|
+
code: span.status === "ok" ? 1 : span.status === "error" ? 2 : 0
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
// src/wrappers.ts
|
|
396
|
+
function createWrapper(operation, fn, options = {}) {
|
|
397
|
+
const { captureContent = true, ...extraAttrs } = options;
|
|
398
|
+
const attributes = { ...extraAttrs };
|
|
399
|
+
return async (...args) => {
|
|
400
|
+
const provider = TracerProvider.get();
|
|
401
|
+
if (!provider.sampler.shouldSample()) {
|
|
402
|
+
return fn(...args);
|
|
403
|
+
}
|
|
404
|
+
const tracer = provider.getTracer("memorylens.wrappers");
|
|
405
|
+
const span = tracer.startSpan(operation, attributes);
|
|
406
|
+
if (captureContent && args.length > 0) {
|
|
407
|
+
const firstArg = args[0];
|
|
408
|
+
if (typeof firstArg === "string") {
|
|
409
|
+
span.setContent(firstArg, void 0);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
try {
|
|
413
|
+
const result = await fn(...args);
|
|
414
|
+
span.setStatus("ok");
|
|
415
|
+
if (captureContent && result !== void 0) {
|
|
416
|
+
if (typeof result === "string") {
|
|
417
|
+
span.setContent(void 0, result);
|
|
418
|
+
} else if (result !== null && typeof result === "object") {
|
|
419
|
+
span.setContent(void 0, JSON.stringify(result));
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
tracer.endSpan(span);
|
|
423
|
+
return result;
|
|
424
|
+
} catch (error) {
|
|
425
|
+
span.setError(error);
|
|
426
|
+
tracer.endSpan(span);
|
|
427
|
+
throw error;
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
function instrumentWrite(fn, options) {
|
|
432
|
+
return createWrapper("memory.write", fn, options);
|
|
433
|
+
}
|
|
434
|
+
function instrumentRead(fn, options) {
|
|
435
|
+
return createWrapper("memory.read", fn, options);
|
|
436
|
+
}
|
|
437
|
+
function instrumentCompress(fn, options) {
|
|
438
|
+
return createWrapper("memory.compress", fn, options);
|
|
439
|
+
}
|
|
440
|
+
function instrumentUpdate(fn, options) {
|
|
441
|
+
return createWrapper("memory.update", fn, options);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
// src/index.ts
|
|
445
|
+
function init(options = {}) {
|
|
446
|
+
const {
|
|
447
|
+
serviceName = process.env["OTEL_SERVICE_NAME"] ?? "memorylens",
|
|
448
|
+
exporter: exporterType = process.env["MEMORYLENS_EXPORTER"] ?? "otlp",
|
|
449
|
+
endpoint,
|
|
450
|
+
sampleRate = parseFloat(process.env["MEMORYLENS_SAMPLE_RATE"] ?? "1.0"),
|
|
451
|
+
batch = true
|
|
452
|
+
} = options;
|
|
453
|
+
const provider = TracerProvider.get();
|
|
454
|
+
provider.serviceName = serviceName;
|
|
455
|
+
provider.sampler = new Sampler(sampleRate);
|
|
456
|
+
const exp = exporterType === "console" ? new ConsoleExporter() : new OTLPExporter({ endpoint });
|
|
457
|
+
const processor = batch ? new BatchSpanProcessor(exp) : new SimpleSpanProcessor(exp);
|
|
458
|
+
provider.addProcessor(processor);
|
|
459
|
+
}
|
|
460
|
+
async function shutdown() {
|
|
461
|
+
const provider = TracerProvider.get();
|
|
462
|
+
await provider.shutdown();
|
|
463
|
+
TracerProvider.reset();
|
|
464
|
+
}
|
|
465
|
+
async function context(ctx, fn) {
|
|
466
|
+
return runWithContext(ctx, fn);
|
|
467
|
+
}
|
|
468
|
+
function getTracer(name) {
|
|
469
|
+
return TracerProvider.get().getTracer(name);
|
|
470
|
+
}
|
|
471
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
472
|
+
0 && (module.exports = {
|
|
473
|
+
BatchSpanProcessor,
|
|
474
|
+
ConsoleExporter,
|
|
475
|
+
ExportResult,
|
|
476
|
+
MutableSpan,
|
|
477
|
+
OTLPExporter,
|
|
478
|
+
Sampler,
|
|
479
|
+
SimpleSpanProcessor,
|
|
480
|
+
Tracer,
|
|
481
|
+
TracerProvider,
|
|
482
|
+
context,
|
|
483
|
+
getCurrentContext,
|
|
484
|
+
getTracer,
|
|
485
|
+
init,
|
|
486
|
+
instrumentCompress,
|
|
487
|
+
instrumentRead,
|
|
488
|
+
instrumentUpdate,
|
|
489
|
+
instrumentWrite,
|
|
490
|
+
runWithContext,
|
|
491
|
+
shutdown
|
|
492
|
+
});
|