@autter/runtime-node 1.5.0 → 1.6.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 +96 -1
- package/dist/{chunk-GI47WGRR.cjs → chunk-ARN26OK6.cjs} +32 -1
- package/dist/{chunk-3TJHUCZ6.js → chunk-FBKYOHU2.js} +290 -28
- package/dist/{chunk-L7HWKMCZ.js → chunk-OY2HTUWY.js} +32 -1
- package/dist/{chunk-L6SRL65J.cjs → chunk-UGNPCOIW.cjs} +11 -11
- package/dist/{chunk-P4VRTFAV.cjs → chunk-UKYTXZOQ.cjs} +302 -40
- package/dist/{chunk-ZS4WQJQR.js → chunk-Y4T7SQMO.js} +1 -1
- package/dist/cli.cjs +29 -9
- package/dist/cli.js +22 -2
- package/dist/index.cjs +474 -187
- package/dist/index.d.cts +148 -7
- package/dist/index.d.ts +148 -7
- package/dist/index.js +335 -48
- package/dist/{sinks-RFV76lF1.d.cts → sinks-CPGDyfU8.d.cts} +29 -1
- package/dist/{sinks-RFV76lF1.d.ts → sinks-CPGDyfU8.d.ts} +29 -1
- package/dist/testing.cjs +8 -8
- package/dist/testing.d.cts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +2 -2
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -38,17 +38,17 @@
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
var _chunkP4VRTFAVcjs = require('./chunk-P4VRTFAV.cjs');
|
|
42
41
|
|
|
43
42
|
|
|
44
|
-
var _chunkL6SRL65Jcjs = require('./chunk-L6SRL65J.cjs');
|
|
45
43
|
|
|
46
44
|
|
|
47
45
|
|
|
48
46
|
|
|
49
47
|
|
|
48
|
+
var _chunkUKYTXZOQcjs = require('./chunk-UKYTXZOQ.cjs');
|
|
50
49
|
|
|
51
50
|
|
|
51
|
+
var _chunkUGNPCOIWcjs = require('./chunk-UGNPCOIW.cjs');
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
|
|
@@ -62,7 +62,14 @@ var _chunkL6SRL65Jcjs = require('./chunk-L6SRL65J.cjs');
|
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
var _chunkARN26OK6cjs = require('./chunk-ARN26OK6.cjs');
|
|
66
73
|
|
|
67
74
|
// src/relay.ts
|
|
68
75
|
var IpWindow = (_class = class {
|
|
@@ -102,6 +109,7 @@ var EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
|
102
109
|
"timing"
|
|
103
110
|
]);
|
|
104
111
|
var SEVERITIES = /* @__PURE__ */ new Set(["fatal", "error", "warning", "info"]);
|
|
112
|
+
var TRACE_ID = /^(?!0{32})[0-9a-f]{32}$/;
|
|
105
113
|
var CONTEXT_MAX_DEPTH = 6;
|
|
106
114
|
var CONTEXT_MAX_NODES = 256;
|
|
107
115
|
var CONTEXT_MAX_STRING = 4e3;
|
|
@@ -214,7 +222,28 @@ function relayContext(raw, redactor) {
|
|
|
214
222
|
const bounded = boundContext(raw);
|
|
215
223
|
return Array.isArray(bounded) ? {} : { context: redactor(bounded) };
|
|
216
224
|
}
|
|
217
|
-
|
|
225
|
+
function relayBreadcrumbs(raw, redactor) {
|
|
226
|
+
const breadcrumbs = _chunkUKYTXZOQcjs.sanitizeBreadcrumbs.call(void 0, raw, redactor);
|
|
227
|
+
return breadcrumbs ? { breadcrumbs } : {};
|
|
228
|
+
}
|
|
229
|
+
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}$/;
|
|
230
|
+
function relayDebugIds(raw, redactor) {
|
|
231
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return {};
|
|
232
|
+
const debugIds = {};
|
|
233
|
+
let count = 0;
|
|
234
|
+
for (const [url, id] of Object.entries(raw)) {
|
|
235
|
+
if (count >= 50) break;
|
|
236
|
+
if (typeof id !== "string" || !DEBUG_ID_RE.test(id) || url.length > 1e3) continue;
|
|
237
|
+
debugIds[redactor.text(url.split(/[?#]/)[0])] = id.toLowerCase();
|
|
238
|
+
count++;
|
|
239
|
+
}
|
|
240
|
+
return count ? { debugIds } : {};
|
|
241
|
+
}
|
|
242
|
+
function relayFingerprint(raw, redactor) {
|
|
243
|
+
const values = _chunkUKYTXZOQcjs.fingerprintValues.call(void 0, raw, redactor.text);
|
|
244
|
+
return values ? { fingerprint: Array.isArray(raw) ? values : values[0] } : {};
|
|
245
|
+
}
|
|
246
|
+
var defaultRelayRedactor = _chunkUKYTXZOQcjs.makeRedactor.call(void 0, true);
|
|
218
247
|
function sanitizeBrowserPayload(raw, redactor = defaultRelayRedactor) {
|
|
219
248
|
if (typeof raw !== "object" || raw === null) return null;
|
|
220
249
|
const p = raw;
|
|
@@ -241,7 +270,11 @@ function sanitizeBrowserPayload(raw, redactor = defaultRelayRedactor) {
|
|
|
241
270
|
...typeof e.line === "number" ? { line: e.line } : {},
|
|
242
271
|
...typeof e.column === "number" ? { column: e.column } : {},
|
|
243
272
|
...typeof e.route === "string" ? { route: e.route.split("?")[0].slice(0, 1e3) } : {},
|
|
244
|
-
...typeof e.context === "object" && e.context !== null ? relayContext(e.context, redactor) : {}
|
|
273
|
+
...typeof e.context === "object" && e.context !== null ? relayContext(e.context, redactor) : {},
|
|
274
|
+
...relayBreadcrumbs(e.breadcrumbs, redactor),
|
|
275
|
+
...relayDebugIds(e.debugIds, redactor),
|
|
276
|
+
...relayFingerprint(e.fingerprint, redactor),
|
|
277
|
+
...typeof e.traceId === "string" && TRACE_ID.test(e.traceId) ? { traceId: e.traceId } : {}
|
|
245
278
|
});
|
|
246
279
|
}
|
|
247
280
|
return {
|
|
@@ -259,7 +292,7 @@ function forward(payload, opts) {
|
|
|
259
292
|
const endpoint = (_nullishCoalesce(opts.endpoint, () => ( DEFAULT_ENDPOINT))).replace(/\/$/, "");
|
|
260
293
|
const url = `${endpoint}/v1/browser`;
|
|
261
294
|
const compat = opts.compatCheck !== false;
|
|
262
|
-
if (compat)
|
|
295
|
+
if (compat) _chunkARN26OK6cjs.ensureCompatConfigured.call(void 0, endpoint);
|
|
263
296
|
void fetch(url, {
|
|
264
297
|
method: "POST",
|
|
265
298
|
headers: {
|
|
@@ -273,9 +306,12 @@ function forward(payload, opts) {
|
|
|
273
306
|
const types = new Set(
|
|
274
307
|
(_nullishCoalesce(payload.events, () => ( []))).map((e) => String(e.type))
|
|
275
308
|
);
|
|
276
|
-
|
|
277
|
-
for (const feature of
|
|
278
|
-
|
|
309
|
+
_chunkARN26OK6cjs.observeIngesterResponse.call(void 0, { status: response.status, headers: response.headers });
|
|
310
|
+
for (const feature of _chunkARN26OK6cjs.featuresForBrowserEvents.call(void 0, types)) _chunkARN26OK6cjs.noteCompatFeature.call(void 0, feature);
|
|
311
|
+
if ((_nullishCoalesce(payload.events, () => ( []))).some((e) => e.traceId)) {
|
|
312
|
+
_chunkARN26OK6cjs.noteCompatFeature.call(void 0, "browser_trace_propagation");
|
|
313
|
+
}
|
|
314
|
+
_chunkARN26OK6cjs.noteRelayRejection.call(void 0, types, response.status, response.headers);
|
|
279
315
|
}).catch((err) => {
|
|
280
316
|
(_nullishCoalesce(opts.onError, () => ( ((e) => console.warn("autter relay forward failed:", e)))))(
|
|
281
317
|
err
|
|
@@ -284,7 +320,7 @@ function forward(payload, opts) {
|
|
|
284
320
|
}
|
|
285
321
|
function createBrowserRelayFetchHandler(opts) {
|
|
286
322
|
const maxBody = _nullishCoalesce(opts.maxBodyBytes, () => ( DEFAULT_MAX_BODY));
|
|
287
|
-
const redactor = opts.redact === void 0 || opts.redact === true ? defaultRelayRedactor :
|
|
323
|
+
const redactor = opts.redact === void 0 || opts.redact === true ? defaultRelayRedactor : _chunkUKYTXZOQcjs.makeRedactor.call(void 0, opts.redact);
|
|
288
324
|
const limiter = opts.perIpRateLimit === false ? null : new IpWindow(_nullishCoalesce(opts.perIpRateLimit, () => ( 120)));
|
|
289
325
|
return async (request) => {
|
|
290
326
|
if (request.method !== "POST") {
|
|
@@ -331,7 +367,7 @@ function createBrowserRelayFetchHandler(opts) {
|
|
|
331
367
|
}
|
|
332
368
|
function createBrowserRelayHandler(opts) {
|
|
333
369
|
const maxBody = _nullishCoalesce(opts.maxBodyBytes, () => ( DEFAULT_MAX_BODY));
|
|
334
|
-
const redactor = opts.redact === void 0 || opts.redact === true ? defaultRelayRedactor :
|
|
370
|
+
const redactor = opts.redact === void 0 || opts.redact === true ? defaultRelayRedactor : _chunkUKYTXZOQcjs.makeRedactor.call(void 0, opts.redact);
|
|
335
371
|
const limiter = opts.perIpRateLimit === false ? null : new IpWindow(_nullishCoalesce(opts.perIpRateLimit, () => ( 120)));
|
|
336
372
|
function respond(res, status, body) {
|
|
337
373
|
res.statusCode = status;
|
|
@@ -602,6 +638,7 @@ function startMemoryMetrics() {
|
|
|
602
638
|
// src/requests.ts
|
|
603
639
|
var _async_hooks = require('async_hooks');
|
|
604
640
|
|
|
641
|
+
|
|
605
642
|
var REQUEST_STATE = /* @__PURE__ */ Symbol.for("autter.runtime.request");
|
|
606
643
|
var BOUND = /* @__PURE__ */ Symbol.for("autter.runtime.bound");
|
|
607
644
|
var CAPTURED = /* @__PURE__ */ new WeakSet();
|
|
@@ -610,6 +647,11 @@ var capturer = () => {
|
|
|
610
647
|
function setRequestExceptionCapturer(fn) {
|
|
611
648
|
capturer = fn;
|
|
612
649
|
}
|
|
650
|
+
var annotator = () => {
|
|
651
|
+
};
|
|
652
|
+
function setRequestSpanAnnotator(fn) {
|
|
653
|
+
annotator = fn;
|
|
654
|
+
}
|
|
613
655
|
function markCaptured(error) {
|
|
614
656
|
if (error && typeof error === "object") CAPTURED.add(error);
|
|
615
657
|
}
|
|
@@ -622,18 +664,49 @@ function expressRouteOf(req) {
|
|
|
622
664
|
return route.startsWith("/") ? route : null;
|
|
623
665
|
}
|
|
624
666
|
function defaultShouldCapture(error) {
|
|
625
|
-
return error instanceof
|
|
667
|
+
return error instanceof _chunkUKYTXZOQcjs.RuntimeError || _chunkUKYTXZOQcjs.errorCodeOf.call(void 0, error) !== void 0 || _chunkUKYTXZOQcjs.responseStatusOf.call(void 0, error) >= 500;
|
|
668
|
+
}
|
|
669
|
+
function onRequestSpan(fn) {
|
|
670
|
+
const active2 = _api.context.active();
|
|
671
|
+
const metadata = _core.getRPCMetadata.call(void 0, active2);
|
|
672
|
+
const span = _optionalChain([metadata, 'optionalAccess', _11 => _11.type]) === _core.RPCType.HTTP ? metadata.span : void 0;
|
|
673
|
+
if (!span || !span.isRecording() || _api.trace.getSpan(active2) === span) {
|
|
674
|
+
fn();
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
_api.context.with(_api.trace.setSpan(active2, span), fn);
|
|
626
678
|
}
|
|
627
|
-
function captureAtBoundary(error, state, rule = void 0) {
|
|
628
|
-
|
|
679
|
+
function captureAtBoundary(error, state, rule = void 0, attributes) {
|
|
680
|
+
let wanted;
|
|
681
|
+
try {
|
|
682
|
+
wanted = typeof rule === "function" ? rule(error) : rule === void 0 ? defaultShouldCapture(error) : rule;
|
|
683
|
+
} catch (e13) {
|
|
684
|
+
wanted = false;
|
|
685
|
+
}
|
|
629
686
|
if (!wanted) return;
|
|
630
687
|
if (error && typeof error === "object" && CAPTURED.has(error)) return;
|
|
631
688
|
markCaptured(error);
|
|
632
689
|
try {
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
690
|
+
const run = () => onRequestSpan(() => capturer(error, attributes));
|
|
691
|
+
if (state && !state.sealed) _chunkUKYTXZOQcjs.local.run(state, run);
|
|
692
|
+
else run();
|
|
693
|
+
} catch (e14) {
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
function requestStateOf(req) {
|
|
697
|
+
if (!req || typeof req !== "object") return void 0;
|
|
698
|
+
return req[REQUEST_STATE];
|
|
699
|
+
}
|
|
700
|
+
function captureRequestError(error, attributes) {
|
|
701
|
+
if (error && typeof error === "object" && CAPTURED.has(error)) {
|
|
702
|
+
if (!attributes) return;
|
|
703
|
+
try {
|
|
704
|
+
onRequestSpan(() => annotator(attributes));
|
|
705
|
+
} catch (e15) {
|
|
706
|
+
}
|
|
707
|
+
return;
|
|
636
708
|
}
|
|
709
|
+
captureAtBoundary(error, _chunkUKYTXZOQcjs.currentOperation.call(void 0, ), true, attributes);
|
|
637
710
|
}
|
|
638
711
|
function bindEmitter(emitter, state) {
|
|
639
712
|
const target = emitter;
|
|
@@ -645,7 +718,7 @@ function bindEmitter(emitter, state) {
|
|
|
645
718
|
let wrapped = wrappers.get(listener);
|
|
646
719
|
if (!wrapped) {
|
|
647
720
|
wrapped = function(...args) {
|
|
648
|
-
return
|
|
721
|
+
return _chunkUKYTXZOQcjs.local.run(
|
|
649
722
|
state,
|
|
650
723
|
() => listener.apply(this, args)
|
|
651
724
|
);
|
|
@@ -700,7 +773,7 @@ function exposeOnCors(res, header) {
|
|
|
700
773
|
if (value && key && inline) inline[key] = value;
|
|
701
774
|
else if (value) res.setHeader("access-control-expose-headers", value);
|
|
702
775
|
}
|
|
703
|
-
} catch (
|
|
776
|
+
} catch (e16) {
|
|
704
777
|
}
|
|
705
778
|
return original.apply(this, args);
|
|
706
779
|
};
|
|
@@ -712,7 +785,7 @@ function pathOf(req) {
|
|
|
712
785
|
function finishRequest(state, input) {
|
|
713
786
|
if (state.sealed) return;
|
|
714
787
|
state.name = (_nullishCoalesce(input.name, () => ( `${input.method} ${input.route}`))).slice(0, 200);
|
|
715
|
-
state.outcome =
|
|
788
|
+
state.outcome = _chunkUKYTXZOQcjs.requestOutcome.call(void 0, {
|
|
716
789
|
...state.explicitOutcome ? { explicit: state.outcome } : {},
|
|
717
790
|
...state.error !== void 0 ? { error: state.error } : {},
|
|
718
791
|
...state.errorThrown ? { thrown: true } : {},
|
|
@@ -720,15 +793,15 @@ function finishRequest(state, input) {
|
|
|
720
793
|
aborted: input.aborted
|
|
721
794
|
});
|
|
722
795
|
const span = _api.trace.getActiveSpan();
|
|
723
|
-
if (_optionalChain([span, 'optionalAccess',
|
|
796
|
+
if (_optionalChain([span, 'optionalAccess', _12 => _12.isRecording, 'call', _13 => _13()])) span.setAttribute("autter.operation.outcome", state.outcome);
|
|
724
797
|
if (input.span) {
|
|
725
798
|
const remote = _api.trace.wrapSpanContext(input.span);
|
|
726
799
|
_api.context.with(
|
|
727
800
|
_api.trace.setSpan(_api.context.active(), remote),
|
|
728
|
-
() =>
|
|
801
|
+
() => _chunkUKYTXZOQcjs.reportExplicitFailure.call(void 0, state)
|
|
729
802
|
);
|
|
730
|
-
} else
|
|
731
|
-
|
|
803
|
+
} else _chunkUKYTXZOQcjs.reportExplicitFailure.call(void 0, state);
|
|
804
|
+
_chunkUKYTXZOQcjs.emitSummary.call(void 0, state, {
|
|
732
805
|
http: {
|
|
733
806
|
"http.request.method": input.method,
|
|
734
807
|
"http.route": input.route,
|
|
@@ -739,14 +812,14 @@ function finishRequest(state, input) {
|
|
|
739
812
|
});
|
|
740
813
|
}
|
|
741
814
|
function beginNodeRequest(req, res, options, route) {
|
|
742
|
-
const header = (_nullishCoalesce(options.requestIdHeader, () => (
|
|
743
|
-
const requestId =
|
|
815
|
+
const header = (_nullishCoalesce(options.requestIdHeader, () => ( _chunkUKYTXZOQcjs.DEFAULT_REQUEST_ID_HEADER))).toLowerCase();
|
|
816
|
+
const requestId = _chunkUKYTXZOQcjs.resolveRequestId.call(void 0,
|
|
744
817
|
options.trustRequestId === false ? void 0 : req.headers[header]
|
|
745
818
|
);
|
|
746
819
|
const method = (_nullishCoalesce(req.method, () => ( "GET"))).toUpperCase();
|
|
747
820
|
const path = pathOf(req);
|
|
748
|
-
const state =
|
|
749
|
-
name: `${method} ${
|
|
821
|
+
const state = _chunkUKYTXZOQcjs.createRequestState.call(void 0, {
|
|
822
|
+
name: `${method} ${_chunkUKYTXZOQcjs.normalizeRoutePath.call(void 0, path)}`,
|
|
750
823
|
requestId,
|
|
751
824
|
req,
|
|
752
825
|
res
|
|
@@ -755,22 +828,22 @@ function beginNodeRequest(req, res, options, route) {
|
|
|
755
828
|
try {
|
|
756
829
|
if (!res.headersSent) res.setHeader(header, requestId);
|
|
757
830
|
exposeOnCors(res, header);
|
|
758
|
-
} catch (
|
|
831
|
+
} catch (e17) {
|
|
759
832
|
}
|
|
760
833
|
const span = _api.trace.getActiveSpan();
|
|
761
|
-
if (_optionalChain([span, 'optionalAccess',
|
|
834
|
+
if (_optionalChain([span, 'optionalAccess', _14 => _14.isRecording, 'call', _15 => _15()]))
|
|
762
835
|
span.setAttributes({
|
|
763
836
|
"autter.request.id": requestId,
|
|
764
837
|
"autter.operation.kind": "request"
|
|
765
838
|
});
|
|
766
|
-
const spanContext = _optionalChain([span, 'optionalAccess',
|
|
839
|
+
const spanContext = _optionalChain([span, 'optionalAccess', _16 => _16.spanContext, 'call', _17 => _17()]);
|
|
767
840
|
bindEmitter(req, state);
|
|
768
841
|
bindEmitter(res, state);
|
|
769
842
|
let finished = false;
|
|
770
843
|
const done = () => {
|
|
771
844
|
finishRequest(state, {
|
|
772
845
|
method,
|
|
773
|
-
route: _nullishCoalesce(_nullishCoalesce(_optionalChain([route, 'optionalCall',
|
|
846
|
+
route: _nullishCoalesce(_nullishCoalesce(_optionalChain([route, 'optionalCall', _18 => _18()]), () => ( expressRouteOf(req))), () => ( _chunkUKYTXZOQcjs.normalizeRoutePath.call(void 0, path))),
|
|
774
847
|
status: res.statusCode,
|
|
775
848
|
aborted: !finished,
|
|
776
849
|
...spanContext ? { span: spanContext } : {}
|
|
@@ -784,50 +857,50 @@ function beginNodeRequest(req, res, options, route) {
|
|
|
784
857
|
return state;
|
|
785
858
|
}
|
|
786
859
|
function autterRequests(options = {}) {
|
|
787
|
-
const ignored =
|
|
860
|
+
const ignored = _chunkUKYTXZOQcjs.compileIgnore.call(void 0, options.ignore);
|
|
788
861
|
return function autterRequestsMiddleware(req, res, next) {
|
|
789
862
|
if (req[REQUEST_STATE] || ignored(pathOf(req))) {
|
|
790
863
|
next();
|
|
791
864
|
return;
|
|
792
865
|
}
|
|
793
866
|
const state = beginNodeRequest(req, res, options);
|
|
794
|
-
|
|
867
|
+
_chunkUKYTXZOQcjs.local.run(state, () => next());
|
|
795
868
|
};
|
|
796
869
|
}
|
|
797
870
|
function autterErrorResponse(options = {}) {
|
|
798
871
|
return function autterErrorResponseMiddleware(error, req, res, next) {
|
|
799
872
|
const state = req[REQUEST_STATE];
|
|
800
|
-
if (state)
|
|
873
|
+
if (state) _chunkUKYTXZOQcjs.noteOperationError.call(void 0, error, true, state);
|
|
801
874
|
captureAtBoundary(error, state, options.capture);
|
|
802
875
|
if (res.headersSent) {
|
|
803
876
|
next(error);
|
|
804
877
|
return;
|
|
805
878
|
}
|
|
806
|
-
const header = (_nullishCoalesce(options.requestIdHeader, () => (
|
|
807
|
-
const inbound = _optionalChain([req, 'access',
|
|
808
|
-
const requestId = _nullishCoalesce(_optionalChain([state, 'optionalAccess',
|
|
809
|
-
res.statusCode =
|
|
879
|
+
const header = (_nullishCoalesce(options.requestIdHeader, () => ( _chunkUKYTXZOQcjs.DEFAULT_REQUEST_ID_HEADER))).toLowerCase();
|
|
880
|
+
const inbound = _optionalChain([req, 'access', _19 => _19.headers, 'optionalAccess', _20 => _20[header]]);
|
|
881
|
+
const requestId = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _21 => _21.requestId]), () => ( (typeof inbound === "string" ? inbound.slice(0, 128) : void 0)));
|
|
882
|
+
res.statusCode = _chunkUKYTXZOQcjs.responseStatusOf.call(void 0, error);
|
|
810
883
|
res.setHeader("content-type", "application/json; charset=utf-8");
|
|
811
|
-
res.end(JSON.stringify(
|
|
884
|
+
res.end(JSON.stringify(_chunkUKYTXZOQcjs.toClientError.call(void 0, error, requestId)));
|
|
812
885
|
};
|
|
813
886
|
}
|
|
814
887
|
var RESOURCE = /* @__PURE__ */ Symbol.for("autter.runtime.resource");
|
|
815
888
|
function autterFastify(fastify, options, done) {
|
|
816
889
|
const opts = _nullishCoalesce(options, () => ( {}));
|
|
817
|
-
const header = (_nullishCoalesce(opts.requestIdHeader, () => (
|
|
818
|
-
const ignored =
|
|
890
|
+
const header = (_nullishCoalesce(opts.requestIdHeader, () => ( _chunkUKYTXZOQcjs.DEFAULT_REQUEST_ID_HEADER))).toLowerCase();
|
|
891
|
+
const ignored = _chunkUKYTXZOQcjs.compileIgnore.call(void 0, opts.ignore);
|
|
819
892
|
const stateOf = (request) => request[REQUEST_STATE];
|
|
820
893
|
fastify.addHook("onRequest", ((request, reply, next) => {
|
|
821
894
|
if (ignored(request.url) || request.raw[REQUEST_STATE]) {
|
|
822
895
|
next();
|
|
823
896
|
return;
|
|
824
897
|
}
|
|
825
|
-
const requestId =
|
|
898
|
+
const requestId = _chunkUKYTXZOQcjs.resolveRequestId.call(void 0,
|
|
826
899
|
opts.trustRequestId === false ? void 0 : request.headers[header]
|
|
827
900
|
);
|
|
828
901
|
const method = String(_nullishCoalesce(request.method, () => ( "GET"))).toUpperCase();
|
|
829
|
-
const state =
|
|
830
|
-
name: `${method} ${
|
|
902
|
+
const state = _chunkUKYTXZOQcjs.createRequestState.call(void 0, {
|
|
903
|
+
name: `${method} ${_chunkUKYTXZOQcjs.normalizeRoutePath.call(void 0, request.url)}`,
|
|
831
904
|
requestId,
|
|
832
905
|
req: request.raw,
|
|
833
906
|
res: reply.raw
|
|
@@ -836,18 +909,18 @@ function autterFastify(fastify, options, done) {
|
|
|
836
909
|
request.raw[REQUEST_STATE] = state;
|
|
837
910
|
reply.header(header, requestId);
|
|
838
911
|
const span = _api.trace.getActiveSpan();
|
|
839
|
-
if (_optionalChain([span, 'optionalAccess',
|
|
912
|
+
if (_optionalChain([span, 'optionalAccess', _22 => _22.isRecording, 'call', _23 => _23()]))
|
|
840
913
|
span.setAttributes({
|
|
841
914
|
"autter.request.id": requestId,
|
|
842
915
|
"autter.operation.kind": "request"
|
|
843
916
|
});
|
|
844
|
-
const spanContext = _optionalChain([span, 'optionalAccess',
|
|
917
|
+
const spanContext = _optionalChain([span, 'optionalAccess', _24 => _24.spanContext, 'call', _25 => _25()]);
|
|
845
918
|
bindEmitter(request.raw, state);
|
|
846
919
|
bindEmitter(reply.raw, state);
|
|
847
920
|
let finished = false;
|
|
848
921
|
const finish = (aborted) => finishRequest(state, {
|
|
849
922
|
method,
|
|
850
|
-
route: _nullishCoalesce(_nullishCoalesce(_optionalChain([request, 'access',
|
|
923
|
+
route: _nullishCoalesce(_nullishCoalesce(_optionalChain([request, 'access', _26 => _26.routeOptions, 'optionalAccess', _27 => _27.url]), () => ( request.routerPath)), () => ( _chunkUKYTXZOQcjs.normalizeRoutePath.call(void 0, request.url))),
|
|
851
924
|
status: reply.raw.statusCode || reply.statusCode,
|
|
852
925
|
aborted,
|
|
853
926
|
...spanContext ? { span: spanContext } : {}
|
|
@@ -857,7 +930,7 @@ function autterFastify(fastify, options, done) {
|
|
|
857
930
|
finish(false);
|
|
858
931
|
});
|
|
859
932
|
reply.raw.once("close", () => finish(!finished));
|
|
860
|
-
|
|
933
|
+
_chunkUKYTXZOQcjs.local.run(state, () => {
|
|
861
934
|
request[RESOURCE] = new (0, _async_hooks.AsyncResource)("autter-request");
|
|
862
935
|
next();
|
|
863
936
|
});
|
|
@@ -873,13 +946,13 @@ function autterFastify(fastify, options, done) {
|
|
|
873
946
|
const value = exposeHeaderValue(reply.getHeader("access-control-expose-headers"), header);
|
|
874
947
|
if (value) reply.header("access-control-expose-headers", value);
|
|
875
948
|
}
|
|
876
|
-
} catch (
|
|
949
|
+
} catch (e18) {
|
|
877
950
|
}
|
|
878
951
|
next(null, payload);
|
|
879
952
|
}));
|
|
880
953
|
fastify.addHook("onError", ((request, _reply, error, next) => {
|
|
881
954
|
const state = stateOf(request);
|
|
882
|
-
if (state)
|
|
955
|
+
if (state) _chunkUKYTXZOQcjs.noteOperationError.call(void 0, error, true, state);
|
|
883
956
|
captureAtBoundary(error, state);
|
|
884
957
|
next();
|
|
885
958
|
}));
|
|
@@ -901,48 +974,48 @@ function withHeaders(response, header, requestId) {
|
|
|
901
974
|
};
|
|
902
975
|
try {
|
|
903
976
|
return apply(response);
|
|
904
|
-
} catch (
|
|
977
|
+
} catch (e19) {
|
|
905
978
|
try {
|
|
906
979
|
return apply(new Response(response.body, response));
|
|
907
|
-
} catch (
|
|
980
|
+
} catch (e20) {
|
|
908
981
|
return response;
|
|
909
982
|
}
|
|
910
983
|
}
|
|
911
984
|
}
|
|
912
985
|
function withRuntimeRequest(handler, options = {}) {
|
|
913
|
-
const header = (_nullishCoalesce(options.requestIdHeader, () => (
|
|
914
|
-
const ignored =
|
|
986
|
+
const header = (_nullishCoalesce(options.requestIdHeader, () => ( _chunkUKYTXZOQcjs.DEFAULT_REQUEST_ID_HEADER))).toLowerCase();
|
|
987
|
+
const ignored = _chunkUKYTXZOQcjs.compileIgnore.call(void 0, options.ignore);
|
|
915
988
|
return async (request, ...rest) => {
|
|
916
989
|
let pathname = "/";
|
|
917
990
|
try {
|
|
918
991
|
pathname = new URL(request.url, "http://localhost").pathname;
|
|
919
|
-
} catch (
|
|
992
|
+
} catch (e21) {
|
|
920
993
|
}
|
|
921
994
|
if (ignored(pathname)) return handler(request, ...rest);
|
|
922
|
-
const requestId =
|
|
995
|
+
const requestId = _chunkUKYTXZOQcjs.resolveRequestId.call(void 0,
|
|
923
996
|
options.trustRequestId === false ? void 0 : request.headers.get(header)
|
|
924
997
|
);
|
|
925
998
|
const method = String(_nullishCoalesce(request.method, () => ( "GET"))).toUpperCase();
|
|
926
|
-
const route = _nullishCoalesce(options.route, () => (
|
|
927
|
-
const state =
|
|
999
|
+
const route = _nullishCoalesce(options.route, () => ( _chunkUKYTXZOQcjs.normalizeRoutePath.call(void 0, pathname)));
|
|
1000
|
+
const state = _chunkUKYTXZOQcjs.createRequestState.call(void 0, {
|
|
928
1001
|
name: `${method} ${_nullishCoalesce(options.name, () => ( route))}`,
|
|
929
1002
|
requestId,
|
|
930
1003
|
req: request
|
|
931
1004
|
});
|
|
932
1005
|
const span = _api.trace.getActiveSpan();
|
|
933
|
-
if (_optionalChain([span, 'optionalAccess',
|
|
1006
|
+
if (_optionalChain([span, 'optionalAccess', _28 => _28.isRecording, 'call', _29 => _29()]))
|
|
934
1007
|
span.setAttributes({
|
|
935
1008
|
"autter.request.id": requestId,
|
|
936
1009
|
"autter.operation.kind": "request"
|
|
937
1010
|
});
|
|
938
|
-
const spanContext = _optionalChain([span, 'optionalAccess',
|
|
1011
|
+
const spanContext = _optionalChain([span, 'optionalAccess', _30 => _30.spanContext, 'call', _31 => _31()]);
|
|
939
1012
|
let status = 500;
|
|
940
1013
|
try {
|
|
941
|
-
const response = await
|
|
1014
|
+
const response = await _chunkUKYTXZOQcjs.local.run(state, async () => {
|
|
942
1015
|
try {
|
|
943
1016
|
return await handler(request, ...rest);
|
|
944
1017
|
} catch (error) {
|
|
945
|
-
|
|
1018
|
+
_chunkUKYTXZOQcjs.noteOperationError.call(void 0, error, true, state);
|
|
946
1019
|
captureAtBoundary(error, state, true);
|
|
947
1020
|
throw error;
|
|
948
1021
|
}
|
|
@@ -950,7 +1023,7 @@ function withRuntimeRequest(handler, options = {}) {
|
|
|
950
1023
|
status = response.status;
|
|
951
1024
|
return withHeaders(response, header, requestId);
|
|
952
1025
|
} finally {
|
|
953
|
-
const aborted = _optionalChain([request, 'access',
|
|
1026
|
+
const aborted = _optionalChain([request, 'access', _32 => _32.signal, 'optionalAccess', _33 => _33.aborted]) === true;
|
|
954
1027
|
finishRequest(state, {
|
|
955
1028
|
method,
|
|
956
1029
|
route,
|
|
@@ -961,9 +1034,9 @@ function withRuntimeRequest(handler, options = {}) {
|
|
|
961
1034
|
});
|
|
962
1035
|
if (options.waitUntil) {
|
|
963
1036
|
try {
|
|
964
|
-
options.waitUntil(
|
|
1037
|
+
options.waitUntil(_chunkUKYTXZOQcjs.flushRuntimeLogs.call(void 0, ).catch(() => {
|
|
965
1038
|
}));
|
|
966
|
-
} catch (
|
|
1039
|
+
} catch (e22) {
|
|
967
1040
|
}
|
|
968
1041
|
}
|
|
969
1042
|
}
|
|
@@ -973,7 +1046,133 @@ function startHookRequest(res) {
|
|
|
973
1046
|
const req = res.req;
|
|
974
1047
|
if (!req || req[REQUEST_STATE]) return;
|
|
975
1048
|
const state = beginNodeRequest(req, res, {});
|
|
976
|
-
|
|
1049
|
+
_chunkUKYTXZOQcjs.local.enterWith(state);
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
// src/unhandled-rejections.ts
|
|
1053
|
+
var MODES = /* @__PURE__ */ new Set([
|
|
1054
|
+
"throw",
|
|
1055
|
+
"strict",
|
|
1056
|
+
"warn",
|
|
1057
|
+
"warn-with-error-code",
|
|
1058
|
+
"none"
|
|
1059
|
+
]);
|
|
1060
|
+
var LISTENER_MARK = /* @__PURE__ */ Symbol.for("autter.runtime.unhandledRejection.listener");
|
|
1061
|
+
var HANDLED_KEY = /* @__PURE__ */ Symbol.for("autter.runtime.unhandledRejection.handled");
|
|
1062
|
+
function handledPromises() {
|
|
1063
|
+
const registry = globalThis;
|
|
1064
|
+
let set = registry[HANDLED_KEY];
|
|
1065
|
+
if (!set) {
|
|
1066
|
+
set = /* @__PURE__ */ new WeakSet();
|
|
1067
|
+
registry[HANDLED_KEY] = set;
|
|
1068
|
+
}
|
|
1069
|
+
return set;
|
|
1070
|
+
}
|
|
1071
|
+
var recorded = /* @__PURE__ */ new WeakSet();
|
|
1072
|
+
function markRecorded(reason) {
|
|
1073
|
+
if (!reason || typeof reason !== "object") return;
|
|
1074
|
+
recorded.add(reason);
|
|
1075
|
+
_optionalChain([setImmediate, 'call', _34 => _34(() => recorded.delete(reason)), 'access', _35 => _35.unref, 'optionalCall', _36 => _36()]);
|
|
1076
|
+
}
|
|
1077
|
+
function recordedAsRejection(error) {
|
|
1078
|
+
return !!error && typeof error === "object" && recorded.has(error);
|
|
1079
|
+
}
|
|
1080
|
+
function splitOptions(value) {
|
|
1081
|
+
return value ? value.split(/\s+/).filter(Boolean) : [];
|
|
1082
|
+
}
|
|
1083
|
+
function unhandledRejectionsMode(execArgv = process.execArgv, nodeOptions = process.env.NODE_OPTIONS) {
|
|
1084
|
+
const args = [...splitOptions(nodeOptions), ...execArgv];
|
|
1085
|
+
let mode = "throw";
|
|
1086
|
+
for (let i = 0; i < args.length; i++) {
|
|
1087
|
+
const arg = _nullishCoalesce(args[i], () => ( ""));
|
|
1088
|
+
if (!arg.startsWith("--")) continue;
|
|
1089
|
+
const eq = arg.indexOf("=");
|
|
1090
|
+
const name = (eq < 0 ? arg : arg.slice(0, eq)).replace(/_/g, "-");
|
|
1091
|
+
if (name !== "--unhandled-rejections") continue;
|
|
1092
|
+
const value = eq < 0 ? args[++i] : arg.slice(eq + 1);
|
|
1093
|
+
if (value && MODES.has(value))
|
|
1094
|
+
mode = value;
|
|
1095
|
+
}
|
|
1096
|
+
return mode;
|
|
1097
|
+
}
|
|
1098
|
+
function isErrorLike(value) {
|
|
1099
|
+
try {
|
|
1100
|
+
return typeof value === "object" && value !== null && Object.prototype.hasOwnProperty.call(value, "stack");
|
|
1101
|
+
} catch (e23) {
|
|
1102
|
+
return false;
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
function describeReason(reason) {
|
|
1106
|
+
if (typeof reason !== "object" && typeof reason !== "function" || reason === null) {
|
|
1107
|
+
try {
|
|
1108
|
+
return String(reason);
|
|
1109
|
+
} catch (e24) {
|
|
1110
|
+
return typeof reason;
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
try {
|
|
1114
|
+
const proto = Object.getPrototypeOf(reason);
|
|
1115
|
+
const ctor = _optionalChain([proto, 'optionalAccess', _37 => _37.constructor]);
|
|
1116
|
+
const name = typeof ctor === "function" ? ctor.name : "";
|
|
1117
|
+
return name ? `#<${name}>` : "[object Object]";
|
|
1118
|
+
} catch (e25) {
|
|
1119
|
+
return "[object Object]";
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
function toUncaught(reason, from) {
|
|
1123
|
+
if (isErrorLike(reason)) return reason;
|
|
1124
|
+
const error = new Error(
|
|
1125
|
+
`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(). The promise rejected with the reason "${describeReason(reason)}".`
|
|
1126
|
+
);
|
|
1127
|
+
error.name = "UnhandledPromiseRejection";
|
|
1128
|
+
error.code = "ERR_UNHANDLED_REJECTION";
|
|
1129
|
+
_optionalChain([Error, 'access', _38 => _38.captureStackTrace, 'optionalCall', _39 => _39(error, from)]);
|
|
1130
|
+
return error;
|
|
1131
|
+
}
|
|
1132
|
+
var warningId = 0;
|
|
1133
|
+
function emitNodeWarning(reason) {
|
|
1134
|
+
try {
|
|
1135
|
+
const text = isErrorLike(reason) ? String(reason.stack) : describeReason(reason);
|
|
1136
|
+
process.emitWarning(text, "UnhandledPromiseRejectionWarning");
|
|
1137
|
+
process.emitWarning(
|
|
1138
|
+
`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
|
+
"UnhandledPromiseRejectionWarning"
|
|
1140
|
+
);
|
|
1141
|
+
} catch (e26) {
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
function installUnhandledRejectionCapture(capture, mode = unhandledRejectionsMode()) {
|
|
1145
|
+
if (mode === "strict") return () => {
|
|
1146
|
+
};
|
|
1147
|
+
const listener = (reason, promise) => {
|
|
1148
|
+
try {
|
|
1149
|
+
if (promise && typeof promise === "object") {
|
|
1150
|
+
const handled = handledPromises();
|
|
1151
|
+
if (handled.has(promise)) return;
|
|
1152
|
+
handled.add(promise);
|
|
1153
|
+
}
|
|
1154
|
+
const alone = process.listeners("unhandledRejection").every((fn) => fn[LISTENER_MARK] === true);
|
|
1155
|
+
if (alone && mode === "throw") {
|
|
1156
|
+
const error = toUncaught(reason, listener);
|
|
1157
|
+
process.nextTick(() => {
|
|
1158
|
+
throw error;
|
|
1159
|
+
});
|
|
1160
|
+
return;
|
|
1161
|
+
}
|
|
1162
|
+
if (alone && mode === "warn-with-error-code") {
|
|
1163
|
+
emitNodeWarning(reason);
|
|
1164
|
+
process.exitCode = 1;
|
|
1165
|
+
}
|
|
1166
|
+
markRecorded(reason);
|
|
1167
|
+
capture(reason);
|
|
1168
|
+
} catch (e27) {
|
|
1169
|
+
}
|
|
1170
|
+
};
|
|
1171
|
+
listener[LISTENER_MARK] = true;
|
|
1172
|
+
process.on("unhandledRejection", listener);
|
|
1173
|
+
return () => {
|
|
1174
|
+
process.off("unhandledRejection", listener);
|
|
1175
|
+
};
|
|
977
1176
|
}
|
|
978
1177
|
|
|
979
1178
|
// src/server.ts
|
|
@@ -1073,7 +1272,7 @@ var ErrorTraceRetentionProcessor = (_class2 = class {
|
|
|
1073
1272
|
this.retainErrors = retainErrors;
|
|
1074
1273
|
this.slowThresholdMs = slowThresholdMs;
|
|
1075
1274
|
this.sweeper = setInterval(() => this.sweep(), RETENTION_SWEEP_INTERVAL_MS);
|
|
1076
|
-
_optionalChain([this, 'access',
|
|
1275
|
+
_optionalChain([this, 'access', _40 => _40.sweeper, 'access', _41 => _41.unref, 'optionalCall', _42 => _42()]);
|
|
1077
1276
|
}
|
|
1078
1277
|
|
|
1079
1278
|
|
|
@@ -1104,7 +1303,7 @@ var ErrorTraceRetentionProcessor = (_class2 = class {
|
|
|
1104
1303
|
}
|
|
1105
1304
|
/** Promote the active trace, if any — called on captured errors. */
|
|
1106
1305
|
retainActiveTrace() {
|
|
1107
|
-
const active2 = _optionalChain([_api.trace, 'access',
|
|
1306
|
+
const active2 = _optionalChain([_api.trace, 'access', _43 => _43.getActiveSpan, 'call', _44 => _44(), 'optionalAccess', _45 => _45.spanContext, 'call', _46 => _46()]);
|
|
1108
1307
|
if (!active2 || (active2.traceFlags & _api.TraceFlags.SAMPLED) !== 0) return;
|
|
1109
1308
|
const entry = this.entryFor(active2.traceId);
|
|
1110
1309
|
if (entry.retained) return;
|
|
@@ -1225,15 +1424,15 @@ async function runLlmSpan(tracer, info, fn) {
|
|
|
1225
1424
|
return result;
|
|
1226
1425
|
} catch (err) {
|
|
1227
1426
|
recordError(span, err);
|
|
1228
|
-
if (
|
|
1427
|
+
if (_chunkUKYTXZOQcjs.isError.call(void 0, err)) span.setAttribute("error.type", err.name);
|
|
1229
1428
|
throw err;
|
|
1230
1429
|
} finally {
|
|
1231
1430
|
span.end();
|
|
1232
|
-
|
|
1431
|
+
_chunkUKYTXZOQcjs.recordOperationAiUsage.call(void 0, { ...usage, model: _nullishCoalesce(responseModel, () => ( info.model)) });
|
|
1233
1432
|
}
|
|
1234
1433
|
}
|
|
1235
1434
|
function recordLlmCall(tracer, call) {
|
|
1236
|
-
|
|
1435
|
+
_chunkUKYTXZOQcjs.recordOperationAiUsage.call(void 0, { ...call, model: call.model });
|
|
1237
1436
|
const durationMs = Math.max(0, _nullishCoalesce(call.durationMs, () => ( 0)));
|
|
1238
1437
|
const endTime = /* @__PURE__ */ new Date();
|
|
1239
1438
|
const startTime = new Date(endTime.getTime() - durationMs);
|
|
@@ -1247,7 +1446,7 @@ function recordLlmCall(tracer, call) {
|
|
|
1247
1446
|
);
|
|
1248
1447
|
if (call.error !== void 0 && call.error !== null) {
|
|
1249
1448
|
recordError(span, call.error);
|
|
1250
|
-
if (call.error
|
|
1449
|
+
if (_chunkUKYTXZOQcjs.isError.call(void 0, call.error)) {
|
|
1251
1450
|
span.setAttribute("error.type", call.error.name);
|
|
1252
1451
|
}
|
|
1253
1452
|
} else {
|
|
@@ -1258,7 +1457,7 @@ function recordLlmCall(tracer, call) {
|
|
|
1258
1457
|
async function runWithSpan(tracer, name, fn, attributes, links) {
|
|
1259
1458
|
const span = tracer.startSpan(name, {
|
|
1260
1459
|
attributes,
|
|
1261
|
-
..._optionalChain([links, 'optionalAccess',
|
|
1460
|
+
..._optionalChain([links, 'optionalAccess', _47 => _47.length]) ? { links } : {}
|
|
1262
1461
|
});
|
|
1263
1462
|
try {
|
|
1264
1463
|
const result = await _api.context.with(
|
|
@@ -1275,13 +1474,14 @@ async function runWithSpan(tracer, name, fn, attributes, links) {
|
|
|
1275
1474
|
}
|
|
1276
1475
|
}
|
|
1277
1476
|
function recordError(span, err) {
|
|
1278
|
-
const
|
|
1279
|
-
const message = activeRedactor.text(
|
|
1280
|
-
if (
|
|
1477
|
+
const isErr = _chunkUKYTXZOQcjs.isError.call(void 0, err);
|
|
1478
|
+
const message = activeRedactor.text(isErr ? err.message : String(err));
|
|
1479
|
+
if (isErr) {
|
|
1281
1480
|
span.addEvent("exception", {
|
|
1282
1481
|
"exception.type": err.name,
|
|
1283
1482
|
"exception.message": message,
|
|
1284
|
-
...err.stack ? { "exception.stacktrace": activeRedactor.text(err.stack) } : {}
|
|
1483
|
+
...err.stack ? { "exception.stacktrace": activeRedactor.text(err.stack) } : {},
|
|
1484
|
+
..._chunkUKYTXZOQcjs.breadcrumbEventAttributes.call(void 0, activeRedactor.text, err)
|
|
1285
1485
|
});
|
|
1286
1486
|
}
|
|
1287
1487
|
span.setStatus({ code: _api.SpanStatusCode.ERROR, message });
|
|
@@ -1292,7 +1492,7 @@ function redactWithActive(attributes) {
|
|
|
1292
1492
|
function captureExpressRoute(_span, response) {
|
|
1293
1493
|
if (!(response instanceof _http.ServerResponse)) return;
|
|
1294
1494
|
const rpcMetadata = _core.getRPCMetadata.call(void 0, _api.context.active());
|
|
1295
|
-
if (_optionalChain([rpcMetadata, 'optionalAccess',
|
|
1495
|
+
if (_optionalChain([rpcMetadata, 'optionalAccess', _48 => _48.type]) !== _core.RPCType.HTTP) return;
|
|
1296
1496
|
const setRoute = () => {
|
|
1297
1497
|
if (rpcMetadata.route) return;
|
|
1298
1498
|
const route = expressRouteOf(response.req);
|
|
@@ -1304,21 +1504,21 @@ function captureExpressRoute(_span, response) {
|
|
|
1304
1504
|
}
|
|
1305
1505
|
var hookRequests = false;
|
|
1306
1506
|
function structuredErrorAttributes(error) {
|
|
1307
|
-
const attrs = { ...
|
|
1308
|
-
const internal =
|
|
1507
|
+
const attrs = { ..._chunkUKYTXZOQcjs.errorAttributes.call(void 0, error, { causes: false }) };
|
|
1508
|
+
const internal = _chunkUKYTXZOQcjs.errorInternal.call(void 0, error);
|
|
1309
1509
|
if (internal) {
|
|
1310
1510
|
try {
|
|
1311
1511
|
attrs["autter.error.internal"] = JSON.stringify(
|
|
1312
1512
|
activeRedactor(internal)
|
|
1313
1513
|
).slice(0, 4e3);
|
|
1314
|
-
} catch (
|
|
1514
|
+
} catch (e28) {
|
|
1315
1515
|
}
|
|
1316
1516
|
}
|
|
1317
1517
|
return attrs;
|
|
1318
1518
|
}
|
|
1319
1519
|
var active = null;
|
|
1320
1520
|
var activeAlwaysOnProvider = null;
|
|
1321
|
-
var activeRedactor =
|
|
1521
|
+
var activeRedactor = _chunkUKYTXZOQcjs.makeRedactor.call(void 0, true);
|
|
1322
1522
|
function initAutterServer(options) {
|
|
1323
1523
|
if (active) return active;
|
|
1324
1524
|
const endpoint = (_nullishCoalesce(options.endpoint, () => ( "https://otlp.autter.dev"))).replace(
|
|
@@ -1326,18 +1526,18 @@ function initAutterServer(options) {
|
|
|
1326
1526
|
""
|
|
1327
1527
|
);
|
|
1328
1528
|
const headers = { authorization: `Bearer ${options.apiKey}` };
|
|
1329
|
-
const traceExporter = () => new (0,
|
|
1529
|
+
const traceExporter = () => new (0, _chunkARN26OK6cjs.CountingExporter)(
|
|
1330
1530
|
new RedactingSpanExporter(
|
|
1331
1531
|
new (0, _exportertraceotlphttp.OTLPTraceExporter)({ url: `${endpoint}/v1/traces`, headers }),
|
|
1332
1532
|
() => activeRedactor
|
|
1333
1533
|
)
|
|
1334
1534
|
);
|
|
1335
1535
|
const environment = _nullishCoalesce(_nullishCoalesce(options.environment, () => ( process.env.NODE_ENV)), () => ( "production"));
|
|
1336
|
-
if (
|
|
1337
|
-
|
|
1338
|
-
activeRedactor =
|
|
1339
|
-
const distro = _nullishCoalesce(options.distro, () => (
|
|
1340
|
-
|
|
1536
|
+
if (_chunkARN26OK6cjs.isDebugEnabled.call(void 0, ) || options.debug === true) _chunkARN26OK6cjs.setDebugMode.call(void 0, true);
|
|
1537
|
+
_chunkARN26OK6cjs.debugLog.call(void 0, `initialising service=${options.service} endpoint=${endpoint}`);
|
|
1538
|
+
activeRedactor = _chunkUKYTXZOQcjs.makeRedactor.call(void 0, _nullishCoalesce(options.redactAttributes, () => ( true)));
|
|
1539
|
+
const distro = _nullishCoalesce(options.distro, () => ( _chunkARN26OK6cjs.SDK_IDENTITY));
|
|
1540
|
+
_chunkARN26OK6cjs.configureCompatCheck.call(void 0, { endpoint, enabled: options.compatCheck !== false, sdk: distro });
|
|
1341
1541
|
const resource = new (0, _resources.Resource)({
|
|
1342
1542
|
[_semanticconventions.ATTR_SERVICE_NAME]: options.service,
|
|
1343
1543
|
"service.instance.id": (options.instanceId || process.env.AUTTER_RUNTIME_INSTANCE_ID || _crypto.randomUUID.call(void 0, )).slice(0, 128),
|
|
@@ -1352,8 +1552,15 @@ function initAutterServer(options) {
|
|
|
1352
1552
|
// would double-count every sampled request).
|
|
1353
1553
|
"autter.metrics_wired": true
|
|
1354
1554
|
});
|
|
1555
|
+
const rootSampler = new (0, _sdktracebase.TraceIdRatioBasedSampler)(_nullishCoalesce(options.traceSampleRate, () => ( 0.01)));
|
|
1355
1556
|
const headSampler = new (0, _sdktracebase.ParentBasedSampler)({
|
|
1356
|
-
root:
|
|
1557
|
+
root: rootSampler,
|
|
1558
|
+
// Browsers (runtime-browser's traceparent) send unsampled parents: they
|
|
1559
|
+
// make no sampling decision. Apply this service's own rate to such
|
|
1560
|
+
// requests instead of never head-sampling them. The ratio sampler is
|
|
1561
|
+
// deterministic by trace id, so services sharing a rate still agree
|
|
1562
|
+
// with an upstream service that chose not to sample.
|
|
1563
|
+
remoteParentNotSampled: rootSampler
|
|
1357
1564
|
});
|
|
1358
1565
|
const retainOnError = options.retainTracesOnError !== false;
|
|
1359
1566
|
const slowThresholdMs = Number.isFinite(options.retainTracesAboveMs) ? Math.max(0, options.retainTracesAboveMs) : 0;
|
|
@@ -1404,9 +1611,9 @@ function initAutterServer(options) {
|
|
|
1404
1611
|
});
|
|
1405
1612
|
sdk.start();
|
|
1406
1613
|
const stopMemoryMetrics = options.memoryMetrics === false ? null : startMemoryMetrics();
|
|
1407
|
-
|
|
1408
|
-
if (stopMemoryMetrics)
|
|
1409
|
-
if (options.llmTracing !== false)
|
|
1614
|
+
_chunkARN26OK6cjs.noteCompatFeature.call(void 0, "endpoint_latency");
|
|
1615
|
+
if (stopMemoryMetrics) _chunkARN26OK6cjs.noteCompatFeature.call(void 0, "memory_metrics");
|
|
1616
|
+
if (options.llmTracing !== false) _chunkARN26OK6cjs.noteCompatFeature.call(void 0, "llm_calls");
|
|
1410
1617
|
const alwaysOnProvider = new (0, _sdktracebase.BasicTracerProvider)({
|
|
1411
1618
|
resource,
|
|
1412
1619
|
sampler: new (0, _sdktracebase.AlwaysOnSampler)(),
|
|
@@ -1418,21 +1625,25 @@ function initAutterServer(options) {
|
|
|
1418
1625
|
const processTracer = alwaysOnProvider.getTracer("autter-processes");
|
|
1419
1626
|
const llmTracer = alwaysOnProvider.getTracer("autter-llm");
|
|
1420
1627
|
function captureException2(error, attributes) {
|
|
1421
|
-
_optionalChain([errorTraceBuffer, 'optionalAccess',
|
|
1422
|
-
|
|
1423
|
-
const
|
|
1424
|
-
const message = activeRedactor.text(
|
|
1425
|
-
const stackText =
|
|
1426
|
-
const
|
|
1628
|
+
_optionalChain([errorTraceBuffer, 'optionalAccess', _49 => _49.retainActiveTrace, 'call', _50 => _50()]);
|
|
1629
|
+
_chunkARN26OK6cjs.telemetryStats.markCaptured();
|
|
1630
|
+
const isErr = _chunkUKYTXZOQcjs.isError.call(void 0, error);
|
|
1631
|
+
const message = activeRedactor.text(isErr ? error.message : String(error));
|
|
1632
|
+
const stackText = isErr && error.stack ? activeRedactor.text(error.stack) : "";
|
|
1633
|
+
const split = _chunkUKYTXZOQcjs.splitFingerprint.call(void 0, attributes);
|
|
1634
|
+
const fingerprint = _chunkUKYTXZOQcjs.fingerprintEventAttributes.call(void 0, split.fingerprint, activeRedactor.text);
|
|
1635
|
+
if (fingerprint["autter.fingerprint"]) _chunkARN26OK6cjs.noteCompatFeature.call(void 0, "fingerprint_override");
|
|
1636
|
+
const redacted = activeRedactor(split.attributes);
|
|
1427
1637
|
const activeSpan = _api.trace.getActiveSpan();
|
|
1428
|
-
const reuseActive = _optionalChain([activeSpan, 'optionalAccess',
|
|
1429
|
-
const span = reuseActive ? activeSpan : errorTracer.startSpan(
|
|
1638
|
+
const reuseActive = _optionalChain([activeSpan, 'optionalAccess', _51 => _51.isRecording, 'call', _52 => _52()]) === true;
|
|
1639
|
+
const span = reuseActive ? activeSpan : errorTracer.startSpan(isErr ? error.name : "Error");
|
|
1430
1640
|
const structured = structuredErrorAttributes(error);
|
|
1431
|
-
const causes =
|
|
1432
|
-
const declared =
|
|
1433
|
-
Object.entries(causes).filter(([key]) => key !== "autter.error.internal")
|
|
1434
|
-
|
|
1435
|
-
|
|
1641
|
+
const causes = _chunkUKYTXZOQcjs.errorAttributes.call(void 0, error);
|
|
1642
|
+
const declared = {
|
|
1643
|
+
...Object.fromEntries(Object.entries(causes).filter(([key]) => key !== "autter.error.internal")),
|
|
1644
|
+
...fingerprint
|
|
1645
|
+
};
|
|
1646
|
+
const requestId = _optionalChain([_chunkUKYTXZOQcjs.currentOperation.call(void 0, ), 'optionalAccess', _53 => _53.requestId]);
|
|
1436
1647
|
span.setAttributes({
|
|
1437
1648
|
"autter.severity": "error",
|
|
1438
1649
|
...redacted,
|
|
@@ -1440,24 +1651,26 @@ function initAutterServer(options) {
|
|
|
1440
1651
|
...requestId ? { "autter.request.id": requestId } : {}
|
|
1441
1652
|
});
|
|
1442
1653
|
markCaptured(error);
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
if (
|
|
1654
|
+
_chunkUKYTXZOQcjs.noteOperationError.call(void 0, error);
|
|
1655
|
+
_chunkUKYTXZOQcjs.notifyException.call(void 0, error, { ...redacted, ...fingerprint });
|
|
1656
|
+
if (isErr && stackText) {
|
|
1446
1657
|
span.addEvent("exception", {
|
|
1447
1658
|
"exception.type": error.name,
|
|
1448
1659
|
"exception.message": message,
|
|
1449
1660
|
"exception.stacktrace": stackText,
|
|
1450
1661
|
...redacted["autter.handled"] === true ? { "autter.handled": true, "autter.sampled": redacted["autter.sampled"] === true } : {},
|
|
1451
|
-
...declared
|
|
1662
|
+
...declared,
|
|
1663
|
+
..._chunkUKYTXZOQcjs.breadcrumbEventAttributes.call(void 0, activeRedactor.text, error)
|
|
1452
1664
|
});
|
|
1453
1665
|
} else {
|
|
1454
|
-
const stack = _optionalChain([new Error(), 'access',
|
|
1666
|
+
const stack = _optionalChain([new Error(), 'access', _54 => _54.stack, 'optionalAccess', _55 => _55.split, 'call', _56 => _56("\n"), 'access', _57 => _57.filter, 'call', _58 => _58((line, i) => i === 0 || !line.includes("captureException")), 'access', _59 => _59.join, 'call', _60 => _60("\n")]);
|
|
1455
1667
|
span.addEvent("exception", {
|
|
1456
|
-
"exception.type":
|
|
1668
|
+
"exception.type": isErr ? error.name : "Error",
|
|
1457
1669
|
"exception.message": message,
|
|
1458
1670
|
...stack ? { "exception.stacktrace": activeRedactor.text(stack) } : {},
|
|
1459
1671
|
...redacted["autter.handled"] === true ? { "autter.handled": true, "autter.sampled": redacted["autter.sampled"] === true } : {},
|
|
1460
|
-
...declared
|
|
1672
|
+
...declared,
|
|
1673
|
+
..._chunkUKYTXZOQcjs.breadcrumbEventAttributes.call(void 0, activeRedactor.text, error)
|
|
1461
1674
|
});
|
|
1462
1675
|
}
|
|
1463
1676
|
span.setStatus({ code: _api.SpanStatusCode.ERROR, message });
|
|
@@ -1465,10 +1678,10 @@ function initAutterServer(options) {
|
|
|
1465
1678
|
}
|
|
1466
1679
|
function captureMessage2(message, severity = "warning", attributes) {
|
|
1467
1680
|
if (severity === "error" || severity === "fatal") {
|
|
1468
|
-
_optionalChain([errorTraceBuffer, 'optionalAccess',
|
|
1681
|
+
_optionalChain([errorTraceBuffer, 'optionalAccess', _61 => _61.retainActiveTrace, 'call', _62 => _62()]);
|
|
1469
1682
|
}
|
|
1470
|
-
|
|
1471
|
-
const stack = _optionalChain([new Error(), 'access',
|
|
1683
|
+
_chunkARN26OK6cjs.telemetryStats.markCaptured();
|
|
1684
|
+
const stack = _optionalChain([new Error(), 'access', _63 => _63.stack, 'optionalAccess', _64 => _64.split, 'call', _65 => _65("\n"), 'access', _66 => _66.filter, 'call', _67 => _67((line, i) => i === 0 || !line.includes("captureMessage")), 'access', _68 => _68.join, 'call', _69 => _69("\n")]);
|
|
1472
1685
|
const safeMessage = activeRedactor.text(message);
|
|
1473
1686
|
const span = errorTracer.startSpan("Message", {
|
|
1474
1687
|
attributes: { "autter.severity": severity, ...activeRedactor(attributes) }
|
|
@@ -1477,16 +1690,17 @@ function initAutterServer(options) {
|
|
|
1477
1690
|
"exception.type": "Message",
|
|
1478
1691
|
"exception.message": safeMessage,
|
|
1479
1692
|
...stack ? { "exception.stacktrace": activeRedactor.text(stack) } : {},
|
|
1480
|
-
"autter.severity": severity
|
|
1693
|
+
"autter.severity": severity,
|
|
1694
|
+
..._chunkUKYTXZOQcjs.breadcrumbEventAttributes.call(void 0, activeRedactor.text)
|
|
1481
1695
|
});
|
|
1482
1696
|
span.setStatus({ code: _api.SpanStatusCode.ERROR, message: safeMessage });
|
|
1483
1697
|
span.end();
|
|
1484
1698
|
}
|
|
1485
1699
|
function reportOutcome2(name, message, attributes) {
|
|
1486
|
-
_optionalChain([errorTraceBuffer, 'optionalAccess',
|
|
1487
|
-
|
|
1700
|
+
_optionalChain([errorTraceBuffer, 'optionalAccess', _70 => _70.retainActiveTrace, 'call', _71 => _71()]);
|
|
1701
|
+
_chunkARN26OK6cjs.telemetryStats.markCaptured();
|
|
1488
1702
|
const activeSpan = _api.trace.getActiveSpan();
|
|
1489
|
-
const reuseActive = _optionalChain([activeSpan, 'optionalAccess',
|
|
1703
|
+
const reuseActive = _optionalChain([activeSpan, 'optionalAccess', _72 => _72.isRecording, 'call', _73 => _73()]) === true;
|
|
1490
1704
|
const span = reuseActive ? activeSpan : errorTracer.startSpan("OutcomeFailure");
|
|
1491
1705
|
const safeOutcome = activeRedactor({ "autter.outcome.name": name.slice(0, 200), "autter.outcome.message": message.slice(0, 1e3) });
|
|
1492
1706
|
const safeName = String(_nullishCoalesce(safeOutcome["autter.outcome.name"], () => ( "operation")));
|
|
@@ -1500,7 +1714,7 @@ function initAutterServer(options) {
|
|
|
1500
1714
|
span.setStatus({ code: _api.SpanStatusCode.ERROR, message: safeMessage });
|
|
1501
1715
|
if (!reuseActive) span.end();
|
|
1502
1716
|
}
|
|
1503
|
-
|
|
1717
|
+
_chunkUKYTXZOQcjs.configureRuntimeLogger.call(void 0, {
|
|
1504
1718
|
endpoint,
|
|
1505
1719
|
apiKey: options.apiKey,
|
|
1506
1720
|
service: options.service,
|
|
@@ -1512,18 +1726,27 @@ function initAutterServer(options) {
|
|
|
1512
1726
|
run: (name, fn, attributes, links) => runWithSpan(processTracer, name, fn, activeRedactor(attributes), links),
|
|
1513
1727
|
reportOutcome: reportOutcome2
|
|
1514
1728
|
});
|
|
1515
|
-
hookRequests = _optionalChain([options, 'access',
|
|
1729
|
+
hookRequests = _optionalChain([options, 'access', _74 => _74.logging, 'optionalAccess', _75 => _75.requests]) === true;
|
|
1730
|
+
let onCrash = null;
|
|
1731
|
+
let uninstallRejections = null;
|
|
1516
1732
|
if (options.captureGlobalErrors !== false) {
|
|
1517
|
-
|
|
1733
|
+
onCrash = (err) => {
|
|
1734
|
+
if (recordedAsRejection(err)) return;
|
|
1518
1735
|
captureException2(err, { "autter.unhandled": true });
|
|
1519
1736
|
if (options.autoFlush === false) void Promise.resolve(flushTarget.forceFlush()).catch(() => {
|
|
1520
1737
|
});
|
|
1521
|
-
}
|
|
1738
|
+
};
|
|
1739
|
+
process.on("uncaughtExceptionMonitor", onCrash);
|
|
1740
|
+
if (options.captureUnhandledRejections !== false) {
|
|
1741
|
+
uninstallRejections = installUnhandledRejectionCapture(
|
|
1742
|
+
(reason) => captureException2(reason, { "autter.unhandled_rejection": true })
|
|
1743
|
+
);
|
|
1744
|
+
}
|
|
1522
1745
|
}
|
|
1523
1746
|
const flushTarget = {
|
|
1524
1747
|
forceFlush: async () => {
|
|
1525
1748
|
const results = await Promise.allSettled([
|
|
1526
|
-
|
|
1749
|
+
_chunkUKYTXZOQcjs.flushRuntimeLogs.call(void 0, ),
|
|
1527
1750
|
Promise.resolve().then(() => alwaysOnProvider.forceFlush()),
|
|
1528
1751
|
Promise.resolve().then(() => mainSpanProcessor.forceFlush()),
|
|
1529
1752
|
...errorTraceBuffer ? [Promise.resolve().then(() => errorTraceBuffer.forceFlush())] : [],
|
|
@@ -1537,10 +1760,10 @@ function initAutterServer(options) {
|
|
|
1537
1760
|
}
|
|
1538
1761
|
}
|
|
1539
1762
|
};
|
|
1540
|
-
|
|
1763
|
+
_chunkARN26OK6cjs.registerFlushTarget.call(void 0, "active-server", flushTarget);
|
|
1541
1764
|
let autoFlushHandle = null;
|
|
1542
1765
|
if (options.autoFlush !== false) {
|
|
1543
|
-
autoFlushHandle =
|
|
1766
|
+
autoFlushHandle = _chunkARN26OK6cjs.installAutterAutoFlush.call(void 0, );
|
|
1544
1767
|
}
|
|
1545
1768
|
const server = {
|
|
1546
1769
|
captureException: captureException2,
|
|
@@ -1550,17 +1773,19 @@ function initAutterServer(options) {
|
|
|
1550
1773
|
withLlmCall: (info, fn) => runLlmSpan(llmTracer, info, fn),
|
|
1551
1774
|
trackLlmCall: (call) => recordLlmCall(llmTracer, call),
|
|
1552
1775
|
shutdown: async () => {
|
|
1553
|
-
const logShutdown = await Promise.allSettled([
|
|
1776
|
+
const logShutdown = await Promise.allSettled([_chunkUKYTXZOQcjs.shutdownRuntimeLogger.call(void 0, )]);
|
|
1554
1777
|
hookRequests = false;
|
|
1555
|
-
|
|
1778
|
+
if (onCrash) process.off("uncaughtExceptionMonitor", onCrash);
|
|
1779
|
+
_optionalChain([uninstallRejections, 'optionalCall', _76 => _76()]);
|
|
1780
|
+
_optionalChain([stopMemoryMetrics, 'optionalCall', _77 => _77()]);
|
|
1556
1781
|
active = null;
|
|
1557
1782
|
activeAlwaysOnProvider = null;
|
|
1558
|
-
_optionalChain([autoFlushHandle, 'optionalAccess',
|
|
1783
|
+
_optionalChain([autoFlushHandle, 'optionalAccess', _78 => _78.dispose, 'call', _79 => _79()]);
|
|
1559
1784
|
autoFlushHandle = null;
|
|
1560
|
-
|
|
1561
|
-
|
|
1785
|
+
_chunkARN26OK6cjs.unregisterFlushTargets.call(void 0, );
|
|
1786
|
+
_chunkARN26OK6cjs.telemetryStats.markAllFlushed();
|
|
1562
1787
|
await Promise.allSettled([alwaysOnProvider.shutdown(), sdk.shutdown()]);
|
|
1563
|
-
if (_optionalChain([logShutdown, 'access',
|
|
1788
|
+
if (_optionalChain([logShutdown, 'access', _80 => _80[0], 'optionalAccess', _81 => _81.status]) === "rejected") throw logShutdown[0].reason;
|
|
1564
1789
|
}
|
|
1565
1790
|
};
|
|
1566
1791
|
active = server;
|
|
@@ -1577,10 +1802,12 @@ function captureException(error, attributes) {
|
|
|
1577
1802
|
return;
|
|
1578
1803
|
}
|
|
1579
1804
|
markCaptured(error);
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
const
|
|
1583
|
-
|
|
1805
|
+
_chunkUKYTXZOQcjs.noteOperationError.call(void 0, error);
|
|
1806
|
+
const split = _chunkUKYTXZOQcjs.splitFingerprint.call(void 0, attributes);
|
|
1807
|
+
const fingerprint = _chunkUKYTXZOQcjs.fingerprintEventAttributes.call(void 0, split.fingerprint, activeRedactor.text);
|
|
1808
|
+
_chunkUKYTXZOQcjs.notifyException.call(void 0, error, { ...split.attributes, ...fingerprint });
|
|
1809
|
+
const span = _api.trace.getTracer("autter-errors").startSpan(_chunkUKYTXZOQcjs.isError.call(void 0, error) ? error.name : "Error", {
|
|
1810
|
+
attributes: { ...activeRedactor(split.attributes), ...fingerprint }
|
|
1584
1811
|
});
|
|
1585
1812
|
recordError(span, error);
|
|
1586
1813
|
span.end();
|
|
@@ -1592,7 +1819,11 @@ function setLoggerOnlyCapture(fn) {
|
|
|
1592
1819
|
function serverActive() {
|
|
1593
1820
|
return active !== null;
|
|
1594
1821
|
}
|
|
1595
|
-
setRequestExceptionCapturer((error) => captureException(error));
|
|
1822
|
+
setRequestExceptionCapturer((error, attributes) => captureException(error, attributes));
|
|
1823
|
+
setRequestSpanAnnotator((attributes) => {
|
|
1824
|
+
const span = _api.trace.getActiveSpan();
|
|
1825
|
+
if (_optionalChain([span, 'optionalAccess', _82 => _82.isRecording, 'call', _83 => _83()])) span.setAttributes(activeRedactor(_chunkUKYTXZOQcjs.splitFingerprint.call(void 0, attributes).attributes));
|
|
1826
|
+
});
|
|
1596
1827
|
function withProcessSpan(name, fn, attributes) {
|
|
1597
1828
|
if (active) return active.withProcessSpan(name, fn, attributes);
|
|
1598
1829
|
return runWithSpan(
|
|
@@ -1625,7 +1856,8 @@ function captureMessage(message, severity = "warning", attributes) {
|
|
|
1625
1856
|
span.addEvent("exception", {
|
|
1626
1857
|
"exception.type": "Message",
|
|
1627
1858
|
"exception.message": safeMessage,
|
|
1628
|
-
"autter.severity": severity
|
|
1859
|
+
"autter.severity": severity,
|
|
1860
|
+
..._chunkUKYTXZOQcjs.breadcrumbEventAttributes.call(void 0, activeRedactor.text)
|
|
1629
1861
|
});
|
|
1630
1862
|
span.setStatus({ code: _api.SpanStatusCode.ERROR, message: safeMessage });
|
|
1631
1863
|
span.end();
|
|
@@ -1633,11 +1865,11 @@ function captureMessage(message, severity = "warning", attributes) {
|
|
|
1633
1865
|
function reportOutcome(name, message, attributes) {
|
|
1634
1866
|
if (active) return active.reportOutcome(name, message, attributes);
|
|
1635
1867
|
const span = _api.trace.getTracer("autter-outcomes").startSpan("OutcomeFailure");
|
|
1636
|
-
const safeOutcome =
|
|
1868
|
+
const safeOutcome = _chunkUKYTXZOQcjs.redactAttributes.call(void 0, { "autter.outcome.name": name.slice(0, 200), "autter.outcome.message": message.slice(0, 1e3) });
|
|
1637
1869
|
const safeName = String(_nullishCoalesce(safeOutcome["autter.outcome.name"], () => ( "operation")));
|
|
1638
1870
|
const safeMessage = String(_nullishCoalesce(safeOutcome["autter.outcome.message"], () => ( "failed")));
|
|
1639
1871
|
span.addEvent("autter.outcome", {
|
|
1640
|
-
...
|
|
1872
|
+
..._chunkUKYTXZOQcjs.redactAttributes.call(void 0, attributes),
|
|
1641
1873
|
"autter.outcome.status": "error",
|
|
1642
1874
|
"autter.outcome.name": safeName,
|
|
1643
1875
|
"autter.outcome.message": safeMessage
|
|
@@ -1646,7 +1878,7 @@ function reportOutcome(name, message, attributes) {
|
|
|
1646
1878
|
span.end();
|
|
1647
1879
|
}
|
|
1648
1880
|
function makeSafeCapture(options) {
|
|
1649
|
-
const clean = (attributes) => attributes ? { ...
|
|
1881
|
+
const clean = (attributes) => attributes ? { ..._chunkUKYTXZOQcjs.redactAttributes.call(void 0, attributes, options) } : void 0;
|
|
1650
1882
|
return {
|
|
1651
1883
|
captureException: (error, attributes) => captureException(error, clean(attributes)),
|
|
1652
1884
|
captureMessage: (message, severity, attributes) => captureMessage(message, _nullishCoalesce(severity, () => ( "warning")), clean(attributes))
|
|
@@ -1673,7 +1905,7 @@ async function emitLlmSelftestTrace() {
|
|
|
1673
1905
|
attributes: { "autter.selftest": true }
|
|
1674
1906
|
},
|
|
1675
1907
|
(llm) => {
|
|
1676
|
-
traceId = _nullishCoalesce(_optionalChain([_api.trace, 'access',
|
|
1908
|
+
traceId = _nullishCoalesce(_optionalChain([_api.trace, 'access', _84 => _84.getActiveSpan, 'call', _85 => _85(), 'optionalAccess', _86 => _86.spanContext, 'call', _87 => _87(), 'access', _88 => _88.traceId]), () => ( ""));
|
|
1677
1909
|
llm.setUsage({ inputTokens: 1, outputTokens: 1 });
|
|
1678
1910
|
llm.setCost(0);
|
|
1679
1911
|
}
|
|
@@ -1701,7 +1933,7 @@ var CALL_METHODS = /* @__PURE__ */ new Set([
|
|
|
1701
1933
|
// openai beta structured outputs
|
|
1702
1934
|
]);
|
|
1703
1935
|
function detectProvider(client) {
|
|
1704
|
-
const name = _nullishCoalesce(_optionalChain([client, 'access',
|
|
1936
|
+
const name = _nullishCoalesce(_optionalChain([client, 'access', _89 => _89.constructor, 'optionalAccess', _90 => _90.name, 'optionalAccess', _91 => _91.toLowerCase, 'call', _92 => _92()]), () => ( ""));
|
|
1705
1937
|
for (const known of ["openai", "anthropic", "mistral", "groq", "cohere"]) {
|
|
1706
1938
|
if (name.includes(known)) return known;
|
|
1707
1939
|
}
|
|
@@ -1709,7 +1941,7 @@ function detectProvider(client) {
|
|
|
1709
1941
|
const baseUrl = String(
|
|
1710
1942
|
_nullishCoalesce(_nullishCoalesce(client.baseURL, () => ( client.baseUrl)), () => ( ""))
|
|
1711
1943
|
);
|
|
1712
|
-
const host = _nullishCoalesce(_optionalChain([baseUrl, 'access',
|
|
1944
|
+
const host = _nullishCoalesce(_optionalChain([baseUrl, 'access', _93 => _93.match, 'call', _94 => _94(/https?:\/\/([^/]+)/), 'optionalAccess', _95 => _95[1]]), () => ( ""));
|
|
1713
1945
|
if (host.includes("openai")) return "openai";
|
|
1714
1946
|
if (host.includes("anthropic")) return "anthropic";
|
|
1715
1947
|
if (host.includes("googleapis")) return "google";
|
|
@@ -1719,13 +1951,13 @@ function detectProvider(client) {
|
|
|
1719
1951
|
}
|
|
1720
1952
|
function extractUsage(result) {
|
|
1721
1953
|
const r = result;
|
|
1722
|
-
const usage = _nullishCoalesce(_optionalChain([r, 'optionalAccess',
|
|
1723
|
-
const meta = _optionalChain([r, 'optionalAccess',
|
|
1724
|
-
const details = _optionalChain([usage, 'optionalAccess',
|
|
1725
|
-
const cached = _nullishCoalesce(_nullishCoalesce(_optionalChain([usage, 'optionalAccess',
|
|
1726
|
-
const input = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([usage, 'optionalAccess',
|
|
1727
|
-
const output = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([usage, 'optionalAccess',
|
|
1728
|
-
const responseModel = _nullishCoalesce(_optionalChain([r, 'optionalAccess',
|
|
1954
|
+
const usage = _nullishCoalesce(_optionalChain([r, 'optionalAccess', _96 => _96.usage]), () => ( _optionalChain([r, 'optionalAccess', _97 => _97.message, 'optionalAccess', _98 => _98.usage])));
|
|
1955
|
+
const meta = _optionalChain([r, 'optionalAccess', _99 => _99.usageMetadata]);
|
|
1956
|
+
const details = _optionalChain([usage, 'optionalAccess', _100 => _100.prompt_tokens_details]);
|
|
1957
|
+
const cached = _nullishCoalesce(_nullishCoalesce(_optionalChain([usage, 'optionalAccess', _101 => _101.cache_read_input_tokens]), () => ( (typeof _optionalChain([details, 'optionalAccess', _102 => _102.cached_tokens]) === "number" ? details.cached_tokens : void 0))), () => ( _optionalChain([meta, 'optionalAccess', _103 => _103.cachedContentTokenCount])));
|
|
1958
|
+
const input = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([usage, 'optionalAccess', _104 => _104.prompt_tokens]), () => ( _optionalChain([usage, 'optionalAccess', _105 => _105.input_tokens]))), () => ( _optionalChain([meta, 'optionalAccess', _106 => _106.promptTokenCount]))), () => ( void 0));
|
|
1959
|
+
const output = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([usage, 'optionalAccess', _107 => _107.completion_tokens]), () => ( _optionalChain([usage, 'optionalAccess', _108 => _108.output_tokens]))), () => ( _optionalChain([meta, 'optionalAccess', _109 => _109.candidatesTokenCount]))), () => ( void 0));
|
|
1960
|
+
const responseModel = _nullishCoalesce(_optionalChain([r, 'optionalAccess', _110 => _110.model]), () => ( _optionalChain([r, 'optionalAccess', _111 => _111.modelVersion])));
|
|
1729
1961
|
return {
|
|
1730
1962
|
inputTokens: typeof input === "number" ? input : void 0,
|
|
1731
1963
|
outputTokens: typeof output === "number" ? output : void 0,
|
|
@@ -1734,7 +1966,7 @@ function extractUsage(result) {
|
|
|
1734
1966
|
};
|
|
1735
1967
|
}
|
|
1736
1968
|
function rollUp(model, usage) {
|
|
1737
|
-
|
|
1969
|
+
_chunkUKYTXZOQcjs.recordOperationAiUsage.call(void 0, {
|
|
1738
1970
|
model: _nullishCoalesce(usage.responseModel, () => ( model)),
|
|
1739
1971
|
...usage.inputTokens !== void 0 ? { inputTokens: usage.inputTokens } : {},
|
|
1740
1972
|
...usage.outputTokens !== void 0 ? { outputTokens: usage.outputTokens } : {},
|
|
@@ -1818,10 +2050,10 @@ function wrapStream(stream, span, model) {
|
|
|
1818
2050
|
});
|
|
1819
2051
|
}
|
|
1820
2052
|
function instrumentLlmClient(client, options) {
|
|
1821
|
-
const provider = (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2053
|
+
const provider = (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _112 => _112.provider]), () => ( detectProvider(client)))).toLowerCase();
|
|
1822
2054
|
const proxied = /* @__PURE__ */ new WeakMap();
|
|
1823
2055
|
function resolveUserId() {
|
|
1824
|
-
return typeof _optionalChain([options, 'optionalAccess',
|
|
2056
|
+
return typeof _optionalChain([options, 'optionalAccess', _113 => _113.userId]) === "function" ? options.userId() : _optionalChain([options, 'optionalAccess', _114 => _114.userId]);
|
|
1825
2057
|
}
|
|
1826
2058
|
function traceCall(fn, self, callPath, args) {
|
|
1827
2059
|
const request = args[0];
|
|
@@ -1835,7 +2067,7 @@ function instrumentLlmClient(client, options) {
|
|
|
1835
2067
|
"gen_ai.system": provider,
|
|
1836
2068
|
"gen_ai.request.model": request.model,
|
|
1837
2069
|
...userId ? { "autter.user_id": userId } : {},
|
|
1838
|
-
...redactWithActive(_optionalChain([options, 'optionalAccess',
|
|
2070
|
+
...redactWithActive(_optionalChain([options, 'optionalAccess', _115 => _115.attributes]))
|
|
1839
2071
|
}
|
|
1840
2072
|
});
|
|
1841
2073
|
let result;
|
|
@@ -1955,6 +2187,42 @@ ${frames.join("\n")}`;
|
|
|
1955
2187
|
} };
|
|
1956
2188
|
}
|
|
1957
2189
|
|
|
2190
|
+
// src/framework-errors.ts
|
|
2191
|
+
function recordBoundaryError(error, req, rule) {
|
|
2192
|
+
try {
|
|
2193
|
+
const state = requestStateOf(req);
|
|
2194
|
+
if (state) _chunkUKYTXZOQcjs.noteOperationError.call(void 0, error, false, state);
|
|
2195
|
+
captureAtBoundary(error, state, rule);
|
|
2196
|
+
} catch (e29) {
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
function autterErrorHandler(options = {}) {
|
|
2200
|
+
return function autterErrorHandlerMiddleware(error, req, _res, next) {
|
|
2201
|
+
recordBoundaryError(error, req, options.capture);
|
|
2202
|
+
next(error);
|
|
2203
|
+
};
|
|
2204
|
+
}
|
|
2205
|
+
function autterFastifyErrors(fastify, options, done) {
|
|
2206
|
+
const rule = _optionalChain([options, 'optionalAccess', _116 => _116.capture]);
|
|
2207
|
+
fastify.addHook("onError", ((request, _reply, error, next) => {
|
|
2208
|
+
recordBoundaryError(error, _optionalChain([request, 'optionalAccess', _117 => _117.raw]), rule);
|
|
2209
|
+
next();
|
|
2210
|
+
}));
|
|
2211
|
+
_optionalChain([done, 'optionalCall', _118 => _118()]);
|
|
2212
|
+
}
|
|
2213
|
+
autterFastifyErrors[/* @__PURE__ */ Symbol.for("skip-override")] = true;
|
|
2214
|
+
autterFastifyErrors[/* @__PURE__ */ Symbol.for("fastify.display-name")] = "autter-runtime-errors";
|
|
2215
|
+
function autterKoa(options = {}) {
|
|
2216
|
+
return async function autterKoaMiddleware(ctx, next) {
|
|
2217
|
+
try {
|
|
2218
|
+
await next();
|
|
2219
|
+
} catch (error) {
|
|
2220
|
+
recordBoundaryError(error, _optionalChain([ctx, 'optionalAccess', _119 => _119.req]), options.capture);
|
|
2221
|
+
throw error;
|
|
2222
|
+
}
|
|
2223
|
+
};
|
|
2224
|
+
}
|
|
2225
|
+
|
|
1958
2226
|
// src/logging-only.ts
|
|
1959
2227
|
|
|
1960
2228
|
|
|
@@ -1969,27 +2237,29 @@ function initAutterLogging(options) {
|
|
|
1969
2237
|
);
|
|
1970
2238
|
return {
|
|
1971
2239
|
captureException,
|
|
1972
|
-
flush:
|
|
2240
|
+
flush: _chunkUKYTXZOQcjs.flushRuntimeLogs,
|
|
1973
2241
|
shutdown: async () => {
|
|
1974
2242
|
}
|
|
1975
2243
|
};
|
|
1976
2244
|
}
|
|
1977
|
-
if (
|
|
2245
|
+
if (_chunkARN26OK6cjs.isDebugEnabled.call(void 0, ) || options.debug === true) _chunkARN26OK6cjs.setDebugMode.call(void 0, true);
|
|
1978
2246
|
const endpoint = (_nullishCoalesce(options.endpoint, () => ( "https://otlp.autter.dev"))).replace(/\/$/, "");
|
|
1979
2247
|
const environment = _nullishCoalesce(_nullishCoalesce(options.environment, () => ( process.env.NODE_ENV)), () => ( "production"));
|
|
1980
|
-
const redact =
|
|
2248
|
+
const redact = _chunkUKYTXZOQcjs.makeRedactor.call(void 0, _nullishCoalesce(options.redactAttributes, () => ( true)));
|
|
1981
2249
|
const mode = _nullishCoalesce(options.exceptions, () => ( "auto"));
|
|
1982
|
-
|
|
2250
|
+
_chunkARN26OK6cjs.debugLog.call(void 0, `initialising logger-only service=${options.service} endpoint=${endpoint}`);
|
|
1983
2251
|
function captureException2(error, attributes) {
|
|
1984
2252
|
markCaptured(error);
|
|
1985
|
-
const
|
|
2253
|
+
const split = _chunkUKYTXZOQcjs.splitFingerprint.call(void 0, attributes);
|
|
2254
|
+
const fingerprint = _chunkUKYTXZOQcjs.fingerprintEventAttributes.call(void 0, split.fingerprint, redact.text);
|
|
2255
|
+
const redacted = redact(split.attributes);
|
|
1986
2256
|
const span = _api.trace.getActiveSpan();
|
|
1987
|
-
if (mode === "auto" && _optionalChain([span, 'optionalAccess',
|
|
1988
|
-
|
|
1989
|
-
|
|
2257
|
+
if (mode === "auto" && _optionalChain([span, 'optionalAccess', _120 => _120.isRecording, 'call', _121 => _121()])) {
|
|
2258
|
+
_chunkUKYTXZOQcjs.noteOperationError.call(void 0, error);
|
|
2259
|
+
_chunkUKYTXZOQcjs.notifyException.call(void 0, error, { ...redacted, ...fingerprint });
|
|
1990
2260
|
span.setAttributes({ "autter.severity": "error", ...redacted, ...structuredErrorAttributes(error) });
|
|
1991
|
-
const declared =
|
|
1992
|
-
if (
|
|
2261
|
+
const declared = { ..._chunkUKYTXZOQcjs.errorAttributes.call(void 0, error), ...fingerprint };
|
|
2262
|
+
if (_chunkUKYTXZOQcjs.isError.call(void 0, error)) {
|
|
1993
2263
|
span.addEvent("exception", {
|
|
1994
2264
|
"exception.type": error.name,
|
|
1995
2265
|
"exception.message": error.message,
|
|
@@ -2005,15 +2275,15 @@ function initAutterLogging(options) {
|
|
|
2005
2275
|
}
|
|
2006
2276
|
span.setStatus({
|
|
2007
2277
|
code: _api.SpanStatusCode.ERROR,
|
|
2008
|
-
message:
|
|
2278
|
+
message: _chunkUKYTXZOQcjs.isError.call(void 0, error) ? error.message : String(error)
|
|
2009
2279
|
});
|
|
2010
2280
|
return;
|
|
2011
2281
|
}
|
|
2012
|
-
|
|
2013
|
-
|
|
2282
|
+
_chunkUKYTXZOQcjs.notifyException.call(void 0, error, { ...redacted, ...fingerprint });
|
|
2283
|
+
_chunkUKYTXZOQcjs.captureExceptionAsLog.call(void 0, error, { ...redacted, ...fingerprint });
|
|
2014
2284
|
}
|
|
2015
2285
|
const captured = /* @__PURE__ */ new WeakSet();
|
|
2016
|
-
|
|
2286
|
+
_chunkUKYTXZOQcjs.configureRuntimeLogger.call(void 0, {
|
|
2017
2287
|
endpoint,
|
|
2018
2288
|
apiKey: _nullishCoalesce(options.apiKey, () => ( "")),
|
|
2019
2289
|
service: options.service,
|
|
@@ -2022,7 +2292,7 @@ function initAutterLogging(options) {
|
|
|
2022
2292
|
...options.logging ? { options: options.logging } : {},
|
|
2023
2293
|
redact,
|
|
2024
2294
|
reportOutcome: (name, message, attributes) => {
|
|
2025
|
-
|
|
2295
|
+
_chunkUKYTXZOQcjs.runtimeLogger.error(message, {
|
|
2026
2296
|
...attributes,
|
|
2027
2297
|
"autter.outcome.name": name.slice(0, 200),
|
|
2028
2298
|
"autter.outcome.message": message.slice(0, 1e3)
|
|
@@ -2037,22 +2307,33 @@ function initAutterLogging(options) {
|
|
|
2037
2307
|
}
|
|
2038
2308
|
});
|
|
2039
2309
|
setLoggerOnlyCapture(captureException2);
|
|
2040
|
-
const onCrash = (error) =>
|
|
2041
|
-
|
|
2310
|
+
const onCrash = (error) => {
|
|
2311
|
+
if (recordedAsRejection(error)) return;
|
|
2312
|
+
captureException2(error, { "autter.unhandled": true });
|
|
2313
|
+
};
|
|
2314
|
+
let uninstallRejections = null;
|
|
2315
|
+
if (options.captureGlobalErrors !== false) {
|
|
2042
2316
|
process.on("uncaughtExceptionMonitor", onCrash);
|
|
2043
|
-
|
|
2044
|
-
|
|
2317
|
+
if (options.captureUnhandledRejections !== false)
|
|
2318
|
+
uninstallRejections = installUnhandledRejectionCapture(
|
|
2319
|
+
(reason) => captureException2(reason, { "autter.unhandled_rejection": true })
|
|
2320
|
+
);
|
|
2321
|
+
}
|
|
2322
|
+
_chunkARN26OK6cjs.registerFlushTarget.call(void 0, "logging", { forceFlush: () => _chunkUKYTXZOQcjs.flushRuntimeLogs.call(void 0, ) });
|
|
2323
|
+
let autoFlushHandle = options.autoFlush === false ? null : _chunkARN26OK6cjs.installAutterAutoFlush.call(void 0, );
|
|
2045
2324
|
const handle = {
|
|
2046
2325
|
captureException: captureException2,
|
|
2047
|
-
flush:
|
|
2326
|
+
flush: _chunkUKYTXZOQcjs.flushRuntimeLogs,
|
|
2048
2327
|
shutdown: async () => {
|
|
2049
2328
|
process.off("uncaughtExceptionMonitor", onCrash);
|
|
2329
|
+
_optionalChain([uninstallRejections, 'optionalCall', _122 => _122()]);
|
|
2330
|
+
uninstallRejections = null;
|
|
2050
2331
|
setLoggerOnlyCapture(null);
|
|
2051
|
-
_optionalChain([autoFlushHandle, 'optionalAccess',
|
|
2332
|
+
_optionalChain([autoFlushHandle, 'optionalAccess', _123 => _123.dispose, 'call', _124 => _124()]);
|
|
2052
2333
|
autoFlushHandle = null;
|
|
2053
|
-
|
|
2334
|
+
_chunkARN26OK6cjs.unregisterFlushTargets.call(void 0, );
|
|
2054
2335
|
activeLogging = null;
|
|
2055
|
-
await
|
|
2336
|
+
await _chunkUKYTXZOQcjs.shutdownRuntimeLogger.call(void 0, );
|
|
2056
2337
|
}
|
|
2057
2338
|
};
|
|
2058
2339
|
activeLogging = handle;
|
|
@@ -2061,7 +2342,7 @@ function initAutterLogging(options) {
|
|
|
2061
2342
|
|
|
2062
2343
|
// src/enrichers.ts
|
|
2063
2344
|
function headerOf(req, name) {
|
|
2064
|
-
const headers = _optionalChain([req, 'optionalAccess',
|
|
2345
|
+
const headers = _optionalChain([req, 'optionalAccess', _125 => _125.headers]);
|
|
2065
2346
|
if (!headers) return void 0;
|
|
2066
2347
|
if (typeof headers.get === "function") {
|
|
2067
2348
|
return _nullishCoalesce(headers.get(name), () => ( void 0));
|
|
@@ -2074,7 +2355,7 @@ function enrichUserAgent() {
|
|
|
2074
2355
|
return (event, { req }) => {
|
|
2075
2356
|
const ua = headerOf(req, "user-agent");
|
|
2076
2357
|
if (!ua) return;
|
|
2077
|
-
const info =
|
|
2358
|
+
const info = _chunkUKYTXZOQcjs.parseUserAgent.call(void 0, ua);
|
|
2078
2359
|
if (info.browser) event.attributes["user_agent.browser"] = info.browser;
|
|
2079
2360
|
if (info.os) event.attributes["user_agent.os"] = info.os;
|
|
2080
2361
|
event.attributes["user_agent.device"] = info.device;
|
|
@@ -2086,7 +2367,7 @@ function enrichRequestSize() {
|
|
|
2086
2367
|
const request = Number(headerOf(req, "content-length"));
|
|
2087
2368
|
if (Number.isFinite(request) && request >= 0)
|
|
2088
2369
|
event.attributes["http.request.body.size"] = request;
|
|
2089
|
-
const raw = _optionalChain([res, 'optionalAccess',
|
|
2370
|
+
const raw = _optionalChain([res, 'optionalAccess', _126 => _126.getHeader, 'optionalCall', _127 => _127(
|
|
2090
2371
|
"content-length"
|
|
2091
2372
|
)]);
|
|
2092
2373
|
const response = Number(raw);
|
|
@@ -2104,7 +2385,7 @@ var COUNTRY_HEADERS = [
|
|
|
2104
2385
|
function enrichEdgeGeo() {
|
|
2105
2386
|
return (event, { req }) => {
|
|
2106
2387
|
for (const name of COUNTRY_HEADERS) {
|
|
2107
|
-
const value = _optionalChain([headerOf, 'call',
|
|
2388
|
+
const value = _optionalChain([headerOf, 'call', _128 => _128(req, name), 'optionalAccess', _129 => _129.trim, 'call', _130 => _130(), 'access', _131 => _131.toUpperCase, 'call', _132 => _132()]);
|
|
2108
2389
|
if (value && /^[A-Z]{2}$/.test(value) && value !== "XX" && value !== "T1") {
|
|
2109
2390
|
event.attributes["geo.country.iso_code"] = value;
|
|
2110
2391
|
return;
|
|
@@ -2138,9 +2419,9 @@ var COMMIT_VARS = [
|
|
|
2138
2419
|
"SOURCE_VERSION"
|
|
2139
2420
|
];
|
|
2140
2421
|
function enrichDeployment(env = process.env) {
|
|
2141
|
-
const pick = (names) => names.map((name) => _optionalChain([env, 'access',
|
|
2142
|
-
const region = _optionalChain([pick, 'call',
|
|
2143
|
-
const commit = _optionalChain([pick, 'call',
|
|
2422
|
+
const pick = (names) => names.map((name) => _optionalChain([env, 'access', _133 => _133[name], 'optionalAccess', _134 => _134.trim, 'call', _135 => _135()])).find((value) => value);
|
|
2423
|
+
const region = _optionalChain([pick, 'call', _136 => _136(REGION_VARS), 'optionalAccess', _137 => _137.slice, 'call', _138 => _138(0, 64)]);
|
|
2424
|
+
const commit = _optionalChain([pick, 'call', _139 => _139(COMMIT_VARS), 'optionalAccess', _140 => _140.slice, 'call', _141 => _141(0, 64)]);
|
|
2144
2425
|
return (event) => {
|
|
2145
2426
|
if (region) event.attributes["deployment.region"] = region;
|
|
2146
2427
|
if (commit) event.attributes["deployment.commit"] = commit;
|
|
@@ -2195,4 +2476,10 @@ function enrichDeployment(env = process.env) {
|
|
|
2195
2476
|
|
|
2196
2477
|
|
|
2197
2478
|
|
|
2198
|
-
|
|
2479
|
+
|
|
2480
|
+
|
|
2481
|
+
|
|
2482
|
+
|
|
2483
|
+
|
|
2484
|
+
|
|
2485
|
+
exports.CODE_PATTERN = _chunkUKYTXZOQcjs.CODE_PATTERN; exports.COMPAT_MANIFEST = _chunkARN26OK6cjs.COMPAT_MANIFEST; exports.INGESTER_VERSION_HEADER = _chunkARN26OK6cjs.INGESTER_VERSION_HEADER; exports.RuntimeError = _chunkUKYTXZOQcjs.RuntimeError; exports.SDK_IDENTITY = _chunkARN26OK6cjs.SDK_IDENTITY; exports.addBreadcrumb = _chunkUKYTXZOQcjs.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 = _chunkUKYTXZOQcjs.consoleSink; exports.createBrowserRelayFetchHandler = createBrowserRelayFetchHandler; exports.createBrowserRelayHandler = createBrowserRelayHandler; exports.createRuntimeLogger = _chunkUKYTXZOQcjs.createRuntimeLogger; exports.defineRuntimeErrors = _chunkUKYTXZOQcjs.defineRuntimeErrors; exports.emitLlmSelftestTrace = emitLlmSelftestTrace; exports.enrichDeployment = enrichDeployment; exports.enrichEdgeGeo = enrichEdgeGeo; exports.enrichRequestSize = enrichRequestSize; exports.enrichUserAgent = enrichUserAgent; exports.errorAttributes = _chunkUKYTXZOQcjs.errorAttributes; exports.evaluateCompat = _chunkARN26OK6cjs.evaluateCompat; exports.fetchIngesterCompat = _chunkARN26OK6cjs.fetchIngesterCompat; exports.fileSink = _chunkUKYTXZOQcjs.fileSink; exports.flushRuntimeLogs = _chunkUKYTXZOQcjs.flushRuntimeLogs; exports.initAutterLogging = initAutterLogging; exports.initAutterServer = initAutterServer; exports.installAutterAutoFlush = _chunkARN26OK6cjs.installAutterAutoFlush; exports.instrumentLlmClient = instrumentLlmClient; exports.isRuntimeErrorLike = _chunkUKYTXZOQcjs.isRuntimeErrorLike; exports.makeSafeCapture = makeSafeCapture; exports.otlpSink = _chunkUKYTXZOQcjs.otlpSink; exports.redactAttributes = _chunkUKYTXZOQcjs.redactAttributes; exports.redactText = _chunkUKYTXZOQcjs.redactText; exports.reportOutcome = reportOutcome; exports.runDoctor = _chunkUGNPCOIWcjs.runDoctor; exports.runInBackground = _chunkUKYTXZOQcjs.runInBackground; exports.runtimeContext = _chunkUKYTXZOQcjs.runtimeContext; exports.runtimeLogStats = _chunkUKYTXZOQcjs.runtimeLogStats; exports.runtimeLogger = _chunkUKYTXZOQcjs.runtimeLogger; exports.sanitizeBrowserPayload = sanitizeBrowserPayload; exports.startCaughtExceptionSampler = startCaughtExceptionSampler; exports.toClientError = _chunkUKYTXZOQcjs.toClientError; exports.trackLlmCall = trackLlmCall; exports.unhandledRejectionsMode = unhandledRejectionsMode; exports.withLlmCall = withLlmCall; exports.withProcessSpan = withProcessSpan; exports.withRuntimeOperation = _chunkUKYTXZOQcjs.withRuntimeOperation; exports.withRuntimeRequest = withRuntimeRequest;
|