@autter/runtime-node 1.6.0 → 1.7.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 +58 -5
- package/dist/{chunk-ARN26OK6.cjs → chunk-GYTQLITW.cjs} +126 -39
- package/dist/{chunk-UGNPCOIW.cjs → chunk-HKVFURYT.cjs} +11 -11
- package/dist/{chunk-FBKYOHU2.js → chunk-KA4AOZX2.js} +41 -31
- package/dist/{chunk-OY2HTUWY.js → chunk-LG52CW3V.js} +118 -31
- package/dist/{chunk-Y4T7SQMO.js → chunk-QUC6OUE7.js} +1 -1
- package/dist/{chunk-UKYTXZOQ.cjs → chunk-RV4MJNM2.cjs} +65 -55
- package/dist/cli.cjs +8 -8
- package/dist/cli.js +2 -2
- package/dist/index.cjs +465 -295
- package/dist/index.d.cts +15 -2
- package/dist/index.d.ts +15 -2
- package/dist/index.js +284 -114
- package/dist/testing.cjs +8 -8
- package/dist/testing.js +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
var
|
|
48
|
+
var _chunkRV4MJNM2cjs = require('./chunk-RV4MJNM2.cjs');
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
var
|
|
51
|
+
var _chunkHKVFURYTcjs = require('./chunk-HKVFURYT.cjs');
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
|
|
@@ -69,7 +69,8 @@ var _chunkUGNPCOIWcjs = require('./chunk-UGNPCOIW.cjs');
|
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
|
|
73
|
+
var _chunkGYTQLITWcjs = require('./chunk-GYTQLITW.cjs');
|
|
73
74
|
|
|
74
75
|
// src/relay.ts
|
|
75
76
|
var IpWindow = (_class = class {
|
|
@@ -223,7 +224,7 @@ function relayContext(raw, redactor) {
|
|
|
223
224
|
return Array.isArray(bounded) ? {} : { context: redactor(bounded) };
|
|
224
225
|
}
|
|
225
226
|
function relayBreadcrumbs(raw, redactor) {
|
|
226
|
-
const breadcrumbs =
|
|
227
|
+
const breadcrumbs = _chunkRV4MJNM2cjs.sanitizeBreadcrumbs.call(void 0, raw, redactor);
|
|
227
228
|
return breadcrumbs ? { breadcrumbs } : {};
|
|
228
229
|
}
|
|
229
230
|
var DEBUG_ID_RE = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
@@ -240,10 +241,10 @@ function relayDebugIds(raw, redactor) {
|
|
|
240
241
|
return count ? { debugIds } : {};
|
|
241
242
|
}
|
|
242
243
|
function relayFingerprint(raw, redactor) {
|
|
243
|
-
const values =
|
|
244
|
+
const values = _chunkRV4MJNM2cjs.fingerprintValues.call(void 0, raw, redactor.text);
|
|
244
245
|
return values ? { fingerprint: Array.isArray(raw) ? values : values[0] } : {};
|
|
245
246
|
}
|
|
246
|
-
var defaultRelayRedactor =
|
|
247
|
+
var defaultRelayRedactor = _chunkRV4MJNM2cjs.makeRedactor.call(void 0, true);
|
|
247
248
|
function sanitizeBrowserPayload(raw, redactor = defaultRelayRedactor) {
|
|
248
249
|
if (typeof raw !== "object" || raw === null) return null;
|
|
249
250
|
const p = raw;
|
|
@@ -292,7 +293,7 @@ function forward(payload, opts) {
|
|
|
292
293
|
const endpoint = (_nullishCoalesce(opts.endpoint, () => ( DEFAULT_ENDPOINT))).replace(/\/$/, "");
|
|
293
294
|
const url = `${endpoint}/v1/browser`;
|
|
294
295
|
const compat = opts.compatCheck !== false;
|
|
295
|
-
if (compat)
|
|
296
|
+
if (compat) _chunkGYTQLITWcjs.ensureCompatConfigured.call(void 0, endpoint);
|
|
296
297
|
void fetch(url, {
|
|
297
298
|
method: "POST",
|
|
298
299
|
headers: {
|
|
@@ -306,12 +307,12 @@ function forward(payload, opts) {
|
|
|
306
307
|
const types = new Set(
|
|
307
308
|
(_nullishCoalesce(payload.events, () => ( []))).map((e) => String(e.type))
|
|
308
309
|
);
|
|
309
|
-
|
|
310
|
-
for (const feature of
|
|
310
|
+
_chunkGYTQLITWcjs.observeIngesterResponse.call(void 0, { status: response.status, headers: response.headers });
|
|
311
|
+
for (const feature of _chunkGYTQLITWcjs.featuresForBrowserEvents.call(void 0, types)) _chunkGYTQLITWcjs.noteCompatFeature.call(void 0, feature);
|
|
311
312
|
if ((_nullishCoalesce(payload.events, () => ( []))).some((e) => e.traceId)) {
|
|
312
|
-
|
|
313
|
+
_chunkGYTQLITWcjs.noteCompatFeature.call(void 0, "browser_trace_propagation");
|
|
313
314
|
}
|
|
314
|
-
|
|
315
|
+
_chunkGYTQLITWcjs.noteRelayRejection.call(void 0, types, response.status, response.headers);
|
|
315
316
|
}).catch((err) => {
|
|
316
317
|
(_nullishCoalesce(opts.onError, () => ( ((e) => console.warn("autter relay forward failed:", e)))))(
|
|
317
318
|
err
|
|
@@ -320,7 +321,7 @@ function forward(payload, opts) {
|
|
|
320
321
|
}
|
|
321
322
|
function createBrowserRelayFetchHandler(opts) {
|
|
322
323
|
const maxBody = _nullishCoalesce(opts.maxBodyBytes, () => ( DEFAULT_MAX_BODY));
|
|
323
|
-
const redactor = opts.redact === void 0 || opts.redact === true ? defaultRelayRedactor :
|
|
324
|
+
const redactor = opts.redact === void 0 || opts.redact === true ? defaultRelayRedactor : _chunkRV4MJNM2cjs.makeRedactor.call(void 0, opts.redact);
|
|
324
325
|
const limiter = opts.perIpRateLimit === false ? null : new IpWindow(_nullishCoalesce(opts.perIpRateLimit, () => ( 120)));
|
|
325
326
|
return async (request) => {
|
|
326
327
|
if (request.method !== "POST") {
|
|
@@ -367,7 +368,7 @@ function createBrowserRelayFetchHandler(opts) {
|
|
|
367
368
|
}
|
|
368
369
|
function createBrowserRelayHandler(opts) {
|
|
369
370
|
const maxBody = _nullishCoalesce(opts.maxBodyBytes, () => ( DEFAULT_MAX_BODY));
|
|
370
|
-
const redactor = opts.redact === void 0 || opts.redact === true ? defaultRelayRedactor :
|
|
371
|
+
const redactor = opts.redact === void 0 || opts.redact === true ? defaultRelayRedactor : _chunkRV4MJNM2cjs.makeRedactor.call(void 0, opts.redact);
|
|
371
372
|
const limiter = opts.perIpRateLimit === false ? null : new IpWindow(_nullishCoalesce(opts.perIpRateLimit, () => ( 120)));
|
|
372
373
|
function respond(res, status, body) {
|
|
373
374
|
res.statusCode = status;
|
|
@@ -440,6 +441,9 @@ function createBrowserRelayHandler(opts) {
|
|
|
440
441
|
}
|
|
441
442
|
|
|
442
443
|
// src/server.ts
|
|
444
|
+
var _events = require('events');
|
|
445
|
+
var _module = require('module');
|
|
446
|
+
var _path = require('path');
|
|
443
447
|
var _http = require('http');
|
|
444
448
|
var _crypto = require('crypto');
|
|
445
449
|
|
|
@@ -478,6 +482,89 @@ var _semanticconventions = require('@opentelemetry/semantic-conventions');
|
|
|
478
482
|
|
|
479
483
|
|
|
480
484
|
|
|
485
|
+
|
|
486
|
+
// src/url-query.ts
|
|
487
|
+
var URL_KEYS = ["http.target", "http.url", "url.full", "url.original", "url.path"];
|
|
488
|
+
var QUERY_KEY = "url.query";
|
|
489
|
+
var NAME_KEYS = ["next.span_name"];
|
|
490
|
+
var MASK = "[redacted]";
|
|
491
|
+
var SCHEME = /^[a-z][a-z0-9+.-]*:\/\//i;
|
|
492
|
+
function splitUrl(value) {
|
|
493
|
+
const from = SCHEME.test(value) ? value.indexOf("://") + 3 : 0;
|
|
494
|
+
const question = value.indexOf("?", from);
|
|
495
|
+
const hash = value.indexOf("#", from);
|
|
496
|
+
const at = question < 0 ? hash : hash < 0 ? question : Math.min(question, hash);
|
|
497
|
+
if (at < 0) return null;
|
|
498
|
+
const query = at === question ? value.slice(at + 1, hash > at ? hash : void 0) : null;
|
|
499
|
+
return { base: value.slice(0, at), query };
|
|
500
|
+
}
|
|
501
|
+
function decodeName(raw) {
|
|
502
|
+
try {
|
|
503
|
+
return decodeURIComponent(raw.replace(/\+/g, " "));
|
|
504
|
+
} catch (e12) {
|
|
505
|
+
return raw;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
function makeUrlQueryPolicy(keepQueryParams = []) {
|
|
509
|
+
const keep = new Set(keepQueryParams.filter((name) => typeof name === "string"));
|
|
510
|
+
const maskQuery = (query) => {
|
|
511
|
+
const out = [];
|
|
512
|
+
for (const part of query.split("&")) {
|
|
513
|
+
if (!part) continue;
|
|
514
|
+
const eq = part.indexOf("=");
|
|
515
|
+
const name = eq < 0 ? part : part.slice(0, eq);
|
|
516
|
+
if (keep.size && keep.has(decodeName(name))) out.push(part);
|
|
517
|
+
else if (eq < 0) out.push(MASK);
|
|
518
|
+
else out.push(eq === part.length - 1 ? part : `${name}=${MASK}`);
|
|
519
|
+
}
|
|
520
|
+
return out.join("&");
|
|
521
|
+
};
|
|
522
|
+
const stripName = (name) => {
|
|
523
|
+
if (!name.includes("?") && !name.includes("#")) return name;
|
|
524
|
+
return name.split(" ").map((token) => {
|
|
525
|
+
if (!token.startsWith("/") && !SCHEME.test(token)) return token;
|
|
526
|
+
return _nullishCoalesce(_optionalChain([splitUrl, 'call', _3 => _3(token), 'optionalAccess', _4 => _4.base]), () => ( token));
|
|
527
|
+
}).join(" ");
|
|
528
|
+
};
|
|
529
|
+
return {
|
|
530
|
+
attributes(attributes) {
|
|
531
|
+
let out = null;
|
|
532
|
+
const set = (key, value) => {
|
|
533
|
+
out ??= { ...attributes };
|
|
534
|
+
out[key] = value;
|
|
535
|
+
};
|
|
536
|
+
let dropped = null;
|
|
537
|
+
for (const key of URL_KEYS) {
|
|
538
|
+
const value = attributes[key];
|
|
539
|
+
if (typeof value !== "string") continue;
|
|
540
|
+
const split = splitUrl(value);
|
|
541
|
+
if (!split) continue;
|
|
542
|
+
set(key, split.base);
|
|
543
|
+
if (split.query) dropped ??= split.query;
|
|
544
|
+
}
|
|
545
|
+
for (const key of NAME_KEYS) {
|
|
546
|
+
const value = attributes[key];
|
|
547
|
+
if (typeof value !== "string") continue;
|
|
548
|
+
const stripped = stripName(value);
|
|
549
|
+
if (stripped !== value) set(key, stripped);
|
|
550
|
+
}
|
|
551
|
+
const current = attributes[QUERY_KEY];
|
|
552
|
+
if (typeof current === "string") {
|
|
553
|
+
const masked = maskQuery(current.startsWith("?") ? current.slice(1) : current);
|
|
554
|
+
if (masked !== current) set(QUERY_KEY, masked);
|
|
555
|
+
} else if (current !== void 0) {
|
|
556
|
+
set(QUERY_KEY, MASK);
|
|
557
|
+
} else if (dropped !== null) {
|
|
558
|
+
const masked = maskQuery(dropped);
|
|
559
|
+
if (masked) set(QUERY_KEY, masked);
|
|
560
|
+
}
|
|
561
|
+
return _nullishCoalesce(out, () => ( attributes));
|
|
562
|
+
},
|
|
563
|
+
name: stripName
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
// src/redact-exporter.ts
|
|
481
568
|
var scrubbedResources = /* @__PURE__ */ new WeakMap();
|
|
482
569
|
function redactResource(resource, redactor) {
|
|
483
570
|
const cached = scrubbedResources.get(resource);
|
|
@@ -486,17 +573,41 @@ function redactResource(resource, redactor) {
|
|
|
486
573
|
scrubbedResources.set(resource, scrubbed);
|
|
487
574
|
return scrubbed;
|
|
488
575
|
}
|
|
489
|
-
|
|
490
|
-
|
|
576
|
+
var DEFAULT_QUERY_POLICY = makeUrlQueryPolicy();
|
|
577
|
+
function stripQueries(span, query) {
|
|
578
|
+
const name = query.name(span.name);
|
|
579
|
+
const attributes = query.attributes(span.attributes);
|
|
580
|
+
if (name === span.name && attributes === span.attributes) return span;
|
|
581
|
+
return wrap(span, { name, attributes });
|
|
582
|
+
}
|
|
583
|
+
function wrap(span, fields) {
|
|
491
584
|
return {
|
|
492
|
-
name:
|
|
585
|
+
name: fields.name,
|
|
493
586
|
kind: span.kind,
|
|
494
587
|
spanContext: () => span.spanContext(),
|
|
495
588
|
parentSpanId: span.parentSpanId,
|
|
496
589
|
startTime: span.startTime,
|
|
497
590
|
endTime: span.endTime,
|
|
591
|
+
status: _nullishCoalesce(fields.status, () => ( span.status)),
|
|
592
|
+
attributes: fields.attributes,
|
|
593
|
+
links: _nullishCoalesce(fields.links, () => ( span.links)),
|
|
594
|
+
events: _nullishCoalesce(fields.events, () => ( span.events)),
|
|
595
|
+
duration: span.duration,
|
|
596
|
+
ended: span.ended,
|
|
597
|
+
resource: _nullishCoalesce(fields.resource, () => ( span.resource)),
|
|
598
|
+
instrumentationLibrary: span.instrumentationLibrary,
|
|
599
|
+
droppedAttributesCount: span.droppedAttributesCount,
|
|
600
|
+
droppedEventsCount: span.droppedEventsCount,
|
|
601
|
+
droppedLinksCount: span.droppedLinksCount
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
function redactSpan(span, redactor, query = DEFAULT_QUERY_POLICY) {
|
|
605
|
+
if (!redactor.enabled) return stripQueries(span, query);
|
|
606
|
+
const status = span.status.message ? { ...span.status, message: redactor.text(span.status.message) } : span.status;
|
|
607
|
+
return wrap(span, {
|
|
608
|
+
name: query.name(redactor.text(span.name)),
|
|
498
609
|
status,
|
|
499
|
-
attributes: redactor.exported(span.attributes),
|
|
610
|
+
attributes: query.attributes(redactor.exported(span.attributes)),
|
|
500
611
|
links: span.links.map(
|
|
501
612
|
(link) => link.attributes ? { ...link, attributes: redactor.exported(link.attributes) } : link
|
|
502
613
|
),
|
|
@@ -505,34 +616,27 @@ function redactSpan(span, redactor) {
|
|
|
505
616
|
name: redactor.text(event.name),
|
|
506
617
|
...event.attributes ? { attributes: redactor.exported(event.attributes) } : {}
|
|
507
618
|
})),
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
resource: redactResource(span.resource, redactor),
|
|
511
|
-
instrumentationLibrary: span.instrumentationLibrary,
|
|
512
|
-
droppedAttributesCount: span.droppedAttributesCount,
|
|
513
|
-
droppedEventsCount: span.droppedEventsCount,
|
|
514
|
-
droppedLinksCount: span.droppedLinksCount
|
|
515
|
-
};
|
|
619
|
+
resource: redactResource(span.resource, redactor)
|
|
620
|
+
});
|
|
516
621
|
}
|
|
517
622
|
var RedactingSpanExporter = class {
|
|
518
|
-
constructor(inner, redactor) {
|
|
623
|
+
constructor(inner, redactor, query = DEFAULT_QUERY_POLICY) {
|
|
519
624
|
this.inner = inner;
|
|
520
625
|
this.redactor = redactor;
|
|
626
|
+
this.query = query;
|
|
521
627
|
}
|
|
522
628
|
|
|
523
629
|
|
|
630
|
+
|
|
524
631
|
export(spans, resultCallback) {
|
|
525
632
|
const redactor = this.redactor();
|
|
526
|
-
|
|
633
|
+
const scrubbed = [];
|
|
527
634
|
let failed = 0;
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
} catch (e12) {
|
|
534
|
-
failed++;
|
|
535
|
-
}
|
|
635
|
+
for (const span of spans) {
|
|
636
|
+
try {
|
|
637
|
+
scrubbed.push(redactSpan(span, redactor, this.query));
|
|
638
|
+
} catch (e13) {
|
|
639
|
+
failed++;
|
|
536
640
|
}
|
|
537
641
|
}
|
|
538
642
|
if (!failed) {
|
|
@@ -554,7 +658,7 @@ var RedactingSpanExporter = class {
|
|
|
554
658
|
return this.inner.shutdown();
|
|
555
659
|
}
|
|
556
660
|
forceFlush() {
|
|
557
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
661
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _5 => _5.inner, 'access', _6 => _6.forceFlush, 'optionalCall', _7 => _7()]), () => ( Promise.resolve()));
|
|
558
662
|
}
|
|
559
663
|
};
|
|
560
664
|
var RedactingMetricExporter = class {
|
|
@@ -611,7 +715,7 @@ function startMemoryMetrics() {
|
|
|
611
715
|
[heapUsed, (result) => result.observe(process.memoryUsage().heapUsed)],
|
|
612
716
|
[heapLimit, (result) => result.observe(_v8.getHeapStatistics.call(void 0, ).heap_size_limit)],
|
|
613
717
|
[containerLimit, (result) => {
|
|
614
|
-
const constrained = _nullishCoalesce(_optionalChain([process, 'access',
|
|
718
|
+
const constrained = _nullishCoalesce(_optionalChain([process, 'access', _8 => _8.constrainedMemory, 'optionalCall', _9 => _9()]), () => ( 0));
|
|
615
719
|
if (constrained > 0) result.observe(constrained);
|
|
616
720
|
}],
|
|
617
721
|
[afterGc, (result) => {
|
|
@@ -641,7 +745,7 @@ var _async_hooks = require('async_hooks');
|
|
|
641
745
|
|
|
642
746
|
var REQUEST_STATE = /* @__PURE__ */ Symbol.for("autter.runtime.request");
|
|
643
747
|
var BOUND = /* @__PURE__ */ Symbol.for("autter.runtime.bound");
|
|
644
|
-
var CAPTURED = /* @__PURE__ */ new WeakSet();
|
|
748
|
+
var CAPTURED = _chunkGYTQLITWcjs.sharedSlot.call(void 0, "requests", () => ({ captured: /* @__PURE__ */ new WeakSet() })).captured;
|
|
645
749
|
var capturer = () => {
|
|
646
750
|
};
|
|
647
751
|
function setRequestExceptionCapturer(fn) {
|
|
@@ -657,30 +761,30 @@ function markCaptured(error) {
|
|
|
657
761
|
}
|
|
658
762
|
function expressRouteOf(req) {
|
|
659
763
|
const props = req;
|
|
660
|
-
const path = _optionalChain([props, 'optionalAccess',
|
|
764
|
+
const path = _optionalChain([props, 'optionalAccess', _10 => _10.route, 'optionalAccess', _11 => _11.path]);
|
|
661
765
|
if (typeof path !== "string" || path === "") return null;
|
|
662
|
-
const base = typeof _optionalChain([props, 'optionalAccess',
|
|
766
|
+
const base = typeof _optionalChain([props, 'optionalAccess', _12 => _12.baseUrl]) === "string" ? props.baseUrl : "";
|
|
663
767
|
const route = base + path;
|
|
664
768
|
return route.startsWith("/") ? route : null;
|
|
665
769
|
}
|
|
666
770
|
function defaultShouldCapture(error) {
|
|
667
|
-
return error instanceof
|
|
771
|
+
return error instanceof _chunkRV4MJNM2cjs.RuntimeError || _chunkRV4MJNM2cjs.errorCodeOf.call(void 0, error) !== void 0 || _chunkRV4MJNM2cjs.responseStatusOf.call(void 0, error) >= 500;
|
|
668
772
|
}
|
|
669
773
|
function onRequestSpan(fn) {
|
|
670
|
-
const
|
|
671
|
-
const metadata = _core.getRPCMetadata.call(void 0,
|
|
672
|
-
const span = _optionalChain([metadata, 'optionalAccess',
|
|
673
|
-
if (!span || !span.isRecording() || _api.trace.getSpan(
|
|
774
|
+
const active = _api.context.active();
|
|
775
|
+
const metadata = _core.getRPCMetadata.call(void 0, active);
|
|
776
|
+
const span = _optionalChain([metadata, 'optionalAccess', _13 => _13.type]) === _core.RPCType.HTTP ? metadata.span : void 0;
|
|
777
|
+
if (!span || !span.isRecording() || _api.trace.getSpan(active) === span) {
|
|
674
778
|
fn();
|
|
675
779
|
return;
|
|
676
780
|
}
|
|
677
|
-
_api.context.with(_api.trace.setSpan(
|
|
781
|
+
_api.context.with(_api.trace.setSpan(active, span), fn);
|
|
678
782
|
}
|
|
679
783
|
function captureAtBoundary(error, state, rule = void 0, attributes) {
|
|
680
784
|
let wanted;
|
|
681
785
|
try {
|
|
682
786
|
wanted = typeof rule === "function" ? rule(error) : rule === void 0 ? defaultShouldCapture(error) : rule;
|
|
683
|
-
} catch (
|
|
787
|
+
} catch (e14) {
|
|
684
788
|
wanted = false;
|
|
685
789
|
}
|
|
686
790
|
if (!wanted) return;
|
|
@@ -688,9 +792,9 @@ function captureAtBoundary(error, state, rule = void 0, attributes) {
|
|
|
688
792
|
markCaptured(error);
|
|
689
793
|
try {
|
|
690
794
|
const run = () => onRequestSpan(() => capturer(error, attributes));
|
|
691
|
-
if (state && !state.sealed)
|
|
795
|
+
if (state && !state.sealed) _chunkRV4MJNM2cjs.local.run(state, run);
|
|
692
796
|
else run();
|
|
693
|
-
} catch (
|
|
797
|
+
} catch (e15) {
|
|
694
798
|
}
|
|
695
799
|
}
|
|
696
800
|
function requestStateOf(req) {
|
|
@@ -702,23 +806,23 @@ function captureRequestError(error, attributes) {
|
|
|
702
806
|
if (!attributes) return;
|
|
703
807
|
try {
|
|
704
808
|
onRequestSpan(() => annotator(attributes));
|
|
705
|
-
} catch (
|
|
809
|
+
} catch (e16) {
|
|
706
810
|
}
|
|
707
811
|
return;
|
|
708
812
|
}
|
|
709
|
-
captureAtBoundary(error,
|
|
813
|
+
captureAtBoundary(error, _chunkRV4MJNM2cjs.currentOperation.call(void 0, ), true, attributes);
|
|
710
814
|
}
|
|
711
815
|
function bindEmitter(emitter, state) {
|
|
712
816
|
const target = emitter;
|
|
713
817
|
if (!target || typeof target !== "object" || target[BOUND]) return;
|
|
714
818
|
target[BOUND] = true;
|
|
715
819
|
const wrappers = /* @__PURE__ */ new WeakMap();
|
|
716
|
-
const
|
|
820
|
+
const wrap2 = (listener) => {
|
|
717
821
|
if (typeof listener !== "function") return listener;
|
|
718
822
|
let wrapped = wrappers.get(listener);
|
|
719
823
|
if (!wrapped) {
|
|
720
824
|
wrapped = function(...args) {
|
|
721
|
-
return
|
|
825
|
+
return _chunkRV4MJNM2cjs.local.run(
|
|
722
826
|
state,
|
|
723
827
|
() => listener.apply(this, args)
|
|
724
828
|
);
|
|
@@ -737,7 +841,7 @@ function bindEmitter(emitter, state) {
|
|
|
737
841
|
const original = target[method];
|
|
738
842
|
if (typeof original !== "function") continue;
|
|
739
843
|
target[method] = function(event, listener) {
|
|
740
|
-
return original.call(this, event,
|
|
844
|
+
return original.call(this, event, wrap2(listener));
|
|
741
845
|
};
|
|
742
846
|
}
|
|
743
847
|
for (const method of ["removeListener", "off"]) {
|
|
@@ -773,7 +877,7 @@ function exposeOnCors(res, header) {
|
|
|
773
877
|
if (value && key && inline) inline[key] = value;
|
|
774
878
|
else if (value) res.setHeader("access-control-expose-headers", value);
|
|
775
879
|
}
|
|
776
|
-
} catch (
|
|
880
|
+
} catch (e17) {
|
|
777
881
|
}
|
|
778
882
|
return original.apply(this, args);
|
|
779
883
|
};
|
|
@@ -785,7 +889,7 @@ function pathOf(req) {
|
|
|
785
889
|
function finishRequest(state, input) {
|
|
786
890
|
if (state.sealed) return;
|
|
787
891
|
state.name = (_nullishCoalesce(input.name, () => ( `${input.method} ${input.route}`))).slice(0, 200);
|
|
788
|
-
state.outcome =
|
|
892
|
+
state.outcome = _chunkRV4MJNM2cjs.requestOutcome.call(void 0, {
|
|
789
893
|
...state.explicitOutcome ? { explicit: state.outcome } : {},
|
|
790
894
|
...state.error !== void 0 ? { error: state.error } : {},
|
|
791
895
|
...state.errorThrown ? { thrown: true } : {},
|
|
@@ -793,15 +897,15 @@ function finishRequest(state, input) {
|
|
|
793
897
|
aborted: input.aborted
|
|
794
898
|
});
|
|
795
899
|
const span = _api.trace.getActiveSpan();
|
|
796
|
-
if (_optionalChain([span, 'optionalAccess',
|
|
900
|
+
if (_optionalChain([span, 'optionalAccess', _14 => _14.isRecording, 'call', _15 => _15()])) span.setAttribute("autter.operation.outcome", state.outcome);
|
|
797
901
|
if (input.span) {
|
|
798
902
|
const remote = _api.trace.wrapSpanContext(input.span);
|
|
799
903
|
_api.context.with(
|
|
800
904
|
_api.trace.setSpan(_api.context.active(), remote),
|
|
801
|
-
() =>
|
|
905
|
+
() => _chunkRV4MJNM2cjs.reportExplicitFailure.call(void 0, state)
|
|
802
906
|
);
|
|
803
|
-
} else
|
|
804
|
-
|
|
907
|
+
} else _chunkRV4MJNM2cjs.reportExplicitFailure.call(void 0, state);
|
|
908
|
+
_chunkRV4MJNM2cjs.emitSummary.call(void 0, state, {
|
|
805
909
|
http: {
|
|
806
910
|
"http.request.method": input.method,
|
|
807
911
|
"http.route": input.route,
|
|
@@ -812,14 +916,14 @@ function finishRequest(state, input) {
|
|
|
812
916
|
});
|
|
813
917
|
}
|
|
814
918
|
function beginNodeRequest(req, res, options, route) {
|
|
815
|
-
const header = (_nullishCoalesce(options.requestIdHeader, () => (
|
|
816
|
-
const requestId =
|
|
919
|
+
const header = (_nullishCoalesce(options.requestIdHeader, () => ( _chunkRV4MJNM2cjs.DEFAULT_REQUEST_ID_HEADER))).toLowerCase();
|
|
920
|
+
const requestId = _chunkRV4MJNM2cjs.resolveRequestId.call(void 0,
|
|
817
921
|
options.trustRequestId === false ? void 0 : req.headers[header]
|
|
818
922
|
);
|
|
819
923
|
const method = (_nullishCoalesce(req.method, () => ( "GET"))).toUpperCase();
|
|
820
924
|
const path = pathOf(req);
|
|
821
|
-
const state =
|
|
822
|
-
name: `${method} ${
|
|
925
|
+
const state = _chunkRV4MJNM2cjs.createRequestState.call(void 0, {
|
|
926
|
+
name: `${method} ${_chunkRV4MJNM2cjs.normalizeRoutePath.call(void 0, path)}`,
|
|
823
927
|
requestId,
|
|
824
928
|
req,
|
|
825
929
|
res
|
|
@@ -828,22 +932,22 @@ function beginNodeRequest(req, res, options, route) {
|
|
|
828
932
|
try {
|
|
829
933
|
if (!res.headersSent) res.setHeader(header, requestId);
|
|
830
934
|
exposeOnCors(res, header);
|
|
831
|
-
} catch (
|
|
935
|
+
} catch (e18) {
|
|
832
936
|
}
|
|
833
937
|
const span = _api.trace.getActiveSpan();
|
|
834
|
-
if (_optionalChain([span, 'optionalAccess',
|
|
938
|
+
if (_optionalChain([span, 'optionalAccess', _16 => _16.isRecording, 'call', _17 => _17()]))
|
|
835
939
|
span.setAttributes({
|
|
836
940
|
"autter.request.id": requestId,
|
|
837
941
|
"autter.operation.kind": "request"
|
|
838
942
|
});
|
|
839
|
-
const spanContext = _optionalChain([span, 'optionalAccess',
|
|
943
|
+
const spanContext = _optionalChain([span, 'optionalAccess', _18 => _18.spanContext, 'call', _19 => _19()]);
|
|
840
944
|
bindEmitter(req, state);
|
|
841
945
|
bindEmitter(res, state);
|
|
842
946
|
let finished = false;
|
|
843
947
|
const done = () => {
|
|
844
948
|
finishRequest(state, {
|
|
845
949
|
method,
|
|
846
|
-
route: _nullishCoalesce(_nullishCoalesce(_optionalChain([route, 'optionalCall',
|
|
950
|
+
route: _nullishCoalesce(_nullishCoalesce(_optionalChain([route, 'optionalCall', _20 => _20()]), () => ( expressRouteOf(req))), () => ( _chunkRV4MJNM2cjs.normalizeRoutePath.call(void 0, path))),
|
|
847
951
|
status: res.statusCode,
|
|
848
952
|
aborted: !finished,
|
|
849
953
|
...spanContext ? { span: spanContext } : {}
|
|
@@ -857,50 +961,50 @@ function beginNodeRequest(req, res, options, route) {
|
|
|
857
961
|
return state;
|
|
858
962
|
}
|
|
859
963
|
function autterRequests(options = {}) {
|
|
860
|
-
const ignored =
|
|
964
|
+
const ignored = _chunkRV4MJNM2cjs.compileIgnore.call(void 0, options.ignore);
|
|
861
965
|
return function autterRequestsMiddleware(req, res, next) {
|
|
862
966
|
if (req[REQUEST_STATE] || ignored(pathOf(req))) {
|
|
863
967
|
next();
|
|
864
968
|
return;
|
|
865
969
|
}
|
|
866
970
|
const state = beginNodeRequest(req, res, options);
|
|
867
|
-
|
|
971
|
+
_chunkRV4MJNM2cjs.local.run(state, () => next());
|
|
868
972
|
};
|
|
869
973
|
}
|
|
870
974
|
function autterErrorResponse(options = {}) {
|
|
871
975
|
return function autterErrorResponseMiddleware(error, req, res, next) {
|
|
872
976
|
const state = req[REQUEST_STATE];
|
|
873
|
-
if (state)
|
|
977
|
+
if (state) _chunkRV4MJNM2cjs.noteOperationError.call(void 0, error, true, state);
|
|
874
978
|
captureAtBoundary(error, state, options.capture);
|
|
875
979
|
if (res.headersSent) {
|
|
876
980
|
next(error);
|
|
877
981
|
return;
|
|
878
982
|
}
|
|
879
|
-
const header = (_nullishCoalesce(options.requestIdHeader, () => (
|
|
880
|
-
const inbound = _optionalChain([req, 'access',
|
|
881
|
-
const requestId = _nullishCoalesce(_optionalChain([state, 'optionalAccess',
|
|
882
|
-
res.statusCode =
|
|
983
|
+
const header = (_nullishCoalesce(options.requestIdHeader, () => ( _chunkRV4MJNM2cjs.DEFAULT_REQUEST_ID_HEADER))).toLowerCase();
|
|
984
|
+
const inbound = _optionalChain([req, 'access', _21 => _21.headers, 'optionalAccess', _22 => _22[header]]);
|
|
985
|
+
const requestId = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _23 => _23.requestId]), () => ( (typeof inbound === "string" ? inbound.slice(0, 128) : void 0)));
|
|
986
|
+
res.statusCode = _chunkRV4MJNM2cjs.responseStatusOf.call(void 0, error);
|
|
883
987
|
res.setHeader("content-type", "application/json; charset=utf-8");
|
|
884
|
-
res.end(JSON.stringify(
|
|
988
|
+
res.end(JSON.stringify(_chunkRV4MJNM2cjs.toClientError.call(void 0, error, requestId)));
|
|
885
989
|
};
|
|
886
990
|
}
|
|
887
991
|
var RESOURCE = /* @__PURE__ */ Symbol.for("autter.runtime.resource");
|
|
888
992
|
function autterFastify(fastify, options, done) {
|
|
889
993
|
const opts = _nullishCoalesce(options, () => ( {}));
|
|
890
|
-
const header = (_nullishCoalesce(opts.requestIdHeader, () => (
|
|
891
|
-
const ignored =
|
|
994
|
+
const header = (_nullishCoalesce(opts.requestIdHeader, () => ( _chunkRV4MJNM2cjs.DEFAULT_REQUEST_ID_HEADER))).toLowerCase();
|
|
995
|
+
const ignored = _chunkRV4MJNM2cjs.compileIgnore.call(void 0, opts.ignore);
|
|
892
996
|
const stateOf = (request) => request[REQUEST_STATE];
|
|
893
997
|
fastify.addHook("onRequest", ((request, reply, next) => {
|
|
894
998
|
if (ignored(request.url) || request.raw[REQUEST_STATE]) {
|
|
895
999
|
next();
|
|
896
1000
|
return;
|
|
897
1001
|
}
|
|
898
|
-
const requestId =
|
|
1002
|
+
const requestId = _chunkRV4MJNM2cjs.resolveRequestId.call(void 0,
|
|
899
1003
|
opts.trustRequestId === false ? void 0 : request.headers[header]
|
|
900
1004
|
);
|
|
901
1005
|
const method = String(_nullishCoalesce(request.method, () => ( "GET"))).toUpperCase();
|
|
902
|
-
const state =
|
|
903
|
-
name: `${method} ${
|
|
1006
|
+
const state = _chunkRV4MJNM2cjs.createRequestState.call(void 0, {
|
|
1007
|
+
name: `${method} ${_chunkRV4MJNM2cjs.normalizeRoutePath.call(void 0, request.url)}`,
|
|
904
1008
|
requestId,
|
|
905
1009
|
req: request.raw,
|
|
906
1010
|
res: reply.raw
|
|
@@ -909,18 +1013,18 @@ function autterFastify(fastify, options, done) {
|
|
|
909
1013
|
request.raw[REQUEST_STATE] = state;
|
|
910
1014
|
reply.header(header, requestId);
|
|
911
1015
|
const span = _api.trace.getActiveSpan();
|
|
912
|
-
if (_optionalChain([span, 'optionalAccess',
|
|
1016
|
+
if (_optionalChain([span, 'optionalAccess', _24 => _24.isRecording, 'call', _25 => _25()]))
|
|
913
1017
|
span.setAttributes({
|
|
914
1018
|
"autter.request.id": requestId,
|
|
915
1019
|
"autter.operation.kind": "request"
|
|
916
1020
|
});
|
|
917
|
-
const spanContext = _optionalChain([span, 'optionalAccess',
|
|
1021
|
+
const spanContext = _optionalChain([span, 'optionalAccess', _26 => _26.spanContext, 'call', _27 => _27()]);
|
|
918
1022
|
bindEmitter(request.raw, state);
|
|
919
1023
|
bindEmitter(reply.raw, state);
|
|
920
1024
|
let finished = false;
|
|
921
1025
|
const finish = (aborted) => finishRequest(state, {
|
|
922
1026
|
method,
|
|
923
|
-
route: _nullishCoalesce(_nullishCoalesce(_optionalChain([request, 'access',
|
|
1027
|
+
route: _nullishCoalesce(_nullishCoalesce(_optionalChain([request, 'access', _28 => _28.routeOptions, 'optionalAccess', _29 => _29.url]), () => ( request.routerPath)), () => ( _chunkRV4MJNM2cjs.normalizeRoutePath.call(void 0, request.url))),
|
|
924
1028
|
status: reply.raw.statusCode || reply.statusCode,
|
|
925
1029
|
aborted,
|
|
926
1030
|
...spanContext ? { span: spanContext } : {}
|
|
@@ -930,7 +1034,7 @@ function autterFastify(fastify, options, done) {
|
|
|
930
1034
|
finish(false);
|
|
931
1035
|
});
|
|
932
1036
|
reply.raw.once("close", () => finish(!finished));
|
|
933
|
-
|
|
1037
|
+
_chunkRV4MJNM2cjs.local.run(state, () => {
|
|
934
1038
|
request[RESOURCE] = new (0, _async_hooks.AsyncResource)("autter-request");
|
|
935
1039
|
next();
|
|
936
1040
|
});
|
|
@@ -946,13 +1050,13 @@ function autterFastify(fastify, options, done) {
|
|
|
946
1050
|
const value = exposeHeaderValue(reply.getHeader("access-control-expose-headers"), header);
|
|
947
1051
|
if (value) reply.header("access-control-expose-headers", value);
|
|
948
1052
|
}
|
|
949
|
-
} catch (
|
|
1053
|
+
} catch (e19) {
|
|
950
1054
|
}
|
|
951
1055
|
next(null, payload);
|
|
952
1056
|
}));
|
|
953
1057
|
fastify.addHook("onError", ((request, _reply, error, next) => {
|
|
954
1058
|
const state = stateOf(request);
|
|
955
|
-
if (state)
|
|
1059
|
+
if (state) _chunkRV4MJNM2cjs.noteOperationError.call(void 0, error, true, state);
|
|
956
1060
|
captureAtBoundary(error, state);
|
|
957
1061
|
next();
|
|
958
1062
|
}));
|
|
@@ -974,48 +1078,48 @@ function withHeaders(response, header, requestId) {
|
|
|
974
1078
|
};
|
|
975
1079
|
try {
|
|
976
1080
|
return apply(response);
|
|
977
|
-
} catch (
|
|
1081
|
+
} catch (e20) {
|
|
978
1082
|
try {
|
|
979
1083
|
return apply(new Response(response.body, response));
|
|
980
|
-
} catch (
|
|
1084
|
+
} catch (e21) {
|
|
981
1085
|
return response;
|
|
982
1086
|
}
|
|
983
1087
|
}
|
|
984
1088
|
}
|
|
985
1089
|
function withRuntimeRequest(handler, options = {}) {
|
|
986
|
-
const header = (_nullishCoalesce(options.requestIdHeader, () => (
|
|
987
|
-
const ignored =
|
|
1090
|
+
const header = (_nullishCoalesce(options.requestIdHeader, () => ( _chunkRV4MJNM2cjs.DEFAULT_REQUEST_ID_HEADER))).toLowerCase();
|
|
1091
|
+
const ignored = _chunkRV4MJNM2cjs.compileIgnore.call(void 0, options.ignore);
|
|
988
1092
|
return async (request, ...rest) => {
|
|
989
1093
|
let pathname = "/";
|
|
990
1094
|
try {
|
|
991
1095
|
pathname = new URL(request.url, "http://localhost").pathname;
|
|
992
|
-
} catch (
|
|
1096
|
+
} catch (e22) {
|
|
993
1097
|
}
|
|
994
1098
|
if (ignored(pathname)) return handler(request, ...rest);
|
|
995
|
-
const requestId =
|
|
1099
|
+
const requestId = _chunkRV4MJNM2cjs.resolveRequestId.call(void 0,
|
|
996
1100
|
options.trustRequestId === false ? void 0 : request.headers.get(header)
|
|
997
1101
|
);
|
|
998
1102
|
const method = String(_nullishCoalesce(request.method, () => ( "GET"))).toUpperCase();
|
|
999
|
-
const route = _nullishCoalesce(options.route, () => (
|
|
1000
|
-
const state =
|
|
1103
|
+
const route = _nullishCoalesce(options.route, () => ( _chunkRV4MJNM2cjs.normalizeRoutePath.call(void 0, pathname)));
|
|
1104
|
+
const state = _chunkRV4MJNM2cjs.createRequestState.call(void 0, {
|
|
1001
1105
|
name: `${method} ${_nullishCoalesce(options.name, () => ( route))}`,
|
|
1002
1106
|
requestId,
|
|
1003
1107
|
req: request
|
|
1004
1108
|
});
|
|
1005
1109
|
const span = _api.trace.getActiveSpan();
|
|
1006
|
-
if (_optionalChain([span, 'optionalAccess',
|
|
1110
|
+
if (_optionalChain([span, 'optionalAccess', _30 => _30.isRecording, 'call', _31 => _31()]))
|
|
1007
1111
|
span.setAttributes({
|
|
1008
1112
|
"autter.request.id": requestId,
|
|
1009
1113
|
"autter.operation.kind": "request"
|
|
1010
1114
|
});
|
|
1011
|
-
const spanContext = _optionalChain([span, 'optionalAccess',
|
|
1115
|
+
const spanContext = _optionalChain([span, 'optionalAccess', _32 => _32.spanContext, 'call', _33 => _33()]);
|
|
1012
1116
|
let status = 500;
|
|
1013
1117
|
try {
|
|
1014
|
-
const response = await
|
|
1118
|
+
const response = await _chunkRV4MJNM2cjs.local.run(state, async () => {
|
|
1015
1119
|
try {
|
|
1016
1120
|
return await handler(request, ...rest);
|
|
1017
1121
|
} catch (error) {
|
|
1018
|
-
|
|
1122
|
+
_chunkRV4MJNM2cjs.noteOperationError.call(void 0, error, true, state);
|
|
1019
1123
|
captureAtBoundary(error, state, true);
|
|
1020
1124
|
throw error;
|
|
1021
1125
|
}
|
|
@@ -1023,7 +1127,7 @@ function withRuntimeRequest(handler, options = {}) {
|
|
|
1023
1127
|
status = response.status;
|
|
1024
1128
|
return withHeaders(response, header, requestId);
|
|
1025
1129
|
} finally {
|
|
1026
|
-
const aborted = _optionalChain([request, 'access',
|
|
1130
|
+
const aborted = _optionalChain([request, 'access', _34 => _34.signal, 'optionalAccess', _35 => _35.aborted]) === true;
|
|
1027
1131
|
finishRequest(state, {
|
|
1028
1132
|
method,
|
|
1029
1133
|
route,
|
|
@@ -1034,9 +1138,9 @@ function withRuntimeRequest(handler, options = {}) {
|
|
|
1034
1138
|
});
|
|
1035
1139
|
if (options.waitUntil) {
|
|
1036
1140
|
try {
|
|
1037
|
-
options.waitUntil(
|
|
1141
|
+
options.waitUntil(_chunkRV4MJNM2cjs.flushRuntimeLogs.call(void 0, ).catch(() => {
|
|
1038
1142
|
}));
|
|
1039
|
-
} catch (
|
|
1143
|
+
} catch (e23) {
|
|
1040
1144
|
}
|
|
1041
1145
|
}
|
|
1042
1146
|
}
|
|
@@ -1046,7 +1150,7 @@ function startHookRequest(res) {
|
|
|
1046
1150
|
const req = res.req;
|
|
1047
1151
|
if (!req || req[REQUEST_STATE]) return;
|
|
1048
1152
|
const state = beginNodeRequest(req, res, {});
|
|
1049
|
-
|
|
1153
|
+
_chunkRV4MJNM2cjs.local.enterWith(state);
|
|
1050
1154
|
}
|
|
1051
1155
|
|
|
1052
1156
|
// src/unhandled-rejections.ts
|
|
@@ -1072,7 +1176,7 @@ var recorded = /* @__PURE__ */ new WeakSet();
|
|
|
1072
1176
|
function markRecorded(reason) {
|
|
1073
1177
|
if (!reason || typeof reason !== "object") return;
|
|
1074
1178
|
recorded.add(reason);
|
|
1075
|
-
_optionalChain([setImmediate, 'call',
|
|
1179
|
+
_optionalChain([setImmediate, 'call', _36 => _36(() => recorded.delete(reason)), 'access', _37 => _37.unref, 'optionalCall', _38 => _38()]);
|
|
1076
1180
|
}
|
|
1077
1181
|
function recordedAsRejection(error) {
|
|
1078
1182
|
return !!error && typeof error === "object" && recorded.has(error);
|
|
@@ -1098,7 +1202,7 @@ function unhandledRejectionsMode(execArgv = process.execArgv, nodeOptions = proc
|
|
|
1098
1202
|
function isErrorLike(value) {
|
|
1099
1203
|
try {
|
|
1100
1204
|
return typeof value === "object" && value !== null && Object.prototype.hasOwnProperty.call(value, "stack");
|
|
1101
|
-
} catch (
|
|
1205
|
+
} catch (e24) {
|
|
1102
1206
|
return false;
|
|
1103
1207
|
}
|
|
1104
1208
|
}
|
|
@@ -1106,16 +1210,16 @@ function describeReason(reason) {
|
|
|
1106
1210
|
if (typeof reason !== "object" && typeof reason !== "function" || reason === null) {
|
|
1107
1211
|
try {
|
|
1108
1212
|
return String(reason);
|
|
1109
|
-
} catch (
|
|
1213
|
+
} catch (e25) {
|
|
1110
1214
|
return typeof reason;
|
|
1111
1215
|
}
|
|
1112
1216
|
}
|
|
1113
1217
|
try {
|
|
1114
1218
|
const proto = Object.getPrototypeOf(reason);
|
|
1115
|
-
const ctor = _optionalChain([proto, 'optionalAccess',
|
|
1219
|
+
const ctor = _optionalChain([proto, 'optionalAccess', _39 => _39.constructor]);
|
|
1116
1220
|
const name = typeof ctor === "function" ? ctor.name : "";
|
|
1117
1221
|
return name ? `#<${name}>` : "[object Object]";
|
|
1118
|
-
} catch (
|
|
1222
|
+
} catch (e26) {
|
|
1119
1223
|
return "[object Object]";
|
|
1120
1224
|
}
|
|
1121
1225
|
}
|
|
@@ -1126,7 +1230,7 @@ function toUncaught(reason, from) {
|
|
|
1126
1230
|
);
|
|
1127
1231
|
error.name = "UnhandledPromiseRejection";
|
|
1128
1232
|
error.code = "ERR_UNHANDLED_REJECTION";
|
|
1129
|
-
_optionalChain([Error, 'access',
|
|
1233
|
+
_optionalChain([Error, 'access', _40 => _40.captureStackTrace, 'optionalCall', _41 => _41(error, from)]);
|
|
1130
1234
|
return error;
|
|
1131
1235
|
}
|
|
1132
1236
|
var warningId = 0;
|
|
@@ -1138,7 +1242,7 @@ function emitNodeWarning(reason) {
|
|
|
1138
1242
|
`Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag \`--unhandled-rejections=strict\` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: ${++warningId})`,
|
|
1139
1243
|
"UnhandledPromiseRejectionWarning"
|
|
1140
1244
|
);
|
|
1141
|
-
} catch (
|
|
1245
|
+
} catch (e27) {
|
|
1142
1246
|
}
|
|
1143
1247
|
}
|
|
1144
1248
|
function installUnhandledRejectionCapture(capture, mode = unhandledRejectionsMode()) {
|
|
@@ -1165,7 +1269,7 @@ function installUnhandledRejectionCapture(capture, mode = unhandledRejectionsMod
|
|
|
1165
1269
|
}
|
|
1166
1270
|
markRecorded(reason);
|
|
1167
1271
|
capture(reason);
|
|
1168
|
-
} catch (
|
|
1272
|
+
} catch (e28) {
|
|
1169
1273
|
}
|
|
1170
1274
|
};
|
|
1171
1275
|
listener[LISTENER_MARK] = true;
|
|
@@ -1175,7 +1279,48 @@ function installUnhandledRejectionCapture(capture, mode = unhandledRejectionsMod
|
|
|
1175
1279
|
};
|
|
1176
1280
|
}
|
|
1177
1281
|
|
|
1282
|
+
// src/route-label.ts
|
|
1283
|
+
|
|
1284
|
+
var ours = /* @__PURE__ */ new WeakMap();
|
|
1285
|
+
var RAW_PATH_SPAN_TYPES = /* @__PURE__ */ new Set(["BaseServer.renderToResponse"]);
|
|
1286
|
+
function noteFrameworkRoute(parent, attributes) {
|
|
1287
|
+
const route = _optionalChain([attributes, 'optionalAccess', _42 => _42["next.route"]]);
|
|
1288
|
+
if (typeof route !== "string" || !route.startsWith("/")) return;
|
|
1289
|
+
if (RAW_PATH_SPAN_TYPES.has(String(_nullishCoalesce(_optionalChain([attributes, 'optionalAccess', _43 => _43["next.span_type"]]), () => ( ""))))) return;
|
|
1290
|
+
const rpc = _core.getRPCMetadata.call(void 0, parent);
|
|
1291
|
+
if (!rpc || rpc.type !== _core.RPCType.HTTP) return;
|
|
1292
|
+
const mine = ours.get(rpc);
|
|
1293
|
+
if (rpc.route !== void 0 && rpc.route !== mine) return;
|
|
1294
|
+
if (mine !== void 0 && mine.includes("[") && !route.includes("[")) return;
|
|
1295
|
+
if (mine !== void 0 && (route === `${mine}/route` || route === `${mine}/page`)) return;
|
|
1296
|
+
rpc.route = route;
|
|
1297
|
+
ours.set(rpc, route);
|
|
1298
|
+
}
|
|
1299
|
+
var RouteLabelSampler = class {
|
|
1300
|
+
constructor(delegate) {
|
|
1301
|
+
this.delegate = delegate;
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
shouldSample(ctx, traceId, spanName, spanKind, attributes, links) {
|
|
1305
|
+
try {
|
|
1306
|
+
noteFrameworkRoute(ctx, attributes);
|
|
1307
|
+
} catch (e29) {
|
|
1308
|
+
}
|
|
1309
|
+
return this.delegate.shouldSample(ctx, traceId, spanName, spanKind, attributes, links);
|
|
1310
|
+
}
|
|
1311
|
+
toString() {
|
|
1312
|
+
return `RouteLabel(${this.delegate.toString()})`;
|
|
1313
|
+
}
|
|
1314
|
+
};
|
|
1315
|
+
|
|
1178
1316
|
// src/server.ts
|
|
1317
|
+
var S = _chunkGYTQLITWcjs.sharedSlot.call(void 0, "server", () => ({
|
|
1318
|
+
active: null,
|
|
1319
|
+
alwaysOnProvider: null,
|
|
1320
|
+
redactor: _chunkRV4MJNM2cjs.makeRedactor.call(void 0, true),
|
|
1321
|
+
loggerOnlyCapture: null,
|
|
1322
|
+
hookRequests: false
|
|
1323
|
+
}));
|
|
1179
1324
|
var LLM_MARKER_ATTRIBUTES = [
|
|
1180
1325
|
"gen_ai.operation.name",
|
|
1181
1326
|
"gen_ai.system",
|
|
@@ -1272,7 +1417,7 @@ var ErrorTraceRetentionProcessor = (_class2 = class {
|
|
|
1272
1417
|
this.retainErrors = retainErrors;
|
|
1273
1418
|
this.slowThresholdMs = slowThresholdMs;
|
|
1274
1419
|
this.sweeper = setInterval(() => this.sweep(), RETENTION_SWEEP_INTERVAL_MS);
|
|
1275
|
-
_optionalChain([this, 'access',
|
|
1420
|
+
_optionalChain([this, 'access', _44 => _44.sweeper, 'access', _45 => _45.unref, 'optionalCall', _46 => _46()]);
|
|
1276
1421
|
}
|
|
1277
1422
|
|
|
1278
1423
|
|
|
@@ -1303,9 +1448,9 @@ var ErrorTraceRetentionProcessor = (_class2 = class {
|
|
|
1303
1448
|
}
|
|
1304
1449
|
/** Promote the active trace, if any — called on captured errors. */
|
|
1305
1450
|
retainActiveTrace() {
|
|
1306
|
-
const
|
|
1307
|
-
if (!
|
|
1308
|
-
const entry = this.entryFor(
|
|
1451
|
+
const active = _optionalChain([_api.trace, 'access', _47 => _47.getActiveSpan, 'call', _48 => _48(), 'optionalAccess', _49 => _49.spanContext, 'call', _50 => _50()]);
|
|
1452
|
+
if (!active || (active.traceFlags & _api.TraceFlags.SAMPLED) !== 0) return;
|
|
1453
|
+
const entry = this.entryFor(active.traceId);
|
|
1309
1454
|
if (entry.retained) return;
|
|
1310
1455
|
entry.retained = true;
|
|
1311
1456
|
this.flush(entry);
|
|
@@ -1372,7 +1517,7 @@ function llmBaseAttributes(info) {
|
|
|
1372
1517
|
...info.sessionId ? { "autter.session_id": info.sessionId } : {},
|
|
1373
1518
|
// Caller-supplied extras go through redaction like every other
|
|
1374
1519
|
// custom attribute family (prompts can contain emails/keys).
|
|
1375
|
-
...info.attributes ?
|
|
1520
|
+
...info.attributes ? S.redactor(info.attributes) : {}
|
|
1376
1521
|
};
|
|
1377
1522
|
}
|
|
1378
1523
|
function usageAttributes(usage) {
|
|
@@ -1413,7 +1558,7 @@ async function runLlmSpan(tracer, info, fn) {
|
|
|
1413
1558
|
},
|
|
1414
1559
|
setResponseModel,
|
|
1415
1560
|
setModel: setResponseModel,
|
|
1416
|
-
setAttributes: (attributes) => span.setAttributes(
|
|
1561
|
+
setAttributes: (attributes) => span.setAttributes(S.redactor(attributes))
|
|
1417
1562
|
};
|
|
1418
1563
|
try {
|
|
1419
1564
|
const result = await _api.context.with(
|
|
@@ -1424,15 +1569,15 @@ async function runLlmSpan(tracer, info, fn) {
|
|
|
1424
1569
|
return result;
|
|
1425
1570
|
} catch (err) {
|
|
1426
1571
|
recordError(span, err);
|
|
1427
|
-
if (
|
|
1572
|
+
if (_chunkRV4MJNM2cjs.isError.call(void 0, err)) span.setAttribute("error.type", err.name);
|
|
1428
1573
|
throw err;
|
|
1429
1574
|
} finally {
|
|
1430
1575
|
span.end();
|
|
1431
|
-
|
|
1576
|
+
_chunkRV4MJNM2cjs.recordOperationAiUsage.call(void 0, { ...usage, model: _nullishCoalesce(responseModel, () => ( info.model)) });
|
|
1432
1577
|
}
|
|
1433
1578
|
}
|
|
1434
1579
|
function recordLlmCall(tracer, call) {
|
|
1435
|
-
|
|
1580
|
+
_chunkRV4MJNM2cjs.recordOperationAiUsage.call(void 0, { ...call, model: call.model });
|
|
1436
1581
|
const durationMs = Math.max(0, _nullishCoalesce(call.durationMs, () => ( 0)));
|
|
1437
1582
|
const endTime = /* @__PURE__ */ new Date();
|
|
1438
1583
|
const startTime = new Date(endTime.getTime() - durationMs);
|
|
@@ -1446,7 +1591,7 @@ function recordLlmCall(tracer, call) {
|
|
|
1446
1591
|
);
|
|
1447
1592
|
if (call.error !== void 0 && call.error !== null) {
|
|
1448
1593
|
recordError(span, call.error);
|
|
1449
|
-
if (
|
|
1594
|
+
if (_chunkRV4MJNM2cjs.isError.call(void 0, call.error)) {
|
|
1450
1595
|
span.setAttribute("error.type", call.error.name);
|
|
1451
1596
|
}
|
|
1452
1597
|
} else {
|
|
@@ -1457,7 +1602,7 @@ function recordLlmCall(tracer, call) {
|
|
|
1457
1602
|
async function runWithSpan(tracer, name, fn, attributes, links) {
|
|
1458
1603
|
const span = tracer.startSpan(name, {
|
|
1459
1604
|
attributes,
|
|
1460
|
-
..._optionalChain([links, 'optionalAccess',
|
|
1605
|
+
..._optionalChain([links, 'optionalAccess', _51 => _51.length]) ? { links } : {}
|
|
1461
1606
|
});
|
|
1462
1607
|
try {
|
|
1463
1608
|
const result = await _api.context.with(
|
|
@@ -1474,70 +1619,85 @@ async function runWithSpan(tracer, name, fn, attributes, links) {
|
|
|
1474
1619
|
}
|
|
1475
1620
|
}
|
|
1476
1621
|
function recordError(span, err) {
|
|
1477
|
-
const isErr =
|
|
1478
|
-
const message =
|
|
1622
|
+
const isErr = _chunkRV4MJNM2cjs.isError.call(void 0, err);
|
|
1623
|
+
const message = S.redactor.text(isErr ? err.message : String(err));
|
|
1479
1624
|
if (isErr) {
|
|
1480
1625
|
span.addEvent("exception", {
|
|
1481
1626
|
"exception.type": err.name,
|
|
1482
1627
|
"exception.message": message,
|
|
1483
|
-
...err.stack ? { "exception.stacktrace":
|
|
1484
|
-
...
|
|
1628
|
+
...err.stack ? { "exception.stacktrace": S.redactor.text(err.stack) } : {},
|
|
1629
|
+
..._chunkRV4MJNM2cjs.breadcrumbEventAttributes.call(void 0, S.redactor.text, err)
|
|
1485
1630
|
});
|
|
1486
1631
|
}
|
|
1487
1632
|
span.setStatus({ code: _api.SpanStatusCode.ERROR, message });
|
|
1488
1633
|
}
|
|
1489
1634
|
function redactWithActive(attributes) {
|
|
1490
|
-
return
|
|
1635
|
+
return S.redactor(attributes);
|
|
1636
|
+
}
|
|
1637
|
+
function patchLoadedHttpModules() {
|
|
1638
|
+
try {
|
|
1639
|
+
const load = _module.createRequire.call(void 0, _path.join.call(void 0, process.cwd(), "autter-runtime-http.cjs"));
|
|
1640
|
+
load("http");
|
|
1641
|
+
load("https");
|
|
1642
|
+
} catch (e30) {
|
|
1643
|
+
}
|
|
1491
1644
|
}
|
|
1492
|
-
|
|
1645
|
+
var METRIC_ROUTE_ATTR = "autter.metric_has_route";
|
|
1646
|
+
function captureRequestRoute(span, response) {
|
|
1493
1647
|
if (!(response instanceof _http.ServerResponse)) return;
|
|
1494
1648
|
const rpcMetadata = _core.getRPCMetadata.call(void 0, _api.context.active());
|
|
1495
|
-
if (_optionalChain([rpcMetadata, 'optionalAccess',
|
|
1649
|
+
if (_optionalChain([rpcMetadata, 'optionalAccess', _52 => _52.type]) !== _core.RPCType.HTTP) return;
|
|
1650
|
+
let failed = false;
|
|
1651
|
+
response.on(_events.errorMonitor, () => {
|
|
1652
|
+
failed = true;
|
|
1653
|
+
});
|
|
1496
1654
|
const setRoute = () => {
|
|
1497
1655
|
if (rpcMetadata.route) return;
|
|
1498
1656
|
const route = expressRouteOf(response.req);
|
|
1499
1657
|
if (route) rpcMetadata.route = route;
|
|
1500
1658
|
};
|
|
1501
1659
|
response.prependListener("finish", setRoute);
|
|
1502
|
-
response.prependListener("close",
|
|
1503
|
-
|
|
1660
|
+
response.prependListener("close", () => {
|
|
1661
|
+
setRoute();
|
|
1662
|
+
if (rpcMetadata.route && !failed) span.setAttribute(METRIC_ROUTE_ATTR, true);
|
|
1663
|
+
});
|
|
1664
|
+
if (S.hookRequests) startHookRequest(response);
|
|
1504
1665
|
}
|
|
1505
|
-
var hookRequests = false;
|
|
1506
1666
|
function structuredErrorAttributes(error) {
|
|
1507
|
-
const attrs = { ...
|
|
1508
|
-
const internal =
|
|
1667
|
+
const attrs = { ..._chunkRV4MJNM2cjs.errorAttributes.call(void 0, error, { causes: false }) };
|
|
1668
|
+
const internal = _chunkRV4MJNM2cjs.errorInternal.call(void 0, error);
|
|
1509
1669
|
if (internal) {
|
|
1510
1670
|
try {
|
|
1511
1671
|
attrs["autter.error.internal"] = JSON.stringify(
|
|
1512
|
-
|
|
1672
|
+
S.redactor(internal)
|
|
1513
1673
|
).slice(0, 4e3);
|
|
1514
|
-
} catch (
|
|
1674
|
+
} catch (e31) {
|
|
1515
1675
|
}
|
|
1516
1676
|
}
|
|
1517
1677
|
return attrs;
|
|
1518
1678
|
}
|
|
1519
|
-
var active = null;
|
|
1520
|
-
var activeAlwaysOnProvider = null;
|
|
1521
|
-
var activeRedactor = _chunkUKYTXZOQcjs.makeRedactor.call(void 0, true);
|
|
1522
1679
|
function initAutterServer(options) {
|
|
1523
|
-
if (active) return active;
|
|
1680
|
+
if (S.active) return S.active;
|
|
1524
1681
|
const endpoint = (_nullishCoalesce(options.endpoint, () => ( "https://otlp.autter.dev"))).replace(
|
|
1525
1682
|
/\/$/,
|
|
1526
1683
|
""
|
|
1527
1684
|
);
|
|
1528
1685
|
const headers = { authorization: `Bearer ${options.apiKey}` };
|
|
1529
|
-
const
|
|
1686
|
+
const redactor = _chunkRV4MJNM2cjs.makeRedactor.call(void 0, _nullishCoalesce(options.redactAttributes, () => ( true)));
|
|
1687
|
+
const queryPolicy = makeUrlQueryPolicy(options.keepQueryParams);
|
|
1688
|
+
const traceExporter = () => new (0, _chunkGYTQLITWcjs.CountingExporter)(
|
|
1530
1689
|
new RedactingSpanExporter(
|
|
1531
1690
|
new (0, _exportertraceotlphttp.OTLPTraceExporter)({ url: `${endpoint}/v1/traces`, headers }),
|
|
1532
|
-
() =>
|
|
1691
|
+
() => redactor,
|
|
1692
|
+
queryPolicy
|
|
1533
1693
|
)
|
|
1534
1694
|
);
|
|
1535
1695
|
const environment = _nullishCoalesce(_nullishCoalesce(options.environment, () => ( process.env.NODE_ENV)), () => ( "production"));
|
|
1536
|
-
if (
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
const distro = _nullishCoalesce(options.distro, () => (
|
|
1540
|
-
|
|
1696
|
+
if (_chunkGYTQLITWcjs.isDebugEnabled.call(void 0, ) || options.debug === true) _chunkGYTQLITWcjs.setDebugMode.call(void 0, true);
|
|
1697
|
+
_chunkGYTQLITWcjs.debugLog.call(void 0, `initialising service=${options.service} endpoint=${endpoint}`);
|
|
1698
|
+
S.redactor = redactor;
|
|
1699
|
+
const distro = _nullishCoalesce(options.distro, () => ( _chunkGYTQLITWcjs.SDK_IDENTITY));
|
|
1700
|
+
_chunkGYTQLITWcjs.configureCompatCheck.call(void 0, { endpoint, enabled: options.compatCheck !== false, sdk: distro });
|
|
1541
1701
|
const resource = new (0, _resources.Resource)({
|
|
1542
1702
|
[_semanticconventions.ATTR_SERVICE_NAME]: options.service,
|
|
1543
1703
|
"service.instance.id": (options.instanceId || process.env.AUTTER_RUNTIME_INSTANCE_ID || _crypto.randomUUID.call(void 0, )).slice(0, 128),
|
|
@@ -1549,8 +1709,14 @@ function initAutterServer(options) {
|
|
|
1549
1709
|
"telemetry.distro.version": distro.version,
|
|
1550
1710
|
// Tells the ingester request metrics arrive on the metrics pipe, so
|
|
1551
1711
|
// it must not also fold our server spans into usage rollups (that
|
|
1552
|
-
// would double-count every sampled request)
|
|
1553
|
-
"autter.metrics_wired": true
|
|
1712
|
+
// would double-count every sampled request)...
|
|
1713
|
+
"autter.metrics_wired": true,
|
|
1714
|
+
// ...for the requests whose metric carries their route: those
|
|
1715
|
+
// request spans say so (`autter.metric_has_route`, see
|
|
1716
|
+
// captureRequestRoute). Ingesters honour metrics_wired only with
|
|
1717
|
+
// this, so an older SDK, whose Next.js metrics have no route, keeps
|
|
1718
|
+
// its span-fed per-route counts.
|
|
1719
|
+
"autter.metrics_routes": true
|
|
1554
1720
|
});
|
|
1555
1721
|
const rootSampler = new (0, _sdktracebase.TraceIdRatioBasedSampler)(_nullishCoalesce(options.traceSampleRate, () => ( 0.01)));
|
|
1556
1722
|
const headSampler = new (0, _sdktracebase.ParentBasedSampler)({
|
|
@@ -1567,6 +1733,7 @@ function initAutterServer(options) {
|
|
|
1567
1733
|
const retainTraces = retainOnError || slowThresholdMs > 0;
|
|
1568
1734
|
let sampler = retainTraces ? new RecordUnsampledSampler(headSampler) : headSampler;
|
|
1569
1735
|
if (options.llmTracing !== false) sampler = new LlmAwareSampler(sampler);
|
|
1736
|
+
sampler = new RouteLabelSampler(sampler);
|
|
1570
1737
|
const errorTraceBuffer = retainTraces ? new ErrorTraceRetentionProcessor(
|
|
1571
1738
|
new (0, _sdktracebase.BatchSpanProcessor)(traceExporter(), { scheduledDelayMillis: 2e3 }),
|
|
1572
1739
|
retainOnError,
|
|
@@ -1584,7 +1751,7 @@ function initAutterServer(options) {
|
|
|
1584
1751
|
// 60 s export.
|
|
1585
1752
|
temporalityPreference: _exportermetricsotlphttp.AggregationTemporalityPreference.DELTA
|
|
1586
1753
|
}),
|
|
1587
|
-
() =>
|
|
1754
|
+
() => redactor
|
|
1588
1755
|
),
|
|
1589
1756
|
exportIntervalMillis: _nullishCoalesce(options.metricIntervalMs, () => ( 6e4))
|
|
1590
1757
|
});
|
|
@@ -1605,15 +1772,16 @@ function initAutterServer(options) {
|
|
|
1605
1772
|
) })
|
|
1606
1773
|
],
|
|
1607
1774
|
instrumentations: [
|
|
1608
|
-
new (0, _instrumentationhttp.HttpInstrumentation)({ responseHook:
|
|
1775
|
+
new (0, _instrumentationhttp.HttpInstrumentation)({ responseHook: captureRequestRoute }),
|
|
1609
1776
|
..._nullishCoalesce(options.instrumentations, () => ( []))
|
|
1610
1777
|
]
|
|
1611
1778
|
});
|
|
1612
1779
|
sdk.start();
|
|
1780
|
+
patchLoadedHttpModules();
|
|
1613
1781
|
const stopMemoryMetrics = options.memoryMetrics === false ? null : startMemoryMetrics();
|
|
1614
|
-
|
|
1615
|
-
if (stopMemoryMetrics)
|
|
1616
|
-
if (options.llmTracing !== false)
|
|
1782
|
+
_chunkGYTQLITWcjs.noteCompatFeature.call(void 0, "endpoint_latency");
|
|
1783
|
+
if (stopMemoryMetrics) _chunkGYTQLITWcjs.noteCompatFeature.call(void 0, "memory_metrics");
|
|
1784
|
+
if (options.llmTracing !== false) _chunkGYTQLITWcjs.noteCompatFeature.call(void 0, "llm_calls");
|
|
1617
1785
|
const alwaysOnProvider = new (0, _sdktracebase.BasicTracerProvider)({
|
|
1618
1786
|
resource,
|
|
1619
1787
|
sampler: new (0, _sdktracebase.AlwaysOnSampler)(),
|
|
@@ -1625,25 +1793,25 @@ function initAutterServer(options) {
|
|
|
1625
1793
|
const processTracer = alwaysOnProvider.getTracer("autter-processes");
|
|
1626
1794
|
const llmTracer = alwaysOnProvider.getTracer("autter-llm");
|
|
1627
1795
|
function captureException2(error, attributes) {
|
|
1628
|
-
_optionalChain([errorTraceBuffer, 'optionalAccess',
|
|
1629
|
-
|
|
1630
|
-
const isErr =
|
|
1631
|
-
const message =
|
|
1632
|
-
const stackText = isErr && error.stack ?
|
|
1633
|
-
const split =
|
|
1634
|
-
const fingerprint =
|
|
1635
|
-
if (fingerprint["autter.fingerprint"])
|
|
1636
|
-
const redacted =
|
|
1796
|
+
_optionalChain([errorTraceBuffer, 'optionalAccess', _53 => _53.retainActiveTrace, 'call', _54 => _54()]);
|
|
1797
|
+
_chunkGYTQLITWcjs.telemetryStats.markCaptured();
|
|
1798
|
+
const isErr = _chunkRV4MJNM2cjs.isError.call(void 0, error);
|
|
1799
|
+
const message = redactor.text(isErr ? error.message : String(error));
|
|
1800
|
+
const stackText = isErr && error.stack ? redactor.text(error.stack) : "";
|
|
1801
|
+
const split = _chunkRV4MJNM2cjs.splitFingerprint.call(void 0, attributes);
|
|
1802
|
+
const fingerprint = _chunkRV4MJNM2cjs.fingerprintEventAttributes.call(void 0, split.fingerprint, redactor.text);
|
|
1803
|
+
if (fingerprint["autter.fingerprint"]) _chunkGYTQLITWcjs.noteCompatFeature.call(void 0, "fingerprint_override");
|
|
1804
|
+
const redacted = redactor(split.attributes);
|
|
1637
1805
|
const activeSpan = _api.trace.getActiveSpan();
|
|
1638
|
-
const reuseActive = _optionalChain([activeSpan, 'optionalAccess',
|
|
1806
|
+
const reuseActive = _optionalChain([activeSpan, 'optionalAccess', _55 => _55.isRecording, 'call', _56 => _56()]) === true;
|
|
1639
1807
|
const span = reuseActive ? activeSpan : errorTracer.startSpan(isErr ? error.name : "Error");
|
|
1640
1808
|
const structured = structuredErrorAttributes(error);
|
|
1641
|
-
const causes =
|
|
1809
|
+
const causes = _chunkRV4MJNM2cjs.errorAttributes.call(void 0, error);
|
|
1642
1810
|
const declared = {
|
|
1643
1811
|
...Object.fromEntries(Object.entries(causes).filter(([key]) => key !== "autter.error.internal")),
|
|
1644
1812
|
...fingerprint
|
|
1645
1813
|
};
|
|
1646
|
-
const requestId = _optionalChain([
|
|
1814
|
+
const requestId = _optionalChain([_chunkRV4MJNM2cjs.currentOperation.call(void 0, ), 'optionalAccess', _57 => _57.requestId]);
|
|
1647
1815
|
span.setAttributes({
|
|
1648
1816
|
"autter.severity": "error",
|
|
1649
1817
|
...redacted,
|
|
@@ -1651,8 +1819,8 @@ function initAutterServer(options) {
|
|
|
1651
1819
|
...requestId ? { "autter.request.id": requestId } : {}
|
|
1652
1820
|
});
|
|
1653
1821
|
markCaptured(error);
|
|
1654
|
-
|
|
1655
|
-
|
|
1822
|
+
_chunkRV4MJNM2cjs.noteOperationError.call(void 0, error);
|
|
1823
|
+
_chunkRV4MJNM2cjs.notifyException.call(void 0, error, { ...redacted, ...fingerprint });
|
|
1656
1824
|
if (isErr && stackText) {
|
|
1657
1825
|
span.addEvent("exception", {
|
|
1658
1826
|
"exception.type": error.name,
|
|
@@ -1660,17 +1828,17 @@ function initAutterServer(options) {
|
|
|
1660
1828
|
"exception.stacktrace": stackText,
|
|
1661
1829
|
...redacted["autter.handled"] === true ? { "autter.handled": true, "autter.sampled": redacted["autter.sampled"] === true } : {},
|
|
1662
1830
|
...declared,
|
|
1663
|
-
...
|
|
1831
|
+
..._chunkRV4MJNM2cjs.breadcrumbEventAttributes.call(void 0, redactor.text, error)
|
|
1664
1832
|
});
|
|
1665
1833
|
} else {
|
|
1666
|
-
const stack = _optionalChain([new Error(), 'access',
|
|
1834
|
+
const stack = _optionalChain([new Error(), 'access', _58 => _58.stack, 'optionalAccess', _59 => _59.split, 'call', _60 => _60("\n"), 'access', _61 => _61.filter, 'call', _62 => _62((line, i) => i === 0 || !line.includes("captureException")), 'access', _63 => _63.join, 'call', _64 => _64("\n")]);
|
|
1667
1835
|
span.addEvent("exception", {
|
|
1668
1836
|
"exception.type": isErr ? error.name : "Error",
|
|
1669
1837
|
"exception.message": message,
|
|
1670
|
-
...stack ? { "exception.stacktrace":
|
|
1838
|
+
...stack ? { "exception.stacktrace": redactor.text(stack) } : {},
|
|
1671
1839
|
...redacted["autter.handled"] === true ? { "autter.handled": true, "autter.sampled": redacted["autter.sampled"] === true } : {},
|
|
1672
1840
|
...declared,
|
|
1673
|
-
...
|
|
1841
|
+
..._chunkRV4MJNM2cjs.breadcrumbEventAttributes.call(void 0, redactor.text, error)
|
|
1674
1842
|
});
|
|
1675
1843
|
}
|
|
1676
1844
|
span.setStatus({ code: _api.SpanStatusCode.ERROR, message });
|
|
@@ -1678,35 +1846,35 @@ function initAutterServer(options) {
|
|
|
1678
1846
|
}
|
|
1679
1847
|
function captureMessage2(message, severity = "warning", attributes) {
|
|
1680
1848
|
if (severity === "error" || severity === "fatal") {
|
|
1681
|
-
_optionalChain([errorTraceBuffer, 'optionalAccess',
|
|
1849
|
+
_optionalChain([errorTraceBuffer, 'optionalAccess', _65 => _65.retainActiveTrace, 'call', _66 => _66()]);
|
|
1682
1850
|
}
|
|
1683
|
-
|
|
1684
|
-
const stack = _optionalChain([new Error(), 'access',
|
|
1685
|
-
const safeMessage =
|
|
1851
|
+
_chunkGYTQLITWcjs.telemetryStats.markCaptured();
|
|
1852
|
+
const stack = _optionalChain([new Error(), 'access', _67 => _67.stack, 'optionalAccess', _68 => _68.split, 'call', _69 => _69("\n"), 'access', _70 => _70.filter, 'call', _71 => _71((line, i) => i === 0 || !line.includes("captureMessage")), 'access', _72 => _72.join, 'call', _73 => _73("\n")]);
|
|
1853
|
+
const safeMessage = redactor.text(message);
|
|
1686
1854
|
const span = errorTracer.startSpan("Message", {
|
|
1687
|
-
attributes: { "autter.severity": severity, ...
|
|
1855
|
+
attributes: { "autter.severity": severity, ...redactor(attributes) }
|
|
1688
1856
|
});
|
|
1689
1857
|
span.addEvent("exception", {
|
|
1690
1858
|
"exception.type": "Message",
|
|
1691
1859
|
"exception.message": safeMessage,
|
|
1692
|
-
...stack ? { "exception.stacktrace":
|
|
1860
|
+
...stack ? { "exception.stacktrace": redactor.text(stack) } : {},
|
|
1693
1861
|
"autter.severity": severity,
|
|
1694
|
-
...
|
|
1862
|
+
..._chunkRV4MJNM2cjs.breadcrumbEventAttributes.call(void 0, redactor.text)
|
|
1695
1863
|
});
|
|
1696
1864
|
span.setStatus({ code: _api.SpanStatusCode.ERROR, message: safeMessage });
|
|
1697
1865
|
span.end();
|
|
1698
1866
|
}
|
|
1699
1867
|
function reportOutcome2(name, message, attributes) {
|
|
1700
|
-
_optionalChain([errorTraceBuffer, 'optionalAccess',
|
|
1701
|
-
|
|
1868
|
+
_optionalChain([errorTraceBuffer, 'optionalAccess', _74 => _74.retainActiveTrace, 'call', _75 => _75()]);
|
|
1869
|
+
_chunkGYTQLITWcjs.telemetryStats.markCaptured();
|
|
1702
1870
|
const activeSpan = _api.trace.getActiveSpan();
|
|
1703
|
-
const reuseActive = _optionalChain([activeSpan, 'optionalAccess',
|
|
1871
|
+
const reuseActive = _optionalChain([activeSpan, 'optionalAccess', _76 => _76.isRecording, 'call', _77 => _77()]) === true;
|
|
1704
1872
|
const span = reuseActive ? activeSpan : errorTracer.startSpan("OutcomeFailure");
|
|
1705
|
-
const safeOutcome =
|
|
1873
|
+
const safeOutcome = redactor({ "autter.outcome.name": name.slice(0, 200), "autter.outcome.message": message.slice(0, 1e3) });
|
|
1706
1874
|
const safeName = String(_nullishCoalesce(safeOutcome["autter.outcome.name"], () => ( "operation")));
|
|
1707
1875
|
const safeMessage = String(_nullishCoalesce(safeOutcome["autter.outcome.message"], () => ( "failed")));
|
|
1708
1876
|
span.addEvent("autter.outcome", {
|
|
1709
|
-
...
|
|
1877
|
+
...redactor(attributes),
|
|
1710
1878
|
"autter.outcome.status": "error",
|
|
1711
1879
|
"autter.outcome.name": safeName,
|
|
1712
1880
|
"autter.outcome.message": safeMessage
|
|
@@ -1714,7 +1882,7 @@ function initAutterServer(options) {
|
|
|
1714
1882
|
span.setStatus({ code: _api.SpanStatusCode.ERROR, message: safeMessage });
|
|
1715
1883
|
if (!reuseActive) span.end();
|
|
1716
1884
|
}
|
|
1717
|
-
|
|
1885
|
+
_chunkRV4MJNM2cjs.configureRuntimeLogger.call(void 0, {
|
|
1718
1886
|
endpoint,
|
|
1719
1887
|
apiKey: options.apiKey,
|
|
1720
1888
|
service: options.service,
|
|
@@ -1722,11 +1890,11 @@ function initAutterServer(options) {
|
|
|
1722
1890
|
distro,
|
|
1723
1891
|
release: options.release,
|
|
1724
1892
|
options: options.logging,
|
|
1725
|
-
redact:
|
|
1726
|
-
run: (name, fn, attributes, links) => runWithSpan(processTracer, name, fn,
|
|
1893
|
+
redact: redactor,
|
|
1894
|
+
run: (name, fn, attributes, links) => runWithSpan(processTracer, name, fn, redactor(attributes), links),
|
|
1727
1895
|
reportOutcome: reportOutcome2
|
|
1728
1896
|
});
|
|
1729
|
-
hookRequests = _optionalChain([options, 'access',
|
|
1897
|
+
S.hookRequests = _optionalChain([options, 'access', _78 => _78.logging, 'optionalAccess', _79 => _79.requests]) === true;
|
|
1730
1898
|
let onCrash = null;
|
|
1731
1899
|
let uninstallRejections = null;
|
|
1732
1900
|
if (options.captureGlobalErrors !== false) {
|
|
@@ -1746,7 +1914,7 @@ function initAutterServer(options) {
|
|
|
1746
1914
|
const flushTarget = {
|
|
1747
1915
|
forceFlush: async () => {
|
|
1748
1916
|
const results = await Promise.allSettled([
|
|
1749
|
-
|
|
1917
|
+
_chunkRV4MJNM2cjs.flushRuntimeLogs.call(void 0, ),
|
|
1750
1918
|
Promise.resolve().then(() => alwaysOnProvider.forceFlush()),
|
|
1751
1919
|
Promise.resolve().then(() => mainSpanProcessor.forceFlush()),
|
|
1752
1920
|
...errorTraceBuffer ? [Promise.resolve().then(() => errorTraceBuffer.forceFlush())] : [],
|
|
@@ -1760,116 +1928,118 @@ function initAutterServer(options) {
|
|
|
1760
1928
|
}
|
|
1761
1929
|
}
|
|
1762
1930
|
};
|
|
1763
|
-
|
|
1931
|
+
_chunkGYTQLITWcjs.registerFlushTarget.call(void 0, "active-server", flushTarget);
|
|
1764
1932
|
let autoFlushHandle = null;
|
|
1765
1933
|
if (options.autoFlush !== false) {
|
|
1766
|
-
autoFlushHandle =
|
|
1934
|
+
autoFlushHandle = _chunkGYTQLITWcjs.installAutterAutoFlush.call(void 0, );
|
|
1767
1935
|
}
|
|
1768
1936
|
const server = {
|
|
1769
1937
|
captureException: captureException2,
|
|
1770
1938
|
captureMessage: captureMessage2,
|
|
1771
1939
|
reportOutcome: reportOutcome2,
|
|
1772
|
-
withProcessSpan: (name, fn, attributes) => runWithSpan(processTracer, name, fn,
|
|
1940
|
+
withProcessSpan: (name, fn, attributes) => runWithSpan(processTracer, name, fn, redactor(attributes)),
|
|
1773
1941
|
withLlmCall: (info, fn) => runLlmSpan(llmTracer, info, fn),
|
|
1774
1942
|
trackLlmCall: (call) => recordLlmCall(llmTracer, call),
|
|
1775
1943
|
shutdown: async () => {
|
|
1776
|
-
const logShutdown = await Promise.allSettled([
|
|
1777
|
-
hookRequests = false;
|
|
1944
|
+
const logShutdown = await Promise.allSettled([_chunkRV4MJNM2cjs.shutdownRuntimeLogger.call(void 0, )]);
|
|
1778
1945
|
if (onCrash) process.off("uncaughtExceptionMonitor", onCrash);
|
|
1779
|
-
_optionalChain([uninstallRejections, 'optionalCall',
|
|
1780
|
-
_optionalChain([stopMemoryMetrics, 'optionalCall',
|
|
1781
|
-
active
|
|
1782
|
-
|
|
1783
|
-
|
|
1946
|
+
_optionalChain([uninstallRejections, 'optionalCall', _80 => _80()]);
|
|
1947
|
+
_optionalChain([stopMemoryMetrics, 'optionalCall', _81 => _81()]);
|
|
1948
|
+
if (S.active === server) {
|
|
1949
|
+
S.active = null;
|
|
1950
|
+
S.alwaysOnProvider = null;
|
|
1951
|
+
S.hookRequests = false;
|
|
1952
|
+
S.redactor = _chunkRV4MJNM2cjs.makeRedactor.call(void 0, true);
|
|
1953
|
+
}
|
|
1954
|
+
_optionalChain([autoFlushHandle, 'optionalAccess', _82 => _82.dispose, 'call', _83 => _83()]);
|
|
1784
1955
|
autoFlushHandle = null;
|
|
1785
|
-
|
|
1786
|
-
|
|
1956
|
+
_chunkGYTQLITWcjs.unregisterFlushTargets.call(void 0, );
|
|
1957
|
+
_chunkGYTQLITWcjs.telemetryStats.markAllFlushed();
|
|
1787
1958
|
await Promise.allSettled([alwaysOnProvider.shutdown(), sdk.shutdown()]);
|
|
1788
|
-
if (_optionalChain([logShutdown, 'access',
|
|
1959
|
+
if (_optionalChain([logShutdown, 'access', _84 => _84[0], 'optionalAccess', _85 => _85.status]) === "rejected") throw logShutdown[0].reason;
|
|
1789
1960
|
}
|
|
1790
1961
|
};
|
|
1791
|
-
active = server;
|
|
1792
|
-
|
|
1962
|
+
S.active = server;
|
|
1963
|
+
S.alwaysOnProvider = alwaysOnProvider;
|
|
1793
1964
|
return server;
|
|
1794
1965
|
}
|
|
1795
1966
|
function captureException(error, attributes) {
|
|
1796
|
-
if (active) {
|
|
1797
|
-
active.captureException(error, attributes);
|
|
1967
|
+
if (S.active) {
|
|
1968
|
+
S.active.captureException(error, attributes);
|
|
1798
1969
|
return;
|
|
1799
1970
|
}
|
|
1800
|
-
if (loggerOnlyCapture) {
|
|
1801
|
-
loggerOnlyCapture(error, attributes);
|
|
1971
|
+
if (S.loggerOnlyCapture) {
|
|
1972
|
+
S.loggerOnlyCapture(error, attributes);
|
|
1802
1973
|
return;
|
|
1803
1974
|
}
|
|
1804
1975
|
markCaptured(error);
|
|
1805
|
-
|
|
1806
|
-
const split =
|
|
1807
|
-
const fingerprint =
|
|
1808
|
-
|
|
1809
|
-
const span = _api.trace.getTracer("autter-errors").startSpan(
|
|
1810
|
-
attributes: { ...
|
|
1976
|
+
_chunkRV4MJNM2cjs.noteOperationError.call(void 0, error);
|
|
1977
|
+
const split = _chunkRV4MJNM2cjs.splitFingerprint.call(void 0, attributes);
|
|
1978
|
+
const fingerprint = _chunkRV4MJNM2cjs.fingerprintEventAttributes.call(void 0, split.fingerprint, S.redactor.text);
|
|
1979
|
+
_chunkRV4MJNM2cjs.notifyException.call(void 0, error, { ...split.attributes, ...fingerprint });
|
|
1980
|
+
const span = _api.trace.getTracer("autter-errors").startSpan(_chunkRV4MJNM2cjs.isError.call(void 0, error) ? error.name : "Error", {
|
|
1981
|
+
attributes: { ...S.redactor(split.attributes), ...fingerprint }
|
|
1811
1982
|
});
|
|
1812
1983
|
recordError(span, error);
|
|
1813
1984
|
span.end();
|
|
1814
1985
|
}
|
|
1815
|
-
var loggerOnlyCapture = null;
|
|
1816
1986
|
function setLoggerOnlyCapture(fn) {
|
|
1817
|
-
loggerOnlyCapture = fn;
|
|
1987
|
+
S.loggerOnlyCapture = fn;
|
|
1818
1988
|
}
|
|
1819
1989
|
function serverActive() {
|
|
1820
|
-
return active !== null;
|
|
1990
|
+
return S.active !== null;
|
|
1821
1991
|
}
|
|
1822
1992
|
setRequestExceptionCapturer((error, attributes) => captureException(error, attributes));
|
|
1823
1993
|
setRequestSpanAnnotator((attributes) => {
|
|
1824
1994
|
const span = _api.trace.getActiveSpan();
|
|
1825
|
-
if (_optionalChain([span, 'optionalAccess',
|
|
1995
|
+
if (_optionalChain([span, 'optionalAccess', _86 => _86.isRecording, 'call', _87 => _87()])) span.setAttributes(S.redactor(_chunkRV4MJNM2cjs.splitFingerprint.call(void 0, attributes).attributes));
|
|
1826
1996
|
});
|
|
1827
1997
|
function withProcessSpan(name, fn, attributes) {
|
|
1828
|
-
if (active) return active.withProcessSpan(name, fn, attributes);
|
|
1998
|
+
if (S.active) return S.active.withProcessSpan(name, fn, attributes);
|
|
1829
1999
|
return runWithSpan(
|
|
1830
2000
|
_api.trace.getTracer("autter-processes"),
|
|
1831
2001
|
name,
|
|
1832
2002
|
fn,
|
|
1833
|
-
|
|
2003
|
+
S.redactor(attributes)
|
|
1834
2004
|
);
|
|
1835
2005
|
}
|
|
1836
2006
|
function withLlmCall(info, fn) {
|
|
1837
|
-
if (active) return active.withLlmCall(info, fn);
|
|
2007
|
+
if (S.active) return S.active.withLlmCall(info, fn);
|
|
1838
2008
|
return runLlmSpan(_api.trace.getTracer("autter-llm"), info, fn);
|
|
1839
2009
|
}
|
|
1840
2010
|
function trackLlmCall(call) {
|
|
1841
|
-
if (active) {
|
|
1842
|
-
active.trackLlmCall(call);
|
|
2011
|
+
if (S.active) {
|
|
2012
|
+
S.active.trackLlmCall(call);
|
|
1843
2013
|
return;
|
|
1844
2014
|
}
|
|
1845
2015
|
recordLlmCall(_api.trace.getTracer("autter-llm"), call);
|
|
1846
2016
|
}
|
|
1847
2017
|
function captureMessage(message, severity = "warning", attributes) {
|
|
1848
|
-
if (active) {
|
|
1849
|
-
active.captureMessage(message, severity, attributes);
|
|
2018
|
+
if (S.active) {
|
|
2019
|
+
S.active.captureMessage(message, severity, attributes);
|
|
1850
2020
|
return;
|
|
1851
2021
|
}
|
|
1852
|
-
const safeMessage =
|
|
2022
|
+
const safeMessage = S.redactor.text(message);
|
|
1853
2023
|
const span = _api.trace.getTracer("autter-errors").startSpan("Message", {
|
|
1854
|
-
attributes: { "autter.severity": severity, ...
|
|
2024
|
+
attributes: { "autter.severity": severity, ...S.redactor(attributes) }
|
|
1855
2025
|
});
|
|
1856
2026
|
span.addEvent("exception", {
|
|
1857
2027
|
"exception.type": "Message",
|
|
1858
2028
|
"exception.message": safeMessage,
|
|
1859
2029
|
"autter.severity": severity,
|
|
1860
|
-
...
|
|
2030
|
+
..._chunkRV4MJNM2cjs.breadcrumbEventAttributes.call(void 0, S.redactor.text)
|
|
1861
2031
|
});
|
|
1862
2032
|
span.setStatus({ code: _api.SpanStatusCode.ERROR, message: safeMessage });
|
|
1863
2033
|
span.end();
|
|
1864
2034
|
}
|
|
1865
2035
|
function reportOutcome(name, message, attributes) {
|
|
1866
|
-
if (active) return active.reportOutcome(name, message, attributes);
|
|
2036
|
+
if (S.active) return S.active.reportOutcome(name, message, attributes);
|
|
1867
2037
|
const span = _api.trace.getTracer("autter-outcomes").startSpan("OutcomeFailure");
|
|
1868
|
-
const safeOutcome =
|
|
2038
|
+
const safeOutcome = _chunkRV4MJNM2cjs.redactAttributes.call(void 0, { "autter.outcome.name": name.slice(0, 200), "autter.outcome.message": message.slice(0, 1e3) });
|
|
1869
2039
|
const safeName = String(_nullishCoalesce(safeOutcome["autter.outcome.name"], () => ( "operation")));
|
|
1870
2040
|
const safeMessage = String(_nullishCoalesce(safeOutcome["autter.outcome.message"], () => ( "failed")));
|
|
1871
2041
|
span.addEvent("autter.outcome", {
|
|
1872
|
-
...
|
|
2042
|
+
..._chunkRV4MJNM2cjs.redactAttributes.call(void 0, attributes),
|
|
1873
2043
|
"autter.outcome.status": "error",
|
|
1874
2044
|
"autter.outcome.name": safeName,
|
|
1875
2045
|
"autter.outcome.message": safeMessage
|
|
@@ -1878,20 +2048,20 @@ function reportOutcome(name, message, attributes) {
|
|
|
1878
2048
|
span.end();
|
|
1879
2049
|
}
|
|
1880
2050
|
function makeSafeCapture(options) {
|
|
1881
|
-
const clean = (attributes) => attributes ? { ...
|
|
2051
|
+
const clean = (attributes) => attributes ? { ..._chunkRV4MJNM2cjs.redactAttributes.call(void 0, attributes, options) } : void 0;
|
|
1882
2052
|
return {
|
|
1883
2053
|
captureException: (error, attributes) => captureException(error, clean(attributes)),
|
|
1884
2054
|
captureMessage: (message, severity, attributes) => captureMessage(message, _nullishCoalesce(severity, () => ( "warning")), clean(attributes))
|
|
1885
2055
|
};
|
|
1886
2056
|
}
|
|
1887
2057
|
function alwaysOnTracer(name) {
|
|
1888
|
-
return
|
|
2058
|
+
return S.alwaysOnProvider ? S.alwaysOnProvider.getTracer(name) : _api.trace.getTracer(name);
|
|
1889
2059
|
}
|
|
1890
2060
|
function autterLlmTracer() {
|
|
1891
2061
|
return alwaysOnTracer("autter-llm");
|
|
1892
2062
|
}
|
|
1893
2063
|
async function emitLlmSelftestTrace() {
|
|
1894
|
-
const provider =
|
|
2064
|
+
const provider = S.alwaysOnProvider;
|
|
1895
2065
|
if (!provider) {
|
|
1896
2066
|
throw new Error(
|
|
1897
2067
|
"emitLlmSelftestTrace() requires initAutterServer() to have been called"
|
|
@@ -1905,7 +2075,7 @@ async function emitLlmSelftestTrace() {
|
|
|
1905
2075
|
attributes: { "autter.selftest": true }
|
|
1906
2076
|
},
|
|
1907
2077
|
(llm) => {
|
|
1908
|
-
traceId = _nullishCoalesce(_optionalChain([_api.trace, 'access',
|
|
2078
|
+
traceId = _nullishCoalesce(_optionalChain([_api.trace, 'access', _88 => _88.getActiveSpan, 'call', _89 => _89(), 'optionalAccess', _90 => _90.spanContext, 'call', _91 => _91(), 'access', _92 => _92.traceId]), () => ( ""));
|
|
1909
2079
|
llm.setUsage({ inputTokens: 1, outputTokens: 1 });
|
|
1910
2080
|
llm.setCost(0);
|
|
1911
2081
|
}
|
|
@@ -1933,7 +2103,7 @@ var CALL_METHODS = /* @__PURE__ */ new Set([
|
|
|
1933
2103
|
// openai beta structured outputs
|
|
1934
2104
|
]);
|
|
1935
2105
|
function detectProvider(client) {
|
|
1936
|
-
const name = _nullishCoalesce(_optionalChain([client, 'access',
|
|
2106
|
+
const name = _nullishCoalesce(_optionalChain([client, 'access', _93 => _93.constructor, 'optionalAccess', _94 => _94.name, 'optionalAccess', _95 => _95.toLowerCase, 'call', _96 => _96()]), () => ( ""));
|
|
1937
2107
|
for (const known of ["openai", "anthropic", "mistral", "groq", "cohere"]) {
|
|
1938
2108
|
if (name.includes(known)) return known;
|
|
1939
2109
|
}
|
|
@@ -1941,7 +2111,7 @@ function detectProvider(client) {
|
|
|
1941
2111
|
const baseUrl = String(
|
|
1942
2112
|
_nullishCoalesce(_nullishCoalesce(client.baseURL, () => ( client.baseUrl)), () => ( ""))
|
|
1943
2113
|
);
|
|
1944
|
-
const host = _nullishCoalesce(_optionalChain([baseUrl, 'access',
|
|
2114
|
+
const host = _nullishCoalesce(_optionalChain([baseUrl, 'access', _97 => _97.match, 'call', _98 => _98(/https?:\/\/([^/]+)/), 'optionalAccess', _99 => _99[1]]), () => ( ""));
|
|
1945
2115
|
if (host.includes("openai")) return "openai";
|
|
1946
2116
|
if (host.includes("anthropic")) return "anthropic";
|
|
1947
2117
|
if (host.includes("googleapis")) return "google";
|
|
@@ -1951,13 +2121,13 @@ function detectProvider(client) {
|
|
|
1951
2121
|
}
|
|
1952
2122
|
function extractUsage(result) {
|
|
1953
2123
|
const r = result;
|
|
1954
|
-
const usage = _nullishCoalesce(_optionalChain([r, 'optionalAccess',
|
|
1955
|
-
const meta = _optionalChain([r, 'optionalAccess',
|
|
1956
|
-
const details = _optionalChain([usage, 'optionalAccess',
|
|
1957
|
-
const cached = _nullishCoalesce(_nullishCoalesce(_optionalChain([usage, 'optionalAccess',
|
|
1958
|
-
const input = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([usage, 'optionalAccess',
|
|
1959
|
-
const output = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([usage, 'optionalAccess',
|
|
1960
|
-
const responseModel = _nullishCoalesce(_optionalChain([r, 'optionalAccess',
|
|
2124
|
+
const usage = _nullishCoalesce(_optionalChain([r, 'optionalAccess', _100 => _100.usage]), () => ( _optionalChain([r, 'optionalAccess', _101 => _101.message, 'optionalAccess', _102 => _102.usage])));
|
|
2125
|
+
const meta = _optionalChain([r, 'optionalAccess', _103 => _103.usageMetadata]);
|
|
2126
|
+
const details = _optionalChain([usage, 'optionalAccess', _104 => _104.prompt_tokens_details]);
|
|
2127
|
+
const cached = _nullishCoalesce(_nullishCoalesce(_optionalChain([usage, 'optionalAccess', _105 => _105.cache_read_input_tokens]), () => ( (typeof _optionalChain([details, 'optionalAccess', _106 => _106.cached_tokens]) === "number" ? details.cached_tokens : void 0))), () => ( _optionalChain([meta, 'optionalAccess', _107 => _107.cachedContentTokenCount])));
|
|
2128
|
+
const input = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([usage, 'optionalAccess', _108 => _108.prompt_tokens]), () => ( _optionalChain([usage, 'optionalAccess', _109 => _109.input_tokens]))), () => ( _optionalChain([meta, 'optionalAccess', _110 => _110.promptTokenCount]))), () => ( void 0));
|
|
2129
|
+
const output = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([usage, 'optionalAccess', _111 => _111.completion_tokens]), () => ( _optionalChain([usage, 'optionalAccess', _112 => _112.output_tokens]))), () => ( _optionalChain([meta, 'optionalAccess', _113 => _113.candidatesTokenCount]))), () => ( void 0));
|
|
2130
|
+
const responseModel = _nullishCoalesce(_optionalChain([r, 'optionalAccess', _114 => _114.model]), () => ( _optionalChain([r, 'optionalAccess', _115 => _115.modelVersion])));
|
|
1961
2131
|
return {
|
|
1962
2132
|
inputTokens: typeof input === "number" ? input : void 0,
|
|
1963
2133
|
outputTokens: typeof output === "number" ? output : void 0,
|
|
@@ -1966,7 +2136,7 @@ function extractUsage(result) {
|
|
|
1966
2136
|
};
|
|
1967
2137
|
}
|
|
1968
2138
|
function rollUp(model, usage) {
|
|
1969
|
-
|
|
2139
|
+
_chunkRV4MJNM2cjs.recordOperationAiUsage.call(void 0, {
|
|
1970
2140
|
model: _nullishCoalesce(usage.responseModel, () => ( model)),
|
|
1971
2141
|
...usage.inputTokens !== void 0 ? { inputTokens: usage.inputTokens } : {},
|
|
1972
2142
|
...usage.outputTokens !== void 0 ? { outputTokens: usage.outputTokens } : {},
|
|
@@ -2050,10 +2220,10 @@ function wrapStream(stream, span, model) {
|
|
|
2050
2220
|
});
|
|
2051
2221
|
}
|
|
2052
2222
|
function instrumentLlmClient(client, options) {
|
|
2053
|
-
const provider = (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2223
|
+
const provider = (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _116 => _116.provider]), () => ( detectProvider(client)))).toLowerCase();
|
|
2054
2224
|
const proxied = /* @__PURE__ */ new WeakMap();
|
|
2055
2225
|
function resolveUserId() {
|
|
2056
|
-
return typeof _optionalChain([options, 'optionalAccess',
|
|
2226
|
+
return typeof _optionalChain([options, 'optionalAccess', _117 => _117.userId]) === "function" ? options.userId() : _optionalChain([options, 'optionalAccess', _118 => _118.userId]);
|
|
2057
2227
|
}
|
|
2058
2228
|
function traceCall(fn, self, callPath, args) {
|
|
2059
2229
|
const request = args[0];
|
|
@@ -2067,7 +2237,7 @@ function instrumentLlmClient(client, options) {
|
|
|
2067
2237
|
"gen_ai.system": provider,
|
|
2068
2238
|
"gen_ai.request.model": request.model,
|
|
2069
2239
|
...userId ? { "autter.user_id": userId } : {},
|
|
2070
|
-
...redactWithActive(_optionalChain([options, 'optionalAccess',
|
|
2240
|
+
...redactWithActive(_optionalChain([options, 'optionalAccess', _119 => _119.attributes]))
|
|
2071
2241
|
}
|
|
2072
2242
|
});
|
|
2073
2243
|
let result;
|
|
@@ -2149,14 +2319,14 @@ function startCaughtExceptionSampler(options = {}) {
|
|
|
2149
2319
|
const rate = Math.max(0, Math.min(1, _nullishCoalesce(options.sampleRate, () => ( 0.01))));
|
|
2150
2320
|
const cap = Math.max(1, Math.min(100, _nullishCoalesce(options.maxPerMinute, () => ( 10))));
|
|
2151
2321
|
const session = new _inspector2.default.Session();
|
|
2152
|
-
let
|
|
2322
|
+
let active = true;
|
|
2153
2323
|
let minute = 0;
|
|
2154
2324
|
let sent = 0;
|
|
2155
2325
|
session.connect();
|
|
2156
2326
|
session.on("Debugger.paused", (message) => {
|
|
2157
2327
|
session.post("Debugger.resume", () => {
|
|
2158
2328
|
});
|
|
2159
|
-
if (!
|
|
2329
|
+
if (!active || message.params.reason !== "exception") return;
|
|
2160
2330
|
const nowMinute = Math.floor(Date.now() / 6e4);
|
|
2161
2331
|
if (nowMinute !== minute) {
|
|
2162
2332
|
minute = nowMinute;
|
|
@@ -2171,16 +2341,16 @@ function startCaughtExceptionSampler(options = {}) {
|
|
|
2171
2341
|
error.stack = `${error.name}: ${error.message}
|
|
2172
2342
|
${frames.join("\n")}`;
|
|
2173
2343
|
queueMicrotask(() => {
|
|
2174
|
-
if (
|
|
2344
|
+
if (active) captureException(error, { "autter.handled": true, "autter.sampled": true });
|
|
2175
2345
|
});
|
|
2176
2346
|
});
|
|
2177
2347
|
session.post("Debugger.enable", (error) => {
|
|
2178
|
-
if (!error &&
|
|
2348
|
+
if (!error && active) session.post("Debugger.setPauseOnExceptions", { state: "all" }, () => {
|
|
2179
2349
|
});
|
|
2180
2350
|
});
|
|
2181
2351
|
return { stop() {
|
|
2182
|
-
if (!
|
|
2183
|
-
|
|
2352
|
+
if (!active) return;
|
|
2353
|
+
active = false;
|
|
2184
2354
|
session.post("Debugger.setPauseOnExceptions", { state: "none" }, () => {
|
|
2185
2355
|
session.post("Debugger.disable", () => session.disconnect());
|
|
2186
2356
|
});
|
|
@@ -2191,9 +2361,9 @@ ${frames.join("\n")}`;
|
|
|
2191
2361
|
function recordBoundaryError(error, req, rule) {
|
|
2192
2362
|
try {
|
|
2193
2363
|
const state = requestStateOf(req);
|
|
2194
|
-
if (state)
|
|
2364
|
+
if (state) _chunkRV4MJNM2cjs.noteOperationError.call(void 0, error, false, state);
|
|
2195
2365
|
captureAtBoundary(error, state, rule);
|
|
2196
|
-
} catch (
|
|
2366
|
+
} catch (e32) {
|
|
2197
2367
|
}
|
|
2198
2368
|
}
|
|
2199
2369
|
function autterErrorHandler(options = {}) {
|
|
@@ -2203,12 +2373,12 @@ function autterErrorHandler(options = {}) {
|
|
|
2203
2373
|
};
|
|
2204
2374
|
}
|
|
2205
2375
|
function autterFastifyErrors(fastify, options, done) {
|
|
2206
|
-
const rule = _optionalChain([options, 'optionalAccess',
|
|
2376
|
+
const rule = _optionalChain([options, 'optionalAccess', _120 => _120.capture]);
|
|
2207
2377
|
fastify.addHook("onError", ((request, _reply, error, next) => {
|
|
2208
|
-
recordBoundaryError(error, _optionalChain([request, 'optionalAccess',
|
|
2378
|
+
recordBoundaryError(error, _optionalChain([request, 'optionalAccess', _121 => _121.raw]), rule);
|
|
2209
2379
|
next();
|
|
2210
2380
|
}));
|
|
2211
|
-
_optionalChain([done, 'optionalCall',
|
|
2381
|
+
_optionalChain([done, 'optionalCall', _122 => _122()]);
|
|
2212
2382
|
}
|
|
2213
2383
|
autterFastifyErrors[/* @__PURE__ */ Symbol.for("skip-override")] = true;
|
|
2214
2384
|
autterFastifyErrors[/* @__PURE__ */ Symbol.for("fastify.display-name")] = "autter-runtime-errors";
|
|
@@ -2217,7 +2387,7 @@ function autterKoa(options = {}) {
|
|
|
2217
2387
|
try {
|
|
2218
2388
|
await next();
|
|
2219
2389
|
} catch (error) {
|
|
2220
|
-
recordBoundaryError(error, _optionalChain([ctx, 'optionalAccess',
|
|
2390
|
+
recordBoundaryError(error, _optionalChain([ctx, 'optionalAccess', _123 => _123.req]), options.capture);
|
|
2221
2391
|
throw error;
|
|
2222
2392
|
}
|
|
2223
2393
|
};
|
|
@@ -2228,38 +2398,38 @@ function autterKoa(options = {}) {
|
|
|
2228
2398
|
|
|
2229
2399
|
|
|
2230
2400
|
|
|
2231
|
-
var
|
|
2401
|
+
var L = _chunkGYTQLITWcjs.sharedSlot.call(void 0, "logging", () => ({ active: null }));
|
|
2232
2402
|
function initAutterLogging(options) {
|
|
2233
|
-
if (
|
|
2403
|
+
if (L.active) return L.active;
|
|
2234
2404
|
if (serverActive()) {
|
|
2235
2405
|
console.warn(
|
|
2236
2406
|
"[autter-runtime] initAutterLogging() ignored: initAutterServer() is already active and includes logging"
|
|
2237
2407
|
);
|
|
2238
2408
|
return {
|
|
2239
2409
|
captureException,
|
|
2240
|
-
flush:
|
|
2410
|
+
flush: _chunkRV4MJNM2cjs.flushRuntimeLogs,
|
|
2241
2411
|
shutdown: async () => {
|
|
2242
2412
|
}
|
|
2243
2413
|
};
|
|
2244
2414
|
}
|
|
2245
|
-
if (
|
|
2415
|
+
if (_chunkGYTQLITWcjs.isDebugEnabled.call(void 0, ) || options.debug === true) _chunkGYTQLITWcjs.setDebugMode.call(void 0, true);
|
|
2246
2416
|
const endpoint = (_nullishCoalesce(options.endpoint, () => ( "https://otlp.autter.dev"))).replace(/\/$/, "");
|
|
2247
2417
|
const environment = _nullishCoalesce(_nullishCoalesce(options.environment, () => ( process.env.NODE_ENV)), () => ( "production"));
|
|
2248
|
-
const redact =
|
|
2418
|
+
const redact = _chunkRV4MJNM2cjs.makeRedactor.call(void 0, _nullishCoalesce(options.redactAttributes, () => ( true)));
|
|
2249
2419
|
const mode = _nullishCoalesce(options.exceptions, () => ( "auto"));
|
|
2250
|
-
|
|
2420
|
+
_chunkGYTQLITWcjs.debugLog.call(void 0, `initialising logger-only service=${options.service} endpoint=${endpoint}`);
|
|
2251
2421
|
function captureException2(error, attributes) {
|
|
2252
2422
|
markCaptured(error);
|
|
2253
|
-
const split =
|
|
2254
|
-
const fingerprint =
|
|
2423
|
+
const split = _chunkRV4MJNM2cjs.splitFingerprint.call(void 0, attributes);
|
|
2424
|
+
const fingerprint = _chunkRV4MJNM2cjs.fingerprintEventAttributes.call(void 0, split.fingerprint, redact.text);
|
|
2255
2425
|
const redacted = redact(split.attributes);
|
|
2256
2426
|
const span = _api.trace.getActiveSpan();
|
|
2257
|
-
if (mode === "auto" && _optionalChain([span, 'optionalAccess',
|
|
2258
|
-
|
|
2259
|
-
|
|
2427
|
+
if (mode === "auto" && _optionalChain([span, 'optionalAccess', _124 => _124.isRecording, 'call', _125 => _125()])) {
|
|
2428
|
+
_chunkRV4MJNM2cjs.noteOperationError.call(void 0, error);
|
|
2429
|
+
_chunkRV4MJNM2cjs.notifyException.call(void 0, error, { ...redacted, ...fingerprint });
|
|
2260
2430
|
span.setAttributes({ "autter.severity": "error", ...redacted, ...structuredErrorAttributes(error) });
|
|
2261
|
-
const declared = { ...
|
|
2262
|
-
if (
|
|
2431
|
+
const declared = { ..._chunkRV4MJNM2cjs.errorAttributes.call(void 0, error), ...fingerprint };
|
|
2432
|
+
if (_chunkRV4MJNM2cjs.isError.call(void 0, error)) {
|
|
2263
2433
|
span.addEvent("exception", {
|
|
2264
2434
|
"exception.type": error.name,
|
|
2265
2435
|
"exception.message": error.message,
|
|
@@ -2275,15 +2445,15 @@ function initAutterLogging(options) {
|
|
|
2275
2445
|
}
|
|
2276
2446
|
span.setStatus({
|
|
2277
2447
|
code: _api.SpanStatusCode.ERROR,
|
|
2278
|
-
message:
|
|
2448
|
+
message: _chunkRV4MJNM2cjs.isError.call(void 0, error) ? error.message : String(error)
|
|
2279
2449
|
});
|
|
2280
2450
|
return;
|
|
2281
2451
|
}
|
|
2282
|
-
|
|
2283
|
-
|
|
2452
|
+
_chunkRV4MJNM2cjs.notifyException.call(void 0, error, { ...redacted, ...fingerprint });
|
|
2453
|
+
_chunkRV4MJNM2cjs.captureExceptionAsLog.call(void 0, error, { ...redacted, ...fingerprint });
|
|
2284
2454
|
}
|
|
2285
2455
|
const captured = /* @__PURE__ */ new WeakSet();
|
|
2286
|
-
|
|
2456
|
+
_chunkRV4MJNM2cjs.configureRuntimeLogger.call(void 0, {
|
|
2287
2457
|
endpoint,
|
|
2288
2458
|
apiKey: _nullishCoalesce(options.apiKey, () => ( "")),
|
|
2289
2459
|
service: options.service,
|
|
@@ -2292,7 +2462,7 @@ function initAutterLogging(options) {
|
|
|
2292
2462
|
...options.logging ? { options: options.logging } : {},
|
|
2293
2463
|
redact,
|
|
2294
2464
|
reportOutcome: (name, message, attributes) => {
|
|
2295
|
-
|
|
2465
|
+
_chunkRV4MJNM2cjs.runtimeLogger.error(message, {
|
|
2296
2466
|
...attributes,
|
|
2297
2467
|
"autter.outcome.name": name.slice(0, 200),
|
|
2298
2468
|
"autter.outcome.message": message.slice(0, 1e3)
|
|
@@ -2319,30 +2489,30 @@ function initAutterLogging(options) {
|
|
|
2319
2489
|
(reason) => captureException2(reason, { "autter.unhandled_rejection": true })
|
|
2320
2490
|
);
|
|
2321
2491
|
}
|
|
2322
|
-
|
|
2323
|
-
let autoFlushHandle = options.autoFlush === false ? null :
|
|
2492
|
+
_chunkGYTQLITWcjs.registerFlushTarget.call(void 0, "logging", { forceFlush: () => _chunkRV4MJNM2cjs.flushRuntimeLogs.call(void 0, ) });
|
|
2493
|
+
let autoFlushHandle = options.autoFlush === false ? null : _chunkGYTQLITWcjs.installAutterAutoFlush.call(void 0, );
|
|
2324
2494
|
const handle = {
|
|
2325
2495
|
captureException: captureException2,
|
|
2326
|
-
flush:
|
|
2496
|
+
flush: _chunkRV4MJNM2cjs.flushRuntimeLogs,
|
|
2327
2497
|
shutdown: async () => {
|
|
2328
2498
|
process.off("uncaughtExceptionMonitor", onCrash);
|
|
2329
|
-
_optionalChain([uninstallRejections, 'optionalCall',
|
|
2499
|
+
_optionalChain([uninstallRejections, 'optionalCall', _126 => _126()]);
|
|
2330
2500
|
uninstallRejections = null;
|
|
2331
2501
|
setLoggerOnlyCapture(null);
|
|
2332
|
-
_optionalChain([autoFlushHandle, 'optionalAccess',
|
|
2502
|
+
_optionalChain([autoFlushHandle, 'optionalAccess', _127 => _127.dispose, 'call', _128 => _128()]);
|
|
2333
2503
|
autoFlushHandle = null;
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
await
|
|
2504
|
+
_chunkGYTQLITWcjs.unregisterFlushTargets.call(void 0, );
|
|
2505
|
+
if (L.active === handle) L.active = null;
|
|
2506
|
+
await _chunkRV4MJNM2cjs.shutdownRuntimeLogger.call(void 0, );
|
|
2337
2507
|
}
|
|
2338
2508
|
};
|
|
2339
|
-
|
|
2509
|
+
L.active = handle;
|
|
2340
2510
|
return handle;
|
|
2341
2511
|
}
|
|
2342
2512
|
|
|
2343
2513
|
// src/enrichers.ts
|
|
2344
2514
|
function headerOf(req, name) {
|
|
2345
|
-
const headers = _optionalChain([req, 'optionalAccess',
|
|
2515
|
+
const headers = _optionalChain([req, 'optionalAccess', _129 => _129.headers]);
|
|
2346
2516
|
if (!headers) return void 0;
|
|
2347
2517
|
if (typeof headers.get === "function") {
|
|
2348
2518
|
return _nullishCoalesce(headers.get(name), () => ( void 0));
|
|
@@ -2355,7 +2525,7 @@ function enrichUserAgent() {
|
|
|
2355
2525
|
return (event, { req }) => {
|
|
2356
2526
|
const ua = headerOf(req, "user-agent");
|
|
2357
2527
|
if (!ua) return;
|
|
2358
|
-
const info =
|
|
2528
|
+
const info = _chunkRV4MJNM2cjs.parseUserAgent.call(void 0, ua);
|
|
2359
2529
|
if (info.browser) event.attributes["user_agent.browser"] = info.browser;
|
|
2360
2530
|
if (info.os) event.attributes["user_agent.os"] = info.os;
|
|
2361
2531
|
event.attributes["user_agent.device"] = info.device;
|
|
@@ -2367,7 +2537,7 @@ function enrichRequestSize() {
|
|
|
2367
2537
|
const request = Number(headerOf(req, "content-length"));
|
|
2368
2538
|
if (Number.isFinite(request) && request >= 0)
|
|
2369
2539
|
event.attributes["http.request.body.size"] = request;
|
|
2370
|
-
const raw = _optionalChain([res, 'optionalAccess',
|
|
2540
|
+
const raw = _optionalChain([res, 'optionalAccess', _130 => _130.getHeader, 'optionalCall', _131 => _131(
|
|
2371
2541
|
"content-length"
|
|
2372
2542
|
)]);
|
|
2373
2543
|
const response = Number(raw);
|
|
@@ -2385,7 +2555,7 @@ var COUNTRY_HEADERS = [
|
|
|
2385
2555
|
function enrichEdgeGeo() {
|
|
2386
2556
|
return (event, { req }) => {
|
|
2387
2557
|
for (const name of COUNTRY_HEADERS) {
|
|
2388
|
-
const value = _optionalChain([headerOf, 'call',
|
|
2558
|
+
const value = _optionalChain([headerOf, 'call', _132 => _132(req, name), 'optionalAccess', _133 => _133.trim, 'call', _134 => _134(), 'access', _135 => _135.toUpperCase, 'call', _136 => _136()]);
|
|
2389
2559
|
if (value && /^[A-Z]{2}$/.test(value) && value !== "XX" && value !== "T1") {
|
|
2390
2560
|
event.attributes["geo.country.iso_code"] = value;
|
|
2391
2561
|
return;
|
|
@@ -2419,9 +2589,9 @@ var COMMIT_VARS = [
|
|
|
2419
2589
|
"SOURCE_VERSION"
|
|
2420
2590
|
];
|
|
2421
2591
|
function enrichDeployment(env = process.env) {
|
|
2422
|
-
const pick = (names) => names.map((name) => _optionalChain([env, 'access',
|
|
2423
|
-
const region = _optionalChain([pick, 'call',
|
|
2424
|
-
const commit = _optionalChain([pick, 'call',
|
|
2592
|
+
const pick = (names) => names.map((name) => _optionalChain([env, 'access', _137 => _137[name], 'optionalAccess', _138 => _138.trim, 'call', _139 => _139()])).find((value) => value);
|
|
2593
|
+
const region = _optionalChain([pick, 'call', _140 => _140(REGION_VARS), 'optionalAccess', _141 => _141.slice, 'call', _142 => _142(0, 64)]);
|
|
2594
|
+
const commit = _optionalChain([pick, 'call', _143 => _143(COMMIT_VARS), 'optionalAccess', _144 => _144.slice, 'call', _145 => _145(0, 64)]);
|
|
2425
2595
|
return (event) => {
|
|
2426
2596
|
if (region) event.attributes["deployment.region"] = region;
|
|
2427
2597
|
if (commit) event.attributes["deployment.commit"] = commit;
|
|
@@ -2482,4 +2652,4 @@ function enrichDeployment(env = process.env) {
|
|
|
2482
2652
|
|
|
2483
2653
|
|
|
2484
2654
|
|
|
2485
|
-
exports.CODE_PATTERN =
|
|
2655
|
+
exports.CODE_PATTERN = _chunkRV4MJNM2cjs.CODE_PATTERN; exports.COMPAT_MANIFEST = _chunkGYTQLITWcjs.COMPAT_MANIFEST; exports.INGESTER_VERSION_HEADER = _chunkGYTQLITWcjs.INGESTER_VERSION_HEADER; exports.RuntimeError = _chunkRV4MJNM2cjs.RuntimeError; exports.SDK_IDENTITY = _chunkGYTQLITWcjs.SDK_IDENTITY; exports.addBreadcrumb = _chunkRV4MJNM2cjs.addBreadcrumb; exports.autterErrorHandler = autterErrorHandler; exports.autterErrorResponse = autterErrorResponse; exports.autterFastify = autterFastify; exports.autterFastifyErrors = autterFastifyErrors; exports.autterKoa = autterKoa; exports.autterRequests = autterRequests; exports.captureException = captureException; exports.captureMessage = captureMessage; exports.captureRequestError = captureRequestError; exports.consoleSink = _chunkRV4MJNM2cjs.consoleSink; exports.createBrowserRelayFetchHandler = createBrowserRelayFetchHandler; exports.createBrowserRelayHandler = createBrowserRelayHandler; exports.createRuntimeLogger = _chunkRV4MJNM2cjs.createRuntimeLogger; exports.defineRuntimeErrors = _chunkRV4MJNM2cjs.defineRuntimeErrors; exports.emitLlmSelftestTrace = emitLlmSelftestTrace; exports.enrichDeployment = enrichDeployment; exports.enrichEdgeGeo = enrichEdgeGeo; exports.enrichRequestSize = enrichRequestSize; exports.enrichUserAgent = enrichUserAgent; exports.errorAttributes = _chunkRV4MJNM2cjs.errorAttributes; exports.evaluateCompat = _chunkGYTQLITWcjs.evaluateCompat; exports.fetchIngesterCompat = _chunkGYTQLITWcjs.fetchIngesterCompat; exports.fileSink = _chunkRV4MJNM2cjs.fileSink; exports.flushRuntimeLogs = _chunkRV4MJNM2cjs.flushRuntimeLogs; exports.initAutterLogging = initAutterLogging; exports.initAutterServer = initAutterServer; exports.installAutterAutoFlush = _chunkGYTQLITWcjs.installAutterAutoFlush; exports.instrumentLlmClient = instrumentLlmClient; exports.isRuntimeErrorLike = _chunkRV4MJNM2cjs.isRuntimeErrorLike; exports.makeSafeCapture = makeSafeCapture; exports.otlpSink = _chunkRV4MJNM2cjs.otlpSink; exports.redactAttributes = _chunkRV4MJNM2cjs.redactAttributes; exports.redactText = _chunkRV4MJNM2cjs.redactText; exports.reportOutcome = reportOutcome; exports.runDoctor = _chunkHKVFURYTcjs.runDoctor; exports.runInBackground = _chunkRV4MJNM2cjs.runInBackground; exports.runtimeContext = _chunkRV4MJNM2cjs.runtimeContext; exports.runtimeLogStats = _chunkRV4MJNM2cjs.runtimeLogStats; exports.runtimeLogger = _chunkRV4MJNM2cjs.runtimeLogger; exports.sanitizeBrowserPayload = sanitizeBrowserPayload; exports.startCaughtExceptionSampler = startCaughtExceptionSampler; exports.toClientError = _chunkRV4MJNM2cjs.toClientError; exports.trackLlmCall = trackLlmCall; exports.unhandledRejectionsMode = unhandledRejectionsMode; exports.withLlmCall = withLlmCall; exports.withProcessSpan = withProcessSpan; exports.withRuntimeOperation = _chunkRV4MJNM2cjs.withRuntimeOperation; exports.withRuntimeRequest = withRuntimeRequest;
|