@elizaos/server 1.6.2-alpha.1 → 1.6.2-alpha.11
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/dist/client/assets/main-CSo-qJrs.js +155 -0
- package/dist/client/assets/{main-BM2lpId8.js.map → main-CSo-qJrs.js.map} +1 -1
- package/dist/client/assets/{main-CNv6B3RZ.css → main-DrN44Cbu.css} +1 -1
- package/dist/client/assets/{main-CQAV8tyh.js → main-SRNpPkyL.js} +3 -3
- package/dist/client/assets/{main-CQAV8tyh.js.map → main-SRNpPkyL.js.map} +1 -1
- package/dist/client/assets/react-vendor-C4SJa6B7.js +611 -0
- package/dist/client/assets/react-vendor-C4SJa6B7.js.map +1 -0
- package/dist/client/index.html +1 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.js +1091 -1084
- package/package.json +5 -5
- package/dist/client/assets/main-BM2lpId8.js +0 -155
- package/dist/client/assets/react-vendor-C1OK-nqm.js +0 -611
- package/dist/client/assets/react-vendor-C1OK-nqm.js.map +0 -1
- package/dist/managers/ConfigManager.d.ts +0 -32
- package/dist/managers/PluginInstaller.d.ts +0 -10
- package/dist/managers/PluginLoader.d.ts +0 -27
package/dist/index.js
CHANGED
|
@@ -12295,21 +12295,21 @@ var require_ParentBasedSampler = __commonJS((exports) => {
|
|
|
12295
12295
|
this._localParentSampled = config.localParentSampled ?? new AlwaysOnSampler_1.AlwaysOnSampler;
|
|
12296
12296
|
this._localParentNotSampled = config.localParentNotSampled ?? new AlwaysOffSampler_1.AlwaysOffSampler;
|
|
12297
12297
|
}
|
|
12298
|
-
shouldSample(
|
|
12299
|
-
const parentContext = api_1.trace.getSpanContext(
|
|
12298
|
+
shouldSample(context3, traceId, spanName, spanKind, attributes, links) {
|
|
12299
|
+
const parentContext = api_1.trace.getSpanContext(context3);
|
|
12300
12300
|
if (!parentContext || !(0, api_1.isSpanContextValid)(parentContext)) {
|
|
12301
|
-
return this._root.shouldSample(
|
|
12301
|
+
return this._root.shouldSample(context3, traceId, spanName, spanKind, attributes, links);
|
|
12302
12302
|
}
|
|
12303
12303
|
if (parentContext.isRemote) {
|
|
12304
12304
|
if (parentContext.traceFlags & api_1.TraceFlags.SAMPLED) {
|
|
12305
|
-
return this._remoteParentSampled.shouldSample(
|
|
12305
|
+
return this._remoteParentSampled.shouldSample(context3, traceId, spanName, spanKind, attributes, links);
|
|
12306
12306
|
}
|
|
12307
|
-
return this._remoteParentNotSampled.shouldSample(
|
|
12307
|
+
return this._remoteParentNotSampled.shouldSample(context3, traceId, spanName, spanKind, attributes, links);
|
|
12308
12308
|
}
|
|
12309
12309
|
if (parentContext.traceFlags & api_1.TraceFlags.SAMPLED) {
|
|
12310
|
-
return this._localParentSampled.shouldSample(
|
|
12310
|
+
return this._localParentSampled.shouldSample(context3, traceId, spanName, spanKind, attributes, links);
|
|
12311
12311
|
}
|
|
12312
|
-
return this._localParentNotSampled.shouldSample(
|
|
12312
|
+
return this._localParentNotSampled.shouldSample(context3, traceId, spanName, spanKind, attributes, links);
|
|
12313
12313
|
}
|
|
12314
12314
|
toString() {
|
|
12315
12315
|
return `ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`;
|
|
@@ -12333,7 +12333,7 @@ var require_TraceIdRatioBasedSampler = __commonJS((exports) => {
|
|
|
12333
12333
|
this._ratio = this._normalize(_ratio);
|
|
12334
12334
|
this._upperBound = Math.floor(this._ratio * 4294967295);
|
|
12335
12335
|
}
|
|
12336
|
-
shouldSample(
|
|
12336
|
+
shouldSample(context3, traceId) {
|
|
12337
12337
|
return {
|
|
12338
12338
|
decision: (0, api_1.isValidTraceId)(traceId) && this._accumulate(traceId) < this._upperBound ? Sampler_1.SamplingDecision.RECORD_AND_SAMPLED : Sampler_1.SamplingDecision.NOT_RECORD
|
|
12339
12339
|
};
|
|
@@ -12729,12 +12729,12 @@ var require_Tracer = __commonJS((exports) => {
|
|
|
12729
12729
|
this._spanProcessor = spanProcessor;
|
|
12730
12730
|
this.instrumentationScope = instrumentationScope;
|
|
12731
12731
|
}
|
|
12732
|
-
startSpan(name, options = {},
|
|
12732
|
+
startSpan(name, options = {}, context3 = api.context.active()) {
|
|
12733
12733
|
if (options.root) {
|
|
12734
|
-
|
|
12734
|
+
context3 = api.trace.deleteSpan(context3);
|
|
12735
12735
|
}
|
|
12736
|
-
const parentSpan = api.trace.getSpan(
|
|
12737
|
-
if ((0, core_1.isTracingSuppressed)(
|
|
12736
|
+
const parentSpan = api.trace.getSpan(context3);
|
|
12737
|
+
if ((0, core_1.isTracingSuppressed)(context3)) {
|
|
12738
12738
|
api.diag.debug("Instrumentation suppressed, returning Noop Span");
|
|
12739
12739
|
const nonRecordingSpan = api.trace.wrapSpanContext(api.INVALID_SPAN_CONTEXT);
|
|
12740
12740
|
return nonRecordingSpan;
|
|
@@ -12759,7 +12759,7 @@ var require_Tracer = __commonJS((exports) => {
|
|
|
12759
12759
|
};
|
|
12760
12760
|
});
|
|
12761
12761
|
const attributes = (0, core_1.sanitizeAttributes)(options.attributes);
|
|
12762
|
-
const samplingResult = this._sampler.shouldSample(
|
|
12762
|
+
const samplingResult = this._sampler.shouldSample(context3, traceId, name, spanKind, attributes, links);
|
|
12763
12763
|
traceState = samplingResult.traceState ?? traceState;
|
|
12764
12764
|
const traceFlags = samplingResult.decision === api.SamplingDecision.RECORD_AND_SAMPLED ? api.TraceFlags.SAMPLED : api.TraceFlags.NONE;
|
|
12765
12765
|
const spanContext = { traceId, spanId, traceFlags, traceState };
|
|
@@ -12772,7 +12772,7 @@ var require_Tracer = __commonJS((exports) => {
|
|
|
12772
12772
|
const span = new Span_1.SpanImpl({
|
|
12773
12773
|
resource: this._resource,
|
|
12774
12774
|
scope: this.instrumentationScope,
|
|
12775
|
-
context:
|
|
12775
|
+
context: context3,
|
|
12776
12776
|
spanContext,
|
|
12777
12777
|
name,
|
|
12778
12778
|
kind: spanKind,
|
|
@@ -12841,9 +12841,9 @@ var require_MultiSpanProcessor = __commonJS((exports) => {
|
|
|
12841
12841
|
});
|
|
12842
12842
|
});
|
|
12843
12843
|
}
|
|
12844
|
-
onStart(span,
|
|
12844
|
+
onStart(span, context3) {
|
|
12845
12845
|
for (const spanProcessor of this._spanProcessors) {
|
|
12846
|
-
spanProcessor.onStart(span,
|
|
12846
|
+
spanProcessor.onStart(span, context3);
|
|
12847
12847
|
}
|
|
12848
12848
|
}
|
|
12849
12849
|
onEnd(span) {
|
|
@@ -13171,19 +13171,19 @@ var require_AbstractAsyncHooksContextManager = __commonJS((exports) => {
|
|
|
13171
13171
|
];
|
|
13172
13172
|
|
|
13173
13173
|
class AbstractAsyncHooksContextManager {
|
|
13174
|
-
bind(
|
|
13174
|
+
bind(context7, target) {
|
|
13175
13175
|
if (target instanceof events_1.EventEmitter) {
|
|
13176
|
-
return this._bindEventEmitter(
|
|
13176
|
+
return this._bindEventEmitter(context7, target);
|
|
13177
13177
|
}
|
|
13178
13178
|
if (typeof target === "function") {
|
|
13179
|
-
return this._bindFunction(
|
|
13179
|
+
return this._bindFunction(context7, target);
|
|
13180
13180
|
}
|
|
13181
13181
|
return target;
|
|
13182
13182
|
}
|
|
13183
|
-
_bindFunction(
|
|
13183
|
+
_bindFunction(context7, target) {
|
|
13184
13184
|
const manager = this;
|
|
13185
13185
|
const contextWrapper = function(...args) {
|
|
13186
|
-
return manager.with(
|
|
13186
|
+
return manager.with(context7, () => target.apply(this, args));
|
|
13187
13187
|
};
|
|
13188
13188
|
Object.defineProperty(contextWrapper, "length", {
|
|
13189
13189
|
enumerable: false,
|
|
@@ -13193,7 +13193,7 @@ var require_AbstractAsyncHooksContextManager = __commonJS((exports) => {
|
|
|
13193
13193
|
});
|
|
13194
13194
|
return contextWrapper;
|
|
13195
13195
|
}
|
|
13196
|
-
_bindEventEmitter(
|
|
13196
|
+
_bindEventEmitter(context7, ee) {
|
|
13197
13197
|
const map = this._getPatchMap(ee);
|
|
13198
13198
|
if (map !== undefined)
|
|
13199
13199
|
return ee;
|
|
@@ -13201,7 +13201,7 @@ var require_AbstractAsyncHooksContextManager = __commonJS((exports) => {
|
|
|
13201
13201
|
ADD_LISTENER_METHODS.forEach((methodName) => {
|
|
13202
13202
|
if (ee[methodName] === undefined)
|
|
13203
13203
|
return;
|
|
13204
|
-
ee[methodName] = this._patchAddListener(ee, ee[methodName],
|
|
13204
|
+
ee[methodName] = this._patchAddListener(ee, ee[methodName], context7);
|
|
13205
13205
|
});
|
|
13206
13206
|
if (typeof ee.removeListener === "function") {
|
|
13207
13207
|
ee.removeListener = this._patchRemoveListener(ee, ee.removeListener);
|
|
@@ -13239,7 +13239,7 @@ var require_AbstractAsyncHooksContextManager = __commonJS((exports) => {
|
|
|
13239
13239
|
return original.apply(this, arguments);
|
|
13240
13240
|
};
|
|
13241
13241
|
}
|
|
13242
|
-
_patchAddListener(ee, original,
|
|
13242
|
+
_patchAddListener(ee, original, context7) {
|
|
13243
13243
|
const contextManager = this;
|
|
13244
13244
|
return function(event, listener) {
|
|
13245
13245
|
if (contextManager._wrapped) {
|
|
@@ -13254,7 +13254,7 @@ var require_AbstractAsyncHooksContextManager = __commonJS((exports) => {
|
|
|
13254
13254
|
listeners = new WeakMap;
|
|
13255
13255
|
map[event] = listeners;
|
|
13256
13256
|
}
|
|
13257
|
-
const patchedListener = contextManager.bind(
|
|
13257
|
+
const patchedListener = contextManager.bind(context7, listener);
|
|
13258
13258
|
listeners.set(listener, patchedListener);
|
|
13259
13259
|
contextManager._wrapped = true;
|
|
13260
13260
|
try {
|
|
@@ -13303,8 +13303,8 @@ var require_AsyncHooksContextManager = __commonJS((exports) => {
|
|
|
13303
13303
|
active() {
|
|
13304
13304
|
return this._stack[this._stack.length - 1] ?? api_1.ROOT_CONTEXT;
|
|
13305
13305
|
}
|
|
13306
|
-
with(
|
|
13307
|
-
this._enterContext(
|
|
13306
|
+
with(context7, fn, thisArg, ...args) {
|
|
13307
|
+
this._enterContext(context7);
|
|
13308
13308
|
try {
|
|
13309
13309
|
return fn.call(thisArg, ...args);
|
|
13310
13310
|
} finally {
|
|
@@ -13324,25 +13324,25 @@ var require_AsyncHooksContextManager = __commonJS((exports) => {
|
|
|
13324
13324
|
_init(uid, type) {
|
|
13325
13325
|
if (type === "TIMERWRAP")
|
|
13326
13326
|
return;
|
|
13327
|
-
const
|
|
13328
|
-
if (
|
|
13329
|
-
this._contexts.set(uid,
|
|
13327
|
+
const context7 = this._stack[this._stack.length - 1];
|
|
13328
|
+
if (context7 !== undefined) {
|
|
13329
|
+
this._contexts.set(uid, context7);
|
|
13330
13330
|
}
|
|
13331
13331
|
}
|
|
13332
13332
|
_destroy(uid) {
|
|
13333
13333
|
this._contexts.delete(uid);
|
|
13334
13334
|
}
|
|
13335
13335
|
_before(uid) {
|
|
13336
|
-
const
|
|
13337
|
-
if (
|
|
13338
|
-
this._enterContext(
|
|
13336
|
+
const context7 = this._contexts.get(uid);
|
|
13337
|
+
if (context7 !== undefined) {
|
|
13338
|
+
this._enterContext(context7);
|
|
13339
13339
|
}
|
|
13340
13340
|
}
|
|
13341
13341
|
_after() {
|
|
13342
13342
|
this._exitContext();
|
|
13343
13343
|
}
|
|
13344
|
-
_enterContext(
|
|
13345
|
-
this._stack.push(
|
|
13344
|
+
_enterContext(context7) {
|
|
13345
|
+
this._stack.push(context7);
|
|
13346
13346
|
}
|
|
13347
13347
|
_exitContext() {
|
|
13348
13348
|
this._stack.pop();
|
|
@@ -13368,9 +13368,9 @@ var require_AsyncLocalStorageContextManager = __commonJS((exports) => {
|
|
|
13368
13368
|
active() {
|
|
13369
13369
|
return this._asyncLocalStorage.getStore() ?? api_1.ROOT_CONTEXT;
|
|
13370
13370
|
}
|
|
13371
|
-
with(
|
|
13371
|
+
with(context7, fn, thisArg, ...args) {
|
|
13372
13372
|
const cb = thisArg == null ? fn : fn.bind(thisArg);
|
|
13373
|
-
return this._asyncLocalStorage.run(
|
|
13373
|
+
return this._asyncLocalStorage.run(context7, cb, ...args);
|
|
13374
13374
|
}
|
|
13375
13375
|
enable() {
|
|
13376
13376
|
return this;
|
|
@@ -19072,6 +19072,9 @@ var require_parse_options = __commonJS((exports, module) => {
|
|
|
19072
19072
|
var require_identifiers = __commonJS((exports, module) => {
|
|
19073
19073
|
var numeric = /^[0-9]+$/;
|
|
19074
19074
|
var compareIdentifiers = (a, b) => {
|
|
19075
|
+
if (typeof a === "number" && typeof b === "number") {
|
|
19076
|
+
return a === b ? 0 : a < b ? -1 : 1;
|
|
19077
|
+
}
|
|
19075
19078
|
const anum = numeric.test(a);
|
|
19076
19079
|
const bnum = numeric.test(b);
|
|
19077
19080
|
if (anum && bnum) {
|
|
@@ -19174,7 +19177,25 @@ var require_semver3 = __commonJS((exports, module) => {
|
|
|
19174
19177
|
if (!(other instanceof SemVer)) {
|
|
19175
19178
|
other = new SemVer(other, this.options);
|
|
19176
19179
|
}
|
|
19177
|
-
|
|
19180
|
+
if (this.major < other.major) {
|
|
19181
|
+
return -1;
|
|
19182
|
+
}
|
|
19183
|
+
if (this.major > other.major) {
|
|
19184
|
+
return 1;
|
|
19185
|
+
}
|
|
19186
|
+
if (this.minor < other.minor) {
|
|
19187
|
+
return -1;
|
|
19188
|
+
}
|
|
19189
|
+
if (this.minor > other.minor) {
|
|
19190
|
+
return 1;
|
|
19191
|
+
}
|
|
19192
|
+
if (this.patch < other.patch) {
|
|
19193
|
+
return -1;
|
|
19194
|
+
}
|
|
19195
|
+
if (this.patch > other.patch) {
|
|
19196
|
+
return 1;
|
|
19197
|
+
}
|
|
19198
|
+
return 0;
|
|
19178
19199
|
}
|
|
19179
19200
|
comparePre(other) {
|
|
19180
19201
|
if (!(other instanceof SemVer)) {
|
|
@@ -19851,6 +19872,7 @@ var require_range = __commonJS((exports, module) => {
|
|
|
19851
19872
|
return result;
|
|
19852
19873
|
};
|
|
19853
19874
|
var parseComparator = (comp, options) => {
|
|
19875
|
+
comp = comp.replace(re[t.BUILD], "");
|
|
19854
19876
|
debug2("comp", comp, options);
|
|
19855
19877
|
comp = replaceCarets(comp, options);
|
|
19856
19878
|
debug2("caret", comp);
|
|
@@ -21778,7 +21800,7 @@ var require_utils20 = __commonJS((exports) => {
|
|
|
21778
21800
|
var types_1 = require_types3();
|
|
21779
21801
|
var AttributeNames_1 = require_AttributeNames7();
|
|
21780
21802
|
var semantic_conventions_1 = require_src2();
|
|
21781
|
-
var getMiddlewareMetadata = (
|
|
21803
|
+
var getMiddlewareMetadata = (context12, layer, isRouter, layerPath) => {
|
|
21782
21804
|
if (isRouter) {
|
|
21783
21805
|
return {
|
|
21784
21806
|
attributes: {
|
|
@@ -21786,7 +21808,7 @@ var require_utils20 = __commonJS((exports) => {
|
|
|
21786
21808
|
[AttributeNames_1.AttributeNames.KOA_TYPE]: types_1.KoaLayerType.ROUTER,
|
|
21787
21809
|
[semantic_conventions_1.SEMATTRS_HTTP_ROUTE]: layerPath?.toString()
|
|
21788
21810
|
},
|
|
21789
|
-
name:
|
|
21811
|
+
name: context12._matchedRouteName || `router - ${layerPath}`
|
|
21790
21812
|
};
|
|
21791
21813
|
} else {
|
|
21792
21814
|
return {
|
|
@@ -21882,23 +21904,23 @@ var require_instrumentation17 = __commonJS((exports) => {
|
|
|
21882
21904
|
}
|
|
21883
21905
|
middlewareLayer[internal_types_1.kLayerPatched] = true;
|
|
21884
21906
|
api2.diag.debug("patching Koa middleware layer");
|
|
21885
|
-
return async (
|
|
21907
|
+
return async (context12, next) => {
|
|
21886
21908
|
const parent = api2.trace.getSpan(api2.context.active());
|
|
21887
21909
|
if (parent === undefined) {
|
|
21888
|
-
return middlewareLayer(
|
|
21910
|
+
return middlewareLayer(context12, next);
|
|
21889
21911
|
}
|
|
21890
|
-
const metadata = (0, utils_1.getMiddlewareMetadata)(
|
|
21912
|
+
const metadata = (0, utils_1.getMiddlewareMetadata)(context12, middlewareLayer, isRouter, layerPath);
|
|
21891
21913
|
const span = this.tracer.startSpan(metadata.name, {
|
|
21892
21914
|
attributes: metadata.attributes
|
|
21893
21915
|
});
|
|
21894
21916
|
const rpcMetadata = (0, core_1.getRPCMetadata)(api2.context.active());
|
|
21895
|
-
if (rpcMetadata?.type === core_1.RPCType.HTTP &&
|
|
21896
|
-
rpcMetadata.route =
|
|
21917
|
+
if (rpcMetadata?.type === core_1.RPCType.HTTP && context12._matchedRoute) {
|
|
21918
|
+
rpcMetadata.route = context12._matchedRoute.toString();
|
|
21897
21919
|
}
|
|
21898
21920
|
const { requestHook: requestHook2 } = this.getConfig();
|
|
21899
21921
|
if (requestHook2) {
|
|
21900
21922
|
(0, instrumentation_1.safeExecuteInTheMiddle)(() => requestHook2(span, {
|
|
21901
|
-
context:
|
|
21923
|
+
context: context12,
|
|
21902
21924
|
middlewareLayer,
|
|
21903
21925
|
layerType
|
|
21904
21926
|
}), (e) => {
|
|
@@ -21910,7 +21932,7 @@ var require_instrumentation17 = __commonJS((exports) => {
|
|
|
21910
21932
|
const newContext = api2.trace.setSpan(api2.context.active(), span);
|
|
21911
21933
|
return api2.context.with(newContext, async () => {
|
|
21912
21934
|
try {
|
|
21913
|
-
return await middlewareLayer(
|
|
21935
|
+
return await middlewareLayer(context12, next);
|
|
21914
21936
|
} catch (err) {
|
|
21915
21937
|
span.recordException(err);
|
|
21916
21938
|
throw err;
|
|
@@ -22615,16 +22637,16 @@ var require_utils23 = __commonJS((exports) => {
|
|
|
22615
22637
|
return attributes;
|
|
22616
22638
|
};
|
|
22617
22639
|
exports.getConnectionAttributesFromUrl = getConnectionAttributesFromUrl;
|
|
22618
|
-
var markConfirmChannelTracing = (
|
|
22619
|
-
return
|
|
22640
|
+
var markConfirmChannelTracing = (context12) => {
|
|
22641
|
+
return context12.setValue(IS_CONFIRM_CHANNEL_CONTEXT_KEY, true);
|
|
22620
22642
|
};
|
|
22621
22643
|
exports.markConfirmChannelTracing = markConfirmChannelTracing;
|
|
22622
|
-
var unmarkConfirmChannelTracing = (
|
|
22623
|
-
return
|
|
22644
|
+
var unmarkConfirmChannelTracing = (context12) => {
|
|
22645
|
+
return context12.deleteValue(IS_CONFIRM_CHANNEL_CONTEXT_KEY);
|
|
22624
22646
|
};
|
|
22625
22647
|
exports.unmarkConfirmChannelTracing = unmarkConfirmChannelTracing;
|
|
22626
|
-
var isConfirmChannelTracing = (
|
|
22627
|
-
return
|
|
22648
|
+
var isConfirmChannelTracing = (context12) => {
|
|
22649
|
+
return context12.getValue(IS_CONFIRM_CHANNEL_CONTEXT_KEY) === true;
|
|
22628
22650
|
};
|
|
22629
22651
|
exports.isConfirmChannelTracing = isConfirmChannelTracing;
|
|
22630
22652
|
});
|
|
@@ -23045,7 +23067,7 @@ var require_src32 = __commonJS((exports) => {
|
|
|
23045
23067
|
|
|
23046
23068
|
// src/index.ts
|
|
23047
23069
|
import {
|
|
23048
|
-
logger as
|
|
23070
|
+
logger as logger30,
|
|
23049
23071
|
parseBooleanFromText,
|
|
23050
23072
|
getDatabaseDir,
|
|
23051
23073
|
getGeneratedDir as getGeneratedDir2,
|
|
@@ -23595,10 +23617,10 @@ var helmet = Object.assign(function helmet2(options = {}) {
|
|
|
23595
23617
|
});
|
|
23596
23618
|
|
|
23597
23619
|
// src/index.ts
|
|
23598
|
-
import * as
|
|
23620
|
+
import * as fs6 from "node:fs";
|
|
23599
23621
|
import http4 from "node:http";
|
|
23600
23622
|
import os3 from "node:os";
|
|
23601
|
-
import
|
|
23623
|
+
import path8, { basename as basename2, dirname as dirname3, extname, join as join4 } from "node:path";
|
|
23602
23624
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
23603
23625
|
|
|
23604
23626
|
// src/api/index.ts
|
|
@@ -23764,6 +23786,8 @@ function createAgentCrudRouter(elizaOS, serverInstance) {
|
|
|
23764
23786
|
}
|
|
23765
23787
|
const updates = req.body;
|
|
23766
23788
|
try {
|
|
23789
|
+
const currentAgent = await db.getAgent(agentId);
|
|
23790
|
+
const activeRuntime = elizaOS.getAgent(agentId);
|
|
23767
23791
|
if (updates.settings?.secrets) {
|
|
23768
23792
|
const salt = getSalt();
|
|
23769
23793
|
const encryptedSecrets = {};
|
|
@@ -23782,11 +23806,46 @@ function createAgentCrudRouter(elizaOS, serverInstance) {
|
|
|
23782
23806
|
await db.updateAgent(agentId, updates);
|
|
23783
23807
|
}
|
|
23784
23808
|
const updatedAgent = await db.getAgent(agentId);
|
|
23785
|
-
|
|
23809
|
+
let needsRestart = false;
|
|
23810
|
+
if (currentAgent && activeRuntime && updatedAgent) {
|
|
23811
|
+
if (updatedAgent.plugins && !Array.isArray(updatedAgent.plugins)) {
|
|
23812
|
+
throw new Error("plugins must be an array");
|
|
23813
|
+
}
|
|
23814
|
+
const currentPlugins = (currentAgent.plugins || []).filter((p) => p != null).map((p) => typeof p === "string" ? p : p.name).filter((name) => typeof name === "string").sort();
|
|
23815
|
+
const updatedPlugins = (updatedAgent.plugins || []).filter((p) => p != null).map((p) => typeof p === "string" ? p : p.name).filter((name) => typeof name === "string").sort();
|
|
23816
|
+
const pluginsChanged = currentPlugins.length !== updatedPlugins.length || currentPlugins.some((plugin, idx) => plugin !== updatedPlugins[idx]);
|
|
23817
|
+
needsRestart = pluginsChanged;
|
|
23818
|
+
if (needsRestart) {
|
|
23819
|
+
logger.debug(`[AGENT UPDATE] Agent ${agentId} requires restart due to plugins changes`);
|
|
23820
|
+
}
|
|
23821
|
+
}
|
|
23786
23822
|
if (activeRuntime && updatedAgent) {
|
|
23787
|
-
|
|
23788
|
-
|
|
23789
|
-
|
|
23823
|
+
if (needsRestart) {
|
|
23824
|
+
logger.debug(`[AGENT UPDATE] Restarting agent ${agentId} due to configuration changes`);
|
|
23825
|
+
try {
|
|
23826
|
+
await serverInstance?.unregisterAgent(agentId);
|
|
23827
|
+
const { enabled, status: status2, createdAt, updatedAt, ...characterData } = updatedAgent;
|
|
23828
|
+
const runtimes = await serverInstance?.startAgents([characterData]);
|
|
23829
|
+
if (!runtimes || runtimes.length === 0) {
|
|
23830
|
+
throw new Error("Failed to restart agent after configuration change");
|
|
23831
|
+
}
|
|
23832
|
+
logger.success(`[AGENT UPDATE] Agent ${agentId} restarted successfully`);
|
|
23833
|
+
} catch (restartError) {
|
|
23834
|
+
logger.error({ error: restartError, agentId }, `[AGENT UPDATE] Failed to restart agent ${agentId}, attempting to restore previous state`);
|
|
23835
|
+
try {
|
|
23836
|
+
const { enabled, status: status2, createdAt, updatedAt, ...previousCharacterData } = currentAgent;
|
|
23837
|
+
await serverInstance?.startAgents([previousCharacterData]);
|
|
23838
|
+
logger.warn(`[AGENT UPDATE] Restored agent ${agentId} to previous state`);
|
|
23839
|
+
} catch (restoreError) {
|
|
23840
|
+
logger.error({ error: restoreError, agentId }, `[AGENT UPDATE] Failed to restore agent ${agentId} - agent may be in broken state`);
|
|
23841
|
+
}
|
|
23842
|
+
throw restartError;
|
|
23843
|
+
}
|
|
23844
|
+
} else {
|
|
23845
|
+
const { enabled, status: status2, createdAt, updatedAt, ...characterData } = updatedAgent;
|
|
23846
|
+
await elizaOS.updateAgent(agentId, characterData);
|
|
23847
|
+
logger.debug(`[AGENT UPDATE] Updated active agent ${agentId} without restart`);
|
|
23848
|
+
}
|
|
23790
23849
|
}
|
|
23791
23850
|
const runtime = elizaOS.getAgent(agentId);
|
|
23792
23851
|
const status = runtime ? "active" : "inactive";
|
|
@@ -28796,7 +28855,7 @@ import express30 from "express";
|
|
|
28796
28855
|
// package.json
|
|
28797
28856
|
var package_default = {
|
|
28798
28857
|
name: "@elizaos/server",
|
|
28799
|
-
version: "1.6.2-alpha.
|
|
28858
|
+
version: "1.6.2-alpha.11",
|
|
28800
28859
|
description: "ElizaOS Server - Core server infrastructure for ElizaOS agents",
|
|
28801
28860
|
publishConfig: {
|
|
28802
28861
|
access: "public",
|
|
@@ -30343,7 +30402,7 @@ async function loadCharacters(charactersArg) {
|
|
|
30343
30402
|
}
|
|
30344
30403
|
|
|
30345
30404
|
// ../../node_modules/@sentry/node/build/esm/integrations/http.js
|
|
30346
|
-
var
|
|
30405
|
+
var import_api10 = __toESM(require_src(), 1);
|
|
30347
30406
|
var import_instrumentation_http = __toESM(require_src7(), 1);
|
|
30348
30407
|
|
|
30349
30408
|
// ../../node_modules/@sentry/core/build/esm/debug-build.js
|
|
@@ -30353,7 +30412,7 @@ var DEBUG_BUILD = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__;
|
|
|
30353
30412
|
var GLOBAL_OBJ = globalThis;
|
|
30354
30413
|
|
|
30355
30414
|
// ../../node_modules/@sentry/core/build/esm/utils/version.js
|
|
30356
|
-
var SDK_VERSION = "10.
|
|
30415
|
+
var SDK_VERSION = "10.18.0";
|
|
30357
30416
|
|
|
30358
30417
|
// ../../node_modules/@sentry/core/build/esm/carrier.js
|
|
30359
30418
|
function getMainCarrier() {
|
|
@@ -31783,13 +31842,21 @@ function parseBaggageHeader(baggageHeader) {
|
|
|
31783
31842
|
return baggageHeaderToObject(baggageHeader);
|
|
31784
31843
|
}
|
|
31785
31844
|
function baggageHeaderToObject(baggageHeader) {
|
|
31786
|
-
return baggageHeader.split(",").map((baggageEntry) =>
|
|
31787
|
-
|
|
31788
|
-
|
|
31789
|
-
|
|
31790
|
-
return;
|
|
31845
|
+
return baggageHeader.split(",").map((baggageEntry) => {
|
|
31846
|
+
const eqIdx = baggageEntry.indexOf("=");
|
|
31847
|
+
if (eqIdx === -1) {
|
|
31848
|
+
return [];
|
|
31791
31849
|
}
|
|
31792
|
-
|
|
31850
|
+
const key = baggageEntry.slice(0, eqIdx);
|
|
31851
|
+
const value = baggageEntry.slice(eqIdx + 1);
|
|
31852
|
+
return [key, value].map((keyOrValue) => {
|
|
31853
|
+
try {
|
|
31854
|
+
return decodeURIComponent(keyOrValue.trim());
|
|
31855
|
+
} catch {
|
|
31856
|
+
return;
|
|
31857
|
+
}
|
|
31858
|
+
});
|
|
31859
|
+
}).reduce((acc, [key, value]) => {
|
|
31793
31860
|
if (key && value) {
|
|
31794
31861
|
acc[key] = value;
|
|
31795
31862
|
}
|
|
@@ -35758,6 +35825,7 @@ function _INTERNAL_cleanupToolCallSpan(toolCallId) {
|
|
|
35758
35825
|
|
|
35759
35826
|
// ../../node_modules/@sentry/core/build/esm/utils/vercel-ai/vercel-ai-attributes.js
|
|
35760
35827
|
var AI_PROMPT_ATTRIBUTE = "ai.prompt";
|
|
35828
|
+
var AI_SCHEMA_ATTRIBUTE = "ai.schema";
|
|
35761
35829
|
var AI_RESPONSE_OBJECT_ATTRIBUTE = "ai.response.object";
|
|
35762
35830
|
var AI_RESPONSE_TEXT_ATTRIBUTE = "ai.response.text";
|
|
35763
35831
|
var AI_RESPONSE_TOOL_CALLS_ATTRIBUTE = "ai.response.toolCalls";
|
|
@@ -35834,6 +35902,7 @@ function processEndedVercelAiSpan(span) {
|
|
|
35834
35902
|
renameAttributeKey(attributes, AI_PROMPT_TOOLS_ATTRIBUTE, "gen_ai.request.available_tools");
|
|
35835
35903
|
renameAttributeKey(attributes, AI_TOOL_CALL_ARGS_ATTRIBUTE, "gen_ai.tool.input");
|
|
35836
35904
|
renameAttributeKey(attributes, AI_TOOL_CALL_RESULT_ATTRIBUTE, "gen_ai.tool.output");
|
|
35905
|
+
renameAttributeKey(attributes, AI_SCHEMA_ATTRIBUTE, "gen_ai.request.schema");
|
|
35837
35906
|
addProviderMetadataToAttributes(attributes);
|
|
35838
35907
|
for (const key of Object.keys(attributes)) {
|
|
35839
35908
|
if (key.startsWith("ai.")) {
|
|
@@ -35870,7 +35939,7 @@ function processGenerateSpan(span, name, attributes) {
|
|
|
35870
35939
|
span.setAttribute("ai.pipeline.name", nameWthoutAi);
|
|
35871
35940
|
span.updateName(nameWthoutAi);
|
|
35872
35941
|
const functionId = attributes[AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE];
|
|
35873
|
-
if (functionId && typeof functionId === "string"
|
|
35942
|
+
if (functionId && typeof functionId === "string") {
|
|
35874
35943
|
span.updateName(`${nameWthoutAi} ${functionId}`);
|
|
35875
35944
|
span.setAttribute("gen_ai.function_id", functionId);
|
|
35876
35945
|
}
|
|
@@ -36898,11 +36967,112 @@ function instrumentAnthropicAiClient(anthropicAiClient, options) {
|
|
|
36898
36967
|
}
|
|
36899
36968
|
// ../../node_modules/@sentry/core/build/esm/utils/google-genai/constants.js
|
|
36900
36969
|
var GOOGLE_GENAI_INTEGRATION_NAME = "Google_GenAI";
|
|
36901
|
-
var GOOGLE_GENAI_INSTRUMENTED_METHODS = [
|
|
36970
|
+
var GOOGLE_GENAI_INSTRUMENTED_METHODS = [
|
|
36971
|
+
"models.generateContent",
|
|
36972
|
+
"models.generateContentStream",
|
|
36973
|
+
"chats.create",
|
|
36974
|
+
"sendMessage",
|
|
36975
|
+
"sendMessageStream"
|
|
36976
|
+
];
|
|
36902
36977
|
var GOOGLE_GENAI_SYSTEM_NAME = "google_genai";
|
|
36903
36978
|
var CHATS_CREATE_METHOD = "chats.create";
|
|
36904
36979
|
var CHAT_PATH = "chat";
|
|
36905
36980
|
|
|
36981
|
+
// ../../node_modules/@sentry/core/build/esm/utils/google-genai/streaming.js
|
|
36982
|
+
function isErrorChunk(chunk, span) {
|
|
36983
|
+
const feedback = chunk?.promptFeedback;
|
|
36984
|
+
if (feedback?.blockReason) {
|
|
36985
|
+
const message = feedback.blockReasonMessage ?? feedback.blockReason;
|
|
36986
|
+
span.setStatus({ code: SPAN_STATUS_ERROR, message: `Content blocked: ${message}` });
|
|
36987
|
+
captureException(`Content blocked: ${message}`, {
|
|
36988
|
+
mechanism: { handled: false, type: "auto.ai.google_genai" }
|
|
36989
|
+
});
|
|
36990
|
+
return true;
|
|
36991
|
+
}
|
|
36992
|
+
return false;
|
|
36993
|
+
}
|
|
36994
|
+
function handleResponseMetadata(chunk, state) {
|
|
36995
|
+
if (typeof chunk.responseId === "string")
|
|
36996
|
+
state.responseId = chunk.responseId;
|
|
36997
|
+
if (typeof chunk.modelVersion === "string")
|
|
36998
|
+
state.responseModel = chunk.modelVersion;
|
|
36999
|
+
const usage = chunk.usageMetadata;
|
|
37000
|
+
if (usage) {
|
|
37001
|
+
if (typeof usage.promptTokenCount === "number")
|
|
37002
|
+
state.promptTokens = usage.promptTokenCount;
|
|
37003
|
+
if (typeof usage.candidatesTokenCount === "number")
|
|
37004
|
+
state.completionTokens = usage.candidatesTokenCount;
|
|
37005
|
+
if (typeof usage.totalTokenCount === "number")
|
|
37006
|
+
state.totalTokens = usage.totalTokenCount;
|
|
37007
|
+
}
|
|
37008
|
+
}
|
|
37009
|
+
function handleCandidateContent(chunk, state, recordOutputs) {
|
|
37010
|
+
if (Array.isArray(chunk.functionCalls)) {
|
|
37011
|
+
state.toolCalls.push(...chunk.functionCalls);
|
|
37012
|
+
}
|
|
37013
|
+
for (const candidate of chunk.candidates ?? []) {
|
|
37014
|
+
if (candidate?.finishReason && !state.finishReasons.includes(candidate.finishReason)) {
|
|
37015
|
+
state.finishReasons.push(candidate.finishReason);
|
|
37016
|
+
}
|
|
37017
|
+
for (const part of candidate?.content?.parts ?? []) {
|
|
37018
|
+
if (recordOutputs && part.text)
|
|
37019
|
+
state.responseTexts.push(part.text);
|
|
37020
|
+
if (part.functionCall) {
|
|
37021
|
+
state.toolCalls.push({
|
|
37022
|
+
type: "function",
|
|
37023
|
+
id: part.functionCall.id,
|
|
37024
|
+
name: part.functionCall.name,
|
|
37025
|
+
arguments: part.functionCall.args
|
|
37026
|
+
});
|
|
37027
|
+
}
|
|
37028
|
+
}
|
|
37029
|
+
}
|
|
37030
|
+
}
|
|
37031
|
+
function processChunk(chunk, state, recordOutputs, span) {
|
|
37032
|
+
if (!chunk || isErrorChunk(chunk, span))
|
|
37033
|
+
return;
|
|
37034
|
+
handleResponseMetadata(chunk, state);
|
|
37035
|
+
handleCandidateContent(chunk, state, recordOutputs);
|
|
37036
|
+
}
|
|
37037
|
+
async function* instrumentStream2(stream, span, recordOutputs) {
|
|
37038
|
+
const state = {
|
|
37039
|
+
responseTexts: [],
|
|
37040
|
+
finishReasons: [],
|
|
37041
|
+
toolCalls: []
|
|
37042
|
+
};
|
|
37043
|
+
try {
|
|
37044
|
+
for await (const chunk of stream) {
|
|
37045
|
+
processChunk(chunk, state, recordOutputs, span);
|
|
37046
|
+
yield chunk;
|
|
37047
|
+
}
|
|
37048
|
+
} finally {
|
|
37049
|
+
const attrs = {
|
|
37050
|
+
[GEN_AI_RESPONSE_STREAMING_ATTRIBUTE]: true
|
|
37051
|
+
};
|
|
37052
|
+
if (state.responseId)
|
|
37053
|
+
attrs[GEN_AI_RESPONSE_ID_ATTRIBUTE] = state.responseId;
|
|
37054
|
+
if (state.responseModel)
|
|
37055
|
+
attrs[GEN_AI_RESPONSE_MODEL_ATTRIBUTE] = state.responseModel;
|
|
37056
|
+
if (state.promptTokens !== undefined)
|
|
37057
|
+
attrs[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE] = state.promptTokens;
|
|
37058
|
+
if (state.completionTokens !== undefined)
|
|
37059
|
+
attrs[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE] = state.completionTokens;
|
|
37060
|
+
if (state.totalTokens !== undefined)
|
|
37061
|
+
attrs[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE] = state.totalTokens;
|
|
37062
|
+
if (state.finishReasons.length) {
|
|
37063
|
+
attrs[GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE] = JSON.stringify(state.finishReasons);
|
|
37064
|
+
}
|
|
37065
|
+
if (recordOutputs && state.responseTexts.length) {
|
|
37066
|
+
attrs[GEN_AI_RESPONSE_TEXT_ATTRIBUTE] = state.responseTexts.join("");
|
|
37067
|
+
}
|
|
37068
|
+
if (recordOutputs && state.toolCalls.length) {
|
|
37069
|
+
attrs[GEN_AI_RESPONSE_TOOL_CALLS_ATTRIBUTE] = JSON.stringify(state.toolCalls);
|
|
37070
|
+
}
|
|
37071
|
+
span.setAttributes(attrs);
|
|
37072
|
+
span.end();
|
|
37073
|
+
}
|
|
37074
|
+
}
|
|
37075
|
+
|
|
36906
37076
|
// ../../node_modules/@sentry/core/build/esm/utils/google-genai/utils.js
|
|
36907
37077
|
function shouldInstrument3(methodPath) {
|
|
36908
37078
|
if (GOOGLE_GENAI_INSTRUMENTED_METHODS.includes(methodPath)) {
|
|
@@ -36911,6 +37081,9 @@ function shouldInstrument3(methodPath) {
|
|
|
36911
37081
|
const methodName = methodPath.split(".").pop();
|
|
36912
37082
|
return GOOGLE_GENAI_INSTRUMENTED_METHODS.includes(methodName);
|
|
36913
37083
|
}
|
|
37084
|
+
function isStreamingMethod(methodPath) {
|
|
37085
|
+
return methodPath.includes("Stream") || methodPath.endsWith("generateContentStream") || methodPath.endsWith("sendMessageStream");
|
|
37086
|
+
}
|
|
36914
37087
|
|
|
36915
37088
|
// ../../node_modules/@sentry/core/build/esm/utils/google-genai/index.js
|
|
36916
37089
|
function extractModel(params, context) {
|
|
@@ -36950,17 +37123,21 @@ function extractConfigAttributes(config) {
|
|
|
36950
37123
|
}
|
|
36951
37124
|
return attributes;
|
|
36952
37125
|
}
|
|
36953
|
-
function extractRequestAttributes3(
|
|
37126
|
+
function extractRequestAttributes3(methodPath, params, context) {
|
|
36954
37127
|
const attributes = {
|
|
36955
37128
|
[GEN_AI_SYSTEM_ATTRIBUTE]: GOOGLE_GENAI_SYSTEM_NAME,
|
|
36956
37129
|
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: getFinalOperationName(methodPath),
|
|
36957
37130
|
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ai.google_genai"
|
|
36958
37131
|
};
|
|
36959
|
-
if (
|
|
36960
|
-
const params = args[0];
|
|
37132
|
+
if (params) {
|
|
36961
37133
|
attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE] = extractModel(params, context);
|
|
36962
37134
|
if ("config" in params && typeof params.config === "object" && params.config) {
|
|
36963
|
-
|
|
37135
|
+
const config = params.config;
|
|
37136
|
+
Object.assign(attributes, extractConfigAttributes(config));
|
|
37137
|
+
if ("tools" in config && Array.isArray(config.tools)) {
|
|
37138
|
+
const functionDeclarations = config.tools.map((tool) => tool.functionDeclarations);
|
|
37139
|
+
attributes[GEN_AI_REQUEST_AVAILABLE_TOOLS_ATTRIBUTE] = JSON.stringify(functionDeclarations);
|
|
37140
|
+
}
|
|
36964
37141
|
}
|
|
36965
37142
|
} else {
|
|
36966
37143
|
attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE] = extractModel({}, context);
|
|
@@ -37012,33 +37189,69 @@ function addResponseAttributes3(span, response, recordOutputs) {
|
|
|
37012
37189
|
});
|
|
37013
37190
|
}
|
|
37014
37191
|
}
|
|
37192
|
+
if (recordOutputs && response.functionCalls) {
|
|
37193
|
+
const functionCalls = response.functionCalls;
|
|
37194
|
+
if (Array.isArray(functionCalls) && functionCalls.length > 0) {
|
|
37195
|
+
span.setAttributes({
|
|
37196
|
+
[GEN_AI_RESPONSE_TOOL_CALLS_ATTRIBUTE]: JSON.stringify(functionCalls)
|
|
37197
|
+
});
|
|
37198
|
+
}
|
|
37199
|
+
}
|
|
37015
37200
|
}
|
|
37016
37201
|
function instrumentMethod3(originalMethod, methodPath, context, options) {
|
|
37017
37202
|
const isSyncCreate = methodPath === CHATS_CREATE_METHOD;
|
|
37018
|
-
|
|
37019
|
-
|
|
37020
|
-
|
|
37021
|
-
|
|
37022
|
-
|
|
37023
|
-
|
|
37024
|
-
|
|
37025
|
-
|
|
37026
|
-
|
|
37027
|
-
|
|
37028
|
-
|
|
37029
|
-
|
|
37030
|
-
|
|
37031
|
-
|
|
37032
|
-
|
|
37203
|
+
return new Proxy(originalMethod, {
|
|
37204
|
+
apply(target, _, args) {
|
|
37205
|
+
const params = args[0];
|
|
37206
|
+
const requestAttributes = extractRequestAttributes3(methodPath, params, context);
|
|
37207
|
+
const model = requestAttributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE] ?? "unknown";
|
|
37208
|
+
const operationName = getFinalOperationName(methodPath);
|
|
37209
|
+
if (isStreamingMethod(methodPath)) {
|
|
37210
|
+
return startSpanManual({
|
|
37211
|
+
name: `${operationName} ${model} stream-response`,
|
|
37212
|
+
op: getSpanOperation2(methodPath),
|
|
37213
|
+
attributes: requestAttributes
|
|
37214
|
+
}, async (span) => {
|
|
37215
|
+
try {
|
|
37216
|
+
if (options.recordInputs && params) {
|
|
37217
|
+
addPrivateRequestAttributes2(span, params);
|
|
37218
|
+
}
|
|
37219
|
+
const stream = await target.apply(context, args);
|
|
37220
|
+
return instrumentStream2(stream, span, Boolean(options.recordOutputs));
|
|
37221
|
+
} catch (error2) {
|
|
37222
|
+
span.setStatus({ code: SPAN_STATUS_ERROR, message: "internal_error" });
|
|
37223
|
+
captureException(error2, {
|
|
37224
|
+
mechanism: {
|
|
37225
|
+
handled: false,
|
|
37226
|
+
type: "auto.ai.google_genai",
|
|
37227
|
+
data: { function: methodPath }
|
|
37228
|
+
}
|
|
37229
|
+
});
|
|
37230
|
+
span.end();
|
|
37231
|
+
throw error2;
|
|
37232
|
+
}
|
|
37033
37233
|
});
|
|
37034
|
-
}
|
|
37035
|
-
|
|
37036
|
-
|
|
37234
|
+
}
|
|
37235
|
+
return startSpan({
|
|
37236
|
+
name: isSyncCreate ? `${operationName} ${model} create` : `${operationName} ${model}`,
|
|
37237
|
+
op: getSpanOperation2(methodPath),
|
|
37238
|
+
attributes: requestAttributes
|
|
37239
|
+
}, (span) => {
|
|
37240
|
+
if (options.recordInputs && params) {
|
|
37241
|
+
addPrivateRequestAttributes2(span, params);
|
|
37037
37242
|
}
|
|
37243
|
+
return handleCallbackErrors(() => target.apply(context, args), (error2) => {
|
|
37244
|
+
captureException(error2, {
|
|
37245
|
+
mechanism: { handled: false, type: "auto.ai.google_genai", data: { function: methodPath } }
|
|
37246
|
+
});
|
|
37247
|
+
}, () => {}, (result) => {
|
|
37248
|
+
if (!isSyncCreate) {
|
|
37249
|
+
addResponseAttributes3(span, result, options.recordOutputs);
|
|
37250
|
+
}
|
|
37251
|
+
});
|
|
37038
37252
|
});
|
|
37039
|
-
}
|
|
37040
|
-
};
|
|
37041
|
-
return run;
|
|
37253
|
+
}
|
|
37254
|
+
});
|
|
37042
37255
|
}
|
|
37043
37256
|
function createDeepProxy3(target, currentPath = "", options) {
|
|
37044
37257
|
return new Proxy(target, {
|
|
@@ -37245,9 +37458,6 @@ class LRUMap {
|
|
|
37245
37458
|
return values;
|
|
37246
37459
|
}
|
|
37247
37460
|
}
|
|
37248
|
-
// ../../node_modules/@sentry/node-core/build/esm/debug-build.js
|
|
37249
|
-
var DEBUG_BUILD2 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__;
|
|
37250
|
-
|
|
37251
37461
|
// ../../node_modules/@sentry/node-core/build/esm/otel/instrument.js
|
|
37252
37462
|
var import_instrumentation = __toESM(require_src6(), 1);
|
|
37253
37463
|
var INSTRUMENTED = {};
|
|
@@ -37317,76 +37527,85 @@ function hasWrap(instrumentation) {
|
|
|
37317
37527
|
return typeof instrumentation["_wrap"] === "function";
|
|
37318
37528
|
}
|
|
37319
37529
|
|
|
37320
|
-
// ../../node_modules/@sentry/node-core/build/esm/integrations/http/
|
|
37321
|
-
var
|
|
37322
|
-
|
|
37323
|
-
var import_instrumentation2 = __toESM(require_src6(), 1);
|
|
37324
|
-
import { subscribe, unsubscribe } from "node:diagnostics_channel";
|
|
37530
|
+
// ../../node_modules/@sentry/node-core/build/esm/integrations/http/httpServerIntegration.js
|
|
37531
|
+
var import_api2 = __toESM(require_src(), 1);
|
|
37532
|
+
import { subscribe } from "node:diagnostics_channel";
|
|
37325
37533
|
|
|
37326
|
-
// ../../node_modules/@sentry/node-core/build/esm/
|
|
37327
|
-
|
|
37328
|
-
const protocol = requestOptions.protocol || "";
|
|
37329
|
-
const hostname = requestOptions.hostname || requestOptions.host || "";
|
|
37330
|
-
const port = !requestOptions.port || requestOptions.port === 80 || requestOptions.port === 443 || /^(.*):(\d+)$/.test(hostname) ? "" : `:${requestOptions.port}`;
|
|
37331
|
-
const path7 = requestOptions.path ? requestOptions.path : "/";
|
|
37332
|
-
return `${protocol}//${hostname}${port}${path7}`;
|
|
37333
|
-
}
|
|
37534
|
+
// ../../node_modules/@sentry/node-core/build/esm/debug-build.js
|
|
37535
|
+
var DEBUG_BUILD2 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__;
|
|
37334
37536
|
|
|
37335
37537
|
// ../../node_modules/@sentry/node-core/build/esm/integrations/http/constants.js
|
|
37336
37538
|
var INSTRUMENTATION_NAME = "@sentry/instrumentation-http";
|
|
37337
37539
|
var MAX_BODY_BYTE_LENGTH = 1024 * 1024;
|
|
37338
37540
|
|
|
37339
|
-
// ../../node_modules/@sentry/node-core/build/esm/integrations/http/
|
|
37340
|
-
var import_api2 = __toESM(require_src(), 1);
|
|
37341
|
-
var import_core34 = __toESM(require_src3(), 1);
|
|
37342
|
-
var import_semantic_conventions = __toESM(require_src2(), 1);
|
|
37343
|
-
import { errorMonitor } from "events";
|
|
37541
|
+
// ../../node_modules/@sentry/node-core/build/esm/integrations/http/httpServerIntegration.js
|
|
37344
37542
|
var HTTP_SERVER_INSTRUMENTED_KEY = import_api2.createContextKey("sentry_http_server_instrumented");
|
|
37543
|
+
var INTEGRATION_NAME6 = "Http.Server";
|
|
37345
37544
|
var clientToRequestSessionAggregatesMap = new Map;
|
|
37346
37545
|
var wrappedEmitFns = new WeakSet;
|
|
37546
|
+
function addStartSpanCallback(request, callback) {
|
|
37547
|
+
addNonEnumerableProperty(request, "_startSpanCallback", new WeakRef(callback));
|
|
37548
|
+
}
|
|
37549
|
+
var _httpServerIntegration = (options = {}) => {
|
|
37550
|
+
const _options = {
|
|
37551
|
+
sessions: options.sessions ?? true,
|
|
37552
|
+
sessionFlushingDelayMS: options.sessionFlushingDelayMS ?? 60000,
|
|
37553
|
+
maxRequestBodySize: options.maxRequestBodySize ?? "medium",
|
|
37554
|
+
ignoreRequestBody: options.ignoreRequestBody
|
|
37555
|
+
};
|
|
37556
|
+
return {
|
|
37557
|
+
name: INTEGRATION_NAME6,
|
|
37558
|
+
setupOnce() {
|
|
37559
|
+
const onHttpServerRequestStart = (_data) => {
|
|
37560
|
+
const data = _data;
|
|
37561
|
+
instrumentServer(data.server, _options);
|
|
37562
|
+
};
|
|
37563
|
+
subscribe("http.server.request.start", onHttpServerRequestStart);
|
|
37564
|
+
},
|
|
37565
|
+
afterAllSetup(client) {
|
|
37566
|
+
if (DEBUG_BUILD2 && client.getIntegrationByName("Http")) {
|
|
37567
|
+
debug.warn("It seems that you have manually added `httpServerIntegration` while `httpIntegration` is also present. Make sure to remove `httpServerIntegration` when adding `httpIntegration`.");
|
|
37568
|
+
}
|
|
37569
|
+
}
|
|
37570
|
+
};
|
|
37571
|
+
};
|
|
37572
|
+
var httpServerIntegration = _httpServerIntegration;
|
|
37347
37573
|
function instrumentServer(server, {
|
|
37348
|
-
|
|
37349
|
-
|
|
37350
|
-
|
|
37351
|
-
|
|
37352
|
-
spans,
|
|
37353
|
-
ignoreStaticAssets = true,
|
|
37354
|
-
sessionFlushingDelayMS,
|
|
37355
|
-
instrumentation,
|
|
37356
|
-
incomingRequestSpanHook
|
|
37574
|
+
ignoreRequestBody,
|
|
37575
|
+
maxRequestBodySize,
|
|
37576
|
+
sessions: sessions2,
|
|
37577
|
+
sessionFlushingDelayMS
|
|
37357
37578
|
}) {
|
|
37358
37579
|
const originalEmit = server.emit;
|
|
37359
37580
|
if (wrappedEmitFns.has(originalEmit)) {
|
|
37360
|
-
DEBUG_BUILD2 && debug.log(INSTRUMENTATION_NAME, "Incoming requests already instrumented, not instrumenting again...");
|
|
37361
37581
|
return;
|
|
37362
37582
|
}
|
|
37363
|
-
const { requestHook, responseHook, applyCustomAttributesOnSpan } = instrumentation ?? {};
|
|
37364
37583
|
const newEmit = new Proxy(originalEmit, {
|
|
37365
37584
|
apply(target, thisArg, args) {
|
|
37366
37585
|
if (args[0] !== "request") {
|
|
37367
37586
|
return target.apply(thisArg, args);
|
|
37368
37587
|
}
|
|
37369
|
-
|
|
37588
|
+
const client = getClient();
|
|
37589
|
+
if (import_api2.context.active().getValue(HTTP_SERVER_INSTRUMENTED_KEY) || !client) {
|
|
37370
37590
|
return target.apply(thisArg, args);
|
|
37371
37591
|
}
|
|
37372
|
-
DEBUG_BUILD2 && debug.log(
|
|
37373
|
-
const client = getClient();
|
|
37592
|
+
DEBUG_BUILD2 && debug.log(INTEGRATION_NAME6, "Handling incoming request");
|
|
37374
37593
|
const isolationScope = getIsolationScope().clone();
|
|
37375
37594
|
const request = args[1];
|
|
37376
37595
|
const response = args[2];
|
|
37377
37596
|
const normalizedRequest = httpRequestToRequestData(request);
|
|
37378
37597
|
const ipAddress = request.ip || request.socket?.remoteAddress;
|
|
37379
37598
|
const url = request.url || "/";
|
|
37380
|
-
if (
|
|
37381
|
-
patchRequestToCaptureBody(request, isolationScope,
|
|
37599
|
+
if (maxRequestBodySize !== "none" && !ignoreRequestBody?.(url, request)) {
|
|
37600
|
+
patchRequestToCaptureBody(request, isolationScope, maxRequestBodySize);
|
|
37382
37601
|
}
|
|
37383
37602
|
isolationScope.setSDKProcessingMetadata({ normalizedRequest, ipAddress });
|
|
37384
37603
|
const httpMethod = (request.method || "GET").toUpperCase();
|
|
37385
37604
|
const httpTargetWithoutQueryFragment = stripUrlQueryAndFragment(url);
|
|
37386
37605
|
const bestEffortTransactionName = `${httpMethod} ${httpTargetWithoutQueryFragment}`;
|
|
37387
37606
|
isolationScope.setTransactionName(bestEffortTransactionName);
|
|
37388
|
-
if (
|
|
37389
|
-
recordRequestSession({
|
|
37607
|
+
if (sessions2 && client) {
|
|
37608
|
+
recordRequestSession(client, {
|
|
37390
37609
|
requestIsolationScope: isolationScope,
|
|
37391
37610
|
response,
|
|
37392
37611
|
sessionFlushingDelayMS: sessionFlushingDelayMS ?? 60000
|
|
@@ -37396,79 +37615,12 @@ function instrumentServer(server, {
|
|
|
37396
37615
|
getCurrentScope().getPropagationContext().propagationSpanId = generateSpanId();
|
|
37397
37616
|
const ctx = import_api2.propagation.extract(import_api2.context.active(), normalizedRequest.headers).setValue(HTTP_SERVER_INSTRUMENTED_KEY, true);
|
|
37398
37617
|
return import_api2.context.with(ctx, () => {
|
|
37399
|
-
|
|
37400
|
-
|
|
37401
|
-
|
|
37402
|
-
|
|
37403
|
-
DEBUG_BUILD2 && debug.log(INSTRUMENTATION_NAME, "Skipping span creation for incoming request");
|
|
37404
|
-
return target.apply(thisArg, args);
|
|
37618
|
+
client.emit("httpServerRequest", request, response, normalizedRequest);
|
|
37619
|
+
const callback = request._startSpanCallback?.deref();
|
|
37620
|
+
if (callback) {
|
|
37621
|
+
return callback(() => target.apply(thisArg, args));
|
|
37405
37622
|
}
|
|
37406
|
-
|
|
37407
|
-
const urlObj = parseStringToURLObject(fullUrl);
|
|
37408
|
-
const headers = request.headers;
|
|
37409
|
-
const userAgent = headers["user-agent"];
|
|
37410
|
-
const ips = headers["x-forwarded-for"];
|
|
37411
|
-
const httpVersion = request.httpVersion;
|
|
37412
|
-
const host = headers.host;
|
|
37413
|
-
const hostname = host?.replace(/^(.*)(:[0-9]{1,5})/, "$1") || "localhost";
|
|
37414
|
-
const tracer = client.tracer;
|
|
37415
|
-
const scheme = fullUrl.startsWith("https") ? "https" : "http";
|
|
37416
|
-
const shouldSendDefaultPii = client?.getOptions().sendDefaultPii ?? false;
|
|
37417
|
-
const span = tracer.startSpan(bestEffortTransactionName, {
|
|
37418
|
-
kind: import_api2.SpanKind.SERVER,
|
|
37419
|
-
attributes: {
|
|
37420
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: "http.server",
|
|
37421
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.otel.http",
|
|
37422
|
-
"sentry.http.prefetch": isKnownPrefetchRequest(request) || undefined,
|
|
37423
|
-
"http.url": fullUrl,
|
|
37424
|
-
"http.method": httpMethod,
|
|
37425
|
-
"http.target": urlObj ? `${urlObj.pathname}${urlObj.search}` : httpTargetWithoutQueryFragment,
|
|
37426
|
-
"http.host": host,
|
|
37427
|
-
"net.host.name": hostname,
|
|
37428
|
-
"http.client_ip": typeof ips === "string" ? ips.split(",")[0] : undefined,
|
|
37429
|
-
"http.user_agent": userAgent,
|
|
37430
|
-
"http.scheme": scheme,
|
|
37431
|
-
"http.flavor": httpVersion,
|
|
37432
|
-
"net.transport": httpVersion?.toUpperCase() === "QUIC" ? "ip_udp" : "ip_tcp",
|
|
37433
|
-
...getRequestContentLengthAttribute(request),
|
|
37434
|
-
...httpHeadersToSpanAttributes(normalizedRequest.headers || {}, shouldSendDefaultPii)
|
|
37435
|
-
}
|
|
37436
|
-
});
|
|
37437
|
-
requestHook?.(span, request);
|
|
37438
|
-
responseHook?.(span, response);
|
|
37439
|
-
applyCustomAttributesOnSpan?.(span, request, response);
|
|
37440
|
-
incomingRequestSpanHook?.(span, request, response);
|
|
37441
|
-
const rpcMetadata = {
|
|
37442
|
-
type: import_core34.RPCType.HTTP,
|
|
37443
|
-
span
|
|
37444
|
-
};
|
|
37445
|
-
import_api2.context.with(import_core34.setRPCMetadata(import_api2.trace.setSpan(import_api2.context.active(), span), rpcMetadata), () => {
|
|
37446
|
-
import_api2.context.bind(import_api2.context.active(), request);
|
|
37447
|
-
import_api2.context.bind(import_api2.context.active(), response);
|
|
37448
|
-
let isEnded = false;
|
|
37449
|
-
function endSpan(status) {
|
|
37450
|
-
if (isEnded) {
|
|
37451
|
-
return;
|
|
37452
|
-
}
|
|
37453
|
-
isEnded = true;
|
|
37454
|
-
const newAttributes = getIncomingRequestAttributesOnResponse(request, response);
|
|
37455
|
-
span.setAttributes(newAttributes);
|
|
37456
|
-
span.setStatus(status);
|
|
37457
|
-
span.end();
|
|
37458
|
-
const route = newAttributes["http.route"];
|
|
37459
|
-
if (route) {
|
|
37460
|
-
getIsolationScope().setTransactionName(`${request.method?.toUpperCase() || "GET"} ${route}`);
|
|
37461
|
-
}
|
|
37462
|
-
}
|
|
37463
|
-
response.on("close", () => {
|
|
37464
|
-
endSpan(getSpanStatusFromHttpCode(response.statusCode));
|
|
37465
|
-
});
|
|
37466
|
-
response.on(errorMonitor, () => {
|
|
37467
|
-
const httpStatus = getSpanStatusFromHttpCode(response.statusCode);
|
|
37468
|
-
endSpan(httpStatus.code === SPAN_STATUS_ERROR ? httpStatus : { code: SPAN_STATUS_ERROR });
|
|
37469
|
-
});
|
|
37470
|
-
return target.apply(thisArg, args);
|
|
37471
|
-
});
|
|
37623
|
+
return target.apply(thisArg, args);
|
|
37472
37624
|
});
|
|
37473
37625
|
});
|
|
37474
37626
|
}
|
|
@@ -37476,7 +37628,7 @@ function instrumentServer(server, {
|
|
|
37476
37628
|
wrappedEmitFns.add(newEmit);
|
|
37477
37629
|
server.emit = newEmit;
|
|
37478
37630
|
}
|
|
37479
|
-
function recordRequestSession({
|
|
37631
|
+
function recordRequestSession(client, {
|
|
37480
37632
|
requestIsolationScope,
|
|
37481
37633
|
response,
|
|
37482
37634
|
sessionFlushingDelayMS
|
|
@@ -37485,7 +37637,6 @@ function recordRequestSession({
|
|
|
37485
37637
|
requestSession: { status: "ok" }
|
|
37486
37638
|
});
|
|
37487
37639
|
response.once("close", () => {
|
|
37488
|
-
const client = getClient();
|
|
37489
37640
|
const requestSession = requestIsolationScope.getScopeData().sdkProcessingMetadata.requestSession;
|
|
37490
37641
|
if (client && requestSession) {
|
|
37491
37642
|
DEBUG_BUILD2 && debug.log(`Recorded request session with status: ${requestSession.status}`);
|
|
@@ -37528,7 +37679,7 @@ function recordRequestSession({
|
|
|
37528
37679
|
function patchRequestToCaptureBody(req, isolationScope, maxIncomingRequestBodySize) {
|
|
37529
37680
|
let bodyByteLength = 0;
|
|
37530
37681
|
const chunks = [];
|
|
37531
|
-
DEBUG_BUILD2 && debug.log(
|
|
37682
|
+
DEBUG_BUILD2 && debug.log(INTEGRATION_NAME6, "Patching request.on");
|
|
37532
37683
|
const callbackMap = new WeakMap;
|
|
37533
37684
|
const maxBodySize = maxIncomingRequestBodySize === "small" ? 1000 : maxIncomingRequestBodySize === "medium" ? 1e4 : MAX_BODY_BYTE_LENGTH;
|
|
37534
37685
|
try {
|
|
@@ -37536,7 +37687,7 @@ function patchRequestToCaptureBody(req, isolationScope, maxIncomingRequestBodySi
|
|
|
37536
37687
|
apply: (target, thisArg, args) => {
|
|
37537
37688
|
const [event, listener, ...restArgs] = args;
|
|
37538
37689
|
if (event === "data") {
|
|
37539
|
-
DEBUG_BUILD2 && debug.log(
|
|
37690
|
+
DEBUG_BUILD2 && debug.log(INTEGRATION_NAME6, `Handling request.on("data") with maximum body size of ${maxBodySize}b`);
|
|
37540
37691
|
const callback = new Proxy(listener, {
|
|
37541
37692
|
apply: (target2, thisArg2, args2) => {
|
|
37542
37693
|
try {
|
|
@@ -37546,10 +37697,10 @@ function patchRequestToCaptureBody(req, isolationScope, maxIncomingRequestBodySi
|
|
|
37546
37697
|
chunks.push(bufferifiedChunk);
|
|
37547
37698
|
bodyByteLength += bufferifiedChunk.byteLength;
|
|
37548
37699
|
} else if (DEBUG_BUILD2) {
|
|
37549
|
-
debug.log(
|
|
37700
|
+
debug.log(INTEGRATION_NAME6, `Dropping request body chunk because maximum body length of ${maxBodySize}b is exceeded.`);
|
|
37550
37701
|
}
|
|
37551
37702
|
} catch (err) {
|
|
37552
|
-
DEBUG_BUILD2 && debug.error(
|
|
37703
|
+
DEBUG_BUILD2 && debug.error(INTEGRATION_NAME6, "Encountered error while storing body chunk.");
|
|
37553
37704
|
}
|
|
37554
37705
|
return Reflect.apply(target2, thisArg2, args2);
|
|
37555
37706
|
}
|
|
@@ -37583,16 +37734,183 @@ function patchRequestToCaptureBody(req, isolationScope, maxIncomingRequestBodySi
|
|
|
37583
37734
|
}
|
|
37584
37735
|
} catch (error2) {
|
|
37585
37736
|
if (DEBUG_BUILD2) {
|
|
37586
|
-
debug.error(
|
|
37737
|
+
debug.error(INTEGRATION_NAME6, "Error building captured request body", error2);
|
|
37587
37738
|
}
|
|
37588
37739
|
}
|
|
37589
37740
|
});
|
|
37590
37741
|
} catch (error2) {
|
|
37591
37742
|
if (DEBUG_BUILD2) {
|
|
37592
|
-
debug.error(
|
|
37743
|
+
debug.error(INTEGRATION_NAME6, "Error patching request to capture body", error2);
|
|
37593
37744
|
}
|
|
37594
37745
|
}
|
|
37595
37746
|
}
|
|
37747
|
+
|
|
37748
|
+
// ../../node_modules/@sentry/node-core/build/esm/integrations/http/httpServerSpansIntegration.js
|
|
37749
|
+
var import_api3 = __toESM(require_src(), 1);
|
|
37750
|
+
var import_core35 = __toESM(require_src3(), 1);
|
|
37751
|
+
var import_semantic_conventions = __toESM(require_src2(), 1);
|
|
37752
|
+
import { errorMonitor } from "node:events";
|
|
37753
|
+
var INTEGRATION_NAME7 = "Http.ServerSpans";
|
|
37754
|
+
var _httpServerSpansIntegration = (options = {}) => {
|
|
37755
|
+
const ignoreStaticAssets = options.ignoreStaticAssets ?? true;
|
|
37756
|
+
const ignoreIncomingRequests = options.ignoreIncomingRequests;
|
|
37757
|
+
const ignoreStatusCodes = options.ignoreStatusCodes ?? [
|
|
37758
|
+
[401, 404],
|
|
37759
|
+
[301, 303],
|
|
37760
|
+
[305, 399]
|
|
37761
|
+
];
|
|
37762
|
+
const { onSpanCreated } = options;
|
|
37763
|
+
const { requestHook, responseHook, applyCustomAttributesOnSpan } = options.instrumentation ?? {};
|
|
37764
|
+
return {
|
|
37765
|
+
name: INTEGRATION_NAME7,
|
|
37766
|
+
setup(client) {
|
|
37767
|
+
if (typeof __SENTRY_TRACING__ !== "undefined" && !__SENTRY_TRACING__) {
|
|
37768
|
+
return;
|
|
37769
|
+
}
|
|
37770
|
+
client.on("httpServerRequest", (_request, _response, normalizedRequest) => {
|
|
37771
|
+
const request = _request;
|
|
37772
|
+
const response = _response;
|
|
37773
|
+
const startSpan2 = (next) => {
|
|
37774
|
+
if (shouldIgnoreSpansForIncomingRequest(request, {
|
|
37775
|
+
ignoreStaticAssets,
|
|
37776
|
+
ignoreIncomingRequests
|
|
37777
|
+
})) {
|
|
37778
|
+
DEBUG_BUILD2 && debug.log(INTEGRATION_NAME7, "Skipping span creation for incoming request", request.url);
|
|
37779
|
+
return next();
|
|
37780
|
+
}
|
|
37781
|
+
const fullUrl = normalizedRequest.url || request.url || "/";
|
|
37782
|
+
const urlObj = parseStringToURLObject(fullUrl);
|
|
37783
|
+
const headers = request.headers;
|
|
37784
|
+
const userAgent = headers["user-agent"];
|
|
37785
|
+
const ips = headers["x-forwarded-for"];
|
|
37786
|
+
const httpVersion = request.httpVersion;
|
|
37787
|
+
const host = headers.host;
|
|
37788
|
+
const hostname = host?.replace(/^(.*)(:[0-9]{1,5})/, "$1") || "localhost";
|
|
37789
|
+
const tracer = client.tracer;
|
|
37790
|
+
const scheme = fullUrl.startsWith("https") ? "https" : "http";
|
|
37791
|
+
const method = normalizedRequest.method || request.method?.toUpperCase() || "GET";
|
|
37792
|
+
const httpTargetWithoutQueryFragment = urlObj ? urlObj.pathname : stripUrlQueryAndFragment(fullUrl);
|
|
37793
|
+
const bestEffortTransactionName = `${method} ${httpTargetWithoutQueryFragment}`;
|
|
37794
|
+
const shouldSendDefaultPii = client.getOptions().sendDefaultPii ?? false;
|
|
37795
|
+
const span = tracer.startSpan(bestEffortTransactionName, {
|
|
37796
|
+
kind: import_api3.SpanKind.SERVER,
|
|
37797
|
+
attributes: {
|
|
37798
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: "http.server",
|
|
37799
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.otel.http",
|
|
37800
|
+
"sentry.http.prefetch": isKnownPrefetchRequest(request) || undefined,
|
|
37801
|
+
"http.url": fullUrl,
|
|
37802
|
+
"http.method": normalizedRequest.method,
|
|
37803
|
+
"http.target": urlObj ? `${urlObj.pathname}${urlObj.search}` : httpTargetWithoutQueryFragment,
|
|
37804
|
+
"http.host": host,
|
|
37805
|
+
"net.host.name": hostname,
|
|
37806
|
+
"http.client_ip": typeof ips === "string" ? ips.split(",")[0] : undefined,
|
|
37807
|
+
"http.user_agent": userAgent,
|
|
37808
|
+
"http.scheme": scheme,
|
|
37809
|
+
"http.flavor": httpVersion,
|
|
37810
|
+
"net.transport": httpVersion?.toUpperCase() === "QUIC" ? "ip_udp" : "ip_tcp",
|
|
37811
|
+
...getRequestContentLengthAttribute(request),
|
|
37812
|
+
...httpHeadersToSpanAttributes(normalizedRequest.headers || {}, shouldSendDefaultPii)
|
|
37813
|
+
}
|
|
37814
|
+
});
|
|
37815
|
+
requestHook?.(span, request);
|
|
37816
|
+
responseHook?.(span, response);
|
|
37817
|
+
applyCustomAttributesOnSpan?.(span, request, response);
|
|
37818
|
+
onSpanCreated?.(span, request, response);
|
|
37819
|
+
const rpcMetadata = {
|
|
37820
|
+
type: import_core35.RPCType.HTTP,
|
|
37821
|
+
span
|
|
37822
|
+
};
|
|
37823
|
+
return import_api3.context.with(import_core35.setRPCMetadata(import_api3.trace.setSpan(import_api3.context.active(), span), rpcMetadata), () => {
|
|
37824
|
+
import_api3.context.bind(import_api3.context.active(), request);
|
|
37825
|
+
import_api3.context.bind(import_api3.context.active(), response);
|
|
37826
|
+
let isEnded = false;
|
|
37827
|
+
function endSpan(status) {
|
|
37828
|
+
if (isEnded) {
|
|
37829
|
+
return;
|
|
37830
|
+
}
|
|
37831
|
+
isEnded = true;
|
|
37832
|
+
const newAttributes = getIncomingRequestAttributesOnResponse(request, response);
|
|
37833
|
+
span.setAttributes(newAttributes);
|
|
37834
|
+
span.setStatus(status);
|
|
37835
|
+
span.end();
|
|
37836
|
+
const route = newAttributes["http.route"];
|
|
37837
|
+
if (route) {
|
|
37838
|
+
getIsolationScope().setTransactionName(`${request.method?.toUpperCase() || "GET"} ${route}`);
|
|
37839
|
+
}
|
|
37840
|
+
}
|
|
37841
|
+
response.on("close", () => {
|
|
37842
|
+
endSpan(getSpanStatusFromHttpCode(response.statusCode));
|
|
37843
|
+
});
|
|
37844
|
+
response.on(errorMonitor, () => {
|
|
37845
|
+
const httpStatus = getSpanStatusFromHttpCode(response.statusCode);
|
|
37846
|
+
endSpan(httpStatus.code === SPAN_STATUS_ERROR ? httpStatus : { code: SPAN_STATUS_ERROR });
|
|
37847
|
+
});
|
|
37848
|
+
return next();
|
|
37849
|
+
});
|
|
37850
|
+
};
|
|
37851
|
+
addStartSpanCallback(request, startSpan2);
|
|
37852
|
+
});
|
|
37853
|
+
},
|
|
37854
|
+
processEvent(event) {
|
|
37855
|
+
if (event.type === "transaction") {
|
|
37856
|
+
const statusCode = event.contexts?.trace?.data?.["http.response.status_code"];
|
|
37857
|
+
if (typeof statusCode === "number") {
|
|
37858
|
+
const shouldDrop = shouldFilterStatusCode(statusCode, ignoreStatusCodes);
|
|
37859
|
+
if (shouldDrop) {
|
|
37860
|
+
DEBUG_BUILD2 && debug.log("Dropping transaction due to status code", statusCode);
|
|
37861
|
+
return null;
|
|
37862
|
+
}
|
|
37863
|
+
}
|
|
37864
|
+
}
|
|
37865
|
+
return event;
|
|
37866
|
+
},
|
|
37867
|
+
afterAllSetup(client) {
|
|
37868
|
+
if (!DEBUG_BUILD2) {
|
|
37869
|
+
return;
|
|
37870
|
+
}
|
|
37871
|
+
if (client.getIntegrationByName("Http")) {
|
|
37872
|
+
debug.warn("It seems that you have manually added `httpServerSpansIntergation` while `httpIntegration` is also present. Make sure to remove `httpIntegration` when adding `httpServerSpansIntegration`.");
|
|
37873
|
+
}
|
|
37874
|
+
if (!client.getIntegrationByName("Http.Server")) {
|
|
37875
|
+
debug.error("It seems that you have manually added `httpServerSpansIntergation` without adding `httpServerIntegration`. This is a requiement for spans to be created - please add the `httpServerIntegration` integration.");
|
|
37876
|
+
}
|
|
37877
|
+
}
|
|
37878
|
+
};
|
|
37879
|
+
};
|
|
37880
|
+
var httpServerSpansIntegration = _httpServerSpansIntegration;
|
|
37881
|
+
function isKnownPrefetchRequest(req) {
|
|
37882
|
+
return req.headers["next-router-prefetch"] === "1";
|
|
37883
|
+
}
|
|
37884
|
+
function isStaticAssetRequest(urlPath) {
|
|
37885
|
+
const path7 = stripUrlQueryAndFragment(urlPath);
|
|
37886
|
+
if (path7.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)) {
|
|
37887
|
+
return true;
|
|
37888
|
+
}
|
|
37889
|
+
if (path7.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/)) {
|
|
37890
|
+
return true;
|
|
37891
|
+
}
|
|
37892
|
+
return false;
|
|
37893
|
+
}
|
|
37894
|
+
function shouldIgnoreSpansForIncomingRequest(request, {
|
|
37895
|
+
ignoreStaticAssets,
|
|
37896
|
+
ignoreIncomingRequests
|
|
37897
|
+
}) {
|
|
37898
|
+
if (import_core35.isTracingSuppressed(import_api3.context.active())) {
|
|
37899
|
+
return true;
|
|
37900
|
+
}
|
|
37901
|
+
const urlPath = request.url;
|
|
37902
|
+
const method = request.method?.toUpperCase();
|
|
37903
|
+
if (method === "OPTIONS" || method === "HEAD" || !urlPath) {
|
|
37904
|
+
return true;
|
|
37905
|
+
}
|
|
37906
|
+
if (ignoreStaticAssets && method === "GET" && isStaticAssetRequest(urlPath)) {
|
|
37907
|
+
return true;
|
|
37908
|
+
}
|
|
37909
|
+
if (ignoreIncomingRequests?.(urlPath, request)) {
|
|
37910
|
+
return true;
|
|
37911
|
+
}
|
|
37912
|
+
return false;
|
|
37913
|
+
}
|
|
37596
37914
|
function getRequestContentLengthAttribute(request) {
|
|
37597
37915
|
const length = getContentLength(request.headers);
|
|
37598
37916
|
if (length == null) {
|
|
@@ -37629,7 +37947,7 @@ function getIncomingRequestAttributesOnResponse(request, response) {
|
|
|
37629
37947
|
[import_semantic_conventions.SEMATTRS_HTTP_STATUS_CODE]: statusCode,
|
|
37630
37948
|
"http.status_text": statusMessage?.toUpperCase()
|
|
37631
37949
|
};
|
|
37632
|
-
const rpcMetadata =
|
|
37950
|
+
const rpcMetadata = import_core35.getRPCMetadata(import_api3.context.active());
|
|
37633
37951
|
if (socket) {
|
|
37634
37952
|
const { localAddress, localPort, remoteAddress, remotePort } = socket;
|
|
37635
37953
|
newAttributes[import_semantic_conventions.SEMATTRS_NET_HOST_IP] = localAddress;
|
|
@@ -37639,51 +37957,42 @@ function getIncomingRequestAttributesOnResponse(request, response) {
|
|
|
37639
37957
|
}
|
|
37640
37958
|
newAttributes[import_semantic_conventions.SEMATTRS_HTTP_STATUS_CODE] = statusCode;
|
|
37641
37959
|
newAttributes["http.status_text"] = (statusMessage || "").toUpperCase();
|
|
37642
|
-
if (rpcMetadata?.type ===
|
|
37960
|
+
if (rpcMetadata?.type === import_core35.RPCType.HTTP && rpcMetadata.route !== undefined) {
|
|
37643
37961
|
const routeName = rpcMetadata.route;
|
|
37644
37962
|
newAttributes[import_semantic_conventions.ATTR_HTTP_ROUTE] = routeName;
|
|
37645
37963
|
}
|
|
37646
37964
|
return newAttributes;
|
|
37647
37965
|
}
|
|
37648
|
-
function
|
|
37649
|
-
return
|
|
37650
|
-
|
|
37651
|
-
|
|
37652
|
-
|
|
37653
|
-
|
|
37654
|
-
return
|
|
37655
|
-
}
|
|
37656
|
-
if (path7.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/)) {
|
|
37657
|
-
return true;
|
|
37658
|
-
}
|
|
37659
|
-
return false;
|
|
37966
|
+
function shouldFilterStatusCode(statusCode, dropForStatusCodes) {
|
|
37967
|
+
return dropForStatusCodes.some((code) => {
|
|
37968
|
+
if (typeof code === "number") {
|
|
37969
|
+
return code === statusCode;
|
|
37970
|
+
}
|
|
37971
|
+
const [min, max] = code;
|
|
37972
|
+
return statusCode >= min && statusCode <= max;
|
|
37973
|
+
});
|
|
37660
37974
|
}
|
|
37661
|
-
|
|
37662
|
-
|
|
37663
|
-
|
|
37664
|
-
|
|
37665
|
-
|
|
37666
|
-
|
|
37667
|
-
|
|
37668
|
-
|
|
37669
|
-
|
|
37670
|
-
|
|
37671
|
-
|
|
37672
|
-
}
|
|
37673
|
-
|
|
37674
|
-
|
|
37675
|
-
}
|
|
37676
|
-
if (ignoreSpansForIncomingRequests?.(urlPath, request)) {
|
|
37677
|
-
return true;
|
|
37678
|
-
}
|
|
37679
|
-
return false;
|
|
37975
|
+
|
|
37976
|
+
// ../../node_modules/@sentry/node-core/build/esm/integrations/http/SentryHttpInstrumentation.js
|
|
37977
|
+
var import_api5 = __toESM(require_src(), 1);
|
|
37978
|
+
var import_core41 = __toESM(require_src3(), 1);
|
|
37979
|
+
var import_instrumentation2 = __toESM(require_src6(), 1);
|
|
37980
|
+
import { subscribe as subscribe2, unsubscribe } from "node:diagnostics_channel";
|
|
37981
|
+
|
|
37982
|
+
// ../../node_modules/@sentry/node-core/build/esm/utils/getRequestUrl.js
|
|
37983
|
+
function getRequestUrl(requestOptions) {
|
|
37984
|
+
const protocol = requestOptions.protocol || "";
|
|
37985
|
+
const hostname = requestOptions.hostname || requestOptions.host || "";
|
|
37986
|
+
const port = !requestOptions.port || requestOptions.port === 80 || requestOptions.port === 443 || /^(.*):(\d+)$/.test(hostname) ? "" : `:${requestOptions.port}`;
|
|
37987
|
+
const path7 = requestOptions.path ? requestOptions.path : "/";
|
|
37988
|
+
return `${protocol}//${hostname}${port}${path7}`;
|
|
37680
37989
|
}
|
|
37681
37990
|
|
|
37682
37991
|
// ../../node_modules/@sentry/opentelemetry/build/esm/index.js
|
|
37683
37992
|
var import_semantic_conventions2 = __toESM(require_src2(), 1);
|
|
37684
37993
|
var api = __toESM(require_src(), 1);
|
|
37685
|
-
var
|
|
37686
|
-
var
|
|
37994
|
+
var import_api4 = __toESM(require_src(), 1);
|
|
37995
|
+
var import_core38 = __toESM(require_src3(), 1);
|
|
37687
37996
|
var import_sdk_trace_base = __toESM(require_src9(), 1);
|
|
37688
37997
|
var SEMANTIC_ATTRIBUTE_SENTRY_PARENT_IS_REMOTE = "sentry.parentIsRemote";
|
|
37689
37998
|
var SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION = "sentry.graphql.operation";
|
|
@@ -37741,7 +38050,7 @@ function getSpanKind(span) {
|
|
|
37741
38050
|
if (spanHasKind(span)) {
|
|
37742
38051
|
return span.kind;
|
|
37743
38052
|
}
|
|
37744
|
-
return
|
|
38053
|
+
return import_api4.SpanKind.INTERNAL;
|
|
37745
38054
|
}
|
|
37746
38055
|
var SENTRY_TRACE_HEADER = "sentry-trace";
|
|
37747
38056
|
var SENTRY_BAGGAGE_HEADER = "baggage";
|
|
@@ -37750,19 +38059,19 @@ var SENTRY_TRACE_STATE_SAMPLED_NOT_RECORDING = "sentry.sampled_not_recording";
|
|
|
37750
38059
|
var SENTRY_TRACE_STATE_URL = "sentry.url";
|
|
37751
38060
|
var SENTRY_TRACE_STATE_SAMPLE_RAND = "sentry.sample_rand";
|
|
37752
38061
|
var SENTRY_TRACE_STATE_SAMPLE_RATE = "sentry.sample_rate";
|
|
37753
|
-
var SENTRY_SCOPES_CONTEXT_KEY =
|
|
37754
|
-
var SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY =
|
|
37755
|
-
var SENTRY_FORK_SET_SCOPE_CONTEXT_KEY =
|
|
37756
|
-
var SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY =
|
|
38062
|
+
var SENTRY_SCOPES_CONTEXT_KEY = import_api4.createContextKey("sentry_scopes");
|
|
38063
|
+
var SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY = import_api4.createContextKey("sentry_fork_isolation_scope");
|
|
38064
|
+
var SENTRY_FORK_SET_SCOPE_CONTEXT_KEY = import_api4.createContextKey("sentry_fork_set_scope");
|
|
38065
|
+
var SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY = import_api4.createContextKey("sentry_fork_set_isolation_scope");
|
|
37757
38066
|
var SCOPE_CONTEXT_FIELD = "_scopeContext";
|
|
37758
|
-
function getScopesFromContext(
|
|
37759
|
-
return
|
|
38067
|
+
function getScopesFromContext(context5) {
|
|
38068
|
+
return context5.getValue(SENTRY_SCOPES_CONTEXT_KEY);
|
|
37760
38069
|
}
|
|
37761
|
-
function setScopesOnContext(
|
|
37762
|
-
return
|
|
38070
|
+
function setScopesOnContext(context5, scopes) {
|
|
38071
|
+
return context5.setValue(SENTRY_SCOPES_CONTEXT_KEY, scopes);
|
|
37763
38072
|
}
|
|
37764
|
-
function setContextOnScope(scope,
|
|
37765
|
-
addNonEnumerableProperty(scope, SCOPE_CONTEXT_FIELD,
|
|
38073
|
+
function setContextOnScope(scope, context5) {
|
|
38074
|
+
addNonEnumerableProperty(scope, SCOPE_CONTEXT_FIELD, context5);
|
|
37766
38075
|
}
|
|
37767
38076
|
function getContextFromScope(scope) {
|
|
37768
38077
|
return scope[SCOPE_CONTEXT_FIELD];
|
|
@@ -37770,7 +38079,7 @@ function getContextFromScope(scope) {
|
|
|
37770
38079
|
function getSamplingDecision(spanContext) {
|
|
37771
38080
|
const { traceFlags, traceState } = spanContext;
|
|
37772
38081
|
const sampledNotRecording = traceState ? traceState.get(SENTRY_TRACE_STATE_SAMPLED_NOT_RECORDING) === "1" : false;
|
|
37773
|
-
if (traceFlags ===
|
|
38082
|
+
if (traceFlags === import_api4.TraceFlags.SAMPLED) {
|
|
37774
38083
|
return true;
|
|
37775
38084
|
}
|
|
37776
38085
|
if (sampledNotRecording) {
|
|
@@ -37845,10 +38154,10 @@ function descriptionForDbSystem({ attributes, name }) {
|
|
|
37845
38154
|
function descriptionForHttpMethod({ name, kind, attributes }, httpMethod) {
|
|
37846
38155
|
const opParts = ["http"];
|
|
37847
38156
|
switch (kind) {
|
|
37848
|
-
case
|
|
38157
|
+
case import_api4.SpanKind.CLIENT:
|
|
37849
38158
|
opParts.push("client");
|
|
37850
38159
|
break;
|
|
37851
|
-
case
|
|
38160
|
+
case import_api4.SpanKind.SERVER:
|
|
37852
38161
|
opParts.push("server");
|
|
37853
38162
|
break;
|
|
37854
38163
|
}
|
|
@@ -37873,7 +38182,7 @@ function descriptionForHttpMethod({ name, kind, attributes }, httpMethod) {
|
|
|
37873
38182
|
if (fragment) {
|
|
37874
38183
|
data["http.fragment"] = fragment;
|
|
37875
38184
|
}
|
|
37876
|
-
const isClientOrServerKind = kind ===
|
|
38185
|
+
const isClientOrServerKind = kind === import_api4.SpanKind.CLIENT || kind === import_api4.SpanKind.SERVER;
|
|
37877
38186
|
const origin = attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] || "manual";
|
|
37878
38187
|
const isManualSpan = !`${origin}`.startsWith("auto");
|
|
37879
38188
|
const alreadyHasCustomSource = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] === "custom";
|
|
@@ -37909,7 +38218,7 @@ function getSanitizedUrl(attributes, kind) {
|
|
|
37909
38218
|
if (typeof httpRoute === "string") {
|
|
37910
38219
|
return { urlPath: httpRoute, url, query, fragment, hasRoute: true };
|
|
37911
38220
|
}
|
|
37912
|
-
if (kind ===
|
|
38221
|
+
if (kind === import_api4.SpanKind.SERVER && typeof httpTarget === "string") {
|
|
37913
38222
|
return { urlPath: stripUrlQueryAndFragment(httpTarget), url, query, fragment, hasRoute: false };
|
|
37914
38223
|
}
|
|
37915
38224
|
if (parsedUrl) {
|
|
@@ -37950,7 +38259,7 @@ function enhanceDscWithOpenTelemetryRootSpanName(client) {
|
|
|
37950
38259
|
});
|
|
37951
38260
|
}
|
|
37952
38261
|
function getActiveSpan2() {
|
|
37953
|
-
return
|
|
38262
|
+
return import_api4.trace.getActiveSpan();
|
|
37954
38263
|
}
|
|
37955
38264
|
var DEBUG_BUILD3 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__;
|
|
37956
38265
|
function makeTraceState({
|
|
@@ -37958,7 +38267,7 @@ function makeTraceState({
|
|
|
37958
38267
|
sampled
|
|
37959
38268
|
}) {
|
|
37960
38269
|
const dscString = dsc ? dynamicSamplingContextToSentryBaggageHeader(dsc) : undefined;
|
|
37961
|
-
const traceStateBase = new
|
|
38270
|
+
const traceStateBase = new import_core38.TraceState;
|
|
37962
38271
|
const traceStateWithDsc = dscString ? traceStateBase.set(SENTRY_TRACE_STATE_DSC, dscString) : traceStateBase;
|
|
37963
38272
|
return sampled === false ? traceStateWithDsc.set(SENTRY_TRACE_STATE_SAMPLED_NOT_RECORDING, "1") : traceStateWithDsc;
|
|
37964
38273
|
}
|
|
@@ -37970,18 +38279,18 @@ function setIsSetup(element) {
|
|
|
37970
38279
|
setupElements.add(element);
|
|
37971
38280
|
}
|
|
37972
38281
|
|
|
37973
|
-
class SentryPropagator extends
|
|
38282
|
+
class SentryPropagator extends import_core38.W3CBaggagePropagator {
|
|
37974
38283
|
constructor() {
|
|
37975
38284
|
super();
|
|
37976
38285
|
setIsSetup("SentryPropagator");
|
|
37977
38286
|
this._urlMatchesTargetsMap = new LRUMap(100);
|
|
37978
38287
|
}
|
|
37979
|
-
inject(
|
|
37980
|
-
if (
|
|
38288
|
+
inject(context5, carrier, setter) {
|
|
38289
|
+
if (import_core38.isTracingSuppressed(context5)) {
|
|
37981
38290
|
DEBUG_BUILD3 && debug.log("[Tracing] Not injecting trace data for url because tracing is suppressed.");
|
|
37982
38291
|
return;
|
|
37983
38292
|
}
|
|
37984
|
-
const activeSpan =
|
|
38293
|
+
const activeSpan = import_api4.trace.getSpan(context5);
|
|
37985
38294
|
const url = activeSpan && getCurrentURL(activeSpan);
|
|
37986
38295
|
const tracePropagationTargets = getClient()?.getOptions()?.tracePropagationTargets;
|
|
37987
38296
|
if (!shouldPropagateTraceForUrl(url, tracePropagationTargets, this._urlMatchesTargetsMap)) {
|
|
@@ -37989,8 +38298,8 @@ class SentryPropagator extends import_core37.W3CBaggagePropagator {
|
|
|
37989
38298
|
return;
|
|
37990
38299
|
}
|
|
37991
38300
|
const existingBaggageHeader = getExistingBaggage(carrier);
|
|
37992
|
-
let baggage =
|
|
37993
|
-
const { dynamicSamplingContext, traceId, spanId, sampled } = getInjectionData(
|
|
38301
|
+
let baggage = import_api4.propagation.getBaggage(context5) || import_api4.propagation.createBaggage({});
|
|
38302
|
+
const { dynamicSamplingContext, traceId, spanId, sampled } = getInjectionData(context5);
|
|
37994
38303
|
if (existingBaggageHeader) {
|
|
37995
38304
|
const baggageEntries = parseBaggageHeader(existingBaggageHeader);
|
|
37996
38305
|
if (baggageEntries) {
|
|
@@ -38007,16 +38316,16 @@ class SentryPropagator extends import_core37.W3CBaggagePropagator {
|
|
|
38007
38316
|
return b;
|
|
38008
38317
|
}, baggage);
|
|
38009
38318
|
}
|
|
38010
|
-
if (traceId && traceId !==
|
|
38319
|
+
if (traceId && traceId !== import_api4.INVALID_TRACEID) {
|
|
38011
38320
|
setter.set(carrier, SENTRY_TRACE_HEADER, generateSentryTraceHeader(traceId, spanId, sampled));
|
|
38012
38321
|
}
|
|
38013
|
-
super.inject(
|
|
38322
|
+
super.inject(import_api4.propagation.setBaggage(context5, baggage), carrier, setter);
|
|
38014
38323
|
}
|
|
38015
|
-
extract(
|
|
38324
|
+
extract(context5, carrier, getter) {
|
|
38016
38325
|
const maybeSentryTraceHeader = getter.get(carrier, SENTRY_TRACE_HEADER);
|
|
38017
38326
|
const baggage = getter.get(carrier, SENTRY_BAGGAGE_HEADER);
|
|
38018
38327
|
const sentryTrace = maybeSentryTraceHeader ? Array.isArray(maybeSentryTraceHeader) ? maybeSentryTraceHeader[0] : maybeSentryTraceHeader : undefined;
|
|
38019
|
-
return ensureScopesOnContext(getContextWithRemoteActiveSpan(
|
|
38328
|
+
return ensureScopesOnContext(getContextWithRemoteActiveSpan(context5, { sentryTrace, baggage }));
|
|
38020
38329
|
}
|
|
38021
38330
|
fields() {
|
|
38022
38331
|
return [SENTRY_TRACE_HEADER, SENTRY_BAGGAGE_HEADER];
|
|
@@ -38037,8 +38346,8 @@ function shouldPropagateTraceForUrl(url, tracePropagationTargets, decisionMap) {
|
|
|
38037
38346
|
DEBUG_BUILD3 && !decision && debug.log(NOT_PROPAGATED_MESSAGE, url);
|
|
38038
38347
|
return decision;
|
|
38039
38348
|
}
|
|
38040
|
-
function getInjectionData(
|
|
38041
|
-
const span =
|
|
38349
|
+
function getInjectionData(context5, options = {}) {
|
|
38350
|
+
const span = import_api4.trace.getSpan(context5);
|
|
38042
38351
|
if (span?.spanContext().isRemote) {
|
|
38043
38352
|
const spanContext = span.spanContext();
|
|
38044
38353
|
const dynamicSamplingContext2 = getDynamicSamplingContextFromSpan(span);
|
|
@@ -38059,7 +38368,7 @@ function getInjectionData(context4, options = {}) {
|
|
|
38059
38368
|
sampled: getSamplingDecision(spanContext)
|
|
38060
38369
|
};
|
|
38061
38370
|
}
|
|
38062
|
-
const scope = options.scope || getScopesFromContext(
|
|
38371
|
+
const scope = options.scope || getScopesFromContext(context5)?.scope || getCurrentScope();
|
|
38063
38372
|
const client = options.client || getClient();
|
|
38064
38373
|
const propagationContext = scope.getPropagationContext();
|
|
38065
38374
|
const dynamicSamplingContext = client ? getDynamicSamplingContextFromScope(client, scope) : undefined;
|
|
@@ -38084,11 +38393,11 @@ function getContextWithRemoteActiveSpan(ctx, { sentryTrace, baggage }) {
|
|
|
38084
38393
|
sampled,
|
|
38085
38394
|
dsc
|
|
38086
38395
|
});
|
|
38087
|
-
return
|
|
38396
|
+
return import_api4.trace.setSpanContext(ctx, spanContext);
|
|
38088
38397
|
}
|
|
38089
38398
|
function continueTraceAsRemoteSpan(ctx, options, callback) {
|
|
38090
38399
|
const ctxWithSpanContext = ensureScopesOnContext(getContextWithRemoteActiveSpan(ctx, options));
|
|
38091
|
-
return
|
|
38400
|
+
return import_api4.context.with(ctxWithSpanContext, callback);
|
|
38092
38401
|
}
|
|
38093
38402
|
function ensureScopesOnContext(ctx) {
|
|
38094
38403
|
const scopes = getScopesFromContext(ctx);
|
|
@@ -38132,7 +38441,7 @@ function generateRemoteSpanContext({
|
|
|
38132
38441
|
traceId,
|
|
38133
38442
|
spanId,
|
|
38134
38443
|
isRemote: true,
|
|
38135
|
-
traceFlags: sampled ?
|
|
38444
|
+
traceFlags: sampled ? import_api4.TraceFlags.SAMPLED : import_api4.TraceFlags.NONE,
|
|
38136
38445
|
traceState
|
|
38137
38446
|
};
|
|
38138
38447
|
return spanContext;
|
|
@@ -38143,13 +38452,13 @@ function startSpan2(options, callback) {
|
|
|
38143
38452
|
const wrapper = getActiveSpanWrapper2(customParentSpan);
|
|
38144
38453
|
return wrapper(() => {
|
|
38145
38454
|
const activeCtx = getContext(options.scope, options.forceTransaction);
|
|
38146
|
-
const shouldSkipSpan = options.onlyIfParent && !
|
|
38147
|
-
const ctx = shouldSkipSpan ?
|
|
38455
|
+
const shouldSkipSpan = options.onlyIfParent && !import_api4.trace.getSpan(activeCtx);
|
|
38456
|
+
const ctx = shouldSkipSpan ? import_core38.suppressTracing(activeCtx) : activeCtx;
|
|
38148
38457
|
const spanOptions = getSpanOptions(options);
|
|
38149
38458
|
return tracer.startActiveSpan(name, spanOptions, ctx, (span) => {
|
|
38150
38459
|
return handleCallbackErrors(() => callback(span), () => {
|
|
38151
38460
|
if (spanToJSON(span).status === undefined) {
|
|
38152
|
-
span.setStatus({ code:
|
|
38461
|
+
span.setStatus({ code: import_api4.SpanStatusCode.ERROR });
|
|
38153
38462
|
}
|
|
38154
38463
|
}, () => span.end());
|
|
38155
38464
|
});
|
|
@@ -38161,13 +38470,13 @@ function startSpanManual2(options, callback) {
|
|
|
38161
38470
|
const wrapper = getActiveSpanWrapper2(customParentSpan);
|
|
38162
38471
|
return wrapper(() => {
|
|
38163
38472
|
const activeCtx = getContext(options.scope, options.forceTransaction);
|
|
38164
|
-
const shouldSkipSpan = options.onlyIfParent && !
|
|
38165
|
-
const ctx = shouldSkipSpan ?
|
|
38473
|
+
const shouldSkipSpan = options.onlyIfParent && !import_api4.trace.getSpan(activeCtx);
|
|
38474
|
+
const ctx = shouldSkipSpan ? import_core38.suppressTracing(activeCtx) : activeCtx;
|
|
38166
38475
|
const spanOptions = getSpanOptions(options);
|
|
38167
38476
|
return tracer.startActiveSpan(name, spanOptions, ctx, (span) => {
|
|
38168
38477
|
return handleCallbackErrors(() => callback(span, () => span.end()), () => {
|
|
38169
38478
|
if (spanToJSON(span).status === undefined) {
|
|
38170
|
-
span.setStatus({ code:
|
|
38479
|
+
span.setStatus({ code: import_api4.SpanStatusCode.ERROR });
|
|
38171
38480
|
}
|
|
38172
38481
|
});
|
|
38173
38482
|
});
|
|
@@ -38179,20 +38488,20 @@ function startInactiveSpan2(options) {
|
|
|
38179
38488
|
const wrapper = getActiveSpanWrapper2(customParentSpan);
|
|
38180
38489
|
return wrapper(() => {
|
|
38181
38490
|
const activeCtx = getContext(options.scope, options.forceTransaction);
|
|
38182
|
-
const shouldSkipSpan = options.onlyIfParent && !
|
|
38183
|
-
const ctx = shouldSkipSpan ?
|
|
38491
|
+
const shouldSkipSpan = options.onlyIfParent && !import_api4.trace.getSpan(activeCtx);
|
|
38492
|
+
const ctx = shouldSkipSpan ? import_core38.suppressTracing(activeCtx) : activeCtx;
|
|
38184
38493
|
const spanOptions = getSpanOptions(options);
|
|
38185
38494
|
const span = tracer.startSpan(name, spanOptions, ctx);
|
|
38186
38495
|
return span;
|
|
38187
38496
|
});
|
|
38188
38497
|
}
|
|
38189
38498
|
function withActiveSpan2(span, callback) {
|
|
38190
|
-
const newContextWithActiveSpan = span ?
|
|
38191
|
-
return
|
|
38499
|
+
const newContextWithActiveSpan = span ? import_api4.trace.setSpan(import_api4.context.active(), span) : import_api4.trace.deleteSpan(import_api4.context.active());
|
|
38500
|
+
return import_api4.context.with(newContextWithActiveSpan, () => callback(getCurrentScope()));
|
|
38192
38501
|
}
|
|
38193
38502
|
function getTracer() {
|
|
38194
38503
|
const client = getClient();
|
|
38195
|
-
return client?.tracer ||
|
|
38504
|
+
return client?.tracer || import_api4.trace.getTracer("@sentry/opentelemetry", SDK_VERSION);
|
|
38196
38505
|
}
|
|
38197
38506
|
function getSpanOptions(options) {
|
|
38198
38507
|
const { startTime, attributes, kind, op, links } = options;
|
|
@@ -38213,14 +38522,14 @@ function ensureTimestampInMilliseconds(timestamp) {
|
|
|
38213
38522
|
}
|
|
38214
38523
|
function getContext(scope, forceTransaction) {
|
|
38215
38524
|
const ctx = getContextForScope(scope);
|
|
38216
|
-
const parentSpan =
|
|
38525
|
+
const parentSpan = import_api4.trace.getSpan(ctx);
|
|
38217
38526
|
if (!parentSpan) {
|
|
38218
38527
|
return ctx;
|
|
38219
38528
|
}
|
|
38220
38529
|
if (!forceTransaction) {
|
|
38221
38530
|
return ctx;
|
|
38222
38531
|
}
|
|
38223
|
-
const ctxWithoutSpan =
|
|
38532
|
+
const ctxWithoutSpan = import_api4.trace.deleteSpan(ctx);
|
|
38224
38533
|
const { spanId, traceId } = parentSpan.spanContext();
|
|
38225
38534
|
const sampled = getSamplingDecision(parentSpan.spanContext());
|
|
38226
38535
|
const rootSpan = getRootSpan(parentSpan);
|
|
@@ -38233,10 +38542,10 @@ function getContext(scope, forceTransaction) {
|
|
|
38233
38542
|
traceId,
|
|
38234
38543
|
spanId,
|
|
38235
38544
|
isRemote: true,
|
|
38236
|
-
traceFlags: sampled ?
|
|
38545
|
+
traceFlags: sampled ? import_api4.TraceFlags.SAMPLED : import_api4.TraceFlags.NONE,
|
|
38237
38546
|
traceState
|
|
38238
38547
|
};
|
|
38239
|
-
const ctxWithSpanContext =
|
|
38548
|
+
const ctxWithSpanContext = import_api4.trace.setSpanContext(ctxWithoutSpan, spanOptions);
|
|
38240
38549
|
return ctxWithSpanContext;
|
|
38241
38550
|
}
|
|
38242
38551
|
function getContextForScope(scope) {
|
|
@@ -38246,14 +38555,14 @@ function getContextForScope(scope) {
|
|
|
38246
38555
|
return ctx;
|
|
38247
38556
|
}
|
|
38248
38557
|
}
|
|
38249
|
-
return
|
|
38558
|
+
return import_api4.context.active();
|
|
38250
38559
|
}
|
|
38251
38560
|
function continueTrace2(options, callback) {
|
|
38252
|
-
return continueTraceAsRemoteSpan(
|
|
38561
|
+
return continueTraceAsRemoteSpan(import_api4.context.active(), options, callback);
|
|
38253
38562
|
}
|
|
38254
38563
|
function getTraceContextForScope(client, scope) {
|
|
38255
38564
|
const ctx = getContextFromScope(scope);
|
|
38256
|
-
const span = ctx &&
|
|
38565
|
+
const span = ctx && import_api4.trace.getSpan(ctx);
|
|
38257
38566
|
const traceContext = span ? spanToTraceContext(span) : getTraceContextFromScope(scope);
|
|
38258
38567
|
const dynamicSamplingContext = span ? getDynamicSamplingContextFromSpan(span) : getDynamicSamplingContextFromScope(client, scope);
|
|
38259
38568
|
return [dynamicSamplingContext, traceContext];
|
|
@@ -38264,8 +38573,8 @@ function getActiveSpanWrapper2(parentSpan) {
|
|
|
38264
38573
|
} : (callback) => callback();
|
|
38265
38574
|
}
|
|
38266
38575
|
function suppressTracing2(callback) {
|
|
38267
|
-
const ctx =
|
|
38268
|
-
return
|
|
38576
|
+
const ctx = import_core38.suppressTracing(import_api4.context.active());
|
|
38577
|
+
return import_api4.context.with(ctx, callback);
|
|
38269
38578
|
}
|
|
38270
38579
|
function setupEventContextTrace(client) {
|
|
38271
38580
|
client.on("preprocessEvent", (event) => {
|
|
@@ -38367,17 +38676,17 @@ function wrapContextManagerClass(ContextManagerClass) {
|
|
|
38367
38676
|
super(...args);
|
|
38368
38677
|
setIsSetup("SentryContextManager");
|
|
38369
38678
|
}
|
|
38370
|
-
with(
|
|
38371
|
-
const currentScopes = getScopesFromContext(
|
|
38679
|
+
with(context5, fn, thisArg, ...args) {
|
|
38680
|
+
const currentScopes = getScopesFromContext(context5);
|
|
38372
38681
|
const currentScope = currentScopes?.scope || getCurrentScope();
|
|
38373
38682
|
const currentIsolationScope = currentScopes?.isolationScope || getIsolationScope();
|
|
38374
|
-
const shouldForkIsolationScope =
|
|
38375
|
-
const scope =
|
|
38376
|
-
const isolationScope =
|
|
38683
|
+
const shouldForkIsolationScope = context5.getValue(SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY) === true;
|
|
38684
|
+
const scope = context5.getValue(SENTRY_FORK_SET_SCOPE_CONTEXT_KEY);
|
|
38685
|
+
const isolationScope = context5.getValue(SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY);
|
|
38377
38686
|
const newCurrentScope = scope || currentScope.clone();
|
|
38378
38687
|
const newIsolationScope = isolationScope || (shouldForkIsolationScope ? currentIsolationScope.clone() : currentIsolationScope);
|
|
38379
38688
|
const scopes = { scope: newCurrentScope, isolationScope: newIsolationScope };
|
|
38380
|
-
const ctx1 = setScopesOnContext(
|
|
38689
|
+
const ctx1 = setScopesOnContext(context5, scopes);
|
|
38381
38690
|
const ctx2 = ctx1.deleteValue(SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY).deleteValue(SENTRY_FORK_SET_SCOPE_CONTEXT_KEY).deleteValue(SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY);
|
|
38382
38691
|
setContextOnScope(newCurrentScope, ctx2);
|
|
38383
38692
|
return super.with(ctx2, fn, thisArg, ...args);
|
|
@@ -38454,9 +38763,9 @@ function mapStatus(span) {
|
|
|
38454
38763
|
const attributes = spanHasAttributes(span) ? span.attributes : {};
|
|
38455
38764
|
const status = spanHasStatus(span) ? span.status : undefined;
|
|
38456
38765
|
if (status) {
|
|
38457
|
-
if (status.code ===
|
|
38766
|
+
if (status.code === import_api4.SpanStatusCode.OK) {
|
|
38458
38767
|
return { code: SPAN_STATUS_OK };
|
|
38459
|
-
} else if (status.code ===
|
|
38768
|
+
} else if (status.code === import_api4.SpanStatusCode.ERROR) {
|
|
38460
38769
|
if (typeof status.message === "undefined") {
|
|
38461
38770
|
const inferredStatus2 = inferStatusFromAttributes(attributes);
|
|
38462
38771
|
if (inferredStatus2) {
|
|
@@ -38474,7 +38783,7 @@ function mapStatus(span) {
|
|
|
38474
38783
|
if (inferredStatus) {
|
|
38475
38784
|
return inferredStatus;
|
|
38476
38785
|
}
|
|
38477
|
-
if (status?.code ===
|
|
38786
|
+
if (status?.code === import_api4.SpanStatusCode.UNSET) {
|
|
38478
38787
|
return { code: SPAN_STATUS_OK };
|
|
38479
38788
|
} else {
|
|
38480
38789
|
return { code: SPAN_STATUS_ERROR, message: "unknown_error" };
|
|
@@ -38725,8 +39034,8 @@ function removeSentryAttributes(data) {
|
|
|
38725
39034
|
function getData(span) {
|
|
38726
39035
|
const attributes = span.attributes;
|
|
38727
39036
|
const data = {};
|
|
38728
|
-
if (span.kind !==
|
|
38729
|
-
data["otel.kind"] =
|
|
39037
|
+
if (span.kind !== import_api4.SpanKind.INTERNAL) {
|
|
39038
|
+
data["otel.kind"] = import_api4.SpanKind[span.kind];
|
|
38730
39039
|
}
|
|
38731
39040
|
const maybeHttpStatusCodeAttribute = attributes[import_semantic_conventions2.SEMATTRS_HTTP_STATUS_CODE];
|
|
38732
39041
|
if (maybeHttpStatusCodeAttribute) {
|
|
@@ -38745,7 +39054,7 @@ function getData(span) {
|
|
|
38745
39054
|
return data;
|
|
38746
39055
|
}
|
|
38747
39056
|
function onSpanStart(span, parentContext) {
|
|
38748
|
-
const parentSpan =
|
|
39057
|
+
const parentSpan = import_api4.trace.getSpan(parentContext);
|
|
38749
39058
|
let scopes = getScopesFromContext(parentContext);
|
|
38750
39059
|
if (parentSpan && !parentSpan.spanContext().isRemote) {
|
|
38751
39060
|
addChildSpanToSpan(parentSpan, span);
|
|
@@ -38753,7 +39062,7 @@ function onSpanStart(span, parentContext) {
|
|
|
38753
39062
|
if (parentSpan?.spanContext().isRemote) {
|
|
38754
39063
|
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_PARENT_IS_REMOTE, true);
|
|
38755
39064
|
}
|
|
38756
|
-
if (parentContext ===
|
|
39065
|
+
if (parentContext === import_api4.ROOT_CONTEXT) {
|
|
38757
39066
|
scopes = {
|
|
38758
39067
|
scope: getDefaultCurrentScope(),
|
|
38759
39068
|
isolationScope: getDefaultIsolationScope()
|
|
@@ -38797,23 +39106,23 @@ class SentrySampler {
|
|
|
38797
39106
|
this._client = client;
|
|
38798
39107
|
setIsSetup("SentrySampler");
|
|
38799
39108
|
}
|
|
38800
|
-
shouldSample(
|
|
39109
|
+
shouldSample(context5, traceId, spanName, spanKind, spanAttributes, _links) {
|
|
38801
39110
|
const options = this._client.getOptions();
|
|
38802
|
-
const parentSpan = getValidSpan(
|
|
39111
|
+
const parentSpan = getValidSpan(context5);
|
|
38803
39112
|
const parentContext = parentSpan?.spanContext();
|
|
38804
39113
|
if (!hasSpansEnabled(options)) {
|
|
38805
|
-
return wrapSamplingDecision({ decision: undefined, context:
|
|
39114
|
+
return wrapSamplingDecision({ decision: undefined, context: context5, spanAttributes });
|
|
38806
39115
|
}
|
|
38807
39116
|
const maybeSpanHttpMethod = spanAttributes[import_semantic_conventions2.SEMATTRS_HTTP_METHOD] || spanAttributes[import_semantic_conventions2.ATTR_HTTP_REQUEST_METHOD];
|
|
38808
|
-
if (spanKind ===
|
|
38809
|
-
return wrapSamplingDecision({ decision: undefined, context:
|
|
39117
|
+
if (spanKind === import_api4.SpanKind.CLIENT && maybeSpanHttpMethod && (!parentSpan || parentContext?.isRemote)) {
|
|
39118
|
+
return wrapSamplingDecision({ decision: undefined, context: context5, spanAttributes });
|
|
38810
39119
|
}
|
|
38811
39120
|
const parentSampled = parentSpan ? getParentSampled(parentSpan, traceId, spanName) : undefined;
|
|
38812
39121
|
const isRootSpan = !parentSpan || parentContext?.isRemote;
|
|
38813
39122
|
if (!isRootSpan) {
|
|
38814
39123
|
return wrapSamplingDecision({
|
|
38815
39124
|
decision: parentSampled ? import_sdk_trace_base.SamplingDecision.RECORD_AND_SAMPLED : import_sdk_trace_base.SamplingDecision.NOT_RECORD,
|
|
38816
|
-
context:
|
|
39125
|
+
context: context5,
|
|
38817
39126
|
spanAttributes
|
|
38818
39127
|
});
|
|
38819
39128
|
}
|
|
@@ -38837,9 +39146,9 @@ class SentrySampler {
|
|
|
38837
39146
|
parentContext
|
|
38838
39147
|
}, mutableSamplingDecision);
|
|
38839
39148
|
if (!mutableSamplingDecision.decision) {
|
|
38840
|
-
return wrapSamplingDecision({ decision: undefined, context:
|
|
39149
|
+
return wrapSamplingDecision({ decision: undefined, context: context5, spanAttributes });
|
|
38841
39150
|
}
|
|
38842
|
-
const { isolationScope } = getScopesFromContext(
|
|
39151
|
+
const { isolationScope } = getScopesFromContext(context5) ?? {};
|
|
38843
39152
|
const dscString = parentContext?.traceState ? parentContext.traceState.get(SENTRY_TRACE_STATE_DSC) : undefined;
|
|
38844
39153
|
const dsc = dscString ? baggageHeaderToDynamicSamplingContext(dscString) : undefined;
|
|
38845
39154
|
const sampleRand = parseSampleRate(dsc?.sample_rand) ?? Math.random();
|
|
@@ -38855,7 +39164,7 @@ class SentrySampler {
|
|
|
38855
39164
|
DEBUG_BUILD3 && debug.log(`[Tracing] Not sampling span because HTTP method is '${method}' for ${spanName}`);
|
|
38856
39165
|
return wrapSamplingDecision({
|
|
38857
39166
|
decision: import_sdk_trace_base.SamplingDecision.NOT_RECORD,
|
|
38858
|
-
context:
|
|
39167
|
+
context: context5,
|
|
38859
39168
|
spanAttributes,
|
|
38860
39169
|
sampleRand,
|
|
38861
39170
|
downstreamTraceSampleRate: 0
|
|
@@ -38868,7 +39177,7 @@ class SentrySampler {
|
|
|
38868
39177
|
return {
|
|
38869
39178
|
...wrapSamplingDecision({
|
|
38870
39179
|
decision: sampled ? import_sdk_trace_base.SamplingDecision.RECORD_AND_SAMPLED : import_sdk_trace_base.SamplingDecision.NOT_RECORD,
|
|
38871
|
-
context:
|
|
39180
|
+
context: context5,
|
|
38872
39181
|
spanAttributes,
|
|
38873
39182
|
sampleRand,
|
|
38874
39183
|
downstreamTraceSampleRate: localSampleRateWasApplied ? sampleRate : undefined
|
|
@@ -38884,7 +39193,7 @@ class SentrySampler {
|
|
|
38884
39193
|
}
|
|
38885
39194
|
function getParentSampled(parentSpan, traceId, spanName) {
|
|
38886
39195
|
const parentContext = parentSpan.spanContext();
|
|
38887
|
-
if (
|
|
39196
|
+
if (import_api4.isSpanContextValid(parentContext) && parentContext.traceId === traceId) {
|
|
38888
39197
|
if (parentContext.isRemote) {
|
|
38889
39198
|
const parentSampled2 = getSamplingDecision(parentSpan.spanContext());
|
|
38890
39199
|
DEBUG_BUILD3 && debug.log(`[Tracing] Inheriting remote parent's sampled decision for ${spanName}: ${parentSampled2}`);
|
|
@@ -38898,12 +39207,12 @@ function getParentSampled(parentSpan, traceId, spanName) {
|
|
|
38898
39207
|
}
|
|
38899
39208
|
function wrapSamplingDecision({
|
|
38900
39209
|
decision,
|
|
38901
|
-
context:
|
|
39210
|
+
context: context5,
|
|
38902
39211
|
spanAttributes,
|
|
38903
39212
|
sampleRand,
|
|
38904
39213
|
downstreamTraceSampleRate
|
|
38905
39214
|
}) {
|
|
38906
|
-
let traceState = getBaseTraceState(
|
|
39215
|
+
let traceState = getBaseTraceState(context5, spanAttributes);
|
|
38907
39216
|
if (downstreamTraceSampleRate !== undefined) {
|
|
38908
39217
|
traceState = traceState.set(SENTRY_TRACE_STATE_SAMPLE_RATE, `${downstreamTraceSampleRate}`);
|
|
38909
39218
|
}
|
|
@@ -38918,19 +39227,19 @@ function wrapSamplingDecision({
|
|
|
38918
39227
|
}
|
|
38919
39228
|
return { decision, traceState };
|
|
38920
39229
|
}
|
|
38921
|
-
function getBaseTraceState(
|
|
38922
|
-
const parentSpan =
|
|
39230
|
+
function getBaseTraceState(context5, spanAttributes) {
|
|
39231
|
+
const parentSpan = import_api4.trace.getSpan(context5);
|
|
38923
39232
|
const parentContext = parentSpan?.spanContext();
|
|
38924
|
-
let traceState = parentContext?.traceState || new
|
|
39233
|
+
let traceState = parentContext?.traceState || new import_core38.TraceState;
|
|
38925
39234
|
const url = spanAttributes[import_semantic_conventions2.SEMATTRS_HTTP_URL] || spanAttributes[import_semantic_conventions2.ATTR_URL_FULL];
|
|
38926
39235
|
if (url && typeof url === "string") {
|
|
38927
39236
|
traceState = traceState.set(SENTRY_TRACE_STATE_URL, url);
|
|
38928
39237
|
}
|
|
38929
39238
|
return traceState;
|
|
38930
39239
|
}
|
|
38931
|
-
function getValidSpan(
|
|
38932
|
-
const span =
|
|
38933
|
-
return span &&
|
|
39240
|
+
function getValidSpan(context5) {
|
|
39241
|
+
const span = import_api4.trace.getSpan(context5);
|
|
39242
|
+
return span && import_api4.isSpanContextValid(span.spanContext()) ? span : undefined;
|
|
38934
39243
|
}
|
|
38935
39244
|
|
|
38936
39245
|
// ../../node_modules/@sentry/node-core/build/esm/utils/baggage.js
|
|
@@ -39045,21 +39354,6 @@ class SentryHttpInstrumentation extends import_instrumentation2.InstrumentationB
|
|
|
39045
39354
|
}
|
|
39046
39355
|
init() {
|
|
39047
39356
|
let hasRegisteredHandlers = false;
|
|
39048
|
-
const spansEnabled = this.getConfig().spans ?? true;
|
|
39049
|
-
const onHttpServerRequestStart = (_data) => {
|
|
39050
|
-
const data = _data;
|
|
39051
|
-
instrumentServer(data.server, {
|
|
39052
|
-
instrumentation: this.getConfig().instrumentation,
|
|
39053
|
-
ignoreIncomingRequestBody: this.getConfig().ignoreIncomingRequestBody,
|
|
39054
|
-
ignoreSpansForIncomingRequests: this.getConfig().ignoreSpansForIncomingRequests,
|
|
39055
|
-
incomingRequestSpanHook: this.getConfig().incomingRequestSpanHook,
|
|
39056
|
-
maxIncomingRequestBodySize: this.getConfig().maxIncomingRequestBodySize,
|
|
39057
|
-
trackIncomingRequestsAsSessions: this.getConfig().trackIncomingRequestsAsSessions,
|
|
39058
|
-
sessionFlushingDelayMS: this.getConfig().sessionFlushingDelayMS ?? 60000,
|
|
39059
|
-
ignoreStaticAssets: this.getConfig().ignoreStaticAssets,
|
|
39060
|
-
spans: spansEnabled && !this.getConfig().disableIncomingRequestSpans
|
|
39061
|
-
});
|
|
39062
|
-
};
|
|
39063
39357
|
const onHttpClientResponseFinish = (_data) => {
|
|
39064
39358
|
const data = _data;
|
|
39065
39359
|
this._onOutgoingRequestFinish(data.request, data.response);
|
|
@@ -39077,16 +39371,14 @@ class SentryHttpInstrumentation extends import_instrumentation2.InstrumentationB
|
|
|
39077
39371
|
return moduleExports;
|
|
39078
39372
|
}
|
|
39079
39373
|
hasRegisteredHandlers = true;
|
|
39080
|
-
|
|
39081
|
-
|
|
39082
|
-
subscribe("http.client.request.error", onHttpClientRequestError);
|
|
39374
|
+
subscribe2("http.client.response.finish", onHttpClientResponseFinish);
|
|
39375
|
+
subscribe2("http.client.request.error", onHttpClientRequestError);
|
|
39083
39376
|
if (this.getConfig().propagateTraceInOutgoingRequests) {
|
|
39084
|
-
|
|
39377
|
+
subscribe2("http.client.request.created", onHttpClientRequestCreated);
|
|
39085
39378
|
}
|
|
39086
39379
|
return moduleExports;
|
|
39087
39380
|
};
|
|
39088
39381
|
const unwrap = () => {
|
|
39089
|
-
unsubscribe("http.server.request.start", onHttpServerRequestStart);
|
|
39090
39382
|
unsubscribe("http.client.response.finish", onHttpClientResponseFinish);
|
|
39091
39383
|
unsubscribe("http.client.request.error", onHttpClientRequestError);
|
|
39092
39384
|
unsubscribe("http.client.request.created", onHttpClientRequestCreated);
|
|
@@ -39115,7 +39407,7 @@ class SentryHttpInstrumentation extends import_instrumentation2.InstrumentationB
|
|
|
39115
39407
|
addTracePropagationHeadersToOutgoingRequest(request, this._propagationDecisionMap);
|
|
39116
39408
|
}
|
|
39117
39409
|
_shouldIgnoreOutgoingRequest(request) {
|
|
39118
|
-
if (
|
|
39410
|
+
if (import_core41.isTracingSuppressed(import_api5.context.active())) {
|
|
39119
39411
|
return true;
|
|
39120
39412
|
}
|
|
39121
39413
|
const ignoreOutgoingRequests = this.getConfig().ignoreOutgoingRequests;
|
|
@@ -39129,53 +39421,51 @@ class SentryHttpInstrumentation extends import_instrumentation2.InstrumentationB
|
|
|
39129
39421
|
}
|
|
39130
39422
|
|
|
39131
39423
|
// ../../node_modules/@sentry/node-core/build/esm/integrations/http/index.js
|
|
39132
|
-
var
|
|
39133
|
-
var instrumentSentryHttp = generateInstrumentOnce(`${
|
|
39424
|
+
var INTEGRATION_NAME8 = "Http";
|
|
39425
|
+
var instrumentSentryHttp = generateInstrumentOnce(`${INTEGRATION_NAME8}.sentry`, (options) => {
|
|
39134
39426
|
return new SentryHttpInstrumentation(options);
|
|
39135
39427
|
});
|
|
39136
39428
|
var httpIntegration = defineIntegration((options = {}) => {
|
|
39137
|
-
const
|
|
39138
|
-
|
|
39139
|
-
|
|
39140
|
-
|
|
39141
|
-
|
|
39429
|
+
const serverOptions = {
|
|
39430
|
+
sessions: options.trackIncomingRequestsAsSessions,
|
|
39431
|
+
sessionFlushingDelayMS: options.sessionFlushingDelayMS,
|
|
39432
|
+
ignoreRequestBody: options.ignoreIncomingRequestBody,
|
|
39433
|
+
maxRequestBodySize: options.maxIncomingRequestBodySize
|
|
39434
|
+
};
|
|
39435
|
+
const serverSpansOptions = {
|
|
39436
|
+
ignoreIncomingRequests: options.ignoreIncomingRequests,
|
|
39437
|
+
ignoreStaticAssets: options.ignoreStaticAssets,
|
|
39438
|
+
ignoreStatusCodes: options.dropSpansForIncomingRequestStatusCodes
|
|
39439
|
+
};
|
|
39440
|
+
const httpInstrumentationOptions = {
|
|
39441
|
+
breadcrumbs: options.breadcrumbs,
|
|
39442
|
+
propagateTraceInOutgoingRequests: true,
|
|
39443
|
+
ignoreOutgoingRequests: options.ignoreOutgoingRequests
|
|
39444
|
+
};
|
|
39445
|
+
const server = httpServerIntegration(serverOptions);
|
|
39446
|
+
const serverSpans = httpServerSpansIntegration(serverSpansOptions);
|
|
39447
|
+
const spans = options.spans ?? false;
|
|
39448
|
+
const disableIncomingRequestSpans = options.disableIncomingRequestSpans ?? false;
|
|
39449
|
+
const enabledServerSpans = spans && !disableIncomingRequestSpans;
|
|
39142
39450
|
return {
|
|
39143
|
-
name:
|
|
39451
|
+
name: INTEGRATION_NAME8,
|
|
39452
|
+
setup(client) {
|
|
39453
|
+
if (enabledServerSpans) {
|
|
39454
|
+
serverSpans.setup(client);
|
|
39455
|
+
}
|
|
39456
|
+
},
|
|
39144
39457
|
setupOnce() {
|
|
39145
|
-
|
|
39146
|
-
|
|
39147
|
-
ignoreSpansForIncomingRequests: options.ignoreIncomingRequests,
|
|
39148
|
-
disableIncomingRequestSpans: true,
|
|
39149
|
-
propagateTraceInOutgoingRequests: true
|
|
39150
|
-
});
|
|
39458
|
+
server.setupOnce();
|
|
39459
|
+
instrumentSentryHttp(httpInstrumentationOptions);
|
|
39151
39460
|
},
|
|
39152
39461
|
processEvent(event) {
|
|
39153
|
-
|
|
39154
|
-
const statusCode = event.contexts?.trace?.data?.["http.response.status_code"];
|
|
39155
|
-
if (typeof statusCode === "number") {
|
|
39156
|
-
const shouldDrop = shouldFilterStatusCode(statusCode, dropSpansForIncomingRequestStatusCodes);
|
|
39157
|
-
if (shouldDrop) {
|
|
39158
|
-
DEBUG_BUILD2 && debug.log("Dropping transaction due to status code", statusCode);
|
|
39159
|
-
return null;
|
|
39160
|
-
}
|
|
39161
|
-
}
|
|
39162
|
-
}
|
|
39163
|
-
return event;
|
|
39462
|
+
return serverSpans.processEvent(event);
|
|
39164
39463
|
}
|
|
39165
39464
|
};
|
|
39166
39465
|
});
|
|
39167
|
-
function shouldFilterStatusCode(statusCode, dropForStatusCodes) {
|
|
39168
|
-
return dropForStatusCodes.some((code) => {
|
|
39169
|
-
if (typeof code === "number") {
|
|
39170
|
-
return code === statusCode;
|
|
39171
|
-
}
|
|
39172
|
-
const [min, max] = code;
|
|
39173
|
-
return statusCode >= min && statusCode <= max;
|
|
39174
|
-
});
|
|
39175
|
-
}
|
|
39176
39466
|
// ../../node_modules/@sentry/node-core/build/esm/integrations/node-fetch/SentryNodeFetchInstrumentation.js
|
|
39177
|
-
var
|
|
39178
|
-
var
|
|
39467
|
+
var import_api6 = __toESM(require_src(), 1);
|
|
39468
|
+
var import_core45 = __toESM(require_src3(), 1);
|
|
39179
39469
|
var import_instrumentation3 = __toESM(require_src6(), 1);
|
|
39180
39470
|
import * as diagch from "diagnostics_channel";
|
|
39181
39471
|
|
|
@@ -39295,7 +39585,7 @@ class SentryNodeFetchInstrumentation extends import_instrumentation3.Instrumenta
|
|
|
39295
39585
|
});
|
|
39296
39586
|
}
|
|
39297
39587
|
_shouldIgnoreOutgoingRequest(request) {
|
|
39298
|
-
if (
|
|
39588
|
+
if (import_core45.isTracingSuppressed(import_api6.context.active())) {
|
|
39299
39589
|
return true;
|
|
39300
39590
|
}
|
|
39301
39591
|
const url = getAbsoluteUrl2(request.origin, request.path);
|
|
@@ -39360,8 +39650,8 @@ function getAbsoluteUrl2(origin, path7 = "/") {
|
|
|
39360
39650
|
}
|
|
39361
39651
|
|
|
39362
39652
|
// ../../node_modules/@sentry/node-core/build/esm/integrations/node-fetch/index.js
|
|
39363
|
-
var
|
|
39364
|
-
var instrumentSentryNodeFetch = generateInstrumentOnce(`${
|
|
39653
|
+
var INTEGRATION_NAME9 = "NodeFetch";
|
|
39654
|
+
var instrumentSentryNodeFetch = generateInstrumentOnce(`${INTEGRATION_NAME9}.sentry`, SentryNodeFetchInstrumentation, (options) => {
|
|
39365
39655
|
return options;
|
|
39366
39656
|
});
|
|
39367
39657
|
var _nativeNodeFetchIntegration = (options = {}) => {
|
|
@@ -39381,7 +39671,7 @@ import { join as join2 } from "node:path";
|
|
|
39381
39671
|
import { promisify } from "node:util";
|
|
39382
39672
|
var readFileAsync = promisify(readFile);
|
|
39383
39673
|
var readDirAsync = promisify(readdir);
|
|
39384
|
-
var
|
|
39674
|
+
var INTEGRATION_NAME10 = "Context";
|
|
39385
39675
|
var _nodeContextIntegration = (options = {}) => {
|
|
39386
39676
|
let cachedContext;
|
|
39387
39677
|
const _options = {
|
|
@@ -39430,7 +39720,7 @@ var _nodeContextIntegration = (options = {}) => {
|
|
|
39430
39720
|
return contexts;
|
|
39431
39721
|
}
|
|
39432
39722
|
return {
|
|
39433
|
-
name:
|
|
39723
|
+
name: INTEGRATION_NAME10,
|
|
39434
39724
|
processEvent(event) {
|
|
39435
39725
|
return addContext(event);
|
|
39436
39726
|
}
|
|
@@ -39664,7 +39954,7 @@ import { createInterface } from "node:readline";
|
|
|
39664
39954
|
var LRU_FILE_CONTENTS_CACHE = new LRUMap(10);
|
|
39665
39955
|
var LRU_FILE_CONTENTS_FS_READ_FAILED = new LRUMap(20);
|
|
39666
39956
|
var DEFAULT_LINES_OF_CONTEXT = 7;
|
|
39667
|
-
var
|
|
39957
|
+
var INTEGRATION_NAME11 = "ContextLines";
|
|
39668
39958
|
var MAX_CONTEXTLINES_COLNO = 1000;
|
|
39669
39959
|
var MAX_CONTEXTLINES_LINENO = 1e4;
|
|
39670
39960
|
function emplace(map, key, contents) {
|
|
@@ -39901,7 +40191,7 @@ function makeContextRange(line, linecontext) {
|
|
|
39901
40191
|
var _contextLinesIntegration = (options = {}) => {
|
|
39902
40192
|
const contextLines = options.frameContextLines !== undefined ? options.frameContextLines : DEFAULT_LINES_OF_CONTEXT;
|
|
39903
40193
|
return {
|
|
39904
|
-
name:
|
|
40194
|
+
name: INTEGRATION_NAME11,
|
|
39905
40195
|
processEvent(event) {
|
|
39906
40196
|
return addSourceContext(event, contextLines);
|
|
39907
40197
|
}
|
|
@@ -39962,7 +40252,7 @@ function functionNamesMatch(a, b) {
|
|
|
39962
40252
|
}
|
|
39963
40253
|
|
|
39964
40254
|
// ../../node_modules/@sentry/node-core/build/esm/integrations/local-variables/local-variables-async.js
|
|
39965
|
-
var base64WorkerScript = "
|
|
40255
|
+
var base64WorkerScript = "LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjE4LjAgKDcxNmVjMzEpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJMRVNfXyI7Y29uc3QgYT10O2Z1bmN0aW9uIHMoLi4uZSl7YS5kZWJ1ZyYmZnVuY3Rpb24oZSl7aWYoISgiY29uc29sZSJpbiBuKSlyZXR1cm4gZSgpO2NvbnN0IHQ9bi5jb25zb2xlLG89e30sYT1PYmplY3Qua2V5cyhpKTthLmZvckVhY2goZT0+e2NvbnN0IG49aVtlXTtvW2VdPXRbZV0sdFtlXT1ufSk7dHJ5e3JldHVybiBlKCl9ZmluYWxseXthLmZvckVhY2goZT0+e3RbZV09b1tlXX0pfX0oKCk9PmNvbnNvbGUubG9nKCJbTG9jYWxWYXJpYWJsZXMgV29ya2VyXSIsLi4uZSkpfWFzeW5jIGZ1bmN0aW9uIGMoZSx0LG4saSl7Y29uc3Qgbz1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pO2lbbl09by5yZXN1bHQuZmlsdGVyKGU9PiJsZW5ndGgiIT09ZS5uYW1lJiYhaXNOYU4ocGFyc2VJbnQoZS5uYW1lLDEwKSkpLnNvcnQoKGUsdCk9PnBhcnNlSW50KGUubmFtZSwxMCktcGFyc2VJbnQodC5uYW1lLDEwKSkubWFwKGU9PmUudmFsdWU/LnZhbHVlKX1hc3luYyBmdW5jdGlvbiByKGUsdCxuLGkpe2NvbnN0IG89YXdhaXQgZS5wb3N0KCJSdW50aW1lLmdldFByb3BlcnRpZXMiLHtvYmplY3RJZDp0LG93blByb3BlcnRpZXM6ITB9KTtpW25dPW8ucmVzdWx0Lm1hcChlPT5bZS5uYW1lLGUudmFsdWU/LnZhbHVlXSkucmVkdWNlKChlLFt0LG5dKT0+KGVbdF09bixlKSx7fSl9ZnVuY3Rpb24gdShlLHQpe2UudmFsdWUmJigidmFsdWUiaW4gZS52YWx1ZT92b2lkIDA9PT1lLnZhbHVlLnZhbHVlfHxudWxsPT09ZS52YWx1ZS52YWx1ZT90W2UubmFtZV09YDwke2UudmFsdWUudmFsdWV9PmA6dFtlLm5hbWVdPWUudmFsdWUudmFsdWU6ImRlc2NyaXB0aW9uImluIGUudmFsdWUmJiJmdW5jdGlvbiIhPT1lLnZhbHVlLnR5cGU/dFtlLm5hbWVdPWA8JHtlLnZhbHVlLmRlc2NyaXB0aW9ufT5gOiJ1bmRlZmluZWQiPT09ZS52YWx1ZS50eXBlJiYodFtlLm5hbWVdPSI8dW5kZWZpbmVkPiIpKX1hc3luYyBmdW5jdGlvbiBsKGUsdCl7Y29uc3Qgbj1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pLGk9e307Zm9yKGNvbnN0IHQgb2Ygbi5yZXN1bHQpaWYodC52YWx1ZT8ub2JqZWN0SWQmJiJBcnJheSI9PT10LnZhbHVlLmNsYXNzTmFtZSl7Y29uc3Qgbj10LnZhbHVlLm9iamVjdElkO2F3YWl0IGMoZSxuLHQubmFtZSxpKX1lbHNlIGlmKHQudmFsdWU/Lm9iamVjdElkJiYiT2JqZWN0Ij09PXQudmFsdWUuY2xhc3NOYW1lKXtjb25zdCBuPXQudmFsdWUub2JqZWN0SWQ7YXdhaXQgcihlLG4sdC5uYW1lLGkpfWVsc2UgdC52YWx1ZSYmdSh0LGkpO3JldHVybiBpfWxldCBmOyhhc3luYyBmdW5jdGlvbigpe2NvbnN0IHQ9bmV3IGU7dC5jb25uZWN0VG9NYWluVGhyZWFkKCkscygiQ29ubmVjdGVkIHRvIG1haW4gdGhyZWFkIik7bGV0IG49ITE7dC5vbigiRGVidWdnZXIucmVzdW1lZCIsKCk9PntuPSExfSksdC5vbigiRGVidWdnZXIucGF1c2VkIixlPT57bj0hMCxhc3luYyBmdW5jdGlvbihlLHtyZWFzb246dCxkYXRhOntvYmplY3RJZDpufSxjYWxsRnJhbWVzOml9KXtpZigiZXhjZXB0aW9uIiE9PXQmJiJwcm9taXNlUmVqZWN0aW9uIiE9PXQpcmV0dXJuO2lmKGY/LigpLG51bGw9PW4pcmV0dXJuO2NvbnN0IGE9W107Zm9yKGxldCB0PTA7dDxpLmxlbmd0aDt0Kyspe2NvbnN0e3Njb3BlQ2hhaW46bixmdW5jdGlvbk5hbWU6byx0aGlzOnN9PWlbdF0sYz1uLmZpbmQoZT0+ImxvY2FsIj09PWUudHlwZSkscj0iZ2xvYmFsIiE9PXMuY2xhc3NOYW1lJiZzLmNsYXNzTmFtZT9gJHtzLmNsYXNzTmFtZX0uJHtvfWA6bztpZih2b2lkIDA9PT1jPy5vYmplY3Qub2JqZWN0SWQpYVt0XT17ZnVuY3Rpb246cn07ZWxzZXtjb25zdCBuPWF3YWl0IGwoZSxjLm9iamVjdC5vYmplY3RJZCk7YVt0XT17ZnVuY3Rpb246cix2YXJzOm59fX1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuY2FsbEZ1bmN0aW9uT24iLHtmdW5jdGlvbkRlY2xhcmF0aW9uOmBmdW5jdGlvbigpIHsgdGhpcy4ke299ID0gdGhpcy4ke299IHx8ICR7SlNPTi5zdHJpbmdpZnkoYSl9OyB9YCxzaWxlbnQ6ITAsb2JqZWN0SWQ6bn0pLGF3YWl0IGUucG9zdCgiUnVudGltZS5yZWxlYXNlT2JqZWN0Iix7b2JqZWN0SWQ6bn0pfSh0LGUucGFyYW1zKS50aGVuKGFzeW5jKCk9PntuJiZhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnJlc3VtZSIpfSxhc3luYyBlPT57biYmYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5yZXN1bWUiKX0pfSksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5lbmFibGUiKTtjb25zdCBpPSExIT09YS5jYXB0dXJlQWxsRXhjZXB0aW9ucztpZihhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6aT8iYWxsIjoidW5jYXVnaHQifSksaSl7Y29uc3QgZT1hLm1heEV4Y2VwdGlvbnNQZXJTZWNvbmR8fDUwO2Y9ZnVuY3Rpb24oZSx0LG4pe2xldCBpPTAsbz01LGE9MDtyZXR1cm4gc2V0SW50ZXJ2YWwoKCk9PnswPT09YT9pPmUmJihvKj0yLG4obyksbz44NjQwMCYmKG89ODY0MDApLGE9byk6KGEtPTEsMD09PWEmJnQoKSksaT0wfSwxZTMpLnVucmVmKCksKCk9PntpKz0xfX0oZSxhc3luYygpPT57cygiUmF0ZS1saW1pdCBsaWZ0ZWQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=";
|
|
39966
40256
|
function log2(...args) {
|
|
39967
40257
|
debug.log("[LocalVariables]", ...args);
|
|
39968
40258
|
}
|
|
@@ -40169,7 +40459,7 @@ class AsyncSession {
|
|
|
40169
40459
|
next(vars);
|
|
40170
40460
|
}
|
|
40171
40461
|
}
|
|
40172
|
-
var
|
|
40462
|
+
var INTEGRATION_NAME12 = "LocalVariables";
|
|
40173
40463
|
var _localVariablesSyncIntegration = (options = {}, sessionOverride) => {
|
|
40174
40464
|
const cachedFrames = new LRUMap(20);
|
|
40175
40465
|
let rateLimiter;
|
|
@@ -40204,7 +40494,7 @@ var _localVariablesSyncIntegration = (options = {}, sessionOverride) => {
|
|
|
40204
40494
|
return event;
|
|
40205
40495
|
}
|
|
40206
40496
|
return {
|
|
40207
|
-
name:
|
|
40497
|
+
name: INTEGRATION_NAME12,
|
|
40208
40498
|
async setupOnce() {
|
|
40209
40499
|
const client = getClient();
|
|
40210
40500
|
const clientOptions = client?.getOptions();
|
|
@@ -40324,11 +40614,11 @@ function supportsEsmLoaderHooks() {
|
|
|
40324
40614
|
|
|
40325
40615
|
// ../../node_modules/@sentry/node-core/build/esm/integrations/modules.js
|
|
40326
40616
|
var moduleCache;
|
|
40327
|
-
var
|
|
40617
|
+
var INTEGRATION_NAME13 = "Modules";
|
|
40328
40618
|
var SERVER_MODULES = typeof __SENTRY_SERVER_MODULES__ === "undefined" ? {} : __SENTRY_SERVER_MODULES__;
|
|
40329
40619
|
var _modulesIntegration = () => {
|
|
40330
40620
|
return {
|
|
40331
|
-
name:
|
|
40621
|
+
name: INTEGRATION_NAME13,
|
|
40332
40622
|
processEvent(event) {
|
|
40333
40623
|
event.modules = {
|
|
40334
40624
|
...event.modules,
|
|
@@ -40432,14 +40722,14 @@ function logAndExitProcess(error2) {
|
|
|
40432
40722
|
}
|
|
40433
40723
|
|
|
40434
40724
|
// ../../node_modules/@sentry/node-core/build/esm/integrations/onuncaughtexception.js
|
|
40435
|
-
var
|
|
40725
|
+
var INTEGRATION_NAME14 = "OnUncaughtException";
|
|
40436
40726
|
var onUncaughtExceptionIntegration = defineIntegration((options = {}) => {
|
|
40437
40727
|
const optionsWithDefaults = {
|
|
40438
40728
|
exitEvenIfOtherHandlersAreRegistered: false,
|
|
40439
40729
|
...options
|
|
40440
40730
|
};
|
|
40441
40731
|
return {
|
|
40442
|
-
name:
|
|
40732
|
+
name: INTEGRATION_NAME14,
|
|
40443
40733
|
setup(client) {
|
|
40444
40734
|
global.process.on("uncaughtException", makeErrorHandler(client, optionsWithDefaults));
|
|
40445
40735
|
}
|
|
@@ -40503,25 +40793,51 @@ function makeErrorHandler(client, options) {
|
|
|
40503
40793
|
}
|
|
40504
40794
|
|
|
40505
40795
|
// ../../node_modules/@sentry/node-core/build/esm/integrations/onunhandledrejection.js
|
|
40506
|
-
var
|
|
40796
|
+
var INTEGRATION_NAME15 = "OnUnhandledRejection";
|
|
40797
|
+
var DEFAULT_IGNORES = [
|
|
40798
|
+
{
|
|
40799
|
+
name: "AI_NoOutputGeneratedError"
|
|
40800
|
+
}
|
|
40801
|
+
];
|
|
40507
40802
|
var _onUnhandledRejectionIntegration = (options = {}) => {
|
|
40508
40803
|
const opts = {
|
|
40509
|
-
mode: "warn",
|
|
40510
|
-
...options
|
|
40804
|
+
mode: options.mode ?? "warn",
|
|
40805
|
+
ignore: [...DEFAULT_IGNORES, ...options.ignore ?? []]
|
|
40511
40806
|
};
|
|
40512
40807
|
return {
|
|
40513
|
-
name:
|
|
40808
|
+
name: INTEGRATION_NAME15,
|
|
40514
40809
|
setup(client) {
|
|
40515
40810
|
global.process.on("unhandledRejection", makeUnhandledPromiseHandler(client, opts));
|
|
40516
40811
|
}
|
|
40517
40812
|
};
|
|
40518
40813
|
};
|
|
40519
40814
|
var onUnhandledRejectionIntegration = defineIntegration(_onUnhandledRejectionIntegration);
|
|
40815
|
+
function extractErrorInfo(reason) {
|
|
40816
|
+
if (typeof reason !== "object" || reason === null) {
|
|
40817
|
+
return { name: "", message: String(reason ?? "") };
|
|
40818
|
+
}
|
|
40819
|
+
const errorLike = reason;
|
|
40820
|
+
const name = typeof errorLike.name === "string" ? errorLike.name : "";
|
|
40821
|
+
const message = typeof errorLike.message === "string" ? errorLike.message : String(reason);
|
|
40822
|
+
return { name, message };
|
|
40823
|
+
}
|
|
40824
|
+
function isMatchingReason(matcher, errorInfo) {
|
|
40825
|
+
const nameMatches = matcher.name === undefined || isMatchingPattern(errorInfo.name, matcher.name, true);
|
|
40826
|
+
const messageMatches = matcher.message === undefined || isMatchingPattern(errorInfo.message, matcher.message);
|
|
40827
|
+
return nameMatches && messageMatches;
|
|
40828
|
+
}
|
|
40829
|
+
function matchesIgnore(list, reason) {
|
|
40830
|
+
const errorInfo = extractErrorInfo(reason);
|
|
40831
|
+
return list.some((matcher) => isMatchingReason(matcher, errorInfo));
|
|
40832
|
+
}
|
|
40520
40833
|
function makeUnhandledPromiseHandler(client, options) {
|
|
40521
40834
|
return function sendUnhandledPromise(reason, promise) {
|
|
40522
40835
|
if (getClient() !== client) {
|
|
40523
40836
|
return;
|
|
40524
40837
|
}
|
|
40838
|
+
if (matchesIgnore(options.ignore ?? [], reason)) {
|
|
40839
|
+
return;
|
|
40840
|
+
}
|
|
40525
40841
|
const level = options.mode === "strict" ? "fatal" : "error";
|
|
40526
40842
|
const activeSpanForError = reason && typeof reason === "object" ? reason._sentry_active_span : undefined;
|
|
40527
40843
|
const activeSpanWrapper = activeSpanForError ? (fn) => withActiveSpan(activeSpanForError, fn) : (fn) => fn();
|
|
@@ -40558,13 +40874,13 @@ function handleRejection(reason, mode) {
|
|
|
40558
40874
|
|
|
40559
40875
|
// ../../node_modules/@sentry/node-core/build/esm/integrations/spotlight.js
|
|
40560
40876
|
import * as http from "node:http";
|
|
40561
|
-
var
|
|
40877
|
+
var INTEGRATION_NAME16 = "Spotlight";
|
|
40562
40878
|
var _spotlightIntegration = (options = {}) => {
|
|
40563
40879
|
const _options = {
|
|
40564
40880
|
sidecarUrl: options.sidecarUrl || "http://localhost:8969/stream"
|
|
40565
40881
|
};
|
|
40566
40882
|
return {
|
|
40567
|
-
name:
|
|
40883
|
+
name: INTEGRATION_NAME16,
|
|
40568
40884
|
setup(client) {
|
|
40569
40885
|
try {
|
|
40570
40886
|
if (false) {}
|
|
@@ -40623,7 +40939,7 @@ function parseSidecarUrl(url) {
|
|
|
40623
40939
|
|
|
40624
40940
|
// ../../node_modules/@sentry/node-core/build/esm/integrations/systemError.js
|
|
40625
40941
|
import * as util from "node:util";
|
|
40626
|
-
var
|
|
40942
|
+
var INTEGRATION_NAME17 = "NodeSystemError";
|
|
40627
40943
|
function isSystemError(error2) {
|
|
40628
40944
|
if (!(error2 instanceof Error)) {
|
|
40629
40945
|
return false;
|
|
@@ -40635,7 +40951,7 @@ function isSystemError(error2) {
|
|
|
40635
40951
|
}
|
|
40636
40952
|
var systemErrorIntegration = defineIntegration((options = {}) => {
|
|
40637
40953
|
return {
|
|
40638
|
-
name:
|
|
40954
|
+
name: INTEGRATION_NAME17,
|
|
40639
40955
|
processEvent: (event, hint, client) => {
|
|
40640
40956
|
if (!isSystemError(hint.originalException)) {
|
|
40641
40957
|
return event;
|
|
@@ -40669,10 +40985,10 @@ var systemErrorIntegration = defineIntegration((options = {}) => {
|
|
|
40669
40985
|
|
|
40670
40986
|
// ../../node_modules/@sentry/node-core/build/esm/integrations/childProcess.js
|
|
40671
40987
|
import * as diagnosticsChannel from "node:diagnostics_channel";
|
|
40672
|
-
var
|
|
40988
|
+
var INTEGRATION_NAME18 = "ChildProcess";
|
|
40673
40989
|
var childProcessIntegration = defineIntegration((options = {}) => {
|
|
40674
40990
|
return {
|
|
40675
|
-
name:
|
|
40991
|
+
name: INTEGRATION_NAME18,
|
|
40676
40992
|
setup() {
|
|
40677
40993
|
diagnosticsChannel.channel("child_process").subscribe((event) => {
|
|
40678
40994
|
if (event && typeof event === "object" && "process" in event) {
|
|
@@ -40747,22 +41063,22 @@ function captureWorkerThreadEvents(worker, options) {
|
|
|
40747
41063
|
var import_context_async_hooks = __toESM(require_src10(), 1);
|
|
40748
41064
|
var SentryContextManager = wrapContextManagerClass(import_context_async_hooks.AsyncLocalStorageContextManager);
|
|
40749
41065
|
// ../../node_modules/@sentry/node-core/build/esm/otel/logger.js
|
|
40750
|
-
var
|
|
41066
|
+
var import_api7 = __toESM(require_src(), 1);
|
|
40751
41067
|
function setupOpenTelemetryLogger() {
|
|
40752
|
-
|
|
40753
|
-
|
|
41068
|
+
import_api7.diag.disable();
|
|
41069
|
+
import_api7.diag.setLogger({
|
|
40754
41070
|
error: debug.error,
|
|
40755
41071
|
warn: debug.warn,
|
|
40756
41072
|
info: debug.log,
|
|
40757
41073
|
debug: debug.log,
|
|
40758
41074
|
verbose: debug.log
|
|
40759
|
-
},
|
|
41075
|
+
}, import_api7.DiagLogLevel.DEBUG);
|
|
40760
41076
|
}
|
|
40761
41077
|
// ../../node_modules/@sentry/node-core/build/esm/integrations/processSession.js
|
|
40762
|
-
var
|
|
41078
|
+
var INTEGRATION_NAME19 = "ProcessSession";
|
|
40763
41079
|
var processSessionIntegration = defineIntegration(() => {
|
|
40764
41080
|
return {
|
|
40765
|
-
name:
|
|
41081
|
+
name: INTEGRATION_NAME19,
|
|
40766
41082
|
setupOnce() {
|
|
40767
41083
|
startSession();
|
|
40768
41084
|
process.on("beforeExit", () => {
|
|
@@ -41179,7 +41495,7 @@ function getSentryRelease(fallback) {
|
|
|
41179
41495
|
var defaultStackParser = createStackParser(nodeStackLineParser(createGetModuleFromFilename()));
|
|
41180
41496
|
|
|
41181
41497
|
// ../../node_modules/@sentry/node-core/build/esm/sdk/client.js
|
|
41182
|
-
var
|
|
41498
|
+
var import_api8 = __toESM(require_src(), 1);
|
|
41183
41499
|
var import_instrumentation4 = __toESM(require_src6(), 1);
|
|
41184
41500
|
import * as os2 from "node:os";
|
|
41185
41501
|
import { threadId, isMainThread } from "worker_threads";
|
|
@@ -41223,7 +41539,7 @@ class NodeClient extends ServerRuntimeClient {
|
|
|
41223
41539
|
}
|
|
41224
41540
|
const name = "@sentry/node";
|
|
41225
41541
|
const version = SDK_VERSION;
|
|
41226
|
-
const tracer =
|
|
41542
|
+
const tracer = import_api8.trace.getTracer(name, version);
|
|
41227
41543
|
this._tracer = tracer;
|
|
41228
41544
|
return tracer;
|
|
41229
41545
|
}
|
|
@@ -41333,7 +41649,7 @@ function _init(_options = {}, getDefaultIntegrationsImpl) {
|
|
|
41333
41649
|
setOpenTelemetryContextAsyncContextStrategy();
|
|
41334
41650
|
const scope = getCurrentScope();
|
|
41335
41651
|
scope.update(options.initialScope);
|
|
41336
|
-
if (options.spotlight && !options.integrations.some(({ name }) => name ===
|
|
41652
|
+
if (options.spotlight && !options.integrations.some(({ name }) => name === INTEGRATION_NAME16)) {
|
|
41337
41653
|
options.integrations.push(spotlightIntegration({
|
|
41338
41654
|
sidecarUrl: typeof options.spotlight === "string" ? options.spotlight : undefined
|
|
41339
41655
|
}));
|
|
@@ -41342,6 +41658,7 @@ function _init(_options = {}, getDefaultIntegrationsImpl) {
|
|
|
41342
41658
|
const client = new NodeClient(options);
|
|
41343
41659
|
getCurrentScope().setClient(client);
|
|
41344
41660
|
client.init();
|
|
41661
|
+
GLOBAL_OBJ._sentryInjectLoaderHookRegister?.();
|
|
41345
41662
|
debug.log(`SDK initialized from ${isCjs() ? "CommonJS" : "ESM"}`);
|
|
41346
41663
|
client.startClientReportTracking();
|
|
41347
41664
|
updateScopeFromEnvVariables();
|
|
@@ -41426,22 +41743,19 @@ function updateScopeFromEnvVariables() {
|
|
|
41426
41743
|
function addOriginToSpan2(span, origin) {
|
|
41427
41744
|
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, origin);
|
|
41428
41745
|
}
|
|
41429
|
-
// ../../node_modules/@sentry/node/build/esm/debug-build.js
|
|
41430
|
-
var DEBUG_BUILD4 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__;
|
|
41431
|
-
|
|
41432
41746
|
// ../../node_modules/@sentry/node/build/esm/integrations/http.js
|
|
41433
|
-
var
|
|
41747
|
+
var INTEGRATION_NAME20 = "Http";
|
|
41434
41748
|
var INSTRUMENTATION_NAME2 = "@opentelemetry_sentry-patched/instrumentation-http";
|
|
41435
|
-
var instrumentSentryHttp2 = generateInstrumentOnce(`${
|
|
41749
|
+
var instrumentSentryHttp2 = generateInstrumentOnce(`${INTEGRATION_NAME20}.sentry`, (options) => {
|
|
41436
41750
|
return new SentryHttpInstrumentation(options);
|
|
41437
41751
|
});
|
|
41438
|
-
var instrumentOtelHttp = generateInstrumentOnce(
|
|
41752
|
+
var instrumentOtelHttp = generateInstrumentOnce(INTEGRATION_NAME20, (config) => {
|
|
41439
41753
|
const instrumentation = new import_instrumentation_http.HttpInstrumentation({
|
|
41440
41754
|
...config,
|
|
41441
41755
|
disableIncomingRequestInstrumentation: true
|
|
41442
41756
|
});
|
|
41443
41757
|
try {
|
|
41444
|
-
instrumentation["_diag"] =
|
|
41758
|
+
instrumentation["_diag"] = import_api10.diag.createComponentLogger({
|
|
41445
41759
|
namespace: INSTRUMENTATION_NAME2
|
|
41446
41760
|
});
|
|
41447
41761
|
instrumentation.instrumentationName = INSTRUMENTATION_NAME2;
|
|
@@ -41461,40 +41775,49 @@ function _shouldUseOtelHttpInstrumentation(options, clientOptions = {}) {
|
|
|
41461
41775
|
return true;
|
|
41462
41776
|
}
|
|
41463
41777
|
var httpIntegration2 = defineIntegration((options = {}) => {
|
|
41464
|
-
const
|
|
41465
|
-
|
|
41466
|
-
|
|
41467
|
-
|
|
41468
|
-
|
|
41778
|
+
const spans = options.spans ?? true;
|
|
41779
|
+
const disableIncomingRequestSpans = options.disableIncomingRequestSpans;
|
|
41780
|
+
const serverOptions = {
|
|
41781
|
+
sessions: options.trackIncomingRequestsAsSessions,
|
|
41782
|
+
sessionFlushingDelayMS: options.sessionFlushingDelayMS,
|
|
41783
|
+
ignoreRequestBody: options.ignoreIncomingRequestBody,
|
|
41784
|
+
maxRequestBodySize: options.maxIncomingRequestBodySize
|
|
41785
|
+
};
|
|
41786
|
+
const serverSpansOptions = {
|
|
41787
|
+
ignoreIncomingRequests: options.ignoreIncomingRequests,
|
|
41788
|
+
ignoreStaticAssets: options.ignoreStaticAssets,
|
|
41789
|
+
ignoreStatusCodes: options.dropSpansForIncomingRequestStatusCodes,
|
|
41790
|
+
instrumentation: options.instrumentation,
|
|
41791
|
+
onSpanCreated: options.incomingRequestSpanHook
|
|
41792
|
+
};
|
|
41793
|
+
const server = httpServerIntegration(serverOptions);
|
|
41794
|
+
const serverSpans = httpServerSpansIntegration(serverSpansOptions);
|
|
41795
|
+
const enableServerSpans = spans && !disableIncomingRequestSpans;
|
|
41469
41796
|
return {
|
|
41470
|
-
name:
|
|
41797
|
+
name: INTEGRATION_NAME20,
|
|
41798
|
+
setup(client) {
|
|
41799
|
+
const clientOptions = client.getOptions();
|
|
41800
|
+
if (enableServerSpans && hasSpansEnabled(clientOptions)) {
|
|
41801
|
+
serverSpans.setup(client);
|
|
41802
|
+
}
|
|
41803
|
+
},
|
|
41471
41804
|
setupOnce() {
|
|
41472
41805
|
const clientOptions = getClient()?.getOptions() || {};
|
|
41473
41806
|
const useOtelHttpInstrumentation = _shouldUseOtelHttpInstrumentation(options, clientOptions);
|
|
41474
|
-
|
|
41475
|
-
|
|
41476
|
-
|
|
41477
|
-
|
|
41478
|
-
|
|
41479
|
-
|
|
41480
|
-
|
|
41807
|
+
server.setupOnce();
|
|
41808
|
+
const sentryHttpInstrumentationOptions = {
|
|
41809
|
+
breadcrumbs: options.breadcrumbs,
|
|
41810
|
+
propagateTraceInOutgoingRequests: !useOtelHttpInstrumentation,
|
|
41811
|
+
ignoreOutgoingRequests: options.ignoreOutgoingRequests
|
|
41812
|
+
};
|
|
41813
|
+
instrumentSentryHttp2(sentryHttpInstrumentationOptions);
|
|
41481
41814
|
if (useOtelHttpInstrumentation) {
|
|
41482
41815
|
const instrumentationConfig = getConfigWithDefaults(options);
|
|
41483
41816
|
instrumentOtelHttp(instrumentationConfig);
|
|
41484
41817
|
}
|
|
41485
41818
|
},
|
|
41486
41819
|
processEvent(event) {
|
|
41487
|
-
|
|
41488
|
-
const statusCode = event.contexts?.trace?.data?.["http.response.status_code"];
|
|
41489
|
-
if (typeof statusCode === "number") {
|
|
41490
|
-
const shouldDrop = shouldFilterStatusCode2(statusCode, dropSpansForIncomingRequestStatusCodes);
|
|
41491
|
-
if (shouldDrop) {
|
|
41492
|
-
DEBUG_BUILD4 && debug.log("Dropping transaction due to status code", statusCode);
|
|
41493
|
-
return null;
|
|
41494
|
-
}
|
|
41495
|
-
}
|
|
41496
|
-
}
|
|
41497
|
-
return event;
|
|
41820
|
+
return serverSpans.processEvent(event);
|
|
41498
41821
|
}
|
|
41499
41822
|
};
|
|
41500
41823
|
});
|
|
@@ -41525,23 +41848,14 @@ function getConfigWithDefaults(options = {}) {
|
|
|
41525
41848
|
};
|
|
41526
41849
|
return instrumentationConfig;
|
|
41527
41850
|
}
|
|
41528
|
-
function shouldFilterStatusCode2(statusCode, dropForStatusCodes) {
|
|
41529
|
-
return dropForStatusCodes.some((code) => {
|
|
41530
|
-
if (typeof code === "number") {
|
|
41531
|
-
return code === statusCode;
|
|
41532
|
-
}
|
|
41533
|
-
const [min, max] = code;
|
|
41534
|
-
return statusCode >= min && statusCode <= max;
|
|
41535
|
-
});
|
|
41536
|
-
}
|
|
41537
41851
|
|
|
41538
41852
|
// ../../node_modules/@sentry/node/build/esm/integrations/node-fetch.js
|
|
41539
41853
|
var import_instrumentation_undici = __toESM(require_src11(), 1);
|
|
41540
|
-
var
|
|
41541
|
-
var instrumentOtelNodeFetch = generateInstrumentOnce(
|
|
41854
|
+
var INTEGRATION_NAME21 = "NodeFetch";
|
|
41855
|
+
var instrumentOtelNodeFetch = generateInstrumentOnce(INTEGRATION_NAME21, import_instrumentation_undici.UndiciInstrumentation, (options) => {
|
|
41542
41856
|
return getConfigWithDefaults2(options);
|
|
41543
41857
|
});
|
|
41544
|
-
var instrumentSentryNodeFetch2 = generateInstrumentOnce(`${
|
|
41858
|
+
var instrumentSentryNodeFetch2 = generateInstrumentOnce(`${INTEGRATION_NAME21}.sentry`, SentryNodeFetchInstrumentation, (options) => {
|
|
41545
41859
|
return options;
|
|
41546
41860
|
});
|
|
41547
41861
|
var _nativeNodeFetchIntegration2 = (options = {}) => {
|
|
@@ -41590,7 +41904,12 @@ function getConfigWithDefaults2(options = {}) {
|
|
|
41590
41904
|
|
|
41591
41905
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/express.js
|
|
41592
41906
|
var import_instrumentation_express = __toESM(require_src12(), 1);
|
|
41593
|
-
|
|
41907
|
+
|
|
41908
|
+
// ../../node_modules/@sentry/node/build/esm/debug-build.js
|
|
41909
|
+
var DEBUG_BUILD4 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__;
|
|
41910
|
+
|
|
41911
|
+
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/express.js
|
|
41912
|
+
var INTEGRATION_NAME22 = "Express";
|
|
41594
41913
|
function requestHook(span) {
|
|
41595
41914
|
addOriginToSpan2(span, "auto.http.otel.express");
|
|
41596
41915
|
const attributes = spanToJSON(span).data;
|
|
@@ -41615,13 +41934,13 @@ function spanNameHook(info, defaultName) {
|
|
|
41615
41934
|
}
|
|
41616
41935
|
return defaultName;
|
|
41617
41936
|
}
|
|
41618
|
-
var instrumentExpress = generateInstrumentOnce(
|
|
41937
|
+
var instrumentExpress = generateInstrumentOnce(INTEGRATION_NAME22, () => new import_instrumentation_express.ExpressInstrumentation({
|
|
41619
41938
|
requestHook: (span) => requestHook(span),
|
|
41620
41939
|
spanNameHook: (info, defaultName) => spanNameHook(info, defaultName)
|
|
41621
41940
|
}));
|
|
41622
41941
|
var _expressIntegration = () => {
|
|
41623
41942
|
return {
|
|
41624
|
-
name:
|
|
41943
|
+
name: INTEGRATION_NAME22,
|
|
41625
41944
|
setupOnce() {
|
|
41626
41945
|
instrumentExpress();
|
|
41627
41946
|
}
|
|
@@ -41633,8 +41952,8 @@ var expressIntegration = defineIntegration(_expressIntegration);
|
|
|
41633
41952
|
import * as dc from "node:diagnostics_channel";
|
|
41634
41953
|
|
|
41635
41954
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/fastify/fastify-otel/index.js
|
|
41636
|
-
var
|
|
41637
|
-
var
|
|
41955
|
+
var import_api11 = __toESM(require_src(), 1);
|
|
41956
|
+
var import_core73 = __toESM(require_src3(), 1);
|
|
41638
41957
|
var import_instrumentation5 = __toESM(require_src6(), 1);
|
|
41639
41958
|
var import_semantic_conventions3 = __toESM(require_src2(), 1);
|
|
41640
41959
|
import dc__default from "node:diagnostics_channel";
|
|
@@ -42890,7 +43209,7 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
|
|
|
42890
43209
|
super(PACKAGE_NAME, PACKAGE_VERSION, config);
|
|
42891
43210
|
this.servername = config?.servername ?? process.env.OTEL_SERVICE_NAME ?? "fastify";
|
|
42892
43211
|
this[kIgnorePaths] = null;
|
|
42893
|
-
this._logger =
|
|
43212
|
+
this._logger = import_api11.diag.createComponentLogger({ namespace: PACKAGE_NAME });
|
|
42894
43213
|
if (config?.ignorePaths != null || process.env.OTEL_FASTIFY_IGNORE_PATHS != null) {
|
|
42895
43214
|
const ignorePaths = config?.ignorePaths ?? process.env.OTEL_FASTIFY_IGNORE_PATHS;
|
|
42896
43215
|
if ((typeof ignorePaths !== "string" || ignorePaths.length === 0) && typeof ignorePaths !== "function") {
|
|
@@ -42947,10 +43266,10 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
|
|
|
42947
43266
|
tracer: instrumentation.tracer,
|
|
42948
43267
|
context: ctx,
|
|
42949
43268
|
inject: (carrier, setter) => {
|
|
42950
|
-
return
|
|
43269
|
+
return import_api11.propagation.inject(ctx, carrier, setter);
|
|
42951
43270
|
},
|
|
42952
43271
|
extract: (carrier, getter) => {
|
|
42953
|
-
return
|
|
43272
|
+
return import_api11.propagation.extract(ctx, carrier, getter);
|
|
42954
43273
|
}
|
|
42955
43274
|
};
|
|
42956
43275
|
});
|
|
@@ -43015,12 +43334,12 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
|
|
|
43015
43334
|
this[kInstrumentation]._logger.debug(`Ignoring request ${request2.method} ${request2.url} because it matches the ignore path`);
|
|
43016
43335
|
return hookDone();
|
|
43017
43336
|
}
|
|
43018
|
-
let ctx =
|
|
43019
|
-
if (
|
|
43020
|
-
ctx =
|
|
43337
|
+
let ctx = import_api11.context.active();
|
|
43338
|
+
if (import_api11.trace.getSpan(ctx) == null) {
|
|
43339
|
+
ctx = import_api11.propagation.extract(ctx, request2.headers);
|
|
43021
43340
|
}
|
|
43022
|
-
const rpcMetadata =
|
|
43023
|
-
if (request2.routeOptions.url != null && rpcMetadata?.type ===
|
|
43341
|
+
const rpcMetadata = import_core73.getRPCMetadata(ctx);
|
|
43342
|
+
if (request2.routeOptions.url != null && rpcMetadata?.type === import_core73.RPCType.HTTP) {
|
|
43024
43343
|
rpcMetadata.route = request2.routeOptions.url;
|
|
43025
43344
|
}
|
|
43026
43345
|
const span = this[kInstrumentation].tracer.startSpan("request", {
|
|
@@ -43031,9 +43350,9 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
|
|
|
43031
43350
|
[import_semantic_conventions3.ATTR_HTTP_REQUEST_METHOD]: request2.method
|
|
43032
43351
|
}
|
|
43033
43352
|
}, ctx);
|
|
43034
|
-
request2[kRequestContext] =
|
|
43353
|
+
request2[kRequestContext] = import_api11.trace.setSpan(ctx, span);
|
|
43035
43354
|
request2[kRequestSpan] = span;
|
|
43036
|
-
|
|
43355
|
+
import_api11.context.with(request2[kRequestContext], () => {
|
|
43037
43356
|
hookDone();
|
|
43038
43357
|
});
|
|
43039
43358
|
});
|
|
@@ -43041,7 +43360,7 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
|
|
|
43041
43360
|
const span = request2[kRequestSpan];
|
|
43042
43361
|
if (span != null) {
|
|
43043
43362
|
span.setStatus({
|
|
43044
|
-
code:
|
|
43363
|
+
code: import_api11.SpanStatusCode.OK,
|
|
43045
43364
|
message: "OK"
|
|
43046
43365
|
});
|
|
43047
43366
|
span.setAttributes({
|
|
@@ -43060,7 +43379,7 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
|
|
|
43060
43379
|
if (span != null) {
|
|
43061
43380
|
if (reply.statusCode < 500) {
|
|
43062
43381
|
span.setStatus({
|
|
43063
|
-
code:
|
|
43382
|
+
code: import_api11.SpanStatusCode.OK,
|
|
43064
43383
|
message: "OK"
|
|
43065
43384
|
});
|
|
43066
43385
|
}
|
|
@@ -43076,7 +43395,7 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
|
|
|
43076
43395
|
const span = request2[kRequestSpan];
|
|
43077
43396
|
if (span != null) {
|
|
43078
43397
|
span.setStatus({
|
|
43079
|
-
code:
|
|
43398
|
+
code: import_api11.SpanStatusCode.ERROR,
|
|
43080
43399
|
message: error2.message
|
|
43081
43400
|
});
|
|
43082
43401
|
span.recordException(error2);
|
|
@@ -43139,11 +43458,11 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
|
|
|
43139
43458
|
if (instrumentation2.isEnabled() === false) {
|
|
43140
43459
|
return handler.call(this, ...args);
|
|
43141
43460
|
}
|
|
43142
|
-
const ctx = request2[kRequestContext] ??
|
|
43461
|
+
const ctx = request2[kRequestContext] ?? import_api11.context.active();
|
|
43143
43462
|
const span = instrumentation2.tracer.startSpan(`handler - ${handler.name?.length > 0 ? handler.name : this.pluginName ?? ANONYMOUS_FUNCTION_NAME}`, {
|
|
43144
43463
|
attributes: spanAttributes
|
|
43145
43464
|
}, ctx);
|
|
43146
|
-
return
|
|
43465
|
+
return import_api11.context.with(import_api11.trace.setSpan(ctx, span), function() {
|
|
43147
43466
|
try {
|
|
43148
43467
|
const res = handler.call(this, ...args);
|
|
43149
43468
|
if (typeof res?.then === "function") {
|
|
@@ -43152,7 +43471,7 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
|
|
|
43152
43471
|
return result;
|
|
43153
43472
|
}, (error2) => {
|
|
43154
43473
|
span.setStatus({
|
|
43155
|
-
code:
|
|
43474
|
+
code: import_api11.SpanStatusCode.ERROR,
|
|
43156
43475
|
message: error2.message
|
|
43157
43476
|
});
|
|
43158
43477
|
span.recordException(error2);
|
|
@@ -43164,7 +43483,7 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
|
|
|
43164
43483
|
return res;
|
|
43165
43484
|
} catch (error2) {
|
|
43166
43485
|
span.setStatus({
|
|
43167
|
-
code:
|
|
43486
|
+
code: import_api11.SpanStatusCode.ERROR,
|
|
43168
43487
|
message: error2.message
|
|
43169
43488
|
});
|
|
43170
43489
|
span.recordException(error2);
|
|
@@ -43179,8 +43498,8 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
|
|
|
43179
43498
|
}
|
|
43180
43499
|
|
|
43181
43500
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/fastify/v3/instrumentation.js
|
|
43182
|
-
var
|
|
43183
|
-
var
|
|
43501
|
+
var import_api13 = __toESM(require_src(), 1);
|
|
43502
|
+
var import_core74 = __toESM(require_src3(), 1);
|
|
43184
43503
|
var import_instrumentation6 = __toESM(require_src6(), 1);
|
|
43185
43504
|
var import_semantic_conventions4 = __toESM(require_src2(), 1);
|
|
43186
43505
|
|
|
@@ -43212,7 +43531,7 @@ var FastifyNames;
|
|
|
43212
43531
|
})(FastifyNames || (FastifyNames = {}));
|
|
43213
43532
|
|
|
43214
43533
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/fastify/v3/utils.js
|
|
43215
|
-
var
|
|
43534
|
+
var import_api12 = __toESM(require_src(), 1);
|
|
43216
43535
|
|
|
43217
43536
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/fastify/v3/constants.js
|
|
43218
43537
|
var spanRequestSymbol = Symbol("opentelemetry.instrumentation.fastify.request_active_span");
|
|
@@ -43237,7 +43556,7 @@ function endSpan(reply, err) {
|
|
|
43237
43556
|
spans.forEach((span) => {
|
|
43238
43557
|
if (err) {
|
|
43239
43558
|
span.setStatus({
|
|
43240
|
-
code:
|
|
43559
|
+
code: import_api12.SpanStatusCode.ERROR,
|
|
43241
43560
|
message: err.message
|
|
43242
43561
|
});
|
|
43243
43562
|
span.recordException(err);
|
|
@@ -43305,9 +43624,9 @@ class FastifyInstrumentationV3 extends import_instrumentation6.InstrumentationBa
|
|
|
43305
43624
|
}
|
|
43306
43625
|
instrumentation._wrap(reply, "send", instrumentation._patchSend());
|
|
43307
43626
|
const anyRequest = request2;
|
|
43308
|
-
const rpcMetadata =
|
|
43627
|
+
const rpcMetadata = import_core74.getRPCMetadata(import_api13.context.active());
|
|
43309
43628
|
const routeName = anyRequest.routeOptions ? anyRequest.routeOptions.url : request2.routerPath;
|
|
43310
|
-
if (routeName && rpcMetadata?.type ===
|
|
43629
|
+
if (routeName && rpcMetadata?.type === import_core74.RPCType.HTTP) {
|
|
43311
43630
|
rpcMetadata.route = routeName;
|
|
43312
43631
|
}
|
|
43313
43632
|
const method = request2.method || "GET";
|
|
@@ -43337,13 +43656,13 @@ class FastifyInstrumentationV3 extends import_instrumentation6.InstrumentationBa
|
|
|
43337
43656
|
origDone.apply(this, doneArgs);
|
|
43338
43657
|
};
|
|
43339
43658
|
}
|
|
43340
|
-
return
|
|
43659
|
+
return import_api13.context.with(import_api13.trace.setSpan(import_api13.context.active(), span), () => {
|
|
43341
43660
|
return safeExecuteInTheMiddleMaybePromise(() => {
|
|
43342
43661
|
return original.apply(this, args);
|
|
43343
43662
|
}, (err) => {
|
|
43344
43663
|
if (err instanceof Error) {
|
|
43345
43664
|
span.setStatus({
|
|
43346
|
-
code:
|
|
43665
|
+
code: import_api13.SpanStatusCode.ERROR,
|
|
43347
43666
|
message: err.message
|
|
43348
43667
|
});
|
|
43349
43668
|
span.recordException(err);
|
|
@@ -43440,7 +43759,7 @@ class FastifyInstrumentationV3 extends import_instrumentation6.InstrumentationBa
|
|
|
43440
43759
|
}
|
|
43441
43760
|
}, true);
|
|
43442
43761
|
}
|
|
43443
|
-
return
|
|
43762
|
+
return import_api13.context.with(import_api13.trace.setSpan(import_api13.context.active(), span), () => {
|
|
43444
43763
|
done();
|
|
43445
43764
|
});
|
|
43446
43765
|
};
|
|
@@ -43472,14 +43791,14 @@ function addFastifyV3SpanAttributes(span) {
|
|
|
43472
43791
|
}
|
|
43473
43792
|
|
|
43474
43793
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/fastify/index.js
|
|
43475
|
-
var
|
|
43476
|
-
var instrumentFastifyV3 = generateInstrumentOnce(`${
|
|
43794
|
+
var INTEGRATION_NAME23 = "Fastify";
|
|
43795
|
+
var instrumentFastifyV3 = generateInstrumentOnce(`${INTEGRATION_NAME23}.v3`, () => new FastifyInstrumentationV3);
|
|
43477
43796
|
function getFastifyIntegration() {
|
|
43478
43797
|
const client = getClient();
|
|
43479
43798
|
if (!client) {
|
|
43480
43799
|
return;
|
|
43481
43800
|
} else {
|
|
43482
|
-
return client.getIntegrationByName(
|
|
43801
|
+
return client.getIntegrationByName(INTEGRATION_NAME23);
|
|
43483
43802
|
}
|
|
43484
43803
|
}
|
|
43485
43804
|
function handleFastifyError(error2, request2, reply, handlerOrigin) {
|
|
@@ -43495,7 +43814,7 @@ function handleFastifyError(error2, request2, reply, handlerOrigin) {
|
|
|
43495
43814
|
captureException(error2, { mechanism: { handled: false, type: "auto.function.fastify" } });
|
|
43496
43815
|
}
|
|
43497
43816
|
}
|
|
43498
|
-
var instrumentFastify = generateInstrumentOnce(`${
|
|
43817
|
+
var instrumentFastify = generateInstrumentOnce(`${INTEGRATION_NAME23}.v5`, () => {
|
|
43499
43818
|
const fastifyOtelInstrumentationInstance = new FastifyOtelInstrumentation;
|
|
43500
43819
|
const plugin = fastifyOtelInstrumentationInstance.plugin();
|
|
43501
43820
|
dc.subscribe("fastify.initialization", (message) => {
|
|
@@ -43520,7 +43839,7 @@ var instrumentFastify = generateInstrumentOnce(`${INTEGRATION_NAME21}.v5`, () =>
|
|
|
43520
43839
|
var _fastifyIntegration = ({ shouldHandleError }) => {
|
|
43521
43840
|
let _shouldHandleError;
|
|
43522
43841
|
return {
|
|
43523
|
-
name:
|
|
43842
|
+
name: INTEGRATION_NAME23,
|
|
43524
43843
|
setupOnce() {
|
|
43525
43844
|
_shouldHandleError = shouldHandleError || defaultShouldHandleError;
|
|
43526
43845
|
instrumentFastifyV3();
|
|
@@ -43584,10 +43903,10 @@ function instrumentOnRequest(fastify) {
|
|
|
43584
43903
|
}
|
|
43585
43904
|
|
|
43586
43905
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/graphql.js
|
|
43587
|
-
var
|
|
43906
|
+
var import_api14 = __toESM(require_src(), 1);
|
|
43588
43907
|
var import_instrumentation_graphql = __toESM(require_src13(), 1);
|
|
43589
|
-
var
|
|
43590
|
-
var instrumentGraphql = generateInstrumentOnce(
|
|
43908
|
+
var INTEGRATION_NAME24 = "Graphql";
|
|
43909
|
+
var instrumentGraphql = generateInstrumentOnce(INTEGRATION_NAME24, import_instrumentation_graphql.GraphQLInstrumentation, (_options) => {
|
|
43591
43910
|
const options = getOptionsWithDefaults(_options);
|
|
43592
43911
|
return {
|
|
43593
43912
|
...options,
|
|
@@ -43595,7 +43914,7 @@ var instrumentGraphql = generateInstrumentOnce(INTEGRATION_NAME22, import_instru
|
|
|
43595
43914
|
addOriginToSpan2(span, "auto.graphql.otel.graphql");
|
|
43596
43915
|
const resultWithMaybeError = result;
|
|
43597
43916
|
if (resultWithMaybeError.errors?.length && !spanToJSON(span).status) {
|
|
43598
|
-
span.setStatus({ code:
|
|
43917
|
+
span.setStatus({ code: import_api14.SpanStatusCode.ERROR });
|
|
43599
43918
|
}
|
|
43600
43919
|
const attributes = spanToJSON(span).data;
|
|
43601
43920
|
const operationType = attributes["graphql.operation.type"];
|
|
@@ -43623,7 +43942,7 @@ var instrumentGraphql = generateInstrumentOnce(INTEGRATION_NAME22, import_instru
|
|
|
43623
43942
|
});
|
|
43624
43943
|
var _graphqlIntegration = (options = {}) => {
|
|
43625
43944
|
return {
|
|
43626
|
-
name:
|
|
43945
|
+
name: INTEGRATION_NAME24,
|
|
43627
43946
|
setupOnce() {
|
|
43628
43947
|
instrumentGraphql(getOptionsWithDefaults(options));
|
|
43629
43948
|
}
|
|
@@ -43652,8 +43971,8 @@ function getGraphqlOperationNamesFromAttribute2(attr) {
|
|
|
43652
43971
|
|
|
43653
43972
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/kafka.js
|
|
43654
43973
|
var import_instrumentation_kafkajs = __toESM(require_src14(), 1);
|
|
43655
|
-
var
|
|
43656
|
-
var instrumentKafka = generateInstrumentOnce(
|
|
43974
|
+
var INTEGRATION_NAME25 = "Kafka";
|
|
43975
|
+
var instrumentKafka = generateInstrumentOnce(INTEGRATION_NAME25, () => new import_instrumentation_kafkajs.KafkaJsInstrumentation({
|
|
43657
43976
|
consumerHook(span) {
|
|
43658
43977
|
addOriginToSpan2(span, "auto.kafkajs.otel.consumer");
|
|
43659
43978
|
},
|
|
@@ -43663,7 +43982,7 @@ var instrumentKafka = generateInstrumentOnce(INTEGRATION_NAME23, () => new impor
|
|
|
43663
43982
|
}));
|
|
43664
43983
|
var _kafkaIntegration = () => {
|
|
43665
43984
|
return {
|
|
43666
|
-
name:
|
|
43985
|
+
name: INTEGRATION_NAME25,
|
|
43667
43986
|
setupOnce() {
|
|
43668
43987
|
instrumentKafka();
|
|
43669
43988
|
}
|
|
@@ -43673,11 +43992,11 @@ var kafkaIntegration = defineIntegration(_kafkaIntegration);
|
|
|
43673
43992
|
|
|
43674
43993
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/lrumemoizer.js
|
|
43675
43994
|
var import_instrumentation_lru_memoizer = __toESM(require_src15(), 1);
|
|
43676
|
-
var
|
|
43677
|
-
var instrumentLruMemoizer = generateInstrumentOnce(
|
|
43995
|
+
var INTEGRATION_NAME26 = "LruMemoizer";
|
|
43996
|
+
var instrumentLruMemoizer = generateInstrumentOnce(INTEGRATION_NAME26, () => new import_instrumentation_lru_memoizer.LruMemoizerInstrumentation);
|
|
43678
43997
|
var _lruMemoizerIntegration = () => {
|
|
43679
43998
|
return {
|
|
43680
|
-
name:
|
|
43999
|
+
name: INTEGRATION_NAME26,
|
|
43681
44000
|
setupOnce() {
|
|
43682
44001
|
instrumentLruMemoizer();
|
|
43683
44002
|
}
|
|
@@ -43687,8 +44006,8 @@ var lruMemoizerIntegration = defineIntegration(_lruMemoizerIntegration);
|
|
|
43687
44006
|
|
|
43688
44007
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/mongo.js
|
|
43689
44008
|
var import_instrumentation_mongodb = __toESM(require_src16(), 1);
|
|
43690
|
-
var
|
|
43691
|
-
var instrumentMongo = generateInstrumentOnce(
|
|
44009
|
+
var INTEGRATION_NAME27 = "Mongo";
|
|
44010
|
+
var instrumentMongo = generateInstrumentOnce(INTEGRATION_NAME27, () => new import_instrumentation_mongodb.MongoDBInstrumentation({
|
|
43692
44011
|
dbStatementSerializer: _defaultDbStatementSerializer,
|
|
43693
44012
|
responseHook(span) {
|
|
43694
44013
|
addOriginToSpan2(span, "auto.db.otel.mongo");
|
|
@@ -43728,7 +44047,7 @@ function isCommandEntry(value) {
|
|
|
43728
44047
|
}
|
|
43729
44048
|
var _mongoIntegration = () => {
|
|
43730
44049
|
return {
|
|
43731
|
-
name:
|
|
44050
|
+
name: INTEGRATION_NAME27,
|
|
43732
44051
|
setupOnce() {
|
|
43733
44052
|
instrumentMongo();
|
|
43734
44053
|
}
|
|
@@ -43738,15 +44057,15 @@ var mongoIntegration = defineIntegration(_mongoIntegration);
|
|
|
43738
44057
|
|
|
43739
44058
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/mongoose.js
|
|
43740
44059
|
var import_instrumentation_mongoose = __toESM(require_src17(), 1);
|
|
43741
|
-
var
|
|
43742
|
-
var instrumentMongoose = generateInstrumentOnce(
|
|
44060
|
+
var INTEGRATION_NAME28 = "Mongoose";
|
|
44061
|
+
var instrumentMongoose = generateInstrumentOnce(INTEGRATION_NAME28, () => new import_instrumentation_mongoose.MongooseInstrumentation({
|
|
43743
44062
|
responseHook(span) {
|
|
43744
44063
|
addOriginToSpan2(span, "auto.db.otel.mongoose");
|
|
43745
44064
|
}
|
|
43746
44065
|
}));
|
|
43747
44066
|
var _mongooseIntegration = () => {
|
|
43748
44067
|
return {
|
|
43749
|
-
name:
|
|
44068
|
+
name: INTEGRATION_NAME28,
|
|
43750
44069
|
setupOnce() {
|
|
43751
44070
|
instrumentMongoose();
|
|
43752
44071
|
}
|
|
@@ -43756,11 +44075,11 @@ var mongooseIntegration = defineIntegration(_mongooseIntegration);
|
|
|
43756
44075
|
|
|
43757
44076
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/mysql.js
|
|
43758
44077
|
var import_instrumentation_mysql = __toESM(require_src18(), 1);
|
|
43759
|
-
var
|
|
43760
|
-
var instrumentMysql = generateInstrumentOnce(
|
|
44078
|
+
var INTEGRATION_NAME29 = "Mysql";
|
|
44079
|
+
var instrumentMysql = generateInstrumentOnce(INTEGRATION_NAME29, () => new import_instrumentation_mysql.MySQLInstrumentation({}));
|
|
43761
44080
|
var _mysqlIntegration = () => {
|
|
43762
44081
|
return {
|
|
43763
|
-
name:
|
|
44082
|
+
name: INTEGRATION_NAME29,
|
|
43764
44083
|
setupOnce() {
|
|
43765
44084
|
instrumentMysql();
|
|
43766
44085
|
}
|
|
@@ -43770,15 +44089,15 @@ var mysqlIntegration = defineIntegration(_mysqlIntegration);
|
|
|
43770
44089
|
|
|
43771
44090
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/mysql2.js
|
|
43772
44091
|
var import_instrumentation_mysql2 = __toESM(require_src20(), 1);
|
|
43773
|
-
var
|
|
43774
|
-
var instrumentMysql2 = generateInstrumentOnce(
|
|
44092
|
+
var INTEGRATION_NAME30 = "Mysql2";
|
|
44093
|
+
var instrumentMysql2 = generateInstrumentOnce(INTEGRATION_NAME30, () => new import_instrumentation_mysql2.MySQL2Instrumentation({
|
|
43775
44094
|
responseHook(span) {
|
|
43776
44095
|
addOriginToSpan2(span, "auto.db.otel.mysql2");
|
|
43777
44096
|
}
|
|
43778
44097
|
}));
|
|
43779
44098
|
var _mysql2Integration = () => {
|
|
43780
44099
|
return {
|
|
43781
|
-
name:
|
|
44100
|
+
name: INTEGRATION_NAME30,
|
|
43782
44101
|
setupOnce() {
|
|
43783
44102
|
instrumentMysql2();
|
|
43784
44103
|
}
|
|
@@ -43880,7 +44199,7 @@ function flatten(input) {
|
|
|
43880
44199
|
}
|
|
43881
44200
|
|
|
43882
44201
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/redis.js
|
|
43883
|
-
var
|
|
44202
|
+
var INTEGRATION_NAME31 = "Redis";
|
|
43884
44203
|
var _redisOptions = {};
|
|
43885
44204
|
var cacheResponseHook = (span, redisCommand, cmdArgs, response) => {
|
|
43886
44205
|
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, "auto.db.otel.redis");
|
|
@@ -43908,12 +44227,12 @@ var cacheResponseHook = (span, redisCommand, cmdArgs, response) => {
|
|
|
43908
44227
|
const spanDescription = safeKey.join(", ");
|
|
43909
44228
|
span.updateName(truncate(spanDescription, 1024));
|
|
43910
44229
|
};
|
|
43911
|
-
var instrumentIORedis = generateInstrumentOnce(`${
|
|
44230
|
+
var instrumentIORedis = generateInstrumentOnce(`${INTEGRATION_NAME31}.IORedis`, () => {
|
|
43912
44231
|
return new import_instrumentation_ioredis.IORedisInstrumentation({
|
|
43913
44232
|
responseHook: cacheResponseHook
|
|
43914
44233
|
});
|
|
43915
44234
|
});
|
|
43916
|
-
var instrumentRedisModule = generateInstrumentOnce(`${
|
|
44235
|
+
var instrumentRedisModule = generateInstrumentOnce(`${INTEGRATION_NAME31}.Redis`, () => {
|
|
43917
44236
|
return new import_instrumentation_redis.RedisInstrumentation({
|
|
43918
44237
|
responseHook: cacheResponseHook
|
|
43919
44238
|
});
|
|
@@ -43921,10 +44240,10 @@ var instrumentRedisModule = generateInstrumentOnce(`${INTEGRATION_NAME29}.Redis`
|
|
|
43921
44240
|
var instrumentRedis = Object.assign(() => {
|
|
43922
44241
|
instrumentIORedis();
|
|
43923
44242
|
instrumentRedisModule();
|
|
43924
|
-
}, { id:
|
|
44243
|
+
}, { id: INTEGRATION_NAME31 });
|
|
43925
44244
|
var _redisIntegration = (options = {}) => {
|
|
43926
44245
|
return {
|
|
43927
|
-
name:
|
|
44246
|
+
name: INTEGRATION_NAME31,
|
|
43928
44247
|
setupOnce() {
|
|
43929
44248
|
_redisOptions = options;
|
|
43930
44249
|
instrumentRedis();
|
|
@@ -43935,8 +44254,8 @@ var redisIntegration = defineIntegration(_redisIntegration);
|
|
|
43935
44254
|
|
|
43936
44255
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/postgres.js
|
|
43937
44256
|
var import_instrumentation_pg = __toESM(require_src24(), 1);
|
|
43938
|
-
var
|
|
43939
|
-
var instrumentPostgres = generateInstrumentOnce(
|
|
44257
|
+
var INTEGRATION_NAME32 = "Postgres";
|
|
44258
|
+
var instrumentPostgres = generateInstrumentOnce(INTEGRATION_NAME32, () => new import_instrumentation_pg.PgInstrumentation({
|
|
43940
44259
|
requireParentSpan: true,
|
|
43941
44260
|
requestHook(span) {
|
|
43942
44261
|
addOriginToSpan2(span, "auto.db.otel.postgres");
|
|
@@ -43944,7 +44263,7 @@ var instrumentPostgres = generateInstrumentOnce(INTEGRATION_NAME30, () => new im
|
|
|
43944
44263
|
}));
|
|
43945
44264
|
var _postgresIntegration = () => {
|
|
43946
44265
|
return {
|
|
43947
|
-
name:
|
|
44266
|
+
name: INTEGRATION_NAME32,
|
|
43948
44267
|
setupOnce() {
|
|
43949
44268
|
instrumentPostgres();
|
|
43950
44269
|
}
|
|
@@ -43953,12 +44272,12 @@ var _postgresIntegration = () => {
|
|
|
43953
44272
|
var postgresIntegration = defineIntegration(_postgresIntegration);
|
|
43954
44273
|
|
|
43955
44274
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/postgresjs.js
|
|
43956
|
-
var
|
|
44275
|
+
var import_api15 = __toESM(require_src(), 1);
|
|
43957
44276
|
var import_instrumentation8 = __toESM(require_src6(), 1);
|
|
43958
44277
|
var import_semantic_conventions5 = __toESM(require_src2(), 1);
|
|
43959
|
-
var
|
|
44278
|
+
var INTEGRATION_NAME33 = "PostgresJs";
|
|
43960
44279
|
var SUPPORTED_VERSIONS2 = [">=3.0.0 <4"];
|
|
43961
|
-
var instrumentPostgresJs = generateInstrumentOnce(
|
|
44280
|
+
var instrumentPostgresJs = generateInstrumentOnce(INTEGRATION_NAME33, (options) => new PostgresJsInstrumentation({
|
|
43962
44281
|
requireParentSpan: options?.requireParentSpan ?? true,
|
|
43963
44282
|
requestHook: options?.requestHook
|
|
43964
44283
|
}));
|
|
@@ -43977,7 +44296,7 @@ class PostgresJsInstrumentation extends import_instrumentation8.InstrumentationB
|
|
|
43977
44296
|
}
|
|
43978
44297
|
_shouldCreateSpans() {
|
|
43979
44298
|
const config = this.getConfig();
|
|
43980
|
-
const hasParentSpan =
|
|
44299
|
+
const hasParentSpan = import_api15.trace.getSpan(import_api15.context.active()) !== undefined;
|
|
43981
44300
|
return hasParentSpan || !config.requireParentSpan;
|
|
43982
44301
|
}
|
|
43983
44302
|
_patchReject(rejectTarget, span) {
|
|
@@ -44026,7 +44345,7 @@ class PostgresJsInstrumentation extends import_instrumentation8.InstrumentationB
|
|
|
44026
44345
|
if (requestHook2) {
|
|
44027
44346
|
import_instrumentation8.safeExecuteInTheMiddle(() => requestHook2(span, sanitizedSqlQuery, postgresConnectionContext), (error2) => {
|
|
44028
44347
|
if (error2) {
|
|
44029
|
-
debug.error(`Error in requestHook for ${
|
|
44348
|
+
debug.error(`Error in requestHook for ${INTEGRATION_NAME33} integration:`, error2);
|
|
44030
44349
|
}
|
|
44031
44350
|
});
|
|
44032
44351
|
}
|
|
@@ -44079,7 +44398,7 @@ class PostgresJsInstrumentation extends import_instrumentation8.InstrumentationB
|
|
|
44079
44398
|
}
|
|
44080
44399
|
var _postgresJsIntegration = () => {
|
|
44081
44400
|
return {
|
|
44082
|
-
name:
|
|
44401
|
+
name: INTEGRATION_NAME33,
|
|
44083
44402
|
setupOnce() {
|
|
44084
44403
|
instrumentPostgresJs();
|
|
44085
44404
|
}
|
|
@@ -44088,21 +44407,21 @@ var _postgresJsIntegration = () => {
|
|
|
44088
44407
|
var postgresJsIntegration = defineIntegration(_postgresJsIntegration);
|
|
44089
44408
|
|
|
44090
44409
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/prisma.js
|
|
44091
|
-
var
|
|
44410
|
+
var import_api18 = __toESM(require_src(), 1);
|
|
44092
44411
|
|
|
44093
44412
|
// ../../node_modules/@prisma/instrumentation/dist/index.mjs
|
|
44094
|
-
var import_api15 = __toESM(require_src(), 1);
|
|
44095
|
-
var import_instrumentation9 = __toESM(require_src26(), 1);
|
|
44096
44413
|
var import_api16 = __toESM(require_src(), 1);
|
|
44414
|
+
var import_instrumentation9 = __toESM(require_src26(), 1);
|
|
44415
|
+
var import_api17 = __toESM(require_src(), 1);
|
|
44097
44416
|
var showAllTraces = process.env.PRISMA_SHOW_ALL_TRACES === "true";
|
|
44098
44417
|
var nonSampledTraceParent = `00-10-10-00`;
|
|
44099
44418
|
function engineSpanKindToOtelSpanKind(engineSpanKind) {
|
|
44100
44419
|
switch (engineSpanKind) {
|
|
44101
44420
|
case "client":
|
|
44102
|
-
return
|
|
44421
|
+
return import_api17.SpanKind.CLIENT;
|
|
44103
44422
|
case "internal":
|
|
44104
44423
|
default:
|
|
44105
|
-
return
|
|
44424
|
+
return import_api17.SpanKind.INTERNAL;
|
|
44106
44425
|
}
|
|
44107
44426
|
}
|
|
44108
44427
|
var ActiveTracingHelper = class {
|
|
@@ -44115,8 +44434,8 @@ var ActiveTracingHelper = class {
|
|
|
44115
44434
|
isEnabled() {
|
|
44116
44435
|
return true;
|
|
44117
44436
|
}
|
|
44118
|
-
getTraceParent(
|
|
44119
|
-
const span =
|
|
44437
|
+
getTraceParent(context10) {
|
|
44438
|
+
const span = import_api17.trace.getSpanContext(context10 ?? import_api17.context.active());
|
|
44120
44439
|
if (span) {
|
|
44121
44440
|
return `00-${span.traceId}-${span.spanId}-0${span.traceFlags}`;
|
|
44122
44441
|
}
|
|
@@ -44131,7 +44450,7 @@ var ActiveTracingHelper = class {
|
|
|
44131
44450
|
}
|
|
44132
44451
|
}
|
|
44133
44452
|
getActiveContext() {
|
|
44134
|
-
return
|
|
44453
|
+
return import_api17.context.active();
|
|
44135
44454
|
}
|
|
44136
44455
|
runInChildSpan(options, callback) {
|
|
44137
44456
|
if (typeof options === "string") {
|
|
@@ -44141,16 +44460,16 @@ var ActiveTracingHelper = class {
|
|
|
44141
44460
|
return callback();
|
|
44142
44461
|
}
|
|
44143
44462
|
const tracer = this.tracerProvider.getTracer("prisma");
|
|
44144
|
-
const
|
|
44463
|
+
const context10 = options.context ?? this.getActiveContext();
|
|
44145
44464
|
const name = `prisma:client:${options.name}`;
|
|
44146
44465
|
if (shouldIgnoreSpan2(name, this.ignoreSpanTypes)) {
|
|
44147
44466
|
return callback();
|
|
44148
44467
|
}
|
|
44149
44468
|
if (options.active === false) {
|
|
44150
|
-
const span = tracer.startSpan(name, options,
|
|
44151
|
-
return endSpan2(span, callback(span,
|
|
44469
|
+
const span = tracer.startSpan(name, options, context10);
|
|
44470
|
+
return endSpan2(span, callback(span, context10));
|
|
44152
44471
|
}
|
|
44153
|
-
return tracer.startActiveSpan(name, options, (span) => endSpan2(span, callback(span,
|
|
44472
|
+
return tracer.startActiveSpan(name, options, (span) => endSpan2(span, callback(span, context10)));
|
|
44154
44473
|
}
|
|
44155
44474
|
};
|
|
44156
44475
|
function dispatchEngineSpan(tracer, engineSpan, allSpans, linkIds, ignoreSpanTypes) {
|
|
@@ -44286,7 +44605,7 @@ var PrismaInstrumentation = class extends import_instrumentation9.Instrumentatio
|
|
|
44286
44605
|
const config = this._config;
|
|
44287
44606
|
const globalValue = {
|
|
44288
44607
|
helper: new ActiveTracingHelper({
|
|
44289
|
-
tracerProvider: this.tracerProvider ??
|
|
44608
|
+
tracerProvider: this.tracerProvider ?? import_api16.trace.getTracerProvider(),
|
|
44290
44609
|
ignoreSpanTypes: config.ignoreSpanTypes ?? []
|
|
44291
44610
|
})
|
|
44292
44611
|
};
|
|
@@ -44303,7 +44622,7 @@ var PrismaInstrumentation = class extends import_instrumentation9.Instrumentatio
|
|
|
44303
44622
|
};
|
|
44304
44623
|
|
|
44305
44624
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/prisma.js
|
|
44306
|
-
var
|
|
44625
|
+
var INTEGRATION_NAME34 = "Prisma";
|
|
44307
44626
|
function isPrismaV6TracingHelper(helper) {
|
|
44308
44627
|
return !!helper && typeof helper === "object" && "dispatchEngineSpans" in helper;
|
|
44309
44628
|
}
|
|
@@ -44322,7 +44641,7 @@ class SentryPrismaInteropInstrumentation extends PrismaInstrumentation {
|
|
|
44322
44641
|
const prismaTracingHelper = getPrismaTracingHelper();
|
|
44323
44642
|
if (isPrismaV6TracingHelper(prismaTracingHelper)) {
|
|
44324
44643
|
prismaTracingHelper.createEngineSpan = (engineSpanEvent) => {
|
|
44325
|
-
const tracer =
|
|
44644
|
+
const tracer = import_api18.trace.getTracer("prismaV5Compatibility");
|
|
44326
44645
|
const initialIdGenerator = tracer._idGenerator;
|
|
44327
44646
|
if (!initialIdGenerator) {
|
|
44328
44647
|
consoleSandbox(() => {
|
|
@@ -44341,16 +44660,16 @@ class SentryPrismaInteropInstrumentation extends PrismaInstrumentation {
|
|
|
44341
44660
|
context: {
|
|
44342
44661
|
traceId: link.trace_id,
|
|
44343
44662
|
spanId: link.span_id,
|
|
44344
|
-
traceFlags:
|
|
44663
|
+
traceFlags: import_api18.TraceFlags.SAMPLED
|
|
44345
44664
|
}
|
|
44346
44665
|
};
|
|
44347
44666
|
});
|
|
44348
|
-
const ctx =
|
|
44667
|
+
const ctx = import_api18.trace.setSpanContext(import_api18.context.active(), {
|
|
44349
44668
|
traceId,
|
|
44350
44669
|
spanId: parentSpanId,
|
|
44351
|
-
traceFlags:
|
|
44670
|
+
traceFlags: import_api18.TraceFlags.SAMPLED
|
|
44352
44671
|
});
|
|
44353
|
-
|
|
44672
|
+
import_api18.context.with(ctx, () => {
|
|
44354
44673
|
const temporaryIdGenerator = {
|
|
44355
44674
|
generateTraceId: () => {
|
|
44356
44675
|
return traceId;
|
|
@@ -44380,18 +44699,18 @@ class SentryPrismaInteropInstrumentation extends PrismaInstrumentation {
|
|
|
44380
44699
|
function engineSpanKindToOTELSpanKind(engineSpanKind) {
|
|
44381
44700
|
switch (engineSpanKind) {
|
|
44382
44701
|
case "client":
|
|
44383
|
-
return
|
|
44702
|
+
return import_api18.SpanKind.CLIENT;
|
|
44384
44703
|
case "internal":
|
|
44385
44704
|
default:
|
|
44386
|
-
return
|
|
44705
|
+
return import_api18.SpanKind.INTERNAL;
|
|
44387
44706
|
}
|
|
44388
44707
|
}
|
|
44389
|
-
var instrumentPrisma = generateInstrumentOnce(
|
|
44708
|
+
var instrumentPrisma = generateInstrumentOnce(INTEGRATION_NAME34, (_options) => {
|
|
44390
44709
|
return new SentryPrismaInteropInstrumentation;
|
|
44391
44710
|
});
|
|
44392
44711
|
var prismaIntegration = defineIntegration((_options) => {
|
|
44393
44712
|
return {
|
|
44394
|
-
name:
|
|
44713
|
+
name: INTEGRATION_NAME34,
|
|
44395
44714
|
setupOnce() {
|
|
44396
44715
|
instrumentPrisma();
|
|
44397
44716
|
},
|
|
@@ -44417,11 +44736,11 @@ var prismaIntegration = defineIntegration((_options) => {
|
|
|
44417
44736
|
|
|
44418
44737
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/hapi/index.js
|
|
44419
44738
|
var import_instrumentation_hapi = __toESM(require_src27(), 1);
|
|
44420
|
-
var
|
|
44421
|
-
var instrumentHapi = generateInstrumentOnce(
|
|
44739
|
+
var INTEGRATION_NAME35 = "Hapi";
|
|
44740
|
+
var instrumentHapi = generateInstrumentOnce(INTEGRATION_NAME35, () => new import_instrumentation_hapi.HapiInstrumentation);
|
|
44422
44741
|
var _hapiIntegration = () => {
|
|
44423
44742
|
return {
|
|
44424
|
-
name:
|
|
44743
|
+
name: INTEGRATION_NAME35,
|
|
44425
44744
|
setupOnce() {
|
|
44426
44745
|
instrumentHapi();
|
|
44427
44746
|
}
|
|
@@ -44443,7 +44762,7 @@ var HonoTypes = {
|
|
|
44443
44762
|
};
|
|
44444
44763
|
|
|
44445
44764
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/hono/instrumentation.js
|
|
44446
|
-
var
|
|
44765
|
+
var import_api19 = __toESM(require_src(), 1);
|
|
44447
44766
|
var import_instrumentation11 = __toESM(require_src6(), 1);
|
|
44448
44767
|
var PACKAGE_NAME3 = "@sentry/instrumentation-hono";
|
|
44449
44768
|
var PACKAGE_VERSION3 = "0.0.1";
|
|
@@ -44539,7 +44858,7 @@ class HonoInstrumentation extends import_instrumentation11.InstrumentationBase {
|
|
|
44539
44858
|
}
|
|
44540
44859
|
const path8 = c.req.path;
|
|
44541
44860
|
const span = instrumentation.tracer.startSpan(path8);
|
|
44542
|
-
return
|
|
44861
|
+
return import_api19.context.with(import_api19.trace.setSpan(import_api19.context.active(), span), () => {
|
|
44543
44862
|
return instrumentation._safeExecute(() => {
|
|
44544
44863
|
const result = handler.apply(this, [c, next]);
|
|
44545
44864
|
if (isThenable(result)) {
|
|
@@ -44588,7 +44907,7 @@ class HonoInstrumentation extends import_instrumentation11.InstrumentationBase {
|
|
|
44588
44907
|
_handleError(span, error2) {
|
|
44589
44908
|
if (error2 instanceof Error) {
|
|
44590
44909
|
span.setStatus({
|
|
44591
|
-
code:
|
|
44910
|
+
code: import_api19.SpanStatusCode.ERROR,
|
|
44592
44911
|
message: error2.message
|
|
44593
44912
|
});
|
|
44594
44913
|
span.recordException(error2);
|
|
@@ -44597,7 +44916,7 @@ class HonoInstrumentation extends import_instrumentation11.InstrumentationBase {
|
|
|
44597
44916
|
}
|
|
44598
44917
|
|
|
44599
44918
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/hono/index.js
|
|
44600
|
-
var
|
|
44919
|
+
var INTEGRATION_NAME36 = "Hono";
|
|
44601
44920
|
function addHonoSpanAttributes(span) {
|
|
44602
44921
|
const attributes = spanToJSON(span).data;
|
|
44603
44922
|
const type = attributes[AttributeNames2.HONO_TYPE];
|
|
@@ -44622,14 +44941,14 @@ function addHonoSpanAttributes(span) {
|
|
|
44622
44941
|
getIsolationScope().setTransactionName(`${method} ${route}`);
|
|
44623
44942
|
}
|
|
44624
44943
|
}
|
|
44625
|
-
var instrumentHono = generateInstrumentOnce(
|
|
44944
|
+
var instrumentHono = generateInstrumentOnce(INTEGRATION_NAME36, () => new HonoInstrumentation({
|
|
44626
44945
|
responseHook: (span) => {
|
|
44627
44946
|
addHonoSpanAttributes(span);
|
|
44628
44947
|
}
|
|
44629
44948
|
}));
|
|
44630
44949
|
var _honoIntegration = () => {
|
|
44631
44950
|
return {
|
|
44632
|
-
name:
|
|
44951
|
+
name: INTEGRATION_NAME36,
|
|
44633
44952
|
setupOnce() {
|
|
44634
44953
|
instrumentHono();
|
|
44635
44954
|
}
|
|
@@ -44640,8 +44959,8 @@ var honoIntegration = defineIntegration(_honoIntegration);
|
|
|
44640
44959
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/koa.js
|
|
44641
44960
|
var import_instrumentation_koa = __toESM(require_src28(), 1);
|
|
44642
44961
|
var import_semantic_conventions7 = __toESM(require_src2(), 1);
|
|
44643
|
-
var
|
|
44644
|
-
var instrumentKoa = generateInstrumentOnce(
|
|
44962
|
+
var INTEGRATION_NAME37 = "Koa";
|
|
44963
|
+
var instrumentKoa = generateInstrumentOnce(INTEGRATION_NAME37, import_instrumentation_koa.KoaInstrumentation, (options = {}) => {
|
|
44645
44964
|
return {
|
|
44646
44965
|
ignoreLayersType: options.ignoreLayersType,
|
|
44647
44966
|
requestHook(span, info) {
|
|
@@ -44669,7 +44988,7 @@ var instrumentKoa = generateInstrumentOnce(INTEGRATION_NAME35, import_instrument
|
|
|
44669
44988
|
});
|
|
44670
44989
|
var _koaIntegration = (options = {}) => {
|
|
44671
44990
|
return {
|
|
44672
|
-
name:
|
|
44991
|
+
name: INTEGRATION_NAME37,
|
|
44673
44992
|
setupOnce() {
|
|
44674
44993
|
instrumentKoa(options);
|
|
44675
44994
|
}
|
|
@@ -44679,11 +44998,11 @@ var koaIntegration = defineIntegration(_koaIntegration);
|
|
|
44679
44998
|
|
|
44680
44999
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/connect.js
|
|
44681
45000
|
var import_instrumentation_connect = __toESM(require_src29(), 1);
|
|
44682
|
-
var
|
|
44683
|
-
var instrumentConnect = generateInstrumentOnce(
|
|
45001
|
+
var INTEGRATION_NAME38 = "Connect";
|
|
45002
|
+
var instrumentConnect = generateInstrumentOnce(INTEGRATION_NAME38, () => new import_instrumentation_connect.ConnectInstrumentation);
|
|
44684
45003
|
var _connectIntegration = () => {
|
|
44685
45004
|
return {
|
|
44686
|
-
name:
|
|
45005
|
+
name: INTEGRATION_NAME38,
|
|
44687
45006
|
setupOnce() {
|
|
44688
45007
|
instrumentConnect();
|
|
44689
45008
|
}
|
|
@@ -44701,12 +45020,12 @@ var TEDIUS_INSTRUMENTED_METHODS = new Set([
|
|
|
44701
45020
|
"prepare",
|
|
44702
45021
|
"execute"
|
|
44703
45022
|
]);
|
|
44704
|
-
var
|
|
44705
|
-
var instrumentTedious = generateInstrumentOnce(
|
|
45023
|
+
var INTEGRATION_NAME39 = "Tedious";
|
|
45024
|
+
var instrumentTedious = generateInstrumentOnce(INTEGRATION_NAME39, () => new import_instrumentation_tedious.TediousInstrumentation({}));
|
|
44706
45025
|
var _tediousIntegration = () => {
|
|
44707
45026
|
let instrumentationWrappedCallback;
|
|
44708
45027
|
return {
|
|
44709
|
-
name:
|
|
45028
|
+
name: INTEGRATION_NAME39,
|
|
44710
45029
|
setupOnce() {
|
|
44711
45030
|
const instrumentation = instrumentTedious();
|
|
44712
45031
|
instrumentationWrappedCallback = instrumentWhenWrapped(instrumentation);
|
|
@@ -44729,12 +45048,12 @@ var tediousIntegration = defineIntegration(_tediousIntegration);
|
|
|
44729
45048
|
|
|
44730
45049
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/genericPool.js
|
|
44731
45050
|
var import_instrumentation_generic_pool = __toESM(require_src31(), 1);
|
|
44732
|
-
var
|
|
44733
|
-
var instrumentGenericPool = generateInstrumentOnce(
|
|
45051
|
+
var INTEGRATION_NAME40 = "GenericPool";
|
|
45052
|
+
var instrumentGenericPool = generateInstrumentOnce(INTEGRATION_NAME40, () => new import_instrumentation_generic_pool.GenericPoolInstrumentation({}));
|
|
44734
45053
|
var _genericPoolIntegration = () => {
|
|
44735
45054
|
let instrumentationWrappedCallback;
|
|
44736
45055
|
return {
|
|
44737
|
-
name:
|
|
45056
|
+
name: INTEGRATION_NAME40,
|
|
44738
45057
|
setupOnce() {
|
|
44739
45058
|
const instrumentation = instrumentGenericPool();
|
|
44740
45059
|
instrumentationWrappedCallback = instrumentWhenWrapped(instrumentation);
|
|
@@ -44755,7 +45074,7 @@ var genericPoolIntegration = defineIntegration(_genericPoolIntegration);
|
|
|
44755
45074
|
|
|
44756
45075
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/amqplib.js
|
|
44757
45076
|
var import_instrumentation_amqplib = __toESM(require_src32(), 1);
|
|
44758
|
-
var
|
|
45077
|
+
var INTEGRATION_NAME41 = "Amqplib";
|
|
44759
45078
|
var config = {
|
|
44760
45079
|
consumeEndHook: (span) => {
|
|
44761
45080
|
addOriginToSpan2(span, "auto.amqplib.otel.consumer");
|
|
@@ -44764,10 +45083,10 @@ var config = {
|
|
|
44764
45083
|
addOriginToSpan2(span, "auto.amqplib.otel.publisher");
|
|
44765
45084
|
}
|
|
44766
45085
|
};
|
|
44767
|
-
var instrumentAmqplib = generateInstrumentOnce(
|
|
45086
|
+
var instrumentAmqplib = generateInstrumentOnce(INTEGRATION_NAME41, () => new import_instrumentation_amqplib.AmqplibInstrumentation(config));
|
|
44768
45087
|
var _amqplibIntegration = () => {
|
|
44769
45088
|
return {
|
|
44770
|
-
name:
|
|
45089
|
+
name: INTEGRATION_NAME41,
|
|
44771
45090
|
setupOnce() {
|
|
44772
45091
|
instrumentAmqplib();
|
|
44773
45092
|
}
|
|
@@ -44776,7 +45095,7 @@ var _amqplibIntegration = () => {
|
|
|
44776
45095
|
var amqplibIntegration = defineIntegration(_amqplibIntegration);
|
|
44777
45096
|
|
|
44778
45097
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/vercelai/constants.js
|
|
44779
|
-
var
|
|
45098
|
+
var INTEGRATION_NAME42 = "VercelAI";
|
|
44780
45099
|
|
|
44781
45100
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/vercelai/instrumentation.js
|
|
44782
45101
|
var import_instrumentation13 = __toESM(require_src6(), 1);
|
|
@@ -44879,7 +45198,7 @@ class SentryVercelAiInstrumentation extends import_instrumentation13.Instrumenta
|
|
|
44879
45198
|
const existingExperimentalTelemetry = args[0].experimental_telemetry || {};
|
|
44880
45199
|
const isEnabled3 = existingExperimentalTelemetry.isEnabled;
|
|
44881
45200
|
const client = getClient();
|
|
44882
|
-
const integration = client?.getIntegrationByName(
|
|
45201
|
+
const integration = client?.getIntegrationByName(INTEGRATION_NAME42);
|
|
44883
45202
|
const integrationOptions = integration?.options;
|
|
44884
45203
|
const shouldRecordInputsAndOutputs = integration ? Boolean(client?.getOptions().sendDefaultPii) : false;
|
|
44885
45204
|
const { recordInputs, recordOutputs } = determineRecordingSettings(integrationOptions, existingExperimentalTelemetry, isEnabled3, shouldRecordInputsAndOutputs);
|
|
@@ -44915,7 +45234,7 @@ class SentryVercelAiInstrumentation extends import_instrumentation13.Instrumenta
|
|
|
44915
45234
|
}
|
|
44916
45235
|
|
|
44917
45236
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/vercelai/index.js
|
|
44918
|
-
var instrumentVercelAi = generateInstrumentOnce(
|
|
45237
|
+
var instrumentVercelAi = generateInstrumentOnce(INTEGRATION_NAME42, () => new SentryVercelAiInstrumentation({}));
|
|
44919
45238
|
function shouldForceIntegration(client) {
|
|
44920
45239
|
const modules = client.getIntegrationByName("Modules");
|
|
44921
45240
|
return !!modules?.getModules?.()?.ai;
|
|
@@ -44923,7 +45242,7 @@ function shouldForceIntegration(client) {
|
|
|
44923
45242
|
var _vercelAIIntegration = (options = {}) => {
|
|
44924
45243
|
let instrumentation;
|
|
44925
45244
|
return {
|
|
44926
|
-
name:
|
|
45245
|
+
name: INTEGRATION_NAME42,
|
|
44927
45246
|
options,
|
|
44928
45247
|
setupOnce() {
|
|
44929
45248
|
instrumentation = instrumentVercelAi();
|
|
@@ -45157,7 +45476,7 @@ var googleGenAIIntegration = defineIntegration(_googleGenAIIntegration);
|
|
|
45157
45476
|
var import_instrumentation22 = __toESM(require_src6(), 1);
|
|
45158
45477
|
|
|
45159
45478
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/firebase/otel/patches/firestore.js
|
|
45160
|
-
var
|
|
45479
|
+
var import_api20 = __toESM(require_src(), 1);
|
|
45161
45480
|
var import_instrumentation21 = __toESM(require_src6(), 1);
|
|
45162
45481
|
var import_semantic_conventions8 = __toESM(require_src2(), 1);
|
|
45163
45482
|
import * as net2 from "node:net";
|
|
@@ -45171,7 +45490,7 @@ function patchFirestore(tracer, firestoreSupportedVersions, wrap, unwrap, config
|
|
|
45171
45490
|
if (!error2) {
|
|
45172
45491
|
return;
|
|
45173
45492
|
}
|
|
45174
|
-
|
|
45493
|
+
import_api20.diag.error(error2?.message);
|
|
45175
45494
|
}, true);
|
|
45176
45495
|
};
|
|
45177
45496
|
}
|
|
@@ -45248,7 +45567,7 @@ function patchSetDoc(tracer, firestoreSpanCreationHook) {
|
|
|
45248
45567
|
};
|
|
45249
45568
|
}
|
|
45250
45569
|
function executeContextWithSpan(span, callback) {
|
|
45251
|
-
return
|
|
45570
|
+
return import_api20.context.with(import_api20.trace.setSpan(import_api20.context.active(), span), () => {
|
|
45252
45571
|
return import_instrumentation21.safeExecuteInTheMiddle(() => {
|
|
45253
45572
|
return callback();
|
|
45254
45573
|
}, (err) => {
|
|
@@ -45260,7 +45579,7 @@ function executeContextWithSpan(span, callback) {
|
|
|
45260
45579
|
});
|
|
45261
45580
|
}
|
|
45262
45581
|
function startDBSpan(tracer, spanName, reference) {
|
|
45263
|
-
const span = tracer.startSpan(`${spanName} ${reference.path}`, { kind:
|
|
45582
|
+
const span = tracer.startSpan(`${spanName} ${reference.path}`, { kind: import_api20.SpanKind.CLIENT });
|
|
45264
45583
|
addAttributes(span, reference);
|
|
45265
45584
|
span.setAttribute(import_semantic_conventions8.ATTR_DB_OPERATION_NAME, spanName);
|
|
45266
45585
|
return span;
|
|
@@ -45342,17 +45661,17 @@ class FirebaseInstrumentation extends import_instrumentation22.InstrumentationBa
|
|
|
45342
45661
|
}
|
|
45343
45662
|
|
|
45344
45663
|
// ../../node_modules/@sentry/node/build/esm/integrations/tracing/firebase/firebase.js
|
|
45345
|
-
var
|
|
45664
|
+
var INTEGRATION_NAME43 = "Firebase";
|
|
45346
45665
|
var config2 = {
|
|
45347
45666
|
firestoreSpanCreationHook: (span) => {
|
|
45348
45667
|
addOriginToSpan2(span, "auto.firebase.otel.firestore");
|
|
45349
45668
|
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, "db.query");
|
|
45350
45669
|
}
|
|
45351
45670
|
};
|
|
45352
|
-
var instrumentFirebase = generateInstrumentOnce(
|
|
45671
|
+
var instrumentFirebase = generateInstrumentOnce(INTEGRATION_NAME43, () => new FirebaseInstrumentation(config2));
|
|
45353
45672
|
var _firebaseIntegration = () => {
|
|
45354
45673
|
return {
|
|
45355
|
-
name:
|
|
45674
|
+
name: INTEGRATION_NAME43,
|
|
45356
45675
|
setupOnce() {
|
|
45357
45676
|
instrumentFirebase();
|
|
45358
45677
|
}
|
|
@@ -45392,7 +45711,7 @@ function getAutoPerformanceIntegrations() {
|
|
|
45392
45711
|
}
|
|
45393
45712
|
|
|
45394
45713
|
// ../../node_modules/@sentry/node/build/esm/sdk/initOtel.js
|
|
45395
|
-
var
|
|
45714
|
+
var import_api21 = __toESM(require_src(), 1);
|
|
45396
45715
|
var import_resources = __toESM(require_src8(), 1);
|
|
45397
45716
|
var import_sdk_trace_base2 = __toESM(require_src9(), 1);
|
|
45398
45717
|
var import_semantic_conventions9 = __toESM(require_src2(), 1);
|
|
@@ -45420,9 +45739,9 @@ function setupOtel(client, options = {}) {
|
|
|
45420
45739
|
...options.spanProcessors || []
|
|
45421
45740
|
]
|
|
45422
45741
|
});
|
|
45423
|
-
|
|
45424
|
-
|
|
45425
|
-
|
|
45742
|
+
import_api21.trace.setGlobalTracerProvider(provider);
|
|
45743
|
+
import_api21.propagation.setGlobalPropagator(new SentryPropagator);
|
|
45744
|
+
import_api21.context.setGlobalContextManager(new SentryContextManager);
|
|
45426
45745
|
return provider;
|
|
45427
45746
|
}
|
|
45428
45747
|
function _clampSpanProcessorTimeout(maxSpanWaitDuration) {
|
|
@@ -45469,277 +45788,9 @@ function _init2(options = {}, getDefaultIntegrationsImpl) {
|
|
|
45469
45788
|
}
|
|
45470
45789
|
// src/index.ts
|
|
45471
45790
|
import sqlPlugin, { createDatabaseAdapter, DatabaseMigrationService } from "@elizaos/plugin-sql";
|
|
45472
|
-
|
|
45473
|
-
// src/managers/PluginLoader.ts
|
|
45474
|
-
import { logger as logger31 } from "@elizaos/core";
|
|
45475
|
-
|
|
45476
|
-
// src/managers/PluginInstaller.ts
|
|
45477
|
-
import { logger as logger30 } from "@elizaos/core";
|
|
45478
|
-
|
|
45479
|
-
class PluginInstaller {
|
|
45480
|
-
attempted = new Set;
|
|
45481
|
-
async tryInstall(pluginName) {
|
|
45482
|
-
try {
|
|
45483
|
-
if (!this.isAllowed()) {
|
|
45484
|
-
logger30.debug(`Auto-install disabled or not allowed in this environment. Skipping install for ${pluginName}.`);
|
|
45485
|
-
return false;
|
|
45486
|
-
}
|
|
45487
|
-
if (this.attempted.has(pluginName)) {
|
|
45488
|
-
logger30.debug(`Auto-install already attempted for ${pluginName}. Skipping.`);
|
|
45489
|
-
return false;
|
|
45490
|
-
}
|
|
45491
|
-
this.attempted.add(pluginName);
|
|
45492
|
-
try {
|
|
45493
|
-
const check = Bun.spawn(["bun", "--version"], { stdout: "pipe", stderr: "pipe" });
|
|
45494
|
-
const code = await check.exited;
|
|
45495
|
-
if (code !== 0) {
|
|
45496
|
-
logger30.warn(`Bun not available on PATH. Cannot auto-install ${pluginName}. Please run: bun add ${pluginName}`);
|
|
45497
|
-
return false;
|
|
45498
|
-
}
|
|
45499
|
-
} catch {
|
|
45500
|
-
logger30.warn(`Bun not available on PATH. Cannot auto-install ${pluginName}. Please run: bun add ${pluginName}`);
|
|
45501
|
-
return false;
|
|
45502
|
-
}
|
|
45503
|
-
logger30.info(`Attempting to auto-install missing plugin: ${pluginName}`);
|
|
45504
|
-
const install = Bun.spawn(["bun", "add", pluginName], {
|
|
45505
|
-
cwd: process.cwd(),
|
|
45506
|
-
env: process.env,
|
|
45507
|
-
stdout: "inherit",
|
|
45508
|
-
stderr: "inherit"
|
|
45509
|
-
});
|
|
45510
|
-
const exit = await install.exited;
|
|
45511
|
-
if (exit === 0) {
|
|
45512
|
-
logger30.info(`Successfully installed ${pluginName}. Retrying import...`);
|
|
45513
|
-
return true;
|
|
45514
|
-
}
|
|
45515
|
-
logger30.error(`bun add ${pluginName} failed with exit code ${exit}. Please install manually.`);
|
|
45516
|
-
return false;
|
|
45517
|
-
} catch (e) {
|
|
45518
|
-
const message = e instanceof Error ? e.message : String(e);
|
|
45519
|
-
logger30.error(`Unexpected error during auto-install of ${pluginName}: ${message}`);
|
|
45520
|
-
return false;
|
|
45521
|
-
}
|
|
45522
|
-
}
|
|
45523
|
-
isAllowed() {
|
|
45524
|
-
if (process.env.ELIZA_NO_AUTO_INSTALL === "true")
|
|
45525
|
-
return false;
|
|
45526
|
-
if (process.env.ELIZA_NO_PLUGIN_AUTO_INSTALL === "true")
|
|
45527
|
-
return false;
|
|
45528
|
-
if (process.env.CI === "true")
|
|
45529
|
-
return false;
|
|
45530
|
-
if (process.env.ELIZA_TEST_MODE === "true")
|
|
45531
|
-
return false;
|
|
45532
|
-
if (false)
|
|
45533
|
-
;
|
|
45534
|
-
return true;
|
|
45535
|
-
}
|
|
45536
|
-
}
|
|
45537
|
-
var pluginInstaller = new PluginInstaller;
|
|
45538
|
-
|
|
45539
|
-
// src/managers/PluginLoader.ts
|
|
45540
|
-
class PluginLoader {
|
|
45541
|
-
isValidPluginShape(obj) {
|
|
45542
|
-
if (!obj || typeof obj !== "object" || !obj.name) {
|
|
45543
|
-
return false;
|
|
45544
|
-
}
|
|
45545
|
-
return !!(obj.init || obj.services || obj.providers || obj.actions || obj.evaluators || obj.description);
|
|
45546
|
-
}
|
|
45547
|
-
validatePlugin(plugin) {
|
|
45548
|
-
const errors = [];
|
|
45549
|
-
if (!plugin) {
|
|
45550
|
-
errors.push("Plugin is null or undefined");
|
|
45551
|
-
return { isValid: false, errors };
|
|
45552
|
-
}
|
|
45553
|
-
if (!plugin.name) {
|
|
45554
|
-
errors.push("Plugin must have a name");
|
|
45555
|
-
}
|
|
45556
|
-
if (plugin.actions) {
|
|
45557
|
-
if (!Array.isArray(plugin.actions)) {
|
|
45558
|
-
errors.push("Plugin actions must be an array");
|
|
45559
|
-
} else {
|
|
45560
|
-
const invalidActions = plugin.actions.filter((a) => typeof a !== "object" || !a);
|
|
45561
|
-
if (invalidActions.length > 0) {
|
|
45562
|
-
errors.push("Plugin actions must be an array of action objects");
|
|
45563
|
-
}
|
|
45564
|
-
}
|
|
45565
|
-
}
|
|
45566
|
-
if (plugin.services) {
|
|
45567
|
-
if (!Array.isArray(plugin.services)) {
|
|
45568
|
-
errors.push("Plugin services must be an array");
|
|
45569
|
-
} else {
|
|
45570
|
-
const invalidServices = plugin.services.filter((s) => typeof s !== "function" && (typeof s !== "object" || !s));
|
|
45571
|
-
if (invalidServices.length > 0) {
|
|
45572
|
-
errors.push("Plugin services must be an array of service classes or objects");
|
|
45573
|
-
}
|
|
45574
|
-
}
|
|
45575
|
-
}
|
|
45576
|
-
if (plugin.providers && !Array.isArray(plugin.providers)) {
|
|
45577
|
-
errors.push("Plugin providers must be an array");
|
|
45578
|
-
}
|
|
45579
|
-
if (plugin.evaluators && !Array.isArray(plugin.evaluators)) {
|
|
45580
|
-
errors.push("Plugin evaluators must be an array");
|
|
45581
|
-
}
|
|
45582
|
-
return {
|
|
45583
|
-
isValid: errors.length === 0,
|
|
45584
|
-
errors
|
|
45585
|
-
};
|
|
45586
|
-
}
|
|
45587
|
-
async loadAndPreparePlugin(pluginName) {
|
|
45588
|
-
try {
|
|
45589
|
-
let pluginModule;
|
|
45590
|
-
try {
|
|
45591
|
-
pluginModule = await import(pluginName);
|
|
45592
|
-
} catch (error2) {
|
|
45593
|
-
logger31.warn(`Failed to load plugin ${pluginName}: ${error2}`);
|
|
45594
|
-
const attempted = await pluginInstaller.tryInstall(pluginName);
|
|
45595
|
-
if (!attempted) {
|
|
45596
|
-
return null;
|
|
45597
|
-
}
|
|
45598
|
-
try {
|
|
45599
|
-
pluginModule = await import(pluginName);
|
|
45600
|
-
} catch (secondError) {
|
|
45601
|
-
logger31.error(`Auto-install attempted for ${pluginName} but import still failed: ${secondError}`);
|
|
45602
|
-
return null;
|
|
45603
|
-
}
|
|
45604
|
-
}
|
|
45605
|
-
if (!pluginModule) {
|
|
45606
|
-
logger31.error(`Failed to load module for plugin ${pluginName}.`);
|
|
45607
|
-
return null;
|
|
45608
|
-
}
|
|
45609
|
-
const expectedFunctionName = `${pluginName.replace(/^@elizaos\/plugin-/, "").replace(/^@elizaos\//, "").replace(/-./g, (match3) => match3[1].toUpperCase())}Plugin`;
|
|
45610
|
-
const exportsToCheck = [
|
|
45611
|
-
pluginModule[expectedFunctionName],
|
|
45612
|
-
pluginModule.default,
|
|
45613
|
-
...Object.values(pluginModule)
|
|
45614
|
-
];
|
|
45615
|
-
for (const potentialPlugin of exportsToCheck) {
|
|
45616
|
-
if (this.isValidPluginShape(potentialPlugin)) {
|
|
45617
|
-
return potentialPlugin;
|
|
45618
|
-
}
|
|
45619
|
-
if (typeof potentialPlugin === "function" && potentialPlugin.length === 0) {
|
|
45620
|
-
try {
|
|
45621
|
-
const produced = potentialPlugin();
|
|
45622
|
-
if (this.isValidPluginShape(produced)) {
|
|
45623
|
-
return produced;
|
|
45624
|
-
}
|
|
45625
|
-
} catch (err) {
|
|
45626
|
-
logger31.debug(`Factory export threw for ${pluginName}: ${err}`);
|
|
45627
|
-
}
|
|
45628
|
-
}
|
|
45629
|
-
}
|
|
45630
|
-
logger31.warn(`Could not find a valid plugin export in ${pluginName}.`);
|
|
45631
|
-
return null;
|
|
45632
|
-
} catch (error2) {
|
|
45633
|
-
logger31.error(`Error loading plugin ${pluginName}: ${error2}`);
|
|
45634
|
-
return null;
|
|
45635
|
-
}
|
|
45636
|
-
}
|
|
45637
|
-
resolvePluginDependencies(availablePlugins, isTestMode = false) {
|
|
45638
|
-
const resolutionOrder = [];
|
|
45639
|
-
const visited = new Set;
|
|
45640
|
-
const visiting = new Set;
|
|
45641
|
-
function visit2(pluginName) {
|
|
45642
|
-
if (!availablePlugins.has(pluginName)) {
|
|
45643
|
-
logger31.warn(`Plugin dependency "${pluginName}" not found and will be skipped.`);
|
|
45644
|
-
return;
|
|
45645
|
-
}
|
|
45646
|
-
if (visited.has(pluginName))
|
|
45647
|
-
return;
|
|
45648
|
-
if (visiting.has(pluginName)) {
|
|
45649
|
-
logger31.error(`Circular dependency detected involving plugin: ${pluginName}`);
|
|
45650
|
-
return;
|
|
45651
|
-
}
|
|
45652
|
-
visiting.add(pluginName);
|
|
45653
|
-
const plugin = availablePlugins.get(pluginName);
|
|
45654
|
-
if (plugin) {
|
|
45655
|
-
const deps = [...plugin.dependencies || []];
|
|
45656
|
-
if (isTestMode) {
|
|
45657
|
-
deps.push(...plugin.testDependencies || []);
|
|
45658
|
-
}
|
|
45659
|
-
for (const dep of deps) {
|
|
45660
|
-
visit2(dep);
|
|
45661
|
-
}
|
|
45662
|
-
}
|
|
45663
|
-
visiting.delete(pluginName);
|
|
45664
|
-
visited.add(pluginName);
|
|
45665
|
-
resolutionOrder.push(pluginName);
|
|
45666
|
-
}
|
|
45667
|
-
for (const name of availablePlugins.keys()) {
|
|
45668
|
-
if (!visited.has(name)) {
|
|
45669
|
-
visit2(name);
|
|
45670
|
-
}
|
|
45671
|
-
}
|
|
45672
|
-
const finalPlugins = resolutionOrder.map((name) => availablePlugins.get(name)).filter((p) => p);
|
|
45673
|
-
logger31.info({ plugins: finalPlugins.map((p) => p.name) }, `Final plugins being loaded:`);
|
|
45674
|
-
return finalPlugins;
|
|
45675
|
-
}
|
|
45676
|
-
}
|
|
45677
|
-
|
|
45678
|
-
// src/managers/ConfigManager.ts
|
|
45679
|
-
var import_dotenv2 = __toESM(require_main(), 1);
|
|
45680
|
-
import * as fs6 from "node:fs";
|
|
45681
|
-
import * as path8 from "node:path";
|
|
45682
|
-
|
|
45683
|
-
class ConfigManager {
|
|
45684
|
-
async loadEnvConfig() {
|
|
45685
|
-
const envPath = this.findEnvFile();
|
|
45686
|
-
if (envPath) {
|
|
45687
|
-
import_dotenv2.default.config({ path: envPath });
|
|
45688
|
-
}
|
|
45689
|
-
return process.env;
|
|
45690
|
-
}
|
|
45691
|
-
findEnvFile() {
|
|
45692
|
-
const possiblePaths = [
|
|
45693
|
-
path8.join(process.cwd(), ".env"),
|
|
45694
|
-
path8.join(process.cwd(), ".env.local")
|
|
45695
|
-
];
|
|
45696
|
-
for (const envPath of possiblePaths) {
|
|
45697
|
-
if (fs6.existsSync(envPath)) {
|
|
45698
|
-
return envPath;
|
|
45699
|
-
}
|
|
45700
|
-
}
|
|
45701
|
-
return null;
|
|
45702
|
-
}
|
|
45703
|
-
hasCharacterSecrets(character) {
|
|
45704
|
-
return Boolean(character?.settings?.secrets && Object.keys(character.settings.secrets).length > 0);
|
|
45705
|
-
}
|
|
45706
|
-
ensureCharacterSettings(character) {
|
|
45707
|
-
if (!character.settings) {
|
|
45708
|
-
character.settings = {};
|
|
45709
|
-
}
|
|
45710
|
-
}
|
|
45711
|
-
async loadLocalEnvSecrets() {
|
|
45712
|
-
const envPath = this.findEnvFile();
|
|
45713
|
-
if (!envPath)
|
|
45714
|
-
return null;
|
|
45715
|
-
try {
|
|
45716
|
-
const buf = fs6.readFileSync(envPath);
|
|
45717
|
-
return import_dotenv2.default.parse(buf);
|
|
45718
|
-
} catch {
|
|
45719
|
-
return null;
|
|
45720
|
-
}
|
|
45721
|
-
}
|
|
45722
|
-
async setDefaultSecretsFromEnv(character) {
|
|
45723
|
-
this.ensureCharacterSettings(character);
|
|
45724
|
-
if (this.hasCharacterSecrets(character)) {
|
|
45725
|
-
return false;
|
|
45726
|
-
}
|
|
45727
|
-
const envSecrets = await this.loadLocalEnvSecrets();
|
|
45728
|
-
if (!envSecrets) {
|
|
45729
|
-
return false;
|
|
45730
|
-
}
|
|
45731
|
-
if (!character.settings) {
|
|
45732
|
-
character.settings = {};
|
|
45733
|
-
}
|
|
45734
|
-
character.settings.secrets = envSecrets;
|
|
45735
|
-
return true;
|
|
45736
|
-
}
|
|
45737
|
-
}
|
|
45738
|
-
|
|
45739
|
-
// src/index.ts
|
|
45740
45791
|
import { encryptedCharacter, stringToUuid as stringToUuid2 } from "@elizaos/core";
|
|
45741
|
-
import { existsSync as
|
|
45742
|
-
var
|
|
45792
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
45793
|
+
var import_dotenv2 = __toESM(require_main(), 1);
|
|
45743
45794
|
import { ElizaOS as ElizaOS3 } from "@elizaos/core";
|
|
45744
45795
|
function expandTildePath(filepath) {
|
|
45745
45796
|
if (!filepath) {
|
|
@@ -45749,19 +45800,19 @@ function expandTildePath(filepath) {
|
|
|
45749
45800
|
if (filepath === "~") {
|
|
45750
45801
|
return process.cwd();
|
|
45751
45802
|
} else if (filepath.startsWith("~/")) {
|
|
45752
|
-
return
|
|
45803
|
+
return path8.join(process.cwd(), filepath.slice(2));
|
|
45753
45804
|
} else if (filepath.startsWith("~~")) {
|
|
45754
45805
|
return filepath;
|
|
45755
45806
|
} else {
|
|
45756
|
-
return
|
|
45807
|
+
return path8.join(process.cwd(), filepath.slice(1));
|
|
45757
45808
|
}
|
|
45758
45809
|
}
|
|
45759
45810
|
return filepath;
|
|
45760
45811
|
}
|
|
45761
45812
|
function resolvePgliteDir(dir, fallbackDir) {
|
|
45762
45813
|
const envPath = resolveEnvFile();
|
|
45763
|
-
if (
|
|
45764
|
-
|
|
45814
|
+
if (existsSync4(envPath)) {
|
|
45815
|
+
import_dotenv2.default.config({ path: envPath });
|
|
45765
45816
|
}
|
|
45766
45817
|
if (dir) {
|
|
45767
45818
|
const resolved2 = expandTildePath(dir);
|
|
@@ -45796,65 +45847,26 @@ class AgentServer {
|
|
|
45796
45847
|
isWebUIEnabled = true;
|
|
45797
45848
|
clientPath;
|
|
45798
45849
|
elizaOS;
|
|
45799
|
-
pluginLoader;
|
|
45800
|
-
configManager;
|
|
45801
45850
|
database;
|
|
45802
45851
|
loadCharacterTryPath;
|
|
45803
45852
|
jsonToCharacter;
|
|
45804
45853
|
async startAgents(characters, plugins = []) {
|
|
45805
|
-
if (!this.elizaOS
|
|
45854
|
+
if (!this.elizaOS) {
|
|
45806
45855
|
throw new Error("Server not properly initialized");
|
|
45807
45856
|
}
|
|
45808
|
-
const
|
|
45857
|
+
const agentConfigs = characters.map((character) => {
|
|
45809
45858
|
character.id ??= stringToUuid2(character.name);
|
|
45810
|
-
|
|
45811
|
-
|
|
45812
|
-
|
|
45813
|
-
|
|
45814
|
-
|
|
45815
|
-
|
|
45816
|
-
|
|
45817
|
-
|
|
45818
|
-
|
|
45819
|
-
|
|
45820
|
-
|
|
45821
|
-
pluginsToLoad.add(dep);
|
|
45822
|
-
});
|
|
45823
|
-
}
|
|
45824
|
-
}
|
|
45825
|
-
const allAvailablePlugins = new Map;
|
|
45826
|
-
for (const p of loadedPlugins.values()) {
|
|
45827
|
-
allAvailablePlugins.set(p.name, p);
|
|
45828
|
-
}
|
|
45829
|
-
for (const name of pluginsToLoad) {
|
|
45830
|
-
if (!allAvailablePlugins.has(name)) {
|
|
45831
|
-
const loaded = await this.pluginLoader?.loadAndPreparePlugin(name);
|
|
45832
|
-
if (loaded) {
|
|
45833
|
-
allAvailablePlugins.set(loaded.name, loaded);
|
|
45834
|
-
}
|
|
45835
|
-
}
|
|
45836
|
-
}
|
|
45837
|
-
let haveSql = false;
|
|
45838
|
-
for (const [name] of allAvailablePlugins.entries()) {
|
|
45839
|
-
if (name === sqlPlugin.name || name === "mysql") {
|
|
45840
|
-
haveSql = true;
|
|
45841
|
-
break;
|
|
45842
|
-
}
|
|
45843
|
-
}
|
|
45844
|
-
if (!haveSql) {
|
|
45845
|
-
allAvailablePlugins.set(sqlPlugin.name, sqlPlugin);
|
|
45846
|
-
}
|
|
45847
|
-
allAvailablePlugins.set(messageBusConnectorPlugin.name, messageBusConnectorPlugin);
|
|
45848
|
-
const finalPlugins = this.pluginLoader?.resolvePluginDependencies(allAvailablePlugins, false);
|
|
45849
|
-
const preparedCharacter = encryptedCharacter(character);
|
|
45850
|
-
return { character: preparedCharacter, plugins: finalPlugins };
|
|
45851
|
-
}));
|
|
45852
|
-
const settings = await this.configManager?.loadEnvConfig();
|
|
45853
|
-
const agentIds = await this.elizaOS.addAgents(preparations.map((p) => ({
|
|
45854
|
-
character: p.character,
|
|
45855
|
-
plugins: p.plugins,
|
|
45856
|
-
settings: settings || {}
|
|
45857
|
-
})));
|
|
45859
|
+
const allPlugins = [
|
|
45860
|
+
...character.plugins || [],
|
|
45861
|
+
...plugins,
|
|
45862
|
+
sqlPlugin
|
|
45863
|
+
];
|
|
45864
|
+
return {
|
|
45865
|
+
character: encryptedCharacter(character),
|
|
45866
|
+
plugins: allPlugins
|
|
45867
|
+
};
|
|
45868
|
+
});
|
|
45869
|
+
const agentIds = await this.elizaOS.addAgents(agentConfigs);
|
|
45858
45870
|
await this.elizaOS.startAgents(agentIds);
|
|
45859
45871
|
const runtimes = [];
|
|
45860
45872
|
for (const id of agentIds) {
|
|
@@ -45869,10 +45881,10 @@ class AgentServer {
|
|
|
45869
45881
|
...runtime.character,
|
|
45870
45882
|
id: runtime.agentId
|
|
45871
45883
|
});
|
|
45872
|
-
|
|
45884
|
+
logger30.info(`Persisted agent ${runtime.character.name} (${runtime.agentId}) to database`);
|
|
45873
45885
|
}
|
|
45874
45886
|
} catch (error2) {
|
|
45875
|
-
|
|
45887
|
+
logger30.error({ error: error2 }, `Failed to persist agent ${runtime.agentId} to database`);
|
|
45876
45888
|
}
|
|
45877
45889
|
}
|
|
45878
45890
|
runtimes.push(runtime);
|
|
@@ -45900,28 +45912,28 @@ class AgentServer {
|
|
|
45900
45912
|
}
|
|
45901
45913
|
constructor() {
|
|
45902
45914
|
try {
|
|
45903
|
-
|
|
45915
|
+
logger30.debug("Initializing AgentServer (constructor)...");
|
|
45904
45916
|
this.loadCharacterTryPath = loadCharacterTryPath;
|
|
45905
45917
|
this.jsonToCharacter = jsonToCharacter;
|
|
45906
45918
|
this.registerSignalHandlers();
|
|
45907
45919
|
} catch (error2) {
|
|
45908
|
-
|
|
45920
|
+
logger30.error({ error: error2 }, "Failed to initialize AgentServer (constructor):");
|
|
45909
45921
|
throw error2;
|
|
45910
45922
|
}
|
|
45911
45923
|
}
|
|
45912
45924
|
async initialize(options) {
|
|
45913
45925
|
if (this.isInitialized) {
|
|
45914
|
-
|
|
45926
|
+
logger30.warn("AgentServer is already initialized, skipping initialization");
|
|
45915
45927
|
return;
|
|
45916
45928
|
}
|
|
45917
45929
|
try {
|
|
45918
|
-
|
|
45930
|
+
logger30.debug("Initializing AgentServer (async operations)...");
|
|
45919
45931
|
const agentDataDir = resolvePgliteDir(options?.dataDir);
|
|
45920
|
-
|
|
45921
|
-
const dbDir =
|
|
45922
|
-
if (!
|
|
45923
|
-
|
|
45924
|
-
|
|
45932
|
+
logger30.info(`[INIT] Database Dir for SQL plugin: ${agentDataDir}`);
|
|
45933
|
+
const dbDir = path8.dirname(agentDataDir);
|
|
45934
|
+
if (!fs6.existsSync(dbDir)) {
|
|
45935
|
+
fs6.mkdirSync(dbDir, { recursive: true });
|
|
45936
|
+
logger30.info(`[INIT] Created database directory: ${dbDir}`);
|
|
45925
45937
|
}
|
|
45926
45938
|
const tempServerAgentId = "00000000-0000-0000-0000-000000000000";
|
|
45927
45939
|
this.database = createDatabaseAdapter({
|
|
@@ -45929,90 +45941,88 @@ class AgentServer {
|
|
|
45929
45941
|
postgresUrl: options?.postgresUrl
|
|
45930
45942
|
}, tempServerAgentId);
|
|
45931
45943
|
await this.database.init();
|
|
45932
|
-
|
|
45933
|
-
|
|
45944
|
+
logger30.success("Database initialized for server operations");
|
|
45945
|
+
logger30.info("[INIT] Running database migrations for messaging tables...");
|
|
45934
45946
|
try {
|
|
45935
45947
|
const migrationService = new DatabaseMigrationService;
|
|
45936
45948
|
const db = this.database.getDatabase();
|
|
45937
45949
|
await migrationService.initializeWithDatabase(db);
|
|
45938
45950
|
migrationService.discoverAndRegisterPluginSchemas([sqlPlugin]);
|
|
45939
45951
|
await migrationService.runAllPluginMigrations();
|
|
45940
|
-
|
|
45952
|
+
logger30.success("[INIT] Database migrations completed successfully");
|
|
45941
45953
|
} catch (migrationError) {
|
|
45942
|
-
|
|
45954
|
+
logger30.error({ error: migrationError }, "[INIT] Failed to run database migrations:");
|
|
45943
45955
|
throw new Error(`Database migration failed: ${migrationError instanceof Error ? migrationError.message : String(migrationError)}`);
|
|
45944
45956
|
}
|
|
45945
45957
|
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
45946
|
-
|
|
45958
|
+
logger30.info("[INIT] Ensuring default server exists...");
|
|
45947
45959
|
await this.ensureDefaultServer();
|
|
45948
|
-
|
|
45949
|
-
|
|
45950
|
-
|
|
45951
|
-
|
|
45960
|
+
logger30.success("[INIT] Default server setup complete");
|
|
45961
|
+
logger30.info("[INIT] Server uses temporary adapter for migrations only");
|
|
45962
|
+
logger30.info("[INIT] Initializing ElizaOS...");
|
|
45963
|
+
logger30.debug("[INIT] ElizaOS will use agent-specific database adapters from SQL plugin");
|
|
45952
45964
|
this.elizaOS = new ElizaOS2;
|
|
45953
45965
|
this.elizaOS.enableEditableMode();
|
|
45954
|
-
|
|
45955
|
-
this.configManager = new ConfigManager;
|
|
45956
|
-
logger32.success("[INIT] ElizaOS initialized");
|
|
45966
|
+
logger30.success("[INIT] ElizaOS initialized");
|
|
45957
45967
|
await this.initializeServer(options);
|
|
45958
45968
|
await new Promise((resolve2) => setTimeout(resolve2, 250));
|
|
45959
45969
|
this.isInitialized = true;
|
|
45960
45970
|
} catch (error2) {
|
|
45961
|
-
|
|
45971
|
+
logger30.error({ error: error2 }, "Failed to initialize AgentServer (async operations):");
|
|
45962
45972
|
console.trace(error2);
|
|
45963
45973
|
throw error2;
|
|
45964
45974
|
}
|
|
45965
45975
|
}
|
|
45966
45976
|
async ensureDefaultServer() {
|
|
45967
45977
|
try {
|
|
45968
|
-
|
|
45978
|
+
logger30.info("[AgentServer] Checking for default server...");
|
|
45969
45979
|
const servers = await this.database.getMessageServers();
|
|
45970
|
-
|
|
45980
|
+
logger30.debug(`[AgentServer] Found ${servers.length} existing servers`);
|
|
45971
45981
|
servers.forEach((s) => {
|
|
45972
|
-
|
|
45982
|
+
logger30.debug(`[AgentServer] Existing server: ID=${s.id}, Name=${s.name}`);
|
|
45973
45983
|
});
|
|
45974
45984
|
const defaultServer = servers.find((s) => s.id === "00000000-0000-0000-0000-000000000000");
|
|
45975
45985
|
if (!defaultServer) {
|
|
45976
|
-
|
|
45986
|
+
logger30.info("[AgentServer] Creating default server with UUID 00000000-0000-0000-0000-000000000000...");
|
|
45977
45987
|
try {
|
|
45978
45988
|
await this.database.db.execute(`
|
|
45979
45989
|
INSERT INTO message_servers (id, name, source_type, created_at, updated_at)
|
|
45980
45990
|
VALUES ('00000000-0000-0000-0000-000000000000', 'Default Server', 'eliza_default', NOW(), NOW())
|
|
45981
45991
|
ON CONFLICT (id) DO NOTHING
|
|
45982
45992
|
`);
|
|
45983
|
-
|
|
45993
|
+
logger30.success("[AgentServer] Default server created via raw SQL");
|
|
45984
45994
|
const checkResult = await this.database.db.execute("SELECT id, name FROM message_servers WHERE id = '00000000-0000-0000-0000-000000000000'");
|
|
45985
|
-
|
|
45995
|
+
logger30.debug("[AgentServer] Raw SQL check result:", checkResult);
|
|
45986
45996
|
} catch (sqlError) {
|
|
45987
|
-
|
|
45997
|
+
logger30.error("[AgentServer] Raw SQL insert failed:", sqlError);
|
|
45988
45998
|
try {
|
|
45989
45999
|
const server = await this.database.createMessageServer({
|
|
45990
46000
|
id: "00000000-0000-0000-0000-000000000000",
|
|
45991
46001
|
name: "Default Server",
|
|
45992
46002
|
sourceType: "eliza_default"
|
|
45993
46003
|
});
|
|
45994
|
-
|
|
46004
|
+
logger30.success("[AgentServer] Default server created via ORM with ID:", server.id);
|
|
45995
46005
|
} catch (ormError) {
|
|
45996
|
-
|
|
46006
|
+
logger30.error("[AgentServer] Both SQL and ORM creation failed:", ormError);
|
|
45997
46007
|
throw new Error(`Failed to create default server: ${ormError.message}`);
|
|
45998
46008
|
}
|
|
45999
46009
|
}
|
|
46000
46010
|
const verifyServers = await this.database.getMessageServers();
|
|
46001
|
-
|
|
46011
|
+
logger30.debug(`[AgentServer] After creation attempt, found ${verifyServers.length} servers`);
|
|
46002
46012
|
verifyServers.forEach((s) => {
|
|
46003
|
-
|
|
46013
|
+
logger30.debug(`[AgentServer] Server after creation: ID=${s.id}, Name=${s.name}`);
|
|
46004
46014
|
});
|
|
46005
46015
|
const verifyDefault = verifyServers.find((s) => s.id === "00000000-0000-0000-0000-000000000000");
|
|
46006
46016
|
if (!verifyDefault) {
|
|
46007
46017
|
throw new Error(`Failed to create or verify default server with ID ${DEFAULT_SERVER_ID6}`);
|
|
46008
46018
|
} else {
|
|
46009
|
-
|
|
46019
|
+
logger30.success("[AgentServer] Default server creation verified successfully");
|
|
46010
46020
|
}
|
|
46011
46021
|
} else {
|
|
46012
|
-
|
|
46022
|
+
logger30.info("[AgentServer] Default server already exists with ID:", defaultServer.id);
|
|
46013
46023
|
}
|
|
46014
46024
|
} catch (error2) {
|
|
46015
|
-
|
|
46025
|
+
logger30.error({ error: error2 }, "[AgentServer] Error ensuring default server:");
|
|
46016
46026
|
throw error2;
|
|
46017
46027
|
}
|
|
46018
46028
|
}
|
|
@@ -46033,16 +46043,16 @@ class AgentServer {
|
|
|
46033
46043
|
integrations: [vercelAIIntegration({ force: sentryEnabled })],
|
|
46034
46044
|
tracesSampleRate: Number(process.env.SENTRY_TRACES_SAMPLE_RATE || 0)
|
|
46035
46045
|
});
|
|
46036
|
-
|
|
46046
|
+
logger30.info("[Sentry] Initialized Sentry for @elizaos/server");
|
|
46037
46047
|
} catch (sentryInitError) {
|
|
46038
|
-
|
|
46048
|
+
logger30.error({ error: sentryInitError }, "[Sentry] Failed to initialize Sentry");
|
|
46039
46049
|
}
|
|
46040
46050
|
}
|
|
46041
46051
|
const isProd = false;
|
|
46042
|
-
|
|
46052
|
+
logger30.debug("Setting up security headers...");
|
|
46043
46053
|
if (!isProd) {
|
|
46044
|
-
|
|
46045
|
-
|
|
46054
|
+
logger30.debug(`NODE_ENV: ${"development"}`);
|
|
46055
|
+
logger30.debug(`CSP will be: ${isProd ? "ENABLED" : "MINIMAL_DEV"}`);
|
|
46046
46056
|
}
|
|
46047
46057
|
this.app.use(helmet({
|
|
46048
46058
|
contentSecurityPolicy: isProd ? {
|
|
@@ -46090,12 +46100,12 @@ class AgentServer {
|
|
|
46090
46100
|
xssFilter: true
|
|
46091
46101
|
}));
|
|
46092
46102
|
if (options?.middlewares) {
|
|
46093
|
-
|
|
46103
|
+
logger30.debug("Applying custom middlewares...");
|
|
46094
46104
|
for (const middleware2 of options.middlewares) {
|
|
46095
46105
|
this.app.use(middleware2);
|
|
46096
46106
|
}
|
|
46097
46107
|
}
|
|
46098
|
-
|
|
46108
|
+
logger30.debug("Setting up standard middlewares...");
|
|
46099
46109
|
this.app.use(cors2({
|
|
46100
46110
|
origin: process.env.CORS_ORIGIN || true,
|
|
46101
46111
|
credentials: true,
|
|
@@ -46107,28 +46117,28 @@ class AgentServer {
|
|
|
46107
46117
|
}));
|
|
46108
46118
|
const serverAuthToken = process.env.ELIZA_SERVER_AUTH_TOKEN;
|
|
46109
46119
|
if (serverAuthToken) {
|
|
46110
|
-
|
|
46120
|
+
logger30.info("Server authentication enabled. Requires X-API-KEY header for /api routes.");
|
|
46111
46121
|
this.app.use("/api", (req, res, next) => {
|
|
46112
46122
|
apiKeyAuthMiddleware(req, res, next);
|
|
46113
46123
|
});
|
|
46114
46124
|
} else {
|
|
46115
|
-
|
|
46125
|
+
logger30.warn("Server authentication is disabled. Set ELIZA_SERVER_AUTH_TOKEN environment variable to enable.");
|
|
46116
46126
|
}
|
|
46117
46127
|
this.isWebUIEnabled = isWebUIEnabled();
|
|
46118
46128
|
if (this.isWebUIEnabled) {
|
|
46119
|
-
|
|
46129
|
+
logger30.info("Web UI enabled");
|
|
46120
46130
|
} else {
|
|
46121
46131
|
const uiEnabledEnv = process.env.ELIZA_UI_ENABLE;
|
|
46122
46132
|
if (uiEnabledEnv !== undefined && uiEnabledEnv.trim() !== "") {
|
|
46123
|
-
|
|
46133
|
+
logger30.info(`Web UI disabled by environment variable (ELIZA_UI_ENABLE=${uiEnabledEnv})`);
|
|
46124
46134
|
} else {
|
|
46125
|
-
|
|
46135
|
+
logger30.info("Web UI disabled for security (production mode)");
|
|
46126
46136
|
}
|
|
46127
46137
|
}
|
|
46128
46138
|
const uploadsBasePath = getUploadsAgentsDir4();
|
|
46129
46139
|
const generatedBasePath = getGeneratedDir2();
|
|
46130
|
-
|
|
46131
|
-
|
|
46140
|
+
fs6.mkdirSync(uploadsBasePath, { recursive: true });
|
|
46141
|
+
fs6.mkdirSync(generatedBasePath, { recursive: true });
|
|
46132
46142
|
this.app.get("/media/uploads/agents/:agentId/:filename", (req, res) => {
|
|
46133
46143
|
const agentId = req.params.agentId;
|
|
46134
46144
|
const filename = req.params.filename;
|
|
@@ -46138,26 +46148,26 @@ class AgentServer {
|
|
|
46138
46148
|
return;
|
|
46139
46149
|
}
|
|
46140
46150
|
const sanitizedFilename = basename2(filename);
|
|
46141
|
-
const agentUploadsPath =
|
|
46142
|
-
const filePath =
|
|
46151
|
+
const agentUploadsPath = join4(uploadsBasePath, agentId);
|
|
46152
|
+
const filePath = join4(agentUploadsPath, sanitizedFilename);
|
|
46143
46153
|
if (!filePath.startsWith(agentUploadsPath)) {
|
|
46144
46154
|
res.status(403).json({ error: "Access denied" });
|
|
46145
46155
|
return;
|
|
46146
46156
|
}
|
|
46147
|
-
if (!
|
|
46157
|
+
if (!fs6.existsSync(filePath)) {
|
|
46148
46158
|
res.status(404).json({ error: "File does not exist!!!!!!!" });
|
|
46149
46159
|
return;
|
|
46150
46160
|
}
|
|
46151
46161
|
res.sendFile(sanitizedFilename, { root: agentUploadsPath }, (err) => {
|
|
46152
46162
|
if (err) {
|
|
46153
46163
|
if (err.message === "Request aborted") {
|
|
46154
|
-
|
|
46164
|
+
logger30.warn(`[MEDIA] Download aborted: ${req.originalUrl}`);
|
|
46155
46165
|
} else if (!res.headersSent) {
|
|
46156
|
-
|
|
46166
|
+
logger30.warn(`[MEDIA] File not found: ${agentUploadsPath}/${sanitizedFilename}`);
|
|
46157
46167
|
res.status(404).json({ error: "File not found" });
|
|
46158
46168
|
}
|
|
46159
46169
|
} else {
|
|
46160
|
-
|
|
46170
|
+
logger30.debug(`[MEDIA] Successfully served: ${sanitizedFilename}`);
|
|
46161
46171
|
}
|
|
46162
46172
|
});
|
|
46163
46173
|
});
|
|
@@ -46170,17 +46180,17 @@ class AgentServer {
|
|
|
46170
46180
|
return;
|
|
46171
46181
|
}
|
|
46172
46182
|
const sanitizedFilename = basename2(filename);
|
|
46173
|
-
const agentGeneratedPath =
|
|
46174
|
-
const filePath =
|
|
46183
|
+
const agentGeneratedPath = join4(generatedBasePath, agentId);
|
|
46184
|
+
const filePath = join4(agentGeneratedPath, sanitizedFilename);
|
|
46175
46185
|
if (!filePath.startsWith(agentGeneratedPath)) {
|
|
46176
46186
|
res.status(403).json({ error: "Access denied" });
|
|
46177
46187
|
return;
|
|
46178
46188
|
}
|
|
46179
|
-
if (!
|
|
46189
|
+
if (!existsSync4(filePath)) {
|
|
46180
46190
|
res.status(404).json({ error: "File not found" });
|
|
46181
46191
|
return;
|
|
46182
46192
|
}
|
|
46183
|
-
const absolutePath =
|
|
46193
|
+
const absolutePath = path8.resolve(filePath);
|
|
46184
46194
|
const options2 = {
|
|
46185
46195
|
dotfiles: "deny"
|
|
46186
46196
|
};
|
|
@@ -46189,7 +46199,7 @@ class AgentServer {
|
|
|
46189
46199
|
const ext2 = extname(filename).toLowerCase();
|
|
46190
46200
|
const mimeType = ext2 === ".png" ? "image/png" : ext2 === ".jpg" || ext2 === ".jpeg" ? "image/jpeg" : "application/octet-stream";
|
|
46191
46201
|
res.setHeader("Content-Type", mimeType);
|
|
46192
|
-
const stream =
|
|
46202
|
+
const stream = fs6.createReadStream(absolutePath);
|
|
46193
46203
|
stream.on("error", () => res.status(404).json({ error: "File not found" }));
|
|
46194
46204
|
stream.pipe(res);
|
|
46195
46205
|
}
|
|
@@ -46204,20 +46214,20 @@ class AgentServer {
|
|
|
46204
46214
|
return;
|
|
46205
46215
|
}
|
|
46206
46216
|
const sanitizedFilename = basename2(filename);
|
|
46207
|
-
const channelUploadsPath =
|
|
46208
|
-
const filePath =
|
|
46217
|
+
const channelUploadsPath = join4(uploadsBasePath, "channels", channelId);
|
|
46218
|
+
const filePath = join4(channelUploadsPath, sanitizedFilename);
|
|
46209
46219
|
if (!filePath.startsWith(channelUploadsPath)) {
|
|
46210
46220
|
res.status(403).json({ error: "Access denied" });
|
|
46211
46221
|
return;
|
|
46212
46222
|
}
|
|
46213
46223
|
res.sendFile(filePath, (err) => {
|
|
46214
46224
|
if (err) {
|
|
46215
|
-
|
|
46225
|
+
logger30.warn({ err, filePath }, `[STATIC] Channel media file not found: ${filePath}`);
|
|
46216
46226
|
if (!res.headersSent) {
|
|
46217
46227
|
res.status(404).json({ error: "File not found" });
|
|
46218
46228
|
}
|
|
46219
46229
|
} else {
|
|
46220
|
-
|
|
46230
|
+
logger30.debug(`[STATIC] Served channel media file: ${filePath}`);
|
|
46221
46231
|
}
|
|
46222
46232
|
});
|
|
46223
46233
|
});
|
|
@@ -46261,11 +46271,11 @@ class AgentServer {
|
|
|
46261
46271
|
if (this.isWebUIEnabled) {
|
|
46262
46272
|
const possiblePaths = [
|
|
46263
46273
|
this.clientPath,
|
|
46264
|
-
|
|
46265
|
-
|
|
46274
|
+
path8.resolve(__dirname3, "client"),
|
|
46275
|
+
path8.resolve(__dirname3, "../../client/dist"),
|
|
46266
46276
|
(() => {
|
|
46267
46277
|
try {
|
|
46268
|
-
return
|
|
46278
|
+
return path8.resolve(path8.dirname(__require.resolve("@elizaos/client/package.json")), "dist");
|
|
46269
46279
|
} catch {
|
|
46270
46280
|
return null;
|
|
46271
46281
|
}
|
|
@@ -46273,12 +46283,12 @@ class AgentServer {
|
|
|
46273
46283
|
(() => {
|
|
46274
46284
|
try {
|
|
46275
46285
|
if (process.argv[1]) {
|
|
46276
|
-
const serverPath =
|
|
46277
|
-
const possibleClientPath =
|
|
46278
|
-
if (
|
|
46286
|
+
const serverPath = path8.dirname(process.argv[1]);
|
|
46287
|
+
const possibleClientPath = path8.join(serverPath, "client");
|
|
46288
|
+
if (existsSync4(path8.join(possibleClientPath, "index.html"))) {
|
|
46279
46289
|
return possibleClientPath;
|
|
46280
46290
|
}
|
|
46281
|
-
if (
|
|
46291
|
+
if (existsSync4(path8.join(serverPath, "index.html"))) {
|
|
46282
46292
|
return serverPath;
|
|
46283
46293
|
}
|
|
46284
46294
|
}
|
|
@@ -46287,8 +46297,8 @@ class AgentServer {
|
|
|
46287
46297
|
})(),
|
|
46288
46298
|
(() => {
|
|
46289
46299
|
try {
|
|
46290
|
-
const bunGlobalPath =
|
|
46291
|
-
if (
|
|
46300
|
+
const bunGlobalPath = path8.join(os3.homedir(), ".bun/install/global/node_modules/@elizaos/server/dist/client");
|
|
46301
|
+
if (existsSync4(path8.join(bunGlobalPath, "index.html"))) {
|
|
46292
46302
|
return bunGlobalPath;
|
|
46293
46303
|
}
|
|
46294
46304
|
try {
|
|
@@ -46298,8 +46308,8 @@ class AgentServer {
|
|
|
46298
46308
|
});
|
|
46299
46309
|
if (proc.exitCode === 0 && proc.stdout) {
|
|
46300
46310
|
const npmRoot = new TextDecoder().decode(proc.stdout).trim();
|
|
46301
|
-
const globalServerPath =
|
|
46302
|
-
if (
|
|
46311
|
+
const globalServerPath = path8.join(npmRoot, "@elizaos/server/dist/client");
|
|
46312
|
+
if (existsSync4(path8.join(globalServerPath, "index.html"))) {
|
|
46303
46313
|
return globalServerPath;
|
|
46304
46314
|
}
|
|
46305
46315
|
}
|
|
@@ -46310,15 +46320,15 @@ class AgentServer {
|
|
|
46310
46320
|
...[
|
|
46311
46321
|
"/usr/local/lib/node_modules/@elizaos/server/dist/client",
|
|
46312
46322
|
"/usr/lib/node_modules/@elizaos/server/dist/client",
|
|
46313
|
-
|
|
46323
|
+
path8.join(os3.homedir(), ".npm-global/lib/node_modules/@elizaos/server/dist/client"),
|
|
46314
46324
|
(() => {
|
|
46315
46325
|
try {
|
|
46316
|
-
const nvmPath =
|
|
46317
|
-
if (
|
|
46318
|
-
const versions =
|
|
46326
|
+
const nvmPath = path8.join(os3.homedir(), ".nvm/versions/node");
|
|
46327
|
+
if (existsSync4(nvmPath)) {
|
|
46328
|
+
const versions = fs6.readdirSync(nvmPath);
|
|
46319
46329
|
for (const version of versions) {
|
|
46320
|
-
const cliPath =
|
|
46321
|
-
if (
|
|
46330
|
+
const cliPath = path8.join(nvmPath, version, "lib/node_modules/@elizaos/server/dist/client");
|
|
46331
|
+
if (existsSync4(path8.join(cliPath, "index.html"))) {
|
|
46322
46332
|
return cliPath;
|
|
46323
46333
|
}
|
|
46324
46334
|
}
|
|
@@ -46328,29 +46338,29 @@ class AgentServer {
|
|
|
46328
46338
|
})()
|
|
46329
46339
|
].filter(Boolean)
|
|
46330
46340
|
].filter(Boolean);
|
|
46331
|
-
|
|
46332
|
-
|
|
46333
|
-
|
|
46341
|
+
logger30.debug(`[STATIC] process.argv[0]: ${process.argv[0]}`);
|
|
46342
|
+
logger30.debug(`[STATIC] process.argv[1]: ${process.argv[1]}`);
|
|
46343
|
+
logger30.debug(`[STATIC] __dirname: ${__dirname3}`);
|
|
46334
46344
|
for (const possiblePath of possiblePaths) {
|
|
46335
|
-
if (possiblePath &&
|
|
46345
|
+
if (possiblePath && existsSync4(path8.join(possiblePath, "index.html"))) {
|
|
46336
46346
|
clientPath = possiblePath;
|
|
46337
|
-
|
|
46347
|
+
logger30.info(`[STATIC] Found client files at: ${clientPath}`);
|
|
46338
46348
|
break;
|
|
46339
46349
|
}
|
|
46340
46350
|
}
|
|
46341
46351
|
if (clientPath) {
|
|
46342
46352
|
this.clientPath = clientPath;
|
|
46343
46353
|
this.app.use(express33.static(clientPath, staticOptions));
|
|
46344
|
-
|
|
46354
|
+
logger30.info(`[STATIC] Serving static files from: ${clientPath}`);
|
|
46345
46355
|
} else {
|
|
46346
|
-
|
|
46356
|
+
logger30.warn("[STATIC] Client dist path not found. Searched locations:");
|
|
46347
46357
|
possiblePaths.forEach((p) => {
|
|
46348
46358
|
if (p)
|
|
46349
|
-
|
|
46359
|
+
logger30.warn(`[STATIC] - ${p}`);
|
|
46350
46360
|
});
|
|
46351
|
-
|
|
46352
|
-
|
|
46353
|
-
|
|
46361
|
+
logger30.warn("[STATIC] The web UI will not be available.");
|
|
46362
|
+
logger30.warn("[STATIC] To fix this, ensure the client is built: cd packages/client && bun run build");
|
|
46363
|
+
logger30.warn("[STATIC] Then rebuild the server: cd packages/server && bun run build");
|
|
46354
46364
|
}
|
|
46355
46365
|
}
|
|
46356
46366
|
const pluginRouteHandler = createPluginRouteHandler(this.elizaOS);
|
|
@@ -46358,7 +46368,7 @@ class AgentServer {
|
|
|
46358
46368
|
const apiRouter = createApiRouter(this.elizaOS, this);
|
|
46359
46369
|
this.app.use("/api", (req, _res, next) => {
|
|
46360
46370
|
if (req.path !== "/ping") {
|
|
46361
|
-
|
|
46371
|
+
logger30.debug(`API request: ${req.method} ${req.path}`);
|
|
46362
46372
|
}
|
|
46363
46373
|
next();
|
|
46364
46374
|
}, apiRouter, (err, req, res, _next) => {
|
|
@@ -46373,7 +46383,7 @@ class AgentServer {
|
|
|
46373
46383
|
return scope;
|
|
46374
46384
|
});
|
|
46375
46385
|
}
|
|
46376
|
-
|
|
46386
|
+
logger30.error({ err }, `API error: ${req.method} ${req.path}`);
|
|
46377
46387
|
res.status(500).json({
|
|
46378
46388
|
success: false,
|
|
46379
46389
|
error: {
|
|
@@ -46421,29 +46431,29 @@ class AgentServer {
|
|
|
46421
46431
|
}
|
|
46422
46432
|
const resolvedClientPath = clientPath || this.clientPath;
|
|
46423
46433
|
if (resolvedClientPath) {
|
|
46424
|
-
const indexFilePath =
|
|
46425
|
-
if (!
|
|
46426
|
-
|
|
46427
|
-
|
|
46434
|
+
const indexFilePath = path8.join(resolvedClientPath, "index.html");
|
|
46435
|
+
if (!existsSync4(indexFilePath)) {
|
|
46436
|
+
logger30.error(`[STATIC] index.html not found at expected path: ${indexFilePath}`);
|
|
46437
|
+
logger30.error(`[STATIC] Client path was: ${resolvedClientPath}`);
|
|
46428
46438
|
res.status(404).send("Client application not found");
|
|
46429
46439
|
return;
|
|
46430
46440
|
}
|
|
46431
46441
|
res.sendFile("index.html", { root: resolvedClientPath }, (err) => {
|
|
46432
46442
|
if (err) {
|
|
46433
|
-
|
|
46434
|
-
|
|
46435
|
-
|
|
46436
|
-
|
|
46443
|
+
logger30.warn(`[STATIC] Failed to serve index.html: ${err.message}`);
|
|
46444
|
+
logger30.warn(`[STATIC] Attempted root: ${resolvedClientPath}`);
|
|
46445
|
+
logger30.warn(`[STATIC] Full path was: ${indexFilePath}`);
|
|
46446
|
+
logger30.warn(`[STATIC] Error code: ${err.code || "unknown"}`);
|
|
46437
46447
|
if (!res.headersSent) {
|
|
46438
46448
|
res.status(404).send("Client application not found");
|
|
46439
46449
|
}
|
|
46440
46450
|
} else {
|
|
46441
|
-
|
|
46451
|
+
logger30.debug(`[STATIC] Successfully served index.html for route: ${req.path}`);
|
|
46442
46452
|
}
|
|
46443
46453
|
});
|
|
46444
46454
|
} else {
|
|
46445
|
-
|
|
46446
|
-
|
|
46455
|
+
logger30.warn("[STATIC] Client dist path not found in SPA fallback");
|
|
46456
|
+
logger30.warn("[STATIC] Neither local nor instance clientPath variables are set");
|
|
46447
46457
|
res.status(404).send("Client application not found");
|
|
46448
46458
|
}
|
|
46449
46459
|
});
|
|
@@ -46454,9 +46464,9 @@ class AgentServer {
|
|
|
46454
46464
|
}
|
|
46455
46465
|
this.server = http4.createServer(this.app);
|
|
46456
46466
|
this.socketIO = setupSocketIO(this.server, this.elizaOS, this);
|
|
46457
|
-
|
|
46467
|
+
logger30.success("AgentServer HTTP server and Socket.IO initialized");
|
|
46458
46468
|
} catch (error2) {
|
|
46459
|
-
|
|
46469
|
+
logger30.error({ error: error2 }, "Failed to complete server initialization:");
|
|
46460
46470
|
throw error2;
|
|
46461
46471
|
}
|
|
46462
46472
|
}
|
|
@@ -46471,64 +46481,63 @@ class AgentServer {
|
|
|
46471
46481
|
if (!runtime.character) {
|
|
46472
46482
|
throw new Error("Runtime missing character configuration");
|
|
46473
46483
|
}
|
|
46474
|
-
|
|
46484
|
+
logger30.debug(`Agent ${runtime.character.name} (${runtime.agentId}) registered`);
|
|
46475
46485
|
try {
|
|
46476
46486
|
if (messageBusConnectorPlugin) {
|
|
46477
46487
|
await runtime.registerPlugin(messageBusConnectorPlugin);
|
|
46478
|
-
|
|
46488
|
+
logger30.info(`[AgentServer] Registered MessageBusConnector for agent ${runtime.character.name}`);
|
|
46479
46489
|
} else {
|
|
46480
|
-
|
|
46490
|
+
logger30.error(`[AgentServer] CRITICAL: MessageBusConnector plugin definition not found.`);
|
|
46481
46491
|
}
|
|
46482
46492
|
} catch (e) {
|
|
46483
|
-
|
|
46493
|
+
logger30.error({ error: e }, `[AgentServer] CRITICAL: Failed to register MessageBusConnector for agent ${runtime.character.name}`);
|
|
46484
46494
|
}
|
|
46485
46495
|
const teePlugin = runtime.plugins.find((p) => p.name === "phala-tee-plugin");
|
|
46486
46496
|
if (teePlugin) {
|
|
46487
|
-
|
|
46497
|
+
logger30.debug(`Found TEE plugin for agent ${runtime.agentId}`);
|
|
46488
46498
|
if (teePlugin.providers) {
|
|
46489
46499
|
for (const provider of teePlugin.providers) {
|
|
46490
46500
|
runtime.registerProvider(provider);
|
|
46491
|
-
|
|
46501
|
+
logger30.debug(`Registered TEE provider: ${provider.name}`);
|
|
46492
46502
|
}
|
|
46493
46503
|
}
|
|
46494
46504
|
if (teePlugin.actions) {
|
|
46495
46505
|
for (const action of teePlugin.actions) {
|
|
46496
46506
|
runtime.registerAction(action);
|
|
46497
|
-
|
|
46507
|
+
logger30.debug(`Registered TEE action: ${action.name}`);
|
|
46498
46508
|
}
|
|
46499
46509
|
}
|
|
46500
46510
|
}
|
|
46501
|
-
|
|
46511
|
+
logger30.success(`Successfully registered agent ${runtime.character.name} (${runtime.agentId}) with core services.`);
|
|
46502
46512
|
await this.addAgentToServer(DEFAULT_SERVER_ID6, runtime.agentId);
|
|
46503
|
-
|
|
46513
|
+
logger30.info(`[AgentServer] Auto-associated agent ${runtime.character.name} with server ID: ${DEFAULT_SERVER_ID6}`);
|
|
46504
46514
|
} catch (error2) {
|
|
46505
|
-
|
|
46515
|
+
logger30.error({ error: error2 }, "Failed to register agent:");
|
|
46506
46516
|
throw error2;
|
|
46507
46517
|
}
|
|
46508
46518
|
}
|
|
46509
46519
|
async unregisterAgent(agentId) {
|
|
46510
46520
|
if (!agentId) {
|
|
46511
|
-
|
|
46521
|
+
logger30.warn("[AGENT UNREGISTER] Attempted to unregister undefined or invalid agent runtime");
|
|
46512
46522
|
return;
|
|
46513
46523
|
}
|
|
46514
46524
|
try {
|
|
46515
46525
|
const agent = this.elizaOS?.getAgent(agentId);
|
|
46516
46526
|
if (agent) {
|
|
46517
46527
|
try {
|
|
46518
|
-
|
|
46519
|
-
|
|
46520
|
-
});
|
|
46521
|
-
logger32.debug(`[AGENT UNREGISTER] Stopping services for agent ${agentId}`);
|
|
46528
|
+
logger30.debug(`[AGENT UNREGISTER] Stopping services for agent ${agentId}`);
|
|
46529
|
+
await agent.stop();
|
|
46530
|
+
logger30.debug(`[AGENT UNREGISTER] All services stopped for agent ${agentId}`);
|
|
46522
46531
|
} catch (stopError) {
|
|
46523
|
-
|
|
46532
|
+
logger30.error({ error: stopError, agentId }, `[AGENT UNREGISTER] Error stopping agent services for ${agentId}:`);
|
|
46524
46533
|
}
|
|
46525
46534
|
}
|
|
46526
46535
|
if (this.elizaOS) {
|
|
46527
46536
|
await this.elizaOS.deleteAgents([agentId]);
|
|
46528
46537
|
}
|
|
46529
|
-
|
|
46538
|
+
logger30.debug(`Agent ${agentId} unregistered`);
|
|
46530
46539
|
} catch (error2) {
|
|
46531
|
-
|
|
46540
|
+
logger30.error({ error: error2, agentId }, `Error removing agent ${agentId}:`);
|
|
46532
46541
|
}
|
|
46533
46542
|
}
|
|
46534
46543
|
registerMiddleware(middleware2) {
|
|
@@ -46540,9 +46549,9 @@ class AgentServer {
|
|
|
46540
46549
|
if (!port || typeof port !== "number") {
|
|
46541
46550
|
throw new Error(`Invalid port number: ${port}`);
|
|
46542
46551
|
}
|
|
46543
|
-
|
|
46544
|
-
|
|
46545
|
-
|
|
46552
|
+
logger30.debug(`Starting server on port ${port}...`);
|
|
46553
|
+
logger30.debug(`Current agents count: ${this.elizaOS?.getAgents().length || 0}`);
|
|
46554
|
+
logger30.debug(`Environment: ${"development"}`);
|
|
46546
46555
|
const host = process.env.SERVER_HOST || "0.0.0.0";
|
|
46547
46556
|
this.server.listen(port, host, () => {
|
|
46548
46557
|
if (this.isWebUIEnabled && false) {} else if (!this.isWebUIEnabled) {
|
|
@@ -46555,26 +46564,26 @@ class AgentServer {
|
|
|
46555
46564
|
` + ` \x1B[1m${baseUrl}/api/messaging\x1B[22m\x1B[0m`);
|
|
46556
46565
|
}
|
|
46557
46566
|
console.log(`AgentServer is listening on port ${port}`);
|
|
46558
|
-
|
|
46567
|
+
logger30.success(`REST API bound to ${host}:${port}. If running locally, access it at http://localhost:${port}.`);
|
|
46559
46568
|
const agents = this.elizaOS?.getAgents() || [];
|
|
46560
|
-
|
|
46569
|
+
logger30.debug(`Active agents: ${agents.length}`);
|
|
46561
46570
|
agents.forEach((agent) => {
|
|
46562
|
-
|
|
46571
|
+
logger30.debug(`- Agent ${agent.agentId}: ${agent.character.name}`);
|
|
46563
46572
|
});
|
|
46564
46573
|
resolve2();
|
|
46565
46574
|
}).on("error", (error2) => {
|
|
46566
|
-
|
|
46575
|
+
logger30.error({ error: error2, host, port }, `Failed to bind server to ${host}:${port}:`);
|
|
46567
46576
|
if (error2.code === "EADDRINUSE") {
|
|
46568
|
-
|
|
46577
|
+
logger30.error(`Port ${port} is already in use. Please try a different port or stop the process using that port.`);
|
|
46569
46578
|
} else if (error2.code === "EACCES") {
|
|
46570
|
-
|
|
46579
|
+
logger30.error(`Permission denied to bind to port ${port}. Try using a port above 1024 or running with appropriate permissions.`);
|
|
46571
46580
|
} else if (error2.code === "EADDRNOTAVAIL") {
|
|
46572
|
-
|
|
46581
|
+
logger30.error(`Cannot bind to ${host}:${port} - address not available. Check if the host address is correct.`);
|
|
46573
46582
|
}
|
|
46574
46583
|
reject(error2);
|
|
46575
46584
|
});
|
|
46576
46585
|
} catch (error2) {
|
|
46577
|
-
|
|
46586
|
+
logger30.error({ error: error2 }, "Failed to start server:");
|
|
46578
46587
|
reject(error2);
|
|
46579
46588
|
}
|
|
46580
46589
|
});
|
|
@@ -46582,7 +46591,7 @@ class AgentServer {
|
|
|
46582
46591
|
async stop() {
|
|
46583
46592
|
if (this.server) {
|
|
46584
46593
|
this.server.close(() => {
|
|
46585
|
-
|
|
46594
|
+
logger30.success("Server stopped");
|
|
46586
46595
|
});
|
|
46587
46596
|
}
|
|
46588
46597
|
}
|
|
@@ -46629,7 +46638,7 @@ class AgentServer {
|
|
|
46629
46638
|
for (const message of messages) {
|
|
46630
46639
|
await this.database.deleteMessage(message.id);
|
|
46631
46640
|
}
|
|
46632
|
-
|
|
46641
|
+
logger30.info(`[AgentServer] Cleared all messages for central channel: ${channelId}`);
|
|
46633
46642
|
}
|
|
46634
46643
|
async findOrCreateCentralDmChannel(user1Id, user2Id, messageServerId) {
|
|
46635
46644
|
return this.database.findOrCreateDmChannel(user1Id, user2Id, messageServerId);
|
|
@@ -46652,7 +46661,7 @@ class AgentServer {
|
|
|
46652
46661
|
metadata: createdMessage.metadata
|
|
46653
46662
|
};
|
|
46654
46663
|
bus_default.emit("new_message", messageForBus);
|
|
46655
|
-
|
|
46664
|
+
logger30.info(`[AgentServer] Published message ${createdMessage.id} to internal message bus`);
|
|
46656
46665
|
}
|
|
46657
46666
|
return createdMessage;
|
|
46658
46667
|
}
|
|
@@ -46663,7 +46672,7 @@ class AgentServer {
|
|
|
46663
46672
|
return this.database.updateMessage(messageId, patch);
|
|
46664
46673
|
}
|
|
46665
46674
|
async removeParticipantFromChannel() {
|
|
46666
|
-
|
|
46675
|
+
logger30.warn(`[AgentServer] Remove participant operation not directly supported in database adapter`);
|
|
46667
46676
|
}
|
|
46668
46677
|
async addAgentToServer(serverId, agentId) {
|
|
46669
46678
|
const server = await this.getServerById(serverId);
|
|
@@ -46691,32 +46700,32 @@ class AgentServer {
|
|
|
46691
46700
|
}
|
|
46692
46701
|
registerSignalHandlers() {
|
|
46693
46702
|
const gracefulShutdown = async () => {
|
|
46694
|
-
|
|
46695
|
-
|
|
46703
|
+
logger30.info("Received shutdown signal, initiating graceful shutdown...");
|
|
46704
|
+
logger30.debug("Stopping all agents...");
|
|
46696
46705
|
const agents = this.elizaOS?.getAgents() || [];
|
|
46697
46706
|
for (const agent of agents) {
|
|
46698
46707
|
try {
|
|
46699
46708
|
await agent.stop();
|
|
46700
|
-
|
|
46709
|
+
logger30.debug(`Stopped agent ${agent.agentId}`);
|
|
46701
46710
|
} catch (error2) {
|
|
46702
|
-
|
|
46711
|
+
logger30.error({ error: error2, agentId: agent.agentId }, `Error stopping agent ${agent.agentId}:`);
|
|
46703
46712
|
}
|
|
46704
46713
|
}
|
|
46705
46714
|
if (this.database) {
|
|
46706
46715
|
try {
|
|
46707
46716
|
await this.database.close();
|
|
46708
|
-
|
|
46717
|
+
logger30.info("Database closed.");
|
|
46709
46718
|
} catch (error2) {
|
|
46710
|
-
|
|
46719
|
+
logger30.error({ error: error2 }, "Error closing database:");
|
|
46711
46720
|
}
|
|
46712
46721
|
}
|
|
46713
46722
|
if (this.server) {
|
|
46714
46723
|
this.server.close(() => {
|
|
46715
|
-
|
|
46724
|
+
logger30.success("Server closed successfully");
|
|
46716
46725
|
process.exit(0);
|
|
46717
46726
|
});
|
|
46718
46727
|
setTimeout(() => {
|
|
46719
|
-
|
|
46728
|
+
logger30.error("Could not close connections in time, forcing shutdown");
|
|
46720
46729
|
process.exit(1);
|
|
46721
46730
|
}, 5000);
|
|
46722
46731
|
} else {
|
|
@@ -46725,7 +46734,7 @@ class AgentServer {
|
|
|
46725
46734
|
};
|
|
46726
46735
|
process.on("SIGTERM", gracefulShutdown);
|
|
46727
46736
|
process.on("SIGINT", gracefulShutdown);
|
|
46728
|
-
|
|
46737
|
+
logger30.debug("Shutdown handlers registered");
|
|
46729
46738
|
}
|
|
46730
46739
|
}
|
|
46731
46740
|
export {
|
|
@@ -46739,8 +46748,6 @@ export {
|
|
|
46739
46748
|
isWebUIEnabled,
|
|
46740
46749
|
hasValidRemoteUrls,
|
|
46741
46750
|
expandTildePath,
|
|
46742
|
-
PluginLoader,
|
|
46743
46751
|
ElizaOS3 as ElizaOS,
|
|
46744
|
-
ConfigManager,
|
|
46745
46752
|
AgentServer
|
|
46746
46753
|
};
|