@sentry/server-utils 11.16.0 → 11.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/chunks/config.js +62 -2
- package/build/cjs/chunks/config.js.map +1 -1
- package/build/cjs/chunks/exports.js +231 -66
- package/build/cjs/chunks/exports.js.map +1 -1
- package/build/cjs/chunks/moduleInjectedTransform.js +8 -0
- package/build/cjs/chunks/moduleInjectedTransform.js.map +1 -1
- package/build/cjs/index.js +447 -199
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.no-diagnostic-channels.js +1 -0
- package/build/cjs/index.request-handler.js +48 -3
- package/build/cjs/index.request-handler.js.map +1 -1
- package/build/esm/ai/langchain/embeddings.js +23 -8
- package/build/esm/ai/langchain/embeddings.js.map +1 -1
- package/build/esm/ai/langchain/index.js +41 -30
- package/build/esm/ai/langchain/index.js.map +1 -1
- package/build/esm/ai/langchain/utils.js +1 -5
- package/build/esm/ai/langchain/utils.js.map +1 -1
- package/build/esm/ai/langgraph/agent-span.js +6 -2
- package/build/esm/ai/langgraph/agent-span.js.map +1 -1
- package/build/esm/ai/langgraph/index.js +5 -1
- package/build/esm/ai/langgraph/index.js.map +1 -1
- package/build/esm/ai/langgraph/stream.js +4 -1
- package/build/esm/ai/langgraph/stream.js.map +1 -1
- package/build/esm/ai/mistral/streaming.js.map +1 -1
- package/build/esm/ai/pi-durable/index.js +10 -13
- package/build/esm/ai/pi-durable/index.js.map +1 -1
- package/build/esm/ai/pi-durable/runs.js +6 -5
- package/build/esm/ai/pi-durable/runs.js.map +1 -1
- package/build/esm/ai/pi-durable/tools.js +21 -17
- package/build/esm/ai/pi-durable/tools.js.map +1 -1
- package/build/esm/exports.js +2 -1
- package/build/esm/index.js +5 -2
- package/build/esm/index.js.map +1 -1
- package/build/esm/index.no-diagnostic-channels.js +2 -1
- package/build/esm/index.request-handler.js +3 -1
- package/build/esm/integrations/amqplib.js.map +1 -1
- package/build/esm/integrations/anthropic.js.map +1 -1
- package/build/esm/integrations/bullmq/tracer.js.map +1 -1
- package/build/esm/integrations/clickhouse-sql.js +31 -0
- package/build/esm/integrations/clickhouse-sql.js.map +1 -0
- package/build/esm/integrations/clickhouse.js +88 -0
- package/build/esm/integrations/clickhouse.js.map +1 -0
- package/build/esm/integrations/express/instrumentation.js +1 -0
- package/build/esm/integrations/express/instrumentation.js.map +1 -1
- package/build/esm/integrations/fastify/instrumentation.js +3 -1
- package/build/esm/integrations/fastify/instrumentation.js.map +1 -1
- package/build/esm/integrations/graphql/utils.js.map +1 -1
- package/build/esm/integrations/hapi/hapi-utils.js +6 -9
- package/build/esm/integrations/hapi/hapi-utils.js.map +1 -1
- package/build/esm/integrations/hapi/index.js +15 -1
- package/build/esm/integrations/hapi/index.js.map +1 -1
- package/build/esm/integrations/hono/isMiddleware.js.map +1 -1
- package/build/esm/integrations/hono/middlewareHandlers.js +3 -1
- package/build/esm/integrations/hono/middlewareHandlers.js.map +1 -1
- package/build/esm/integrations/hono/patchRoute.js +2 -1
- package/build/esm/integrations/hono/patchRoute.js.map +1 -1
- package/build/esm/integrations/hono/unwrapThrownValue.js +20 -0
- package/build/esm/integrations/hono/unwrapThrownValue.js.map +1 -0
- package/build/esm/integrations/index.js +2 -0
- package/build/esm/integrations/index.js.map +1 -1
- package/build/esm/integrations/langchain.js +10 -3
- package/build/esm/integrations/langchain.js.map +1 -1
- package/build/esm/integrations/mongodb/mongodb-span.js +7 -9
- package/build/esm/integrations/mongodb/mongodb-span.js.map +1 -1
- package/build/esm/integrations/pino.js +2 -2
- package/build/esm/integrations/pino.js.map +1 -1
- package/build/esm/integrations/prisma/tracing-helper.js.map +1 -1
- package/build/esm/integrations/serveTunnel.js +2 -2
- package/build/esm/integrations/serveTunnel.js.map +1 -1
- package/build/esm/integrations/vercel-ai/extract.js +88 -0
- package/build/esm/integrations/vercel-ai/extract.js.map +1 -0
- package/build/esm/integrations/vercel-ai/util.js +5 -1
- package/build/esm/integrations/vercel-ai/util.js.map +1 -1
- package/build/esm/integrations/vercel-ai/vercel-ai-dc-subscriber.js +19 -9
- package/build/esm/integrations/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
- package/build/esm/integrations/winston.js +2 -2
- package/build/esm/integrations/winston.js.map +1 -1
- package/build/esm/orchestrion/channels.js +2 -0
- package/build/esm/orchestrion/channels.js.map +1 -1
- package/build/esm/orchestrion/config/channel-integration-definitions.js +8 -0
- package/build/esm/orchestrion/config/channel-integration-definitions.js.map +1 -1
- package/build/esm/orchestrion/config/clickhouse.js +51 -0
- package/build/esm/orchestrion/config/clickhouse.js.map +1 -0
- package/build/esm/orchestrion/config/hono.js +2 -2
- package/build/esm/orchestrion/config/hono.js.map +1 -1
- package/build/esm/orchestrion/config/index.js +2 -0
- package/build/esm/orchestrion/config/index.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/utils/installedModules.js +87 -0
- package/build/esm/utils/installedModules.js.map +1 -0
- package/build/esm/utils/module.js +29 -0
- package/build/esm/utils/module.js.map +1 -0
- package/build/esm/utils/serverTimingTraceHeader.js +49 -0
- package/build/esm/utils/serverTimingTraceHeader.js.map +1 -0
- package/build/esm/utils/sql.js +41 -19
- package/build/esm/utils/sql.js.map +1 -1
- package/build/esm/utils/tunnelServer.js +3 -3
- package/build/esm/utils/tunnelServer.js.map +1 -1
- package/build/esm/utils/wrapServerRequestHandler.js +5 -4
- package/build/esm/utils/wrapServerRequestHandler.js.map +1 -1
- package/build/types/ai/langchain/embeddings.d.ts +2 -2
- package/build/types/ai/langchain/embeddings.d.ts.map +1 -1
- package/build/types/ai/langchain/index.d.ts.map +1 -1
- package/build/types/ai/langchain/types.d.ts +8 -4
- package/build/types/ai/langchain/types.d.ts.map +1 -1
- package/build/types/ai/langchain/utils.d.ts.map +1 -1
- package/build/types/ai/langgraph/agent-span.d.ts +5 -2
- package/build/types/ai/langgraph/agent-span.d.ts.map +1 -1
- package/build/types/ai/langgraph/index.d.ts.map +1 -1
- package/build/types/ai/langgraph/stream.d.ts.map +1 -1
- package/build/types/ai/langgraph/types.d.ts +10 -2
- package/build/types/ai/langgraph/types.d.ts.map +1 -1
- package/build/types/ai/mistral/streaming.d.ts.map +1 -1
- package/build/types/ai/pi-durable/index.d.ts.map +1 -1
- package/build/types/ai/pi-durable/runs.d.ts +4 -2
- package/build/types/ai/pi-durable/runs.d.ts.map +1 -1
- package/build/types/ai/pi-durable/tools.d.ts +4 -6
- package/build/types/ai/pi-durable/tools.d.ts.map +1 -1
- package/build/types/ai/pi-durable/types.d.ts +10 -1
- package/build/types/ai/pi-durable/types.d.ts.map +1 -1
- package/build/types/exports.d.ts +1 -0
- package/build/types/exports.d.ts.map +1 -1
- package/build/types/index.d.ts +5 -3
- package/build/types/index.d.ts.map +1 -1
- package/build/types/index.request-handler.d.ts +1 -0
- package/build/types/index.request-handler.d.ts.map +1 -1
- package/build/types/integrations/amqplib.d.ts.map +1 -1
- package/build/types/integrations/anthropic.d.ts.map +1 -1
- package/build/types/integrations/bullmq/tracer.d.ts.map +1 -1
- package/build/types/integrations/clickhouse-sql.d.ts +8 -0
- package/build/types/integrations/clickhouse-sql.d.ts.map +1 -0
- package/build/types/integrations/clickhouse.d.ts +11 -0
- package/build/types/integrations/clickhouse.d.ts.map +1 -0
- package/build/types/integrations/express/types.d.ts +1 -0
- package/build/types/integrations/express/types.d.ts.map +1 -1
- package/build/types/integrations/fastify/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/hapi/hapi-utils.d.ts.map +1 -1
- package/build/types/integrations/hapi/index.d.ts +12 -0
- package/build/types/integrations/hapi/index.d.ts.map +1 -1
- package/build/types/integrations/hono/isMiddleware.d.ts.map +1 -1
- package/build/types/integrations/hono/middlewareHandlers.d.ts.map +1 -1
- package/build/types/integrations/hono/patchRoute.d.ts.map +1 -1
- package/build/types/integrations/hono/unwrapThrownValue.d.ts +10 -0
- package/build/types/integrations/hono/unwrapThrownValue.d.ts.map +1 -0
- package/build/types/integrations/index.d.ts.map +1 -1
- package/build/types/integrations/langchain.d.ts.map +1 -1
- package/build/types/integrations/mongodb/mongodb-span.d.ts.map +1 -1
- package/build/types/integrations/prisma/tracing-helper.d.ts.map +1 -1
- package/build/types/integrations/vercel-ai/extract.d.ts +27 -0
- package/build/types/integrations/vercel-ai/extract.d.ts.map +1 -0
- package/build/types/integrations/vercel-ai/util.d.ts +2 -0
- package/build/types/integrations/vercel-ai/util.d.ts.map +1 -1
- package/build/types/integrations/vercel-ai/vercel-ai-dc-subscriber.d.ts +1 -1
- package/build/types/integrations/vercel-ai/vercel-ai-dc-subscriber.d.ts.map +1 -1
- package/build/types/orchestrion/channels.d.ts +12 -0
- package/build/types/orchestrion/channels.d.ts.map +1 -1
- package/build/types/orchestrion/config/channel-integration-definitions.d.ts +3 -0
- package/build/types/orchestrion/config/channel-integration-definitions.d.ts.map +1 -1
- package/build/types/orchestrion/config/clickhouse.d.ts +18 -0
- package/build/types/orchestrion/config/clickhouse.d.ts.map +1 -0
- package/build/types/orchestrion/config/index.d.ts.map +1 -1
- package/build/types/utils/installedModules.d.ts +17 -0
- package/build/types/utils/installedModules.d.ts.map +1 -0
- package/build/types/utils/module.d.ts +3 -0
- package/build/types/utils/module.d.ts.map +1 -0
- package/build/types/utils/serverTimingTraceHeader.d.ts +18 -0
- package/build/types/utils/serverTimingTraceHeader.d.ts.map +1 -0
- package/build/types/utils/sql.d.ts +28 -3
- package/build/types/utils/sql.d.ts.map +1 -1
- package/build/types/utils/tunnelServer.d.ts.map +1 -1
- package/build/types/utils/wrapServerRequestHandler.d.ts.map +1 -1
- package/package.json +4 -4
package/build/cjs/index.js
CHANGED
|
@@ -219,7 +219,7 @@ function wrapRouteHandler(route, pluginName) {
|
|
|
219
219
|
*/
|
|
220
220
|
function wrapExtMethods(method, extPoint, pluginName) {
|
|
221
221
|
if (Array.isArray(method)) {
|
|
222
|
-
for (
|
|
222
|
+
for (const [i, m] of method.entries()) method[i] = wrapExtMethods(m, extPoint);
|
|
223
223
|
return method;
|
|
224
224
|
} else if (isPatchableExtMethod(method)) {
|
|
225
225
|
if (method[handlerPatched] === true) return method;
|
|
@@ -240,7 +240,7 @@ function wrapExtMethods(method, extPoint, pluginName) {
|
|
|
240
240
|
*/
|
|
241
241
|
function wrapRouteArguments(args, pluginName) {
|
|
242
242
|
const route = args[0];
|
|
243
|
-
if (Array.isArray(route)) for (
|
|
243
|
+
if (Array.isArray(route)) for (const [i, r] of route.entries()) route[i] = wrapRouteHandler(r, pluginName);
|
|
244
244
|
else args[0] = wrapRouteHandler(route, pluginName);
|
|
245
245
|
}
|
|
246
246
|
/**
|
|
@@ -252,13 +252,10 @@ function wrapRouteArguments(args, pluginName) {
|
|
|
252
252
|
function wrapExtArguments(args, pluginName) {
|
|
253
253
|
if (Array.isArray(args[0])) {
|
|
254
254
|
const eventsList = args[0];
|
|
255
|
-
for (
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
lifecycleEventObj.method = wrapExtMethods(lifecycleEventObj.method, eventObj.type, pluginName);
|
|
260
|
-
eventsList[i] = lifecycleEventObj;
|
|
261
|
-
}
|
|
255
|
+
for (const [i, eventObj] of eventsList.entries()) if (isLifecycleExtType(eventObj.type)) {
|
|
256
|
+
const lifecycleEventObj = eventObj;
|
|
257
|
+
lifecycleEventObj.method = wrapExtMethods(lifecycleEventObj.method, eventObj.type, pluginName);
|
|
258
|
+
eventsList[i] = lifecycleEventObj;
|
|
262
259
|
}
|
|
263
260
|
return;
|
|
264
261
|
} else if (isDirectExtInput(args)) {
|
|
@@ -618,7 +615,7 @@ function eveTracePolicy() {
|
|
|
618
615
|
};
|
|
619
616
|
}
|
|
620
617
|
// src/integrations/fastify/utils.ts
|
|
621
|
-
const INTEGRATION_NAME$
|
|
618
|
+
const INTEGRATION_NAME$35 = "Fastify";
|
|
622
619
|
/**
|
|
623
620
|
* Default function to determine if an error should be sent to Sentry
|
|
624
621
|
*
|
|
@@ -645,7 +642,7 @@ function getErrorStatusCode(error) {
|
|
|
645
642
|
// src/integrations/fastify/errors.ts
|
|
646
643
|
const kErrorCaptured = Symbol("sentry.fastifyErrorCaptured");
|
|
647
644
|
function getFastifyIntegration() {
|
|
648
|
-
return (0, _sentry_core.getClient)()?.getIntegrationByName(INTEGRATION_NAME$
|
|
645
|
+
return (0, _sentry_core.getClient)()?.getIntegrationByName(INTEGRATION_NAME$35);
|
|
649
646
|
}
|
|
650
647
|
/**
|
|
651
648
|
* Subscribe to the Fastify v5 error diagnostics channel.
|
|
@@ -677,7 +674,7 @@ function handleFastifyError(request, reply, error) {
|
|
|
677
674
|
}
|
|
678
675
|
}
|
|
679
676
|
// src/integrations/fastify/instrumentation.ts
|
|
680
|
-
const ORIGIN$
|
|
677
|
+
const ORIGIN$23 = "auto.http.fastify";
|
|
681
678
|
const FASTIFY_HOOKS = [
|
|
682
679
|
"onRequest",
|
|
683
680
|
"preParsing",
|
|
@@ -770,7 +767,7 @@ function onRequest(request, _reply, hookDone) {
|
|
|
770
767
|
const method = request.method || "GET";
|
|
771
768
|
(0, _sentry_core.getIsolationScope)().setTransactionName(`${method} ${routeName}`);
|
|
772
769
|
const attributes = {
|
|
773
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
770
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$23,
|
|
774
771
|
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.HANDLER,
|
|
775
772
|
[_sentry_conventions_attributes.HTTP_REQUEST_METHOD]: request.method,
|
|
776
773
|
[_sentry_conventions_attributes.URL_PATH]: request.url
|
|
@@ -866,6 +863,8 @@ function handlerWrapper(handler, hookName, spanAttributes = {}) {
|
|
|
866
863
|
const request = getRequestFromArgs(args);
|
|
867
864
|
if (!request) return handler.call(this, ...args);
|
|
868
865
|
const parentSpan = request[kRequestSpan] ?? void 0;
|
|
866
|
+
const effectiveParentSpan = parentSpan ?? (0, _sentry_core.getActiveSpan)();
|
|
867
|
+
if (effectiveParentSpan && !(0, _sentry_core.spanIsSampled)(effectiveParentSpan)) return handler.call(this, ...args);
|
|
869
868
|
const handlerName = handler.name?.length > 0 ? handler.name : this.pluginName ?? ANONYMOUS_FUNCTION_NAME;
|
|
870
869
|
const hookType = spanAttributes[ATTRIBUTE_FASTIFY_TYPE];
|
|
871
870
|
const op = hookType === HOOK_TYPE_INSTANCE ? _sentry_conventions_op.MIDDLEWARE : hookType === HOOK_TYPE_HANDLER ? _sentry_conventions_op.HANDLER : void 0;
|
|
@@ -878,7 +877,7 @@ function handlerWrapper(handler, hookName, spanAttributes = {}) {
|
|
|
878
877
|
attributes: {
|
|
879
878
|
...spanAttributes,
|
|
880
879
|
[_sentry_conventions_attributes.SENTRY_OP]: op,
|
|
881
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
880
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$23
|
|
882
881
|
},
|
|
883
882
|
parentSpan
|
|
884
883
|
}, () => handler.call(this, ...args));
|
|
@@ -901,7 +900,7 @@ function instrumentFastify() {
|
|
|
901
900
|
const _fastifyIntegration = (({ shouldHandleError } = {}) => {
|
|
902
901
|
let _shouldHandleError;
|
|
903
902
|
return {
|
|
904
|
-
name: INTEGRATION_NAME$
|
|
903
|
+
name: INTEGRATION_NAME$35,
|
|
905
904
|
setupOnce() {
|
|
906
905
|
_shouldHandleError = shouldHandleError || defaultShouldHandleError$1;
|
|
907
906
|
subscribeToFastifyErrorChannel();
|
|
@@ -1357,7 +1356,7 @@ function isLazyResult(value) {
|
|
|
1357
1356
|
return typeof value === "object" && value !== null && typeof value.toArray === "function" && typeof value[Symbol.asyncIterator] === "function";
|
|
1358
1357
|
}
|
|
1359
1358
|
// src/integrations/prisma/index.ts
|
|
1360
|
-
const INTEGRATION_NAME$
|
|
1359
|
+
const INTEGRATION_NAME$34 = "Prisma";
|
|
1361
1360
|
/**
|
|
1362
1361
|
* Sets up the global Prisma tracing helper that Prisma looks up on `globalThis` to emit tracing data.
|
|
1363
1362
|
*
|
|
@@ -1372,7 +1371,7 @@ function instrumentPrisma(options) {
|
|
|
1372
1371
|
}
|
|
1373
1372
|
const _prismaIntegration = ((options) => {
|
|
1374
1373
|
return {
|
|
1375
|
-
name: INTEGRATION_NAME$
|
|
1374
|
+
name: INTEGRATION_NAME$34,
|
|
1376
1375
|
setupOnce() {
|
|
1377
1376
|
instrumentPrisma(options);
|
|
1378
1377
|
},
|
|
@@ -1419,6 +1418,7 @@ const CHANNELS = {
|
|
|
1419
1418
|
...require_config.amqplibChannels,
|
|
1420
1419
|
...require_config.anthropicAiChannels,
|
|
1421
1420
|
...require_config.awsSdkChannels,
|
|
1421
|
+
...require_config.clickhouseChannels,
|
|
1422
1422
|
...require_config.cronChannels,
|
|
1423
1423
|
...require_config.dataloaderChannels,
|
|
1424
1424
|
...require_config.expressChannels,
|
|
@@ -1461,7 +1461,7 @@ const CHANNELS = {
|
|
|
1461
1461
|
...require_config.vercelAiChannels
|
|
1462
1462
|
};
|
|
1463
1463
|
// src/integrations/amqplib.ts
|
|
1464
|
-
const INTEGRATION_NAME$
|
|
1464
|
+
const INTEGRATION_NAME$33 = "Amqplib";
|
|
1465
1465
|
const PUBLISHER_ORIGIN = "auto.queue.amqplib.publisher";
|
|
1466
1466
|
const CONSUMER_ORIGIN$1 = "auto.queue.amqplib.consumer";
|
|
1467
1467
|
const MESSAGING_OPERATION_VALUE_PROCESS = "process";
|
|
@@ -1487,7 +1487,7 @@ const CONNECTION_ATTRIBUTES = Symbol("sentry.amqplib.connection.attributes");
|
|
|
1487
1487
|
const NOOP$4 = () => {};
|
|
1488
1488
|
const _amqplibIntegration = (() => {
|
|
1489
1489
|
return {
|
|
1490
|
-
name: INTEGRATION_NAME$
|
|
1490
|
+
name: INTEGRATION_NAME$33,
|
|
1491
1491
|
setup(client) {
|
|
1492
1492
|
invokeOrchestrionInstrumentation(client, require_config.amqplibModuleNames, instrumentAmqplib, []);
|
|
1493
1493
|
}
|
|
@@ -1889,7 +1889,7 @@ function wrapApiPromiseResponse(result, onResponse, onError) {
|
|
|
1889
1889
|
return true;
|
|
1890
1890
|
}
|
|
1891
1891
|
// src/integrations/anthropic.ts
|
|
1892
|
-
const INTEGRATION_NAME$
|
|
1892
|
+
const INTEGRATION_NAME$32 = "Anthropic_AI";
|
|
1893
1893
|
const INSTRUMENTED_CHANNELS$3 = [{
|
|
1894
1894
|
channel: CHANNELS.ANTHROPIC_CHAT,
|
|
1895
1895
|
operation: "chat",
|
|
@@ -1901,7 +1901,7 @@ const INSTRUMENTED_CHANNELS$3 = [{
|
|
|
1901
1901
|
}];
|
|
1902
1902
|
const _anthropicAIIntegration = ((options = {}) => {
|
|
1903
1903
|
return {
|
|
1904
|
-
name: INTEGRATION_NAME$
|
|
1904
|
+
name: INTEGRATION_NAME$32,
|
|
1905
1905
|
setup(client) {
|
|
1906
1906
|
invokeOrchestrionInstrumentation(client, require_config.anthropicAiModuleNames, instrumentAnthropic, [options]);
|
|
1907
1907
|
}
|
|
@@ -1947,7 +1947,7 @@ function instrumentAnthropic(options) {
|
|
|
1947
1947
|
*/
|
|
1948
1948
|
function createGenAiSpan$4(data, operation, options, stream) {
|
|
1949
1949
|
const args = data.arguments ?? [];
|
|
1950
|
-
if (require_exports.shouldSkipAiProviderSpan(INTEGRATION_NAME$
|
|
1950
|
+
if (require_exports.shouldSkipAiProviderSpan(INTEGRATION_NAME$32)) return;
|
|
1951
1951
|
const requestOptions = args[1];
|
|
1952
1952
|
if (isStreamHelperRequest(requestOptions?.headers) && isInsideStreamHelperSpan()) return;
|
|
1953
1953
|
const params = typeof args[0] === "object" && args[0] !== null ? args[0] : void 0;
|
|
@@ -2979,7 +2979,7 @@ function extractAttributesFromNormalizedRequest(normalizedRequest) {
|
|
|
2979
2979
|
};
|
|
2980
2980
|
}
|
|
2981
2981
|
// src/integrations/aws-sdk/index.ts
|
|
2982
|
-
const INTEGRATION_NAME$
|
|
2982
|
+
const INTEGRATION_NAME$31 = "Aws";
|
|
2983
2983
|
function setMetadataAttributes(span, metadata) {
|
|
2984
2984
|
if (!metadata) return;
|
|
2985
2985
|
if (metadata.requestId) span.setAttribute(_sentry_conventions_attributes._AWS_REQUEST_ID, metadata.requestId);
|
|
@@ -2989,7 +2989,7 @@ function setMetadataAttributes(span, metadata) {
|
|
|
2989
2989
|
const _awsIntegration = ((options) => {
|
|
2990
2990
|
const servicesExtensions = new ServicesExtensions(options);
|
|
2991
2991
|
return {
|
|
2992
|
-
name: INTEGRATION_NAME$
|
|
2992
|
+
name: INTEGRATION_NAME$31,
|
|
2993
2993
|
setup(client) {
|
|
2994
2994
|
invokeOrchestrionInstrumentation(client, require_config.awsSdkModuleNames, instrumentAwsSdk, [servicesExtensions]);
|
|
2995
2995
|
}
|
|
@@ -3093,9 +3093,9 @@ function instrumentAwsSdk(servicesExtensions) {
|
|
|
3093
3093
|
*/
|
|
3094
3094
|
const awsIntegration = (0, _sentry_core.defineIntegration)(_awsIntegration);
|
|
3095
3095
|
// src/integrations/dataloader.ts
|
|
3096
|
-
const INTEGRATION_NAME$
|
|
3096
|
+
const INTEGRATION_NAME$30 = "Dataloader";
|
|
3097
3097
|
const MODULE_NAME = "dataloader";
|
|
3098
|
-
const ORIGIN$
|
|
3098
|
+
const ORIGIN$22 = "auto.db.dataloader";
|
|
3099
3099
|
/**
|
|
3100
3100
|
* Maps each operation to a convention cache op. `load`, `loadMany` and `batch` are cache reads,
|
|
3101
3101
|
* `prime` writes an entry, and `clear`/`clearAll` remove entries. The precise operation stays
|
|
@@ -3128,7 +3128,7 @@ function makeSpanOptions(loader, operation, keyArg) {
|
|
|
3128
3128
|
[_sentry_conventions_attributes.SENTRY_OP]: cacheOperation,
|
|
3129
3129
|
[_sentry_conventions_attributes.CACHE_OPERATION]: _sentry_core.CACHE_OPERATION_NAMES[cacheOperation],
|
|
3130
3130
|
[_sentry_conventions_attributes.SENTRY_KIND]: operation === "batch" ? void 0 : "client",
|
|
3131
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
3131
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$22,
|
|
3132
3132
|
[_sentry_conventions_attributes.DB_OPERATION_NAME]: operation,
|
|
3133
3133
|
[_sentry_conventions_attributes.DB_COLLECTION_NAME]: loader?.name ?? void 0,
|
|
3134
3134
|
[_sentry_conventions_attributes.CACHE_KEY]: getCacheKey(keyArg)
|
|
@@ -3137,7 +3137,7 @@ function makeSpanOptions(loader, operation, keyArg) {
|
|
|
3137
3137
|
}
|
|
3138
3138
|
const _dataloaderIntegration = (() => {
|
|
3139
3139
|
return {
|
|
3140
|
-
name: INTEGRATION_NAME$
|
|
3140
|
+
name: INTEGRATION_NAME$30,
|
|
3141
3141
|
setupOnce() {
|
|
3142
3142
|
if (!tracingChannel) return;
|
|
3143
3143
|
require_debug_build.DEBUG_BUILD && _sentry_core.debug.log("[instrumentation:dataloader] subscribing to dataloader tracing channels");
|
|
@@ -3207,10 +3207,10 @@ function startInactiveSpanFor(loader, operation, keyArg) {
|
|
|
3207
3207
|
*/
|
|
3208
3208
|
const dataloaderIntegration = (0, _sentry_core.defineIntegration)(_dataloaderIntegration);
|
|
3209
3209
|
// src/integrations/generic-pool.ts
|
|
3210
|
-
const INTEGRATION_NAME$
|
|
3210
|
+
const INTEGRATION_NAME$29 = "GenericPool";
|
|
3211
3211
|
const _genericPoolIntegration = (() => {
|
|
3212
3212
|
return {
|
|
3213
|
-
name: INTEGRATION_NAME$
|
|
3213
|
+
name: INTEGRATION_NAME$29,
|
|
3214
3214
|
setup(client) {
|
|
3215
3215
|
invokeOrchestrionInstrumentation(client, require_config.genericPoolModuleNames, instrumentGenericPool, []);
|
|
3216
3216
|
}
|
|
@@ -3485,10 +3485,10 @@ function updateMonitorConfig(job, monitorConfig) {
|
|
|
3485
3485
|
if (typeof job === "function" && monitorConfigs.has(job)) monitorConfigs.set(job, monitorConfig);
|
|
3486
3486
|
}
|
|
3487
3487
|
// src/integrations/cron.ts
|
|
3488
|
-
const INTEGRATION_NAME$
|
|
3488
|
+
const INTEGRATION_NAME$28 = "CronJob";
|
|
3489
3489
|
const _cronJobIntegration = ((options = {}) => {
|
|
3490
3490
|
return {
|
|
3491
|
-
name: INTEGRATION_NAME$
|
|
3491
|
+
name: INTEGRATION_NAME$28,
|
|
3492
3492
|
setup(client) {
|
|
3493
3493
|
invokeOrchestrionInstrumentation(client, require_config.cronModuleNames, subscribe$4, [options], { requiresTracingChannelBinding: false });
|
|
3494
3494
|
}
|
|
@@ -3501,8 +3501,8 @@ const _cronJobIntegration = ((options = {}) => {
|
|
|
3501
3501
|
*/
|
|
3502
3502
|
const cronJobIntegration = (0, _sentry_core.defineIntegration)(_cronJobIntegration);
|
|
3503
3503
|
function subscribe$4(options) {
|
|
3504
|
-
subscribeToJobCreation(CHANNELS.CRON_JOB_CONSTRUCTOR, INTEGRATION_NAME$
|
|
3505
|
-
subscribeToScheduleChange(CHANNELS.CRON_JOB_SET_TIME, INTEGRATION_NAME$
|
|
3504
|
+
subscribeToJobCreation(CHANNELS.CRON_JOB_CONSTRUCTOR, INTEGRATION_NAME$28, (args) => wrapJob(args, options));
|
|
3505
|
+
subscribeToScheduleChange(CHANNELS.CRON_JOB_SET_TIME, INTEGRATION_NAME$28, onSetTime);
|
|
3506
3506
|
}
|
|
3507
3507
|
/** Sets the new time's config after `job.setTime(cronTime)`. Without one, the job doesn't check in. */
|
|
3508
3508
|
function onSetTime({ arguments: [cronTime], self }) {
|
|
@@ -3520,10 +3520,10 @@ function wrapJob(args, options) {
|
|
|
3520
3520
|
args[1] = wrapScheduledJob(onTick, name, utcOffset == null ? cronExpressionToMonitorConfig(cronTime, timeZone, "cron") : void 0, "auto.function.cron");
|
|
3521
3521
|
}
|
|
3522
3522
|
// src/integrations/node-cron.ts
|
|
3523
|
-
const INTEGRATION_NAME$
|
|
3523
|
+
const INTEGRATION_NAME$27 = "NodeCron";
|
|
3524
3524
|
const _nodeCronIntegration = ((options = {}) => {
|
|
3525
3525
|
return {
|
|
3526
|
-
name: INTEGRATION_NAME$
|
|
3526
|
+
name: INTEGRATION_NAME$27,
|
|
3527
3527
|
setup(client) {
|
|
3528
3528
|
invokeOrchestrionInstrumentation(client, require_config.nodeCronModuleNames, subscribe$3, [options], { requiresTracingChannelBinding: false });
|
|
3529
3529
|
}
|
|
@@ -3536,9 +3536,9 @@ const _nodeCronIntegration = ((options = {}) => {
|
|
|
3536
3536
|
*/
|
|
3537
3537
|
const nodeCronIntegration = (0, _sentry_core.defineIntegration)(_nodeCronIntegration);
|
|
3538
3538
|
function subscribe$3(options) {
|
|
3539
|
-
subscribeToJobCreation(CHANNELS.NODE_CRON_CREATE_TASK, INTEGRATION_NAME$
|
|
3540
|
-
subscribeToJobCreation(CHANNELS.NODE_CRON_V4_CREATE_TASK, INTEGRATION_NAME$
|
|
3541
|
-
subscribeToJobCreation(CHANNELS.NODE_CRON_V3_CREATE_TASK, INTEGRATION_NAME$
|
|
3539
|
+
subscribeToJobCreation(CHANNELS.NODE_CRON_CREATE_TASK, INTEGRATION_NAME$27, (args) => wrapTask(args, options));
|
|
3540
|
+
subscribeToJobCreation(CHANNELS.NODE_CRON_V4_CREATE_TASK, INTEGRATION_NAME$27, (args) => wrapTask(args, options, isReadAlikeByNodeCron4));
|
|
3541
|
+
subscribeToJobCreation(CHANNELS.NODE_CRON_V3_CREATE_TASK, INTEGRATION_NAME$27, (args) => wrapTask(args, options, isReadAlikeByNodeCron3));
|
|
3542
3542
|
}
|
|
3543
3543
|
function wrapTask(args, options, isReadAlike) {
|
|
3544
3544
|
const [expression, func, taskOptions] = args;
|
|
@@ -3580,10 +3580,10 @@ function isReadAlikeByNodeCron3(expression) {
|
|
|
3580
3580
|
});
|
|
3581
3581
|
}
|
|
3582
3582
|
// src/integrations/node-schedule.ts
|
|
3583
|
-
const INTEGRATION_NAME$
|
|
3583
|
+
const INTEGRATION_NAME$26 = "NodeSchedule";
|
|
3584
3584
|
const _nodeScheduleIntegration = ((options = {}) => {
|
|
3585
3585
|
return {
|
|
3586
|
-
name: INTEGRATION_NAME$
|
|
3586
|
+
name: INTEGRATION_NAME$26,
|
|
3587
3587
|
setup(client) {
|
|
3588
3588
|
invokeOrchestrionInstrumentation(client, require_config.nodeScheduleModuleNames, subscribe$2, [options], { requiresTracingChannelBinding: false });
|
|
3589
3589
|
}
|
|
@@ -3596,7 +3596,7 @@ const _nodeScheduleIntegration = ((options = {}) => {
|
|
|
3596
3596
|
*/
|
|
3597
3597
|
const nodeScheduleIntegration = (0, _sentry_core.defineIntegration)(_nodeScheduleIntegration);
|
|
3598
3598
|
function subscribe$2(options) {
|
|
3599
|
-
subscribeToScheduleChange(CHANNELS.NODE_SCHEDULE_SCHEDULE, INTEGRATION_NAME$
|
|
3599
|
+
subscribeToScheduleChange(CHANNELS.NODE_SCHEDULE_SCHEDULE, INTEGRATION_NAME$26, onSchedule, (change) => beforeSchedule(change, options));
|
|
3600
3600
|
}
|
|
3601
3601
|
const ANONYMOUS_NAME = /^<Anonymous Job \d+[ >]/;
|
|
3602
3602
|
const addsToPendingRuns = /* @__PURE__ */ new WeakSet();
|
|
@@ -4150,8 +4150,8 @@ var BullMQTelemetry = class {
|
|
|
4150
4150
|
}
|
|
4151
4151
|
};
|
|
4152
4152
|
// src/integrations/google-genai.ts
|
|
4153
|
-
const INTEGRATION_NAME$
|
|
4154
|
-
const ORIGIN$
|
|
4153
|
+
const INTEGRATION_NAME$25 = "Google_GenAI";
|
|
4154
|
+
const ORIGIN$21 = "auto.ai.google_genai";
|
|
4155
4155
|
const INSTRUMENTED_CHANNELS$2 = [
|
|
4156
4156
|
{
|
|
4157
4157
|
channel: CHANNELS.GOOGLE_GENAI_GENERATE_CONTENT,
|
|
@@ -4172,7 +4172,7 @@ const INSTRUMENTED_CHANNELS$2 = [
|
|
|
4172
4172
|
];
|
|
4173
4173
|
const _googleGenAIIntegration = ((options = {}) => {
|
|
4174
4174
|
return {
|
|
4175
|
-
name: INTEGRATION_NAME$
|
|
4175
|
+
name: INTEGRATION_NAME$25,
|
|
4176
4176
|
setup(client) {
|
|
4177
4177
|
invokeOrchestrionInstrumentation(client, require_config.googleGenAiModuleNames, instrumentGoogleGenai, [options]);
|
|
4178
4178
|
}
|
|
@@ -4196,12 +4196,12 @@ function instrumentGoogleGenai(options) {
|
|
|
4196
4196
|
* Returning `undefined` opts the payload out so no span is opened.
|
|
4197
4197
|
*/
|
|
4198
4198
|
function createGenAiSpan$3(data, operation, options) {
|
|
4199
|
-
if (require_exports.shouldSkipAiProviderSpan(INTEGRATION_NAME$
|
|
4199
|
+
if (require_exports.shouldSkipAiProviderSpan(INTEGRATION_NAME$25)) return;
|
|
4200
4200
|
if (operation !== "chat") {
|
|
4201
4201
|
const activeSpan = (0, _sentry_core.getActiveSpan)();
|
|
4202
4202
|
if (activeSpan) {
|
|
4203
4203
|
const { attributes: { [_sentry_conventions_attributes.SENTRY_OP]: op, [_sentry_conventions_attributes.SENTRY_ORIGIN]: origin } } = (0, _sentry_core.spanToJSON)(activeSpan);
|
|
4204
|
-
if (origin === ORIGIN$
|
|
4204
|
+
if (origin === ORIGIN$21 && op === "gen_ai.chat") return;
|
|
4205
4205
|
}
|
|
4206
4206
|
}
|
|
4207
4207
|
const request = (data.arguments ?? [])[0];
|
|
@@ -4214,7 +4214,7 @@ function createGenAiSpan$3(data, operation, options) {
|
|
|
4214
4214
|
data._sentryRecordOutputs = recordOutputs;
|
|
4215
4215
|
const attributes = require_exports.extractRequestAttributes$1(operation, params, data.self, recordInputs);
|
|
4216
4216
|
const model = attributes[_sentry_conventions_attributes.GEN_AI_REQUEST_MODEL] || "unknown";
|
|
4217
|
-
attributes[_sentry_conventions_attributes.SENTRY_ORIGIN] = ORIGIN$
|
|
4217
|
+
attributes[_sentry_conventions_attributes.SENTRY_ORIGIN] = ORIGIN$21;
|
|
4218
4218
|
const client = (0, _sentry_core.getClient)();
|
|
4219
4219
|
const span = (0, _sentry_core.startInactiveSpan)({
|
|
4220
4220
|
name: model !== "unknown" || !(client && (0, _sentry_core.hasSpanStreamingEnabled)(client)) ? `${operation} ${model}` : operation,
|
|
@@ -4252,7 +4252,7 @@ function wrapStreamResult$2(span, data, operation) {
|
|
|
4252
4252
|
*/
|
|
4253
4253
|
const googleGenAIIntegration = (0, _sentry_core.defineIntegration)(_googleGenAIIntegration);
|
|
4254
4254
|
// src/integrations/graphql/constants.ts
|
|
4255
|
-
const ORIGIN$
|
|
4255
|
+
const ORIGIN$20 = "auto.graphql.graphql";
|
|
4256
4256
|
const SPAN_NAME_PARSE = "graphql.parse";
|
|
4257
4257
|
const SPAN_NAME_VALIDATE = "graphql.validate";
|
|
4258
4258
|
const SPAN_NAME_EXECUTE = "graphql.execute";
|
|
@@ -4395,7 +4395,7 @@ function setupParseChannel(tracingChannel) {
|
|
|
4395
4395
|
return (0, _sentry_core.startInactiveSpan)({
|
|
4396
4396
|
name: client && (0, _sentry_core.hasSpanStreamingEnabled)(client) ? `GraphQL ${PROCESSING_TYPE_PARSE}` : SPAN_NAME_PARSE,
|
|
4397
4397
|
attributes: {
|
|
4398
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
4398
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$20,
|
|
4399
4399
|
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.GRAPHQL,
|
|
4400
4400
|
[_sentry_conventions_attributes.GRAPHQL_PROCESSING_TYPE]: PROCESSING_TYPE_PARSE
|
|
4401
4401
|
}
|
|
@@ -4408,7 +4408,7 @@ function setupValidateChannel(tracingChannel) {
|
|
|
4408
4408
|
return (0, _sentry_core.startInactiveSpan)({
|
|
4409
4409
|
name: client && (0, _sentry_core.hasSpanStreamingEnabled)(client) ? `GraphQL ${PROCESSING_TYPE_VALIDATE}` : SPAN_NAME_VALIDATE,
|
|
4410
4410
|
attributes: {
|
|
4411
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
4411
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$20,
|
|
4412
4412
|
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.GRAPHQL,
|
|
4413
4413
|
[_sentry_conventions_attributes.GRAPHQL_PROCESSING_TYPE]: PROCESSING_TYPE_VALIDATE,
|
|
4414
4414
|
[_sentry_conventions_attributes.GRAPHQL_DOCUMENT]: collectGraphqlDocument(data.document)
|
|
@@ -4428,7 +4428,7 @@ function setupOperationChannel(tracingChannel, channelName, fallbackName, useOpe
|
|
|
4428
4428
|
const span = (0, _sentry_core.startInactiveSpan)({
|
|
4429
4429
|
name: client && (0, _sentry_core.hasSpanStreamingEnabled)(client) ? streamedName : getOperationSpanName(data.operationType, data.operationName, fallbackName),
|
|
4430
4430
|
attributes: {
|
|
4431
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
4431
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$20,
|
|
4432
4432
|
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.GRAPHQL,
|
|
4433
4433
|
[_sentry_conventions_attributes.GRAPHQL_PROCESSING_TYPE]: PROCESSING_TYPE_EXECUTE,
|
|
4434
4434
|
[_sentry_conventions_attributes.GRAPHQL_OPERATION_TYPE]: data.operationType,
|
|
@@ -4452,7 +4452,7 @@ function setupResolveChannel(tracingChannel, ignoreTrivialResolveSpans) {
|
|
|
4452
4452
|
return (0, _sentry_core.startInactiveSpan)({
|
|
4453
4453
|
name: client && (0, _sentry_core.hasSpanStreamingEnabled)(client) ? `GraphQL ${PROCESSING_TYPE_RESOLVE}` : `${SPAN_NAME_RESOLVE} ${data.fieldPath}`,
|
|
4454
4454
|
attributes: {
|
|
4455
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
4455
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$20,
|
|
4456
4456
|
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.GRAPHQL,
|
|
4457
4457
|
[_sentry_conventions_attributes.GRAPHQL_PROCESSING_TYPE]: PROCESSING_TYPE_RESOLVE,
|
|
4458
4458
|
[GRAPHQL_FIELD_NAME]: data.fieldName,
|
|
@@ -4537,7 +4537,7 @@ function createFieldIfNotExists(contextValue, info, path) {
|
|
|
4537
4537
|
}
|
|
4538
4538
|
function createResolverSpan(info, path, parentSpan) {
|
|
4539
4539
|
const attributes = {
|
|
4540
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
4540
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$20,
|
|
4541
4541
|
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.GRAPHQL,
|
|
4542
4542
|
[_sentry_conventions_attributes.GRAPHQL_PROCESSING_TYPE]: PROCESSING_TYPE_RESOLVE,
|
|
4543
4543
|
[GRAPHQL_FIELD_NAME]: info.fieldName,
|
|
@@ -4604,7 +4604,7 @@ function getOperation(document, operationName) {
|
|
|
4604
4604
|
}
|
|
4605
4605
|
// src/integrations/graphql/spans.ts
|
|
4606
4606
|
const BASE_ATTRIBUTES = {
|
|
4607
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
4607
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$20,
|
|
4608
4608
|
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.GRAPHQL
|
|
4609
4609
|
};
|
|
4610
4610
|
function startParseSpan() {
|
|
@@ -4719,7 +4719,7 @@ function finalizeExecuteSpan(span, result) {
|
|
|
4719
4719
|
});
|
|
4720
4720
|
}
|
|
4721
4721
|
// src/integrations/graphql/index.ts
|
|
4722
|
-
const INTEGRATION_NAME$
|
|
4722
|
+
const INTEGRATION_NAME$24 = "Graphql";
|
|
4723
4723
|
function getOptionsWithDefaults(options) {
|
|
4724
4724
|
return {
|
|
4725
4725
|
ignoreResolveSpans: options.ignoreResolveSpans !== false,
|
|
@@ -4731,7 +4731,7 @@ const _graphqlIntegration = ((options = {}) => {
|
|
|
4731
4731
|
const config = getOptionsWithDefaults(options);
|
|
4732
4732
|
const getConfig = () => config;
|
|
4733
4733
|
return {
|
|
4734
|
-
name: INTEGRATION_NAME$
|
|
4734
|
+
name: INTEGRATION_NAME$24,
|
|
4735
4735
|
setup(client) {
|
|
4736
4736
|
invokeOrchestrionInstrumentation(client, require_config.graphqlModuleNames, instrumentGraphql, [config, getConfig]);
|
|
4737
4737
|
},
|
|
@@ -4757,10 +4757,10 @@ function setupNativeGraphQLInstrumentation(options) {
|
|
|
4757
4757
|
*/
|
|
4758
4758
|
const graphqlIntegration = (0, _sentry_core.defineIntegration)(_graphqlIntegration);
|
|
4759
4759
|
// src/integrations/hapi/index.ts
|
|
4760
|
-
const INTEGRATION_NAME$
|
|
4760
|
+
const INTEGRATION_NAME$23 = "Hapi";
|
|
4761
4761
|
const _hapiIntegration = (({ shouldHandleError } = {}) => {
|
|
4762
4762
|
return {
|
|
4763
|
-
name: INTEGRATION_NAME$
|
|
4763
|
+
name: INTEGRATION_NAME$23,
|
|
4764
4764
|
setup(client) {
|
|
4765
4765
|
invokeOrchestrionInstrumentation(client, require_config.hapiModuleNames, instrumentHapi, [shouldHandleError], { requiresTracingChannelBinding: false });
|
|
4766
4766
|
}
|
|
@@ -4806,8 +4806,22 @@ function instrumentHapi(shouldHandleError) {
|
|
|
4806
4806
|
* `lib/server.js`. Requires the Sentry runtime hook or bundler plugin.
|
|
4807
4807
|
*/
|
|
4808
4808
|
const hapiIntegration = (0, _sentry_core.defineIntegration)(_hapiIntegration);
|
|
4809
|
+
/**
|
|
4810
|
+
* Add a Hapi plugin to capture errors to Sentry.
|
|
4811
|
+
*
|
|
4812
|
+
* @deprecated The error handler is now registered automatically when the Hapi
|
|
4813
|
+
* server starts (via the orchestrion `@hapi/hapi` instrumentation), so calling
|
|
4814
|
+
* this is no longer necessary. It remains a safe, idempotent operation when the
|
|
4815
|
+
* handler is already attached, and is kept for setups where auto-registration is
|
|
4816
|
+
* unavailable. This will be removed in a future major version.
|
|
4817
|
+
*
|
|
4818
|
+
* @param server The Hapi server to attach the error handler to
|
|
4819
|
+
*/
|
|
4820
|
+
async function setupHapiErrorHandler(server) {
|
|
4821
|
+
attachHapiErrorHandler$1(server);
|
|
4822
|
+
}
|
|
4809
4823
|
// src/integrations/hono/honoIntegration.ts
|
|
4810
|
-
const INTEGRATION_NAME$
|
|
4824
|
+
const INTEGRATION_NAME$22 = "Hono";
|
|
4811
4825
|
function getHonoRuntime() {
|
|
4812
4826
|
return require_exports.isBun() ? "bun" : require_exports.isDeno() ? "deno" : require_exports.isCloudflareWorkers() ? "cloudflare" : "node";
|
|
4813
4827
|
}
|
|
@@ -4900,7 +4914,7 @@ function instrumentHono(options) {
|
|
|
4900
4914
|
}
|
|
4901
4915
|
const _honoIntegration = ((options = {}) => {
|
|
4902
4916
|
return {
|
|
4903
|
-
name: INTEGRATION_NAME$
|
|
4917
|
+
name: INTEGRATION_NAME$22,
|
|
4904
4918
|
setup(client) {
|
|
4905
4919
|
invokeOrchestrionInstrumentation(client, require_config.honoModuleNames, instrumentHono, [options]);
|
|
4906
4920
|
}
|
|
@@ -4919,8 +4933,8 @@ const _honoIntegration = ((options = {}) => {
|
|
|
4919
4933
|
*/
|
|
4920
4934
|
const honoIntegration = (0, _sentry_core.defineIntegration)(_honoIntegration);
|
|
4921
4935
|
// src/integrations/koa/index.ts
|
|
4922
|
-
const INTEGRATION_NAME$
|
|
4923
|
-
const ORIGIN$
|
|
4936
|
+
const INTEGRATION_NAME$21 = "Koa";
|
|
4937
|
+
const ORIGIN$19 = "auto.http.koa";
|
|
4924
4938
|
const LAYER_TYPE = {
|
|
4925
4939
|
ROUTER: "router",
|
|
4926
4940
|
MIDDLEWARE: "middleware"
|
|
@@ -4929,7 +4943,7 @@ const kLayerPatched = Symbol("sentry.koa.layer-patched");
|
|
|
4929
4943
|
const _koaIntegration = ((options = {}) => {
|
|
4930
4944
|
const ignoreLayersType = options.ignoreLayersType ?? [];
|
|
4931
4945
|
return {
|
|
4932
|
-
name: INTEGRATION_NAME$
|
|
4946
|
+
name: INTEGRATION_NAME$21,
|
|
4933
4947
|
setup(client) {
|
|
4934
4948
|
invokeOrchestrionInstrumentation(client, require_config.koaModuleNames, instrumentKoa, [ignoreLayersType], { requiresTracingChannelBinding: false });
|
|
4935
4949
|
}
|
|
@@ -5007,7 +5021,7 @@ function patchLayer(middlewareLayer, isRouter, ignoreLayersType, layerPath) {
|
|
|
5007
5021
|
attributes: {
|
|
5008
5022
|
...metadata.attributes,
|
|
5009
5023
|
[_sentry_conventions_attributes.SENTRY_OP]: layerType === LAYER_TYPE.MIDDLEWARE ? _sentry_conventions_op.MIDDLEWARE : _sentry_conventions_op.ROUTER,
|
|
5010
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
5024
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$19
|
|
5011
5025
|
}
|
|
5012
5026
|
}, () => {
|
|
5013
5027
|
if (!context["__SENTRY_KOA_SPAN__"]) {
|
|
@@ -5254,7 +5268,7 @@ const REDIS_DC_CHANNEL_BATCH = "node-redis:batch";
|
|
|
5254
5268
|
const REDIS_DC_CHANNEL_CONNECT = "node-redis:connect";
|
|
5255
5269
|
const IOREDIS_DC_CHANNEL_COMMAND = "ioredis:command";
|
|
5256
5270
|
const IOREDIS_DC_CHANNEL_CONNECT = "ioredis:connect";
|
|
5257
|
-
const ORIGIN$
|
|
5271
|
+
const ORIGIN$18 = "auto.db.redis.native_channel";
|
|
5258
5272
|
const DB_SYSTEM_NAME_VALUE_REDIS = "redis";
|
|
5259
5273
|
/**
|
|
5260
5274
|
* Subscribe Sentry span handlers to node-redis and ioredis diagnostics-channel
|
|
@@ -5281,7 +5295,7 @@ function setupCommandChannel(tracingChannel, channelName, getCommandArgs, cacheO
|
|
|
5281
5295
|
port: data.serverPort
|
|
5282
5296
|
});
|
|
5283
5297
|
const attributes = {
|
|
5284
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
5298
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$18,
|
|
5285
5299
|
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB_QUERY,
|
|
5286
5300
|
[_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_REDIS,
|
|
5287
5301
|
[_sentry_conventions_attributes.DB_OPERATION_NAME]: data.command,
|
|
@@ -5309,7 +5323,7 @@ function setupBatchChannel(tracingChannel, channelName, getOperationName) {
|
|
|
5309
5323
|
return (0, _sentry_core.startInactiveSpan)({
|
|
5310
5324
|
name: operation,
|
|
5311
5325
|
attributes: {
|
|
5312
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
5326
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$18,
|
|
5313
5327
|
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB_QUERY,
|
|
5314
5328
|
[_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_REDIS,
|
|
5315
5329
|
[_sentry_conventions_attributes.DB_OPERATION_NAME]: operation,
|
|
@@ -5325,7 +5339,7 @@ function setupConnectChannel$1(tracingChannel, channelName) {
|
|
|
5325
5339
|
return (0, _sentry_core.startInactiveSpan)({
|
|
5326
5340
|
name: "redis-connect",
|
|
5327
5341
|
attributes: {
|
|
5328
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
5342
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$18,
|
|
5329
5343
|
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
|
|
5330
5344
|
[_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_REDIS,
|
|
5331
5345
|
...data.serverAddress != null ? { [_sentry_conventions_attributes.SERVER_ADDRESS]: data.serverAddress } : {},
|
|
@@ -5335,7 +5349,7 @@ function setupConnectChannel$1(tracingChannel, channelName) {
|
|
|
5335
5349
|
});
|
|
5336
5350
|
}
|
|
5337
5351
|
// src/integrations/redis/ioredis-channel-subscriber.ts
|
|
5338
|
-
const ORIGIN$
|
|
5352
|
+
const ORIGIN$17 = "auto.db.redis";
|
|
5339
5353
|
const DB_SYSTEM_VALUE_REDIS$1 = "redis";
|
|
5340
5354
|
function getConnectionOptions(self) {
|
|
5341
5355
|
return {
|
|
@@ -5348,7 +5362,7 @@ function connectionAttributes(host, port) {
|
|
|
5348
5362
|
[_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_VALUE_REDIS$1,
|
|
5349
5363
|
...host != null ? { [_sentry_conventions_attributes.SERVER_ADDRESS]: host } : {},
|
|
5350
5364
|
...port != null ? { [_sentry_conventions_attributes.SERVER_PORT]: port } : {},
|
|
5351
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
5365
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$17
|
|
5352
5366
|
};
|
|
5353
5367
|
}
|
|
5354
5368
|
const tracedCommands = /* @__PURE__ */ new WeakSet();
|
|
@@ -5413,8 +5427,8 @@ function instrumentIoredis(options) {
|
|
|
5413
5427
|
});
|
|
5414
5428
|
}
|
|
5415
5429
|
// src/integrations/redis/index.ts
|
|
5416
|
-
const INTEGRATION_NAME$
|
|
5417
|
-
const ORIGIN$
|
|
5430
|
+
const INTEGRATION_NAME$20 = "Redis";
|
|
5431
|
+
const ORIGIN$16 = "auto.db.redis";
|
|
5418
5432
|
const DB_SYSTEM_VALUE_REDIS = "redis";
|
|
5419
5433
|
function endSpan$1(span, err) {
|
|
5420
5434
|
if (err) span.setStatus({
|
|
@@ -5436,7 +5450,7 @@ function nodeRedisAttributes(options) {
|
|
|
5436
5450
|
[_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_VALUE_REDIS,
|
|
5437
5451
|
[_sentry_conventions_attributes.SERVER_ADDRESS]: host,
|
|
5438
5452
|
...port != null ? { [_sentry_conventions_attributes.SERVER_PORT]: port } : {},
|
|
5439
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
5453
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$16
|
|
5440
5454
|
};
|
|
5441
5455
|
}
|
|
5442
5456
|
function startCommandSpan(commandName, commandArgs, attributes, cacheOptions) {
|
|
@@ -5474,7 +5488,7 @@ function subscribeLegacyRedisCommand(cacheOptions) {
|
|
|
5474
5488
|
const client = data.self;
|
|
5475
5489
|
const attributes = {
|
|
5476
5490
|
[_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_VALUE_REDIS,
|
|
5477
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
5491
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$16
|
|
5478
5492
|
};
|
|
5479
5493
|
if (client?.connection_options?.host != null) attributes[_sentry_conventions_attributes.SERVER_ADDRESS] = client.connection_options.host;
|
|
5480
5494
|
if (client?.connection_options?.port != null) attributes[_sentry_conventions_attributes.SERVER_PORT] = client.connection_options.port;
|
|
@@ -5552,7 +5566,7 @@ function bindNodeRedisBatchChannel(channelName, getOperation) {
|
|
|
5552
5566
|
}
|
|
5553
5567
|
const _redisIntegration = ((options = {}) => {
|
|
5554
5568
|
return {
|
|
5555
|
-
name: INTEGRATION_NAME$
|
|
5569
|
+
name: INTEGRATION_NAME$20,
|
|
5556
5570
|
setup(client) {
|
|
5557
5571
|
invokeOrchestrionInstrumentation(client, require_config.redisModuleNames, instrumentLegacyRedis, [options], { requiresTracingChannelBinding: false });
|
|
5558
5572
|
invokeOrchestrionInstrumentation(client, require_config.redisModuleNames, instrumentNodeRedis, [options]);
|
|
@@ -5779,7 +5793,7 @@ function wrapEachBatch(original) {
|
|
|
5779
5793
|
return wrapped;
|
|
5780
5794
|
}
|
|
5781
5795
|
// src/integrations/kafkajs/index.ts
|
|
5782
|
-
const INTEGRATION_NAME$
|
|
5796
|
+
const INTEGRATION_NAME$19 = "Kafka";
|
|
5783
5797
|
function subscribeToProducer() {
|
|
5784
5798
|
tracingChannel(CHANNELS.KAFKAJS_SEND_BATCH).subscribe({
|
|
5785
5799
|
start(ctx) {
|
|
@@ -5809,7 +5823,7 @@ function subscribeToConsumer() {
|
|
|
5809
5823
|
}
|
|
5810
5824
|
const _kafkaIntegration = (() => {
|
|
5811
5825
|
return {
|
|
5812
|
-
name: INTEGRATION_NAME$
|
|
5826
|
+
name: INTEGRATION_NAME$19,
|
|
5813
5827
|
setup(client) {
|
|
5814
5828
|
invokeOrchestrionInstrumentation(client, require_config.kafkajsModuleNames, instrumentKafkajs, [], { requiresTracingChannelBinding: false });
|
|
5815
5829
|
}
|
|
@@ -5833,8 +5847,8 @@ function instrumentKafkajs() {
|
|
|
5833
5847
|
*/
|
|
5834
5848
|
const kafkaIntegration = (0, _sentry_core.defineIntegration)(_kafkaIntegration);
|
|
5835
5849
|
// src/integrations/knex.ts
|
|
5836
|
-
const INTEGRATION_NAME$
|
|
5837
|
-
const ORIGIN$
|
|
5850
|
+
const INTEGRATION_NAME$18 = "Knex";
|
|
5851
|
+
const ORIGIN$15 = "auto.db.knex";
|
|
5838
5852
|
const MAX_QUERY_LENGTH = 1021;
|
|
5839
5853
|
const ATTR_DB_SQL_TABLE$1 = "db.sql.table";
|
|
5840
5854
|
const DB_SYSTEM_SQLITE = "sqlite";
|
|
@@ -5842,7 +5856,7 @@ const DB_SYSTEM_POSTGRESQL$2 = "postgresql";
|
|
|
5842
5856
|
const parentSpanSymbol = Symbol("sentry.orchestrion.knex.parent-span");
|
|
5843
5857
|
const _knexIntegration = (() => {
|
|
5844
5858
|
return {
|
|
5845
|
-
name: INTEGRATION_NAME$
|
|
5859
|
+
name: INTEGRATION_NAME$18,
|
|
5846
5860
|
setupOnce() {
|
|
5847
5861
|
if (!tracingChannel) return;
|
|
5848
5862
|
require_debug_build.DEBUG_BUILD && _sentry_core.debug.log(`[instrumentation:knex] subscribing to channel "${CHANNELS.KNEX_QUERY}"`);
|
|
@@ -5888,7 +5902,7 @@ function subscribeQuery$1() {
|
|
|
5888
5902
|
const attributes = {
|
|
5889
5903
|
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
|
|
5890
5904
|
[_sentry_conventions_attributes.SENTRY_KIND]: "client",
|
|
5891
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
5905
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$15,
|
|
5892
5906
|
...require_exports.getSqlQueryAttributes(query?.sql ? (0, _sentry_core.truncate)(query.sql, MAX_QUERY_LENGTH) : void 0, dialect),
|
|
5893
5907
|
"knex.version": data.moduleVersion,
|
|
5894
5908
|
[_sentry_conventions_attributes.DB_SYSTEM_NAME]: dbSystem,
|
|
@@ -6087,7 +6101,7 @@ const groqIntegration = (0, _sentry_core.defineIntegration)(createOpenAiCompatib
|
|
|
6087
6101
|
}
|
|
6088
6102
|
}));
|
|
6089
6103
|
// src/integrations/langchain.ts
|
|
6090
|
-
const INTEGRATION_NAME$
|
|
6104
|
+
const INTEGRATION_NAME$17 = require_exports.LANGCHAIN_INTEGRATION_NAME;
|
|
6091
6105
|
const SKIPPED_PROVIDERS = [
|
|
6092
6106
|
require_exports.OPENAI_INTEGRATION_NAME,
|
|
6093
6107
|
require_exports.ANTHROPIC_AI_INTEGRATION_NAME,
|
|
@@ -6100,7 +6114,7 @@ function markProvidersSkipped() {
|
|
|
6100
6114
|
}
|
|
6101
6115
|
const _langChainIntegration = ((options = {}) => {
|
|
6102
6116
|
return {
|
|
6103
|
-
name: INTEGRATION_NAME$
|
|
6117
|
+
name: INTEGRATION_NAME$17,
|
|
6104
6118
|
setup(client) {
|
|
6105
6119
|
invokeOrchestrionInstrumentation(client, require_config.langchainModuleNames, instrumentChatModels, [options], { requiresTracingChannelBinding: false });
|
|
6106
6120
|
invokeOrchestrionInstrumentation(client, require_config.langchainModuleNames, instrumentEmbeddings, [options]);
|
|
@@ -6135,12 +6149,18 @@ function instrumentChatModels(options) {
|
|
|
6135
6149
|
});
|
|
6136
6150
|
}
|
|
6137
6151
|
function instrumentEmbeddings(options) {
|
|
6138
|
-
for (const channelName of require_config.langchainEmbeddingsChannels) bindTracingChannelToSpan(tracingChannel(channelName), (data) => createEmbeddingsSpan(data, options));
|
|
6152
|
+
for (const channelName of require_config.langchainEmbeddingsChannels) bindTracingChannelToSpan(tracingChannel(channelName), (data) => createEmbeddingsSpan(data, options), { beforeSpanEnd: (_span, data) => data._sentryOnSpanEnd?.("error" in data ? { error: data.error } : { response: data.result }) });
|
|
6139
6153
|
}
|
|
6140
6154
|
function createEmbeddingsSpan(data, options) {
|
|
6141
6155
|
markProvidersSkipped();
|
|
6142
|
-
const
|
|
6143
|
-
|
|
6156
|
+
const call = {
|
|
6157
|
+
operation: "embeddings",
|
|
6158
|
+
input: (data.arguments ?? [])[0]
|
|
6159
|
+
};
|
|
6160
|
+
const span = (0, _sentry_core.startInactiveSpan)(require_exports._INTERNAL_getLangChainEmbeddingsSpanOptions(data.self, call, options));
|
|
6161
|
+
require_exports.runGenAiSpanStart(options, span, call);
|
|
6162
|
+
data._sentryOnSpanEnd = (result) => require_exports.runGenAiSpanEnd(options, span, call, result);
|
|
6163
|
+
return span;
|
|
6144
6164
|
}
|
|
6145
6165
|
/**
|
|
6146
6166
|
* Diagnostics-channel-based LangChain integration. Subscribes to the diagnostics_channels
|
|
@@ -6149,11 +6169,11 @@ function createEmbeddingsSpan(data, options) {
|
|
|
6149
6169
|
*/
|
|
6150
6170
|
const langChainIntegration = (0, _sentry_core.defineIntegration)(_langChainIntegration);
|
|
6151
6171
|
// src/integrations/langgraph.ts
|
|
6152
|
-
const INTEGRATION_NAME$
|
|
6172
|
+
const INTEGRATION_NAME$16 = require_exports.LANGGRAPH_INTEGRATION_NAME;
|
|
6153
6173
|
let insideCreateReactAgent = false;
|
|
6154
6174
|
const _langGraphIntegration = ((options = {}) => {
|
|
6155
6175
|
return {
|
|
6156
|
-
name: INTEGRATION_NAME$
|
|
6176
|
+
name: INTEGRATION_NAME$16,
|
|
6157
6177
|
setup(client) {
|
|
6158
6178
|
invokeOrchestrionInstrumentation(client, require_config.langgraphModuleNames, instrumentLanggraph, [options], { requiresTracingChannelBinding: false });
|
|
6159
6179
|
}
|
|
@@ -6538,7 +6558,8 @@ function endRun(run, runs, status) {
|
|
|
6538
6558
|
* function returns shows whether the run survived the commit.
|
|
6539
6559
|
*/
|
|
6540
6560
|
function observeRunControl(runtime, run, runs) {
|
|
6541
|
-
const commit = (
|
|
6561
|
+
const commit = runtime.commit.bind(runtime);
|
|
6562
|
+
runtime.commit = (change, context, ...rest) => {
|
|
6542
6563
|
let ended = false;
|
|
6543
6564
|
let settlement;
|
|
6544
6565
|
const observedChange = async (tx, current) => {
|
|
@@ -6569,16 +6590,16 @@ function observeRunControl(runtime, run, runs) {
|
|
|
6569
6590
|
run.pendingEnd = ended ? { status: toRunStatus(settlement) } : void 0;
|
|
6570
6591
|
return result;
|
|
6571
6592
|
};
|
|
6572
|
-
return
|
|
6593
|
+
return commit(observedChange, context, ...rest).then(() => {
|
|
6573
6594
|
if (ended) endRun(run, runs, toRunStatus(settlement));
|
|
6574
6595
|
}, (error) => {
|
|
6575
6596
|
run.pendingEnd = void 0;
|
|
6576
6597
|
throw error;
|
|
6577
6598
|
});
|
|
6578
6599
|
};
|
|
6579
|
-
return
|
|
6580
|
-
|
|
6581
|
-
}
|
|
6600
|
+
return () => {
|
|
6601
|
+
runtime.commit = commit;
|
|
6602
|
+
};
|
|
6582
6603
|
}
|
|
6583
6604
|
function toRunStatus(settlement) {
|
|
6584
6605
|
if (settlement?.status !== "unanswered") return;
|
|
@@ -6602,35 +6623,38 @@ function markBuiltInTool(tool) {
|
|
|
6602
6623
|
/**
|
|
6603
6624
|
* Prepare the runtime of a `pi.tool` phase. The tool task resolves the called tool from its agent,
|
|
6604
6625
|
* so the runtime hands out traced tools, and it collects the result entries the phase commits.
|
|
6605
|
-
*
|
|
6606
|
-
* after `execute()` returns: from `api.output()`, through `afterTool` hooks and
|
|
6626
|
+
* The returned function ends the phase's tool spans with the result the model receives, which
|
|
6627
|
+
* pi-durable builds after `execute()` returns: from `api.output()`, through `afterTool` hooks and
|
|
6628
|
+
* output limits.
|
|
6607
6629
|
*/
|
|
6608
|
-
function instrumentToolPhase(runtime, runs, wrapTool) {
|
|
6630
|
+
function instrumentToolPhase(runtime, runs, wrapTool, isNested) {
|
|
6609
6631
|
const results = /* @__PURE__ */ new Map();
|
|
6610
6632
|
runs.toolCalls.set(runtime.taskId, []);
|
|
6611
|
-
const agent =
|
|
6633
|
+
const agent = runtime.agent.bind(runtime);
|
|
6634
|
+
const commit = runtime.commit.bind(runtime);
|
|
6635
|
+
runtime.agent = (context) => agent(context).then((resolved) => resolved?.tools ? {
|
|
6612
6636
|
...resolved,
|
|
6613
|
-
tools: resolved.tools.map(wrapTool)
|
|
6637
|
+
tools: resolved.tools.map(wrapTool),
|
|
6638
|
+
...resolved.callable ? { callable: resolved.callable.map(wrapTool) } : {}
|
|
6614
6639
|
} : resolved);
|
|
6615
|
-
|
|
6640
|
+
runtime.commit = (change, context, ...rest) => {
|
|
6616
6641
|
let committed = [];
|
|
6617
6642
|
const observedChange = (tx, current) => {
|
|
6618
6643
|
committed = [];
|
|
6619
6644
|
return change(observeToolResultEntries(tx, committed), current);
|
|
6620
6645
|
};
|
|
6621
|
-
return
|
|
6646
|
+
return commit(observedChange, context, ...rest).then(() => {
|
|
6622
6647
|
for (const message of committed) results.set(message.toolCallId, message);
|
|
6623
6648
|
});
|
|
6624
6649
|
};
|
|
6625
|
-
return {
|
|
6626
|
-
runtime
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
for (const call of runs.toolCalls.get(runtime.taskId) ?? []) finishToolCall(call, call.callId !== void 0 ? results.get(call.callId) : void 0);
|
|
6632
|
-
runs.toolCalls.delete(runtime.taskId);
|
|
6650
|
+
return () => {
|
|
6651
|
+
runtime.agent = agent;
|
|
6652
|
+
runtime.commit = commit;
|
|
6653
|
+
for (const call of runs.toolCalls.get(runtime.taskId) ?? []) {
|
|
6654
|
+
const committed = call.callId !== void 0 ? results.get(call.callId) : void 0;
|
|
6655
|
+
finishToolCall(call, isNested ? call.returned : committed);
|
|
6633
6656
|
}
|
|
6657
|
+
runs.toolCalls.delete(runtime.taskId);
|
|
6634
6658
|
};
|
|
6635
6659
|
}
|
|
6636
6660
|
/** Wrap a tool so each call gets a `gen_ai.execute_tool` span. */
|
|
@@ -6670,10 +6694,11 @@ function instrumentTool(tool, runs, options) {
|
|
|
6670
6694
|
const result = await tool.execute(args, trackOwnedConversations(api, span, runs), context);
|
|
6671
6695
|
call.endTimestamp = (0, _sentry_core.timestampInSeconds)();
|
|
6672
6696
|
call.onSpanEnd = () => require_exports.runGenAiSpanEnd(options, span, toolCall, { response: result });
|
|
6673
|
-
|
|
6697
|
+
call.returned = {
|
|
6674
6698
|
content: result?.output ?? result?.content,
|
|
6675
6699
|
isError: result?.isError
|
|
6676
|
-
}
|
|
6700
|
+
};
|
|
6701
|
+
if (!calls) finishToolCall(call, call.returned);
|
|
6677
6702
|
return result;
|
|
6678
6703
|
} catch (error) {
|
|
6679
6704
|
call.endTimestamp = (0, _sentry_core.timestampInSeconds)();
|
|
@@ -6842,7 +6867,7 @@ function instrumentRegistry(registry, options, runs) {
|
|
|
6842
6867
|
let wrapped = tasks.get(task);
|
|
6843
6868
|
if (!wrapped) {
|
|
6844
6869
|
const { definition } = task;
|
|
6845
|
-
const wrapPhase = (phase, receiver, isAbort = false) => (taskRecord, runtime, context) => runPhase(definition.name, (
|
|
6870
|
+
const wrapPhase = (phase, receiver, isAbort = false) => (taskRecord, runtime, context) => runPhase(definition.name, taskRecord, () => phase.call(receiver, taskRecord, runtime, context), runtime, context, runs, wrapTool, isAbort, options);
|
|
6846
6871
|
const phases = {};
|
|
6847
6872
|
for (const [name, phase] of Object.entries(definition.phases)) phases[name] = typeof phase === "function" ? wrapPhase(phase, definition.phases) : phase;
|
|
6848
6873
|
wrapped = {
|
|
@@ -6874,18 +6899,15 @@ function instrumentRegistry(registry, options, runs) {
|
|
|
6874
6899
|
return bound(target, property);
|
|
6875
6900
|
} });
|
|
6876
6901
|
}
|
|
6877
|
-
function runPhase(kind, phase, runtime, context, runs, wrapTool, isAbort, options) {
|
|
6902
|
+
function runPhase(kind, task, phase, runtime, context, runs, wrapTool, isAbort, options) {
|
|
6878
6903
|
const { conversationId } = runtime;
|
|
6879
6904
|
const isRunWork = kind === PI_TASK.GENERATION || kind === PI_TASK.TOOL;
|
|
6880
6905
|
const run = isRunWork || kind === PI_TASK.COMPACTION ? runs.active.get(conversationId) ?? (isRunWork && !isAbort ? startRun(conversationId, runs) : void 0) : void 0;
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
observed = toolPhase.runtime;
|
|
6887
|
-
finishToolPhase = toolPhase.finish;
|
|
6888
|
-
}
|
|
6906
|
+
const input = kind === PI_TASK.TOOL ? task?.input : void 0;
|
|
6907
|
+
const callerSpan = input?.kind === "nested" ? runs.toolCalls.get(input.parent)?.find((call) => call.callId === input.parentCallId)?.span : void 0;
|
|
6908
|
+
let finishPhase;
|
|
6909
|
+
if (run && kind === PI_TASK.GENERATION) finishPhase = observeRunControl(runtime, run, runs);
|
|
6910
|
+
else if (kind === PI_TASK.TOOL) finishPhase = instrumentToolPhase(runtime, runs, wrapTool, input?.kind === "nested");
|
|
6889
6911
|
const runInScope = async (scope) => {
|
|
6890
6912
|
let sessionId = run?.sessionId;
|
|
6891
6913
|
if (!sessionId) {
|
|
@@ -6902,7 +6924,7 @@ function runPhase(kind, phase, runtime, context, runs, wrapTool, isAbort, option
|
|
|
6902
6924
|
context
|
|
6903
6925
|
});
|
|
6904
6926
|
try {
|
|
6905
|
-
return await phase(
|
|
6927
|
+
return await phase();
|
|
6906
6928
|
} catch (error) {
|
|
6907
6929
|
if (!runtime.signal?.aborted) {
|
|
6908
6930
|
(0, _sentry_core.captureException)(error, { mechanism: {
|
|
@@ -6916,11 +6938,11 @@ function runPhase(kind, phase, runtime, context, runs, wrapTool, isAbort, option
|
|
|
6916
6938
|
}
|
|
6917
6939
|
throw error;
|
|
6918
6940
|
} finally {
|
|
6919
|
-
|
|
6941
|
+
finishPhase?.();
|
|
6920
6942
|
}
|
|
6921
6943
|
};
|
|
6922
6944
|
if (!run) return require_exports.withCleanScopes((0, _sentry_core.getDefaultIsolationScope)().clone(), () => (0, _sentry_core.startNewTrace)(() => runInScope((0, _sentry_core.getCurrentScope)())));
|
|
6923
|
-
return require_exports.withCleanScopes(run.isolationScope, () => (0, _sentry_core.withActiveSpan)(run.span, runInScope));
|
|
6945
|
+
return require_exports.withCleanScopes(run.isolationScope, () => (0, _sentry_core.withActiveSpan)(callerSpan ?? run.span, runInScope));
|
|
6924
6946
|
}
|
|
6925
6947
|
// src/integrations/pi-durable.ts
|
|
6926
6948
|
const _piDurableIntegration = ((options = {}) => {
|
|
@@ -7232,10 +7254,10 @@ function createObservabilityBootstrap(exporter) {
|
|
|
7232
7254
|
*/
|
|
7233
7255
|
const mastraIntegration = (0, _sentry_core.defineIntegration)(_mastraIntegration);
|
|
7234
7256
|
// src/integrations/mcp-server.ts
|
|
7235
|
-
const INTEGRATION_NAME$
|
|
7257
|
+
const INTEGRATION_NAME$15 = "McpServer";
|
|
7236
7258
|
const _mcpServerIntegration = (() => {
|
|
7237
7259
|
return {
|
|
7238
|
-
name: INTEGRATION_NAME$
|
|
7260
|
+
name: INTEGRATION_NAME$15,
|
|
7239
7261
|
setup(client) {
|
|
7240
7262
|
invokeOrchestrionInstrumentation(client, require_config.mcpServerModuleNames, subscribe$1, [], { requiresTracingChannelBinding: false });
|
|
7241
7263
|
}
|
|
@@ -7269,12 +7291,12 @@ const tunnelServers = /* @__PURE__ */ new WeakSet();
|
|
|
7269
7291
|
function instrumentTunnelServer(message) {
|
|
7270
7292
|
try {
|
|
7271
7293
|
const server = message?.server;
|
|
7272
|
-
if (!server || tunnelServers.has(server) || (0, _sentry_core_server.
|
|
7294
|
+
if (!server || tunnelServers.has(server) || (0, _sentry_core_server.httpServerHandlesTunnel)()) return;
|
|
7273
7295
|
tunnelServers.add(server);
|
|
7274
7296
|
const originalEmit = server.emit;
|
|
7275
7297
|
server.emit = function(event, ...data) {
|
|
7276
7298
|
const [request, response] = data;
|
|
7277
|
-
if (event === "request" && (0, _sentry_core_server.
|
|
7299
|
+
if (event === "request" && (0, _sentry_core_server.handleServedNodeTunnelRequest)(request, response)) return true;
|
|
7278
7300
|
return originalEmit.call(this, event, ...data);
|
|
7279
7301
|
};
|
|
7280
7302
|
} catch (error) {
|
|
@@ -7290,7 +7312,7 @@ let isSubscribed = false;
|
|
|
7290
7312
|
function instrumentTunnelServers() {
|
|
7291
7313
|
if (isSubscribed) return;
|
|
7292
7314
|
isSubscribed = true;
|
|
7293
|
-
(0, _sentry_core_server.
|
|
7315
|
+
(0, _sentry_core_server.setNodeTunnelHandler)(_sentry_core_server.handleServedNodeTunnelRequest);
|
|
7294
7316
|
subscribe(_sentry_core_server.HTTP_ON_SERVER_REQUEST, instrumentTunnelServer);
|
|
7295
7317
|
}
|
|
7296
7318
|
/**
|
|
@@ -7310,11 +7332,35 @@ function makeServeTunnelIntegration(instrumentRuntimeServers) {
|
|
|
7310
7332
|
};
|
|
7311
7333
|
});
|
|
7312
7334
|
}
|
|
7335
|
+
// src/utils/module.ts
|
|
7336
|
+
/** normalizes Windows paths */
|
|
7337
|
+
function normalizeWindowsPath(path) {
|
|
7338
|
+
return path.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
7339
|
+
}
|
|
7340
|
+
/** Creates a function that gets the module name from a filename */
|
|
7341
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? (0, _sentry_core.dirname)(process.argv[1]) : process.cwd(), isWindows = node_path.sep === "\\") {
|
|
7342
|
+
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
7343
|
+
return (filename) => {
|
|
7344
|
+
if (!filename) return;
|
|
7345
|
+
const normalizedFilename = isWindows ? normalizeWindowsPath(filename) : filename;
|
|
7346
|
+
let { dir, base: file, ext } = node_path.posix.parse(normalizedFilename);
|
|
7347
|
+
if (ext === ".js" || ext === ".mjs" || ext === ".cjs") file = file.slice(0, ext.length * -1);
|
|
7348
|
+
const decodedFile = decodeURIComponent(file);
|
|
7349
|
+
if (!dir) dir = ".";
|
|
7350
|
+
const n = dir.lastIndexOf("/node_modules");
|
|
7351
|
+
if (n > -1) return `${dir.slice(n + 14).replace(/\//g, ".")}:${decodedFile}`;
|
|
7352
|
+
if (dir.startsWith(normalizedBase)) {
|
|
7353
|
+
const moduleName = dir.slice(normalizedBase.length + 1).replace(/\//g, ".");
|
|
7354
|
+
return moduleName ? `${moduleName}:${decodedFile}` : decodedFile;
|
|
7355
|
+
}
|
|
7356
|
+
return decodedFile;
|
|
7357
|
+
};
|
|
7358
|
+
}
|
|
7313
7359
|
// src/integrations/lru-memoizer.ts
|
|
7314
|
-
const INTEGRATION_NAME$
|
|
7360
|
+
const INTEGRATION_NAME$14 = "LruMemoizer";
|
|
7315
7361
|
const _lruMemoizerIntegration = (() => {
|
|
7316
7362
|
return {
|
|
7317
|
-
name: INTEGRATION_NAME$
|
|
7363
|
+
name: INTEGRATION_NAME$14,
|
|
7318
7364
|
setup(client) {
|
|
7319
7365
|
invokeOrchestrionInstrumentation(client, require_config.lruMemoizerModuleNames, instrumentLruMemoizer, []);
|
|
7320
7366
|
}
|
|
@@ -7342,10 +7388,11 @@ function serializeDbStatement(commandObj) {
|
|
|
7342
7388
|
}
|
|
7343
7389
|
function scrubStatement(value) {
|
|
7344
7390
|
if (Array.isArray(value)) return value.map((element) => scrubStatement(element));
|
|
7345
|
-
if (isCommandObj(value))
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7391
|
+
if (isCommandObj(value)) {
|
|
7392
|
+
const scrubbed = {};
|
|
7393
|
+
for (const key of Object.keys(value)) scrubbed[key] = scrubStatement(value[key]);
|
|
7394
|
+
return scrubbed;
|
|
7395
|
+
}
|
|
7349
7396
|
return "?";
|
|
7350
7397
|
}
|
|
7351
7398
|
function isCommandObj(value) {
|
|
@@ -7354,9 +7401,6 @@ function isCommandObj(value) {
|
|
|
7354
7401
|
function isBuffer(value) {
|
|
7355
7402
|
return typeof Buffer !== "undefined" && Buffer.isBuffer(value);
|
|
7356
7403
|
}
|
|
7357
|
-
function isCommandEntry(value) {
|
|
7358
|
-
return Array.isArray(value);
|
|
7359
|
-
}
|
|
7360
7404
|
/**
|
|
7361
7405
|
* Build span attributes for a mongodb v4+ command from the connection
|
|
7362
7406
|
* context, namespace and command.
|
|
@@ -7395,7 +7439,7 @@ function getSpanAttributes(dbName, dbCollection, host, port, commandObj, operati
|
|
|
7395
7439
|
const portNumber = parseInt(port, 10);
|
|
7396
7440
|
if (!isNaN(portNumber)) attributes[_sentry_conventions_attributes.SERVER_PORT] = portNumber;
|
|
7397
7441
|
}
|
|
7398
|
-
if (commandObj) try {
|
|
7442
|
+
if (commandObj && (0, _sentry_core.getActiveSpan)()?.isRecording()) try {
|
|
7399
7443
|
attributes[_sentry_conventions_attributes.DB_QUERY_TEXT] = serializeDbStatement(commandObj);
|
|
7400
7444
|
} catch {}
|
|
7401
7445
|
return attributes;
|
|
@@ -7457,8 +7501,8 @@ function startMongoSpan(attributes) {
|
|
|
7457
7501
|
});
|
|
7458
7502
|
}
|
|
7459
7503
|
// src/integrations/mongodb/index.ts
|
|
7460
|
-
const INTEGRATION_NAME$
|
|
7461
|
-
const ORIGIN$
|
|
7504
|
+
const INTEGRATION_NAME$13 = "Mongo";
|
|
7505
|
+
const ORIGIN$14 = "auto.db.mongo";
|
|
7462
7506
|
const V3_DEDICATED_COMMANDS = /* @__PURE__ */ new Set([
|
|
7463
7507
|
"insert",
|
|
7464
7508
|
"update",
|
|
@@ -7469,7 +7513,7 @@ const V3_DEDICATED_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
7469
7513
|
]);
|
|
7470
7514
|
const _mongoIntegration = (() => {
|
|
7471
7515
|
return {
|
|
7472
|
-
name: INTEGRATION_NAME$
|
|
7516
|
+
name: INTEGRATION_NAME$13,
|
|
7473
7517
|
setup(client) {
|
|
7474
7518
|
invokeOrchestrionInstrumentation(client, require_config.mongodbModuleNames, instrumentMongodb, []);
|
|
7475
7519
|
}
|
|
@@ -7492,7 +7536,7 @@ function subscribeV4Command() {
|
|
|
7492
7536
|
const cmd = args[1];
|
|
7493
7537
|
if (!ns || !cmd || typeof cmd !== "object" || cmd.ismaster || cmd.hello) return;
|
|
7494
7538
|
const operation = Object.keys(cmd)[0];
|
|
7495
|
-
return startMongoSpan(getV4SpanAttributes(data.self, ns, cmd, operation, ORIGIN$
|
|
7539
|
+
return startMongoSpan(getV4SpanAttributes(data.self, ns, cmd, operation, ORIGIN$14));
|
|
7496
7540
|
});
|
|
7497
7541
|
}
|
|
7498
7542
|
/**
|
|
@@ -7551,7 +7595,7 @@ function bindV3(channelName, extract) {
|
|
|
7551
7595
|
if (!args) return;
|
|
7552
7596
|
const info = extract(args);
|
|
7553
7597
|
if (!info || typeof info.ns !== "string") return;
|
|
7554
|
-
return startMongoSpan(getV3SpanAttributes(info.ns, info.topology, info.command, info.operation, ORIGIN$
|
|
7598
|
+
return startMongoSpan(getV3SpanAttributes(info.ns, info.topology, info.command, info.operation, ORIGIN$14));
|
|
7555
7599
|
});
|
|
7556
7600
|
}
|
|
7557
7601
|
/**
|
|
@@ -7570,7 +7614,7 @@ const MONGOOSE_DC_CHANNEL_MODEL_SAVE = "mongoose:model:save";
|
|
|
7570
7614
|
const MONGOOSE_DC_CHANNEL_MODEL_INSERT_MANY = "mongoose:model:insertMany";
|
|
7571
7615
|
const MONGOOSE_DC_CHANNEL_MODEL_BULK_WRITE = "mongoose:model:bulkWrite";
|
|
7572
7616
|
const MONGOOSE_DC_CHANNEL_CURSOR_NEXT = "mongoose:cursor:next";
|
|
7573
|
-
const ORIGIN$
|
|
7617
|
+
const ORIGIN$13 = "auto.db.mongoose.native_channel";
|
|
7574
7618
|
const DB_SYSTEM_NAME_VALUE_MONGODB$1 = "mongodb";
|
|
7575
7619
|
const MAX_REDACTION_DEPTH = 10;
|
|
7576
7620
|
let subscribed$1 = false;
|
|
@@ -7610,7 +7654,7 @@ function setupChannel(tracingChannel, channelName) {
|
|
|
7610
7654
|
return (0, _sentry_core.startInactiveSpan)({
|
|
7611
7655
|
name,
|
|
7612
7656
|
attributes: {
|
|
7613
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
7657
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$13,
|
|
7614
7658
|
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
|
|
7615
7659
|
[_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MONGODB$1,
|
|
7616
7660
|
[_sentry_conventions_attributes.DB_OPERATION_NAME]: data.operation,
|
|
@@ -7698,13 +7742,13 @@ function startMongooseLegacySpan({ collection, modelName, operation, origin, par
|
|
|
7698
7742
|
});
|
|
7699
7743
|
}
|
|
7700
7744
|
// src/integrations/mongoose/index.ts
|
|
7701
|
-
const INTEGRATION_NAME$
|
|
7702
|
-
const ORIGIN$
|
|
7745
|
+
const INTEGRATION_NAME$12 = "Mongoose";
|
|
7746
|
+
const ORIGIN$12 = "auto.db.mongoose";
|
|
7703
7747
|
const STORED_PARENT_SPAN = /* @__PURE__ */ new WeakMap();
|
|
7704
7748
|
let orchestrionSubscribed = false;
|
|
7705
7749
|
const _mongooseIntegration = (() => {
|
|
7706
7750
|
return {
|
|
7707
|
-
name: INTEGRATION_NAME$
|
|
7751
|
+
name: INTEGRATION_NAME$12,
|
|
7708
7752
|
setupOnce() {
|
|
7709
7753
|
if (!tracingChannel) return;
|
|
7710
7754
|
(0, _sentry_core.waitForTracingChannelBinding)(() => {
|
|
@@ -7756,7 +7800,7 @@ function startSpan(collection, modelName, operation, parentSpan) {
|
|
|
7756
7800
|
collection,
|
|
7757
7801
|
modelName,
|
|
7758
7802
|
operation,
|
|
7759
|
-
origin: ORIGIN$
|
|
7803
|
+
origin: ORIGIN$12,
|
|
7760
7804
|
parentSpan
|
|
7761
7805
|
});
|
|
7762
7806
|
}
|
|
@@ -7787,7 +7831,7 @@ function stashParentSpan(self) {
|
|
|
7787
7831
|
*/
|
|
7788
7832
|
const mongooseIntegration = (0, _sentry_core.defineIntegration)(_mongooseIntegration);
|
|
7789
7833
|
// src/integrations/mistral.ts
|
|
7790
|
-
const INTEGRATION_NAME$
|
|
7834
|
+
const INTEGRATION_NAME$11 = require_exports.MISTRAL_INTEGRATION_NAME;
|
|
7791
7835
|
const INSTRUMENTED_CHANNELS$1 = [
|
|
7792
7836
|
{
|
|
7793
7837
|
channel: CHANNELS.MISTRAL_CHAT,
|
|
@@ -7817,7 +7861,7 @@ const INSTRUMENTED_CHANNELS$1 = [
|
|
|
7817
7861
|
];
|
|
7818
7862
|
const _mistralAIIntegration = ((options = {}) => {
|
|
7819
7863
|
return {
|
|
7820
|
-
name: INTEGRATION_NAME$
|
|
7864
|
+
name: INTEGRATION_NAME$11,
|
|
7821
7865
|
setup(client) {
|
|
7822
7866
|
invokeOrchestrionInstrumentation(client, require_config.mistralModuleNames, instrumentMistral, [options]);
|
|
7823
7867
|
}
|
|
@@ -7838,7 +7882,7 @@ function instrumentMistral(options) {
|
|
|
7838
7882
|
* Returning `undefined` opts the payload out so no span is opened.
|
|
7839
7883
|
*/
|
|
7840
7884
|
function createGenAiSpan$1(data, operation, streaming, options) {
|
|
7841
|
-
if (require_exports.shouldSkipAiProviderSpan(INTEGRATION_NAME$
|
|
7885
|
+
if (require_exports.shouldSkipAiProviderSpan(INTEGRATION_NAME$11)) return;
|
|
7842
7886
|
const args = data.arguments ?? [];
|
|
7843
7887
|
const params = args[0];
|
|
7844
7888
|
const call = {
|
|
@@ -7919,11 +7963,11 @@ function instrumentTypeSafe(options) {
|
|
|
7919
7963
|
*/
|
|
7920
7964
|
const typesafeIntegration = (0, _sentry_core.defineIntegration)(_typesafeIntegration);
|
|
7921
7965
|
// src/integrations/mysql.ts
|
|
7922
|
-
const INTEGRATION_NAME$
|
|
7966
|
+
const INTEGRATION_NAME$10 = "Mysql";
|
|
7923
7967
|
const DB_SYSTEM_NAME_VALUE_MYSQL$1 = "mysql";
|
|
7924
7968
|
const _mysqlIntegration = (() => {
|
|
7925
7969
|
return {
|
|
7926
|
-
name: INTEGRATION_NAME$
|
|
7970
|
+
name: INTEGRATION_NAME$10,
|
|
7927
7971
|
setup(client) {
|
|
7928
7972
|
invokeOrchestrionInstrumentation(client, require_config.mysqlModuleNames, instrumentMysql, []);
|
|
7929
7973
|
}
|
|
@@ -8001,7 +8045,7 @@ const MYSQL2_DC_CHANNEL_QUERY = "mysql2:query";
|
|
|
8001
8045
|
const MYSQL2_DC_CHANNEL_EXECUTE = "mysql2:execute";
|
|
8002
8046
|
const MYSQL2_DC_CHANNEL_CONNECT = "mysql2:connect";
|
|
8003
8047
|
const MYSQL2_DC_CHANNEL_POOL_CONNECT = "mysql2:pool:connect";
|
|
8004
|
-
const ORIGIN$
|
|
8048
|
+
const ORIGIN$11 = "auto.db.mysql2.native_channel";
|
|
8005
8049
|
const DB_SYSTEM_NAME_VALUE_MYSQL = "mysql";
|
|
8006
8050
|
/**
|
|
8007
8051
|
* Subscribe Sentry span handlers to mysql2's diagnostics-channel events
|
|
@@ -8021,7 +8065,7 @@ function subscribeMysql2DiagnosticChannels(tracingChannel) {
|
|
|
8021
8065
|
function setupQueryChannel(tracingChannel, channelName) {
|
|
8022
8066
|
bindTracingChannelToSpan(tracingChannel(channelName), (data) => {
|
|
8023
8067
|
const attributes = {
|
|
8024
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
8068
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$11,
|
|
8025
8069
|
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
|
|
8026
8070
|
[_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MYSQL,
|
|
8027
8071
|
...require_exports.getSqlQueryAttributes(data.query, "mysql"),
|
|
@@ -8042,7 +8086,7 @@ function setupConnectChannel(tracingChannel, channelName, spanName) {
|
|
|
8042
8086
|
name: spanName,
|
|
8043
8087
|
onlyIfParent: true,
|
|
8044
8088
|
attributes: {
|
|
8045
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
8089
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$11,
|
|
8046
8090
|
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
|
|
8047
8091
|
[_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MYSQL,
|
|
8048
8092
|
[_sentry_conventions_attributes.DB_NAMESPACE]: data.database || void 0,
|
|
@@ -8053,8 +8097,8 @@ function setupConnectChannel(tracingChannel, channelName, spanName) {
|
|
|
8053
8097
|
});
|
|
8054
8098
|
}
|
|
8055
8099
|
// src/integrations/mysql2/index.ts
|
|
8056
|
-
const INTEGRATION_NAME$
|
|
8057
|
-
const ORIGIN$
|
|
8100
|
+
const INTEGRATION_NAME$9 = "Mysql2";
|
|
8101
|
+
const ORIGIN$10 = "auto.db.mysql2";
|
|
8058
8102
|
const DB_SYSTEM_VALUE_MYSQL = "mysql";
|
|
8059
8103
|
/**
|
|
8060
8104
|
* Diagnostics-channel-based mysql2 integration.
|
|
@@ -8077,11 +8121,11 @@ function subscribeQueryChannel(channelName) {
|
|
|
8077
8121
|
const statement = getQueryText$1(data.arguments);
|
|
8078
8122
|
const attributes = {
|
|
8079
8123
|
[_sentry_conventions_attributes.SENTRY_KIND]: "client",
|
|
8080
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
8124
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$10,
|
|
8081
8125
|
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
|
|
8082
8126
|
[_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_VALUE_MYSQL,
|
|
8083
8127
|
...require_exports.getSqlQueryAttributes(statement, "mysql"),
|
|
8084
|
-
...getConnectionAttributes$
|
|
8128
|
+
...getConnectionAttributes$2(data.self?.config)
|
|
8085
8129
|
};
|
|
8086
8130
|
return (0, _sentry_core.startInactiveSpan)({
|
|
8087
8131
|
name: require_exports.getSqlSpanName(attributes, "mysql2.query"),
|
|
@@ -8103,7 +8147,7 @@ function extractSql$1(firstArg) {
|
|
|
8103
8147
|
return typeof sql === "string" ? sql : void 0;
|
|
8104
8148
|
}
|
|
8105
8149
|
}
|
|
8106
|
-
function getConnectionAttributes$
|
|
8150
|
+
function getConnectionAttributes$2(config) {
|
|
8107
8151
|
const { host, port, database, user } = config?.connectionConfig ?? config ?? {};
|
|
8108
8152
|
const portNumber = typeof port === "string" ? parseInt(port, 10) : port;
|
|
8109
8153
|
const portIsNumber = typeof portNumber === "number" && !isNaN(portNumber);
|
|
@@ -8116,7 +8160,7 @@ function getConnectionAttributes$1(config) {
|
|
|
8116
8160
|
}
|
|
8117
8161
|
const _mysql2Integration = (() => {
|
|
8118
8162
|
return {
|
|
8119
|
-
name: INTEGRATION_NAME$
|
|
8163
|
+
name: INTEGRATION_NAME$9,
|
|
8120
8164
|
setupOnce() {
|
|
8121
8165
|
if (!tracingChannel) return;
|
|
8122
8166
|
(0, _sentry_core.waitForTracingChannelBinding)(() => {
|
|
@@ -8209,7 +8253,7 @@ const _pinoIntegration = (0, _sentry_core.defineIntegration)((userOptions = {})
|
|
|
8209
8253
|
[_sentry_conventions_attributes.SENTRY_ORIGIN]: "auto.log.pino",
|
|
8210
8254
|
"pino.logger.level": levelNumber
|
|
8211
8255
|
};
|
|
8212
|
-
(0, _sentry_core.
|
|
8256
|
+
(0, _sentry_core.captureLogEvent)({
|
|
8213
8257
|
level,
|
|
8214
8258
|
message: logMessage,
|
|
8215
8259
|
attributes
|
|
@@ -8322,7 +8366,7 @@ function createSentryWinstonTransport(TransportClass, sentryWinstonOptions) {
|
|
|
8322
8366
|
const customLevel = sentryWinstonOptions?.customLevelMap?.[levelFromSymbol];
|
|
8323
8367
|
const winstonLogLevel = WINSTON_LEVEL_TO_LOG_SEVERITY_LEVEL_MAP[levelFromSymbol];
|
|
8324
8368
|
const logSeverityLevel = customLevel ?? winstonLogLevel ?? "info";
|
|
8325
|
-
if (this._levels.has(logSeverityLevel)) (0, _sentry_core.
|
|
8369
|
+
if (this._levels.has(logSeverityLevel)) (0, _sentry_core.captureLogEvent)({
|
|
8326
8370
|
level: logSeverityLevel,
|
|
8327
8371
|
message,
|
|
8328
8372
|
attributes: {
|
|
@@ -8352,8 +8396,8 @@ const WINSTON_LEVEL_TO_LOG_SEVERITY_LEVEL_MAP = {
|
|
|
8352
8396
|
crit: "fatal"
|
|
8353
8397
|
};
|
|
8354
8398
|
// src/integrations/openai.ts
|
|
8355
|
-
const INTEGRATION_NAME$
|
|
8356
|
-
const ORIGIN$
|
|
8399
|
+
const INTEGRATION_NAME$8 = "OpenAI";
|
|
8400
|
+
const ORIGIN$9 = "auto.ai.openai";
|
|
8357
8401
|
const INSTRUMENTED_CHANNELS = [
|
|
8358
8402
|
{
|
|
8359
8403
|
channel: CHANNELS.OPENAI_CHAT,
|
|
@@ -8370,7 +8414,7 @@ const INSTRUMENTED_CHANNELS = [
|
|
|
8370
8414
|
];
|
|
8371
8415
|
const _openAIIntegration = ((options = {}) => {
|
|
8372
8416
|
return {
|
|
8373
|
-
name: INTEGRATION_NAME$
|
|
8417
|
+
name: INTEGRATION_NAME$8,
|
|
8374
8418
|
setup(client) {
|
|
8375
8419
|
invokeOrchestrionInstrumentation(client, require_config.openaiModuleNames, instrumentOpenai, [options]);
|
|
8376
8420
|
}
|
|
@@ -8394,7 +8438,7 @@ function instrumentOpenai(options) {
|
|
|
8394
8438
|
* Returning `undefined` opts the payload out so no span is opened.
|
|
8395
8439
|
*/
|
|
8396
8440
|
function createGenAiSpan(data, operation, options) {
|
|
8397
|
-
if (require_exports.shouldSkipAiProviderSpan(INTEGRATION_NAME$
|
|
8441
|
+
if (require_exports.shouldSkipAiProviderSpan(INTEGRATION_NAME$8)) return;
|
|
8398
8442
|
const args = data.arguments ?? [];
|
|
8399
8443
|
const params = args[0];
|
|
8400
8444
|
const call = {
|
|
@@ -8404,7 +8448,7 @@ function createGenAiSpan(data, operation, options) {
|
|
|
8404
8448
|
const { recordInputs, recordOutputs } = require_exports.resolveGenAiCallRecording(options, call);
|
|
8405
8449
|
data._sentryRecordOutputs = recordOutputs;
|
|
8406
8450
|
const attributes = require_exports.extractRequestAttributes$3(args, operation, recordInputs);
|
|
8407
|
-
attributes[_sentry_conventions_attributes.SENTRY_ORIGIN] = ORIGIN$
|
|
8451
|
+
attributes[_sentry_conventions_attributes.SENTRY_ORIGIN] = ORIGIN$9;
|
|
8408
8452
|
const model = params?.model || "unknown";
|
|
8409
8453
|
const client = (0, _sentry_core.getClient)();
|
|
8410
8454
|
const span = (0, _sentry_core.startInactiveSpan)({
|
|
@@ -8444,8 +8488,8 @@ function wrapStreamResult(span, data) {
|
|
|
8444
8488
|
*/
|
|
8445
8489
|
const openAIIntegration = (0, _sentry_core.defineIntegration)(_openAIIntegration);
|
|
8446
8490
|
// src/integrations/pg.ts
|
|
8447
|
-
const INTEGRATION_NAME$
|
|
8448
|
-
const ORIGIN$
|
|
8491
|
+
const INTEGRATION_NAME$7 = "Postgres";
|
|
8492
|
+
const ORIGIN$8 = "auto.db.postgres";
|
|
8449
8493
|
const ATTR_PG_PLAN = "db.postgresql.plan";
|
|
8450
8494
|
const ATTR_PG_IDLE_TIMEOUT = "db.postgresql.idle.timeout.millis";
|
|
8451
8495
|
const ATTR_PG_MAX_CLIENT = "db.postgresql.max.client";
|
|
@@ -8455,7 +8499,7 @@ const SPAN_CONNECT = "pg.connect";
|
|
|
8455
8499
|
const SPAN_POOL_CONNECT = "pg-pool.connect";
|
|
8456
8500
|
const _postgresIntegration = ((options = {}) => {
|
|
8457
8501
|
return {
|
|
8458
|
-
name: INTEGRATION_NAME$
|
|
8502
|
+
name: INTEGRATION_NAME$7,
|
|
8459
8503
|
setup(client) {
|
|
8460
8504
|
invokeOrchestrionInstrumentation(client, require_config.pgModuleNames, instrumentPostgres, [options]);
|
|
8461
8505
|
}
|
|
@@ -8463,7 +8507,7 @@ const _postgresIntegration = ((options = {}) => {
|
|
|
8463
8507
|
});
|
|
8464
8508
|
function instrumentPostgres(options) {
|
|
8465
8509
|
bindPgQueryChannel(CHANNELS.PG_QUERY, {
|
|
8466
|
-
origin: ORIGIN$
|
|
8510
|
+
origin: ORIGIN$8,
|
|
8467
8511
|
connectionString: true
|
|
8468
8512
|
});
|
|
8469
8513
|
if (!options.ignoreConnectSpans) {
|
|
@@ -8512,7 +8556,7 @@ function querySpanOptions(ctx, { origin, connectionString }) {
|
|
|
8512
8556
|
const queryConfig = extractQueryConfig(ctx.arguments);
|
|
8513
8557
|
const attributes = {
|
|
8514
8558
|
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
|
|
8515
|
-
...connectionString ? getPgConnectionAttributes(params) : getConnectionAttributes(params),
|
|
8559
|
+
...connectionString ? getPgConnectionAttributes(params) : getConnectionAttributes$1(params),
|
|
8516
8560
|
[_sentry_conventions_attributes.SENTRY_ORIGIN]: origin,
|
|
8517
8561
|
...require_exports.getSqlQueryAttributes(queryConfig?.text),
|
|
8518
8562
|
[ATTR_PG_PLAN]: typeof queryConfig?.name === "string" ? queryConfig.name : void 0
|
|
@@ -8557,7 +8601,7 @@ function extractQueryConfig(args) {
|
|
|
8557
8601
|
}
|
|
8558
8602
|
}
|
|
8559
8603
|
/** The `db.*`/`server.*` attributes for a pg-style set of connection parameters. */
|
|
8560
|
-
function getConnectionAttributes(params) {
|
|
8604
|
+
function getConnectionAttributes$1(params) {
|
|
8561
8605
|
return {
|
|
8562
8606
|
[_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_POSTGRESQL$1,
|
|
8563
8607
|
[_sentry_conventions_attributes.DB_NAMESPACE]: params.database,
|
|
@@ -8568,7 +8612,7 @@ function getConnectionAttributes(params) {
|
|
|
8568
8612
|
}
|
|
8569
8613
|
function getPgConnectionAttributes(params) {
|
|
8570
8614
|
return {
|
|
8571
|
-
...getConnectionAttributes(params),
|
|
8615
|
+
...getConnectionAttributes$1(params),
|
|
8572
8616
|
[_sentry_conventions_attributes.DB_CONNECTION_STRING]: getConnectionString(params)
|
|
8573
8617
|
};
|
|
8574
8618
|
}
|
|
@@ -8620,7 +8664,7 @@ const postgresIntegration = (0, _sentry_core.defineIntegration)(_postgresIntegra
|
|
|
8620
8664
|
* Tracing channel published by `postgres` >= 4.0.0 for every query (see postgres `src/diagnostics.js`).
|
|
8621
8665
|
*/
|
|
8622
8666
|
const POSTGRESJS_DC_CHANNEL_QUERY = "postgres:query";
|
|
8623
|
-
const ORIGIN$
|
|
8667
|
+
const ORIGIN$7 = "auto.db.postgresjs";
|
|
8624
8668
|
const DB_SYSTEM_NAME_POSTGRES$1 = "postgres";
|
|
8625
8669
|
/**
|
|
8626
8670
|
* Subscribe Sentry span handlers to the `postgres:query` tracing channel published natively by
|
|
@@ -8637,7 +8681,7 @@ function subscribePostgresJsDiagnosticChannels(tracingChannel, options = {}) {
|
|
|
8637
8681
|
const attributes = {
|
|
8638
8682
|
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
|
|
8639
8683
|
[_sentry_conventions_attributes.SENTRY_KIND]: "client",
|
|
8640
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
8684
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$7,
|
|
8641
8685
|
[_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_NAME_POSTGRES$1,
|
|
8642
8686
|
...queryAttributes,
|
|
8643
8687
|
...require_exports._getConnectionAttributes(connectionContext)
|
|
@@ -8690,8 +8734,8 @@ function callRequestHook(requestHook, span, sanitizedSqlQuery, connectionContext
|
|
|
8690
8734
|
}
|
|
8691
8735
|
}
|
|
8692
8736
|
// src/integrations/postgresjs/index.ts
|
|
8693
|
-
const INTEGRATION_NAME$
|
|
8694
|
-
const ORIGIN$
|
|
8737
|
+
const INTEGRATION_NAME$6 = "PostgresJs";
|
|
8738
|
+
const ORIGIN$6 = "auto.db.postgresjs";
|
|
8695
8739
|
const DB_SYSTEM_NAME_POSTGRES = "postgres";
|
|
8696
8740
|
const NOOP$3 = () => {};
|
|
8697
8741
|
const QUERY_FROM_INSTRUMENTED_SQL = Symbol.for("sentry.query.from.instrumented.sql");
|
|
@@ -8735,7 +8779,7 @@ function attachConnectionAttributesFromChannel(message) {
|
|
|
8735
8779
|
}
|
|
8736
8780
|
const _postgresJsIntegration = ((options = {}) => {
|
|
8737
8781
|
return {
|
|
8738
|
-
name: INTEGRATION_NAME$
|
|
8782
|
+
name: INTEGRATION_NAME$6,
|
|
8739
8783
|
setupOnce() {
|
|
8740
8784
|
if (!tracingChannel) return;
|
|
8741
8785
|
(0, _sentry_core.waitForTracingChannelBinding)(() => {
|
|
@@ -8779,7 +8823,7 @@ function instrumentPostgresJs(options) {
|
|
|
8779
8823
|
const attributes = {
|
|
8780
8824
|
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
|
|
8781
8825
|
[_sentry_conventions_attributes.SENTRY_KIND]: "client",
|
|
8782
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
8826
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$6,
|
|
8783
8827
|
[_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_NAME_POSTGRES,
|
|
8784
8828
|
...queryAttributes,
|
|
8785
8829
|
...context && require_exports._getConnectionAttributes(context)
|
|
@@ -8818,22 +8862,22 @@ function instrumentPostgresJs(options) {
|
|
|
8818
8862
|
*/
|
|
8819
8863
|
const postgresJsIntegration = (0, _sentry_core.defineIntegration)(_postgresJsIntegration);
|
|
8820
8864
|
// src/integrations/neon.ts
|
|
8821
|
-
const INTEGRATION_NAME$
|
|
8822
|
-
const ORIGIN$
|
|
8865
|
+
const INTEGRATION_NAME$5 = "Neon";
|
|
8866
|
+
const ORIGIN$5 = "auto.db.neon";
|
|
8823
8867
|
const DB_SYSTEM_POSTGRESQL = "postgresql";
|
|
8824
8868
|
const DEFAULT_PORT = 5432;
|
|
8825
8869
|
const NOOP$2 = () => {};
|
|
8826
8870
|
const httpQuerySpans = /* @__PURE__ */ new WeakSet();
|
|
8827
8871
|
const _neonIntegration = (() => {
|
|
8828
8872
|
return {
|
|
8829
|
-
name: INTEGRATION_NAME$
|
|
8873
|
+
name: INTEGRATION_NAME$5,
|
|
8830
8874
|
setup(client) {
|
|
8831
8875
|
invokeOrchestrionInstrumentation(client, require_config.neonModuleNames, instrumentNeon, []);
|
|
8832
8876
|
}
|
|
8833
8877
|
};
|
|
8834
8878
|
});
|
|
8835
8879
|
function instrumentNeon() {
|
|
8836
|
-
bindPgQueryChannel(CHANNELS.NEON_QUERY, { origin: ORIGIN$
|
|
8880
|
+
bindPgQueryChannel(CHANNELS.NEON_QUERY, { origin: ORIGIN$5 });
|
|
8837
8881
|
bindTracingChannelToSpan(tracingChannel(CHANNELS.NEON_HTTP_QUERY), (data) => {
|
|
8838
8882
|
const span = (0, _sentry_core.startInactiveSpan)(httpQuerySpanOptions(data.arguments));
|
|
8839
8883
|
httpQuerySpans.add(span);
|
|
@@ -8848,7 +8892,7 @@ function instrumentNeon() {
|
|
|
8848
8892
|
const span = (0, _sentry_core.getActiveSpan)();
|
|
8849
8893
|
const url = data.result?.resolvedURL;
|
|
8850
8894
|
if (!span || !httpQuerySpans.has(span) || !url) return;
|
|
8851
|
-
span.setAttributes(getConnectionAttributes({
|
|
8895
|
+
span.setAttributes(getConnectionAttributes$1({
|
|
8852
8896
|
host: url.hostname,
|
|
8853
8897
|
port: Number(url.port) || DEFAULT_PORT,
|
|
8854
8898
|
database: url.pathname.slice(1),
|
|
@@ -8866,7 +8910,7 @@ function httpQuerySpanOptions(args) {
|
|
|
8866
8910
|
const operationName = batchSize === void 0 ? statements[0]?.[_sentry_conventions_attributes.DB_OPERATION_NAME] : getBatchOperationName(statements);
|
|
8867
8911
|
const attributes = {
|
|
8868
8912
|
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
|
|
8869
|
-
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$
|
|
8913
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$5,
|
|
8870
8914
|
[_sentry_conventions_attributes.SENTRY_KIND]: "client",
|
|
8871
8915
|
[_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_POSTGRESQL,
|
|
8872
8916
|
[_sentry_conventions_attributes.DB_QUERY_TEXT]: queryText || void 0,
|
|
@@ -8907,6 +8951,108 @@ function getQueryText(data) {
|
|
|
8907
8951
|
* hook or bundler plugin to be active.
|
|
8908
8952
|
*/
|
|
8909
8953
|
const neonIntegration = (0, _sentry_core.defineIntegration)(_neonIntegration);
|
|
8954
|
+
// src/integrations/clickhouse-sql.ts
|
|
8955
|
+
const NUMBER_RE = /-?(?:0x[\dA-F_]+|0b[01_]+|(?:\d[\d_]*(?:\.[\d_]*)?|\.\d[\d_]*)(?:e[+-]?[\d_]+)?)(?![\w$])/iy;
|
|
8956
|
+
const FORMAT_RE = /FORMAT(?!\s*[=<>!])(?:\s|\/\*|--|#)/iy;
|
|
8957
|
+
const FORMAT_IDENTIFIER_RE = /(?:\b(?:INTO|TABLE|FROM|JOIN|ON|SELECT|PREWHERE|WHERE|HAVING|QUALIFY|AND|OR|NOT|BY|AS)|[,.=<>(])\s*$/i;
|
|
8958
|
+
/**
|
|
8959
|
+
* ClickHouse SQL: `"` quotes an identifier as in `standard`, but `\` escapes the next character, `#`
|
|
8960
|
+
* starts a line comment, block comments nest, and `$$…$$` heredocs open a literal. Numbers can have
|
|
8961
|
+
* `_` separators.
|
|
8962
|
+
*/
|
|
8963
|
+
const CLICKHOUSE_SQL_RULES = {
|
|
8964
|
+
hashComments: true,
|
|
8965
|
+
nestedComments: true,
|
|
8966
|
+
backslashEscapes: true,
|
|
8967
|
+
dollarQuote: /\$\w*\$/y,
|
|
8968
|
+
matchLiteral(sql, start) {
|
|
8969
|
+
if (require_exports.isIdentifierChar(sql[start - 1]) || sql[start - 1] === "?") return 0;
|
|
8970
|
+
NUMBER_RE.lastIndex = start;
|
|
8971
|
+
return NUMBER_RE.exec(sql)?.[0].length ?? 0;
|
|
8972
|
+
},
|
|
8973
|
+
isInlineData(sql, start, out) {
|
|
8974
|
+
if (require_exports.isIdentifierChar(sql[start - 1])) return false;
|
|
8975
|
+
FORMAT_RE.lastIndex = start;
|
|
8976
|
+
if (!FORMAT_RE.test(sql)) return false;
|
|
8977
|
+
const before = out.join("");
|
|
8978
|
+
return /^[\s;]*INSERT\b/i.test(before) && !FORMAT_IDENTIFIER_RE.test(before);
|
|
8979
|
+
}
|
|
8980
|
+
};
|
|
8981
|
+
// src/integrations/clickhouse.ts
|
|
8982
|
+
const INTEGRATION_NAME$4 = "ClickHouse";
|
|
8983
|
+
const ORIGIN$4 = "auto.db.clickhouse";
|
|
8984
|
+
const DB_SYSTEM_CLICKHOUSE = "clickhouse";
|
|
8985
|
+
const _clickhouseIntegration = (() => {
|
|
8986
|
+
return {
|
|
8987
|
+
name: INTEGRATION_NAME$4,
|
|
8988
|
+
setup(client) {
|
|
8989
|
+
invokeOrchestrionInstrumentation(client, require_config.clickhouseModuleNames, instrumentClickhouse, []);
|
|
8990
|
+
}
|
|
8991
|
+
};
|
|
8992
|
+
});
|
|
8993
|
+
function instrumentClickhouse() {
|
|
8994
|
+
const channels = [
|
|
8995
|
+
[CHANNELS.CLICKHOUSE_QUERY, "query"],
|
|
8996
|
+
[CHANNELS.CLICKHOUSE_COMMAND, "command"],
|
|
8997
|
+
[CHANNELS.CLICKHOUSE_EXEC, "exec"],
|
|
8998
|
+
[CHANNELS.CLICKHOUSE_INSERT, "insert"],
|
|
8999
|
+
[CHANNELS.CLICKHOUSE_WEB_QUERY, "query"],
|
|
9000
|
+
[CHANNELS.CLICKHOUSE_WEB_COMMAND, "command"],
|
|
9001
|
+
[CHANNELS.CLICKHOUSE_WEB_EXEC, "exec"],
|
|
9002
|
+
[CHANNELS.CLICKHOUSE_WEB_INSERT, "insert"],
|
|
9003
|
+
[CHANNELS.CLICKHOUSE_COMMON_QUERY, "query"],
|
|
9004
|
+
[CHANNELS.CLICKHOUSE_COMMON_COMMAND, "command"],
|
|
9005
|
+
[CHANNELS.CLICKHOUSE_COMMON_EXEC, "exec"],
|
|
9006
|
+
[CHANNELS.CLICKHOUSE_COMMON_INSERT, "insert"]
|
|
9007
|
+
];
|
|
9008
|
+
for (const [channelName, method] of channels) bindTracingChannelToSpan(tracingChannel(channelName), (data) => {
|
|
9009
|
+
const params = data.arguments[0];
|
|
9010
|
+
if (method === "insert" && Array.isArray(params?.values) && params.values.length === 0) return;
|
|
9011
|
+
const attributes = {
|
|
9012
|
+
[_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
|
|
9013
|
+
[_sentry_conventions_attributes.SENTRY_KIND]: "client",
|
|
9014
|
+
[_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$4,
|
|
9015
|
+
...getConnectionAttributes(data.self?.connectionParams, params),
|
|
9016
|
+
...method === "insert" ? getInsertAttributes(params) : require_exports.getSqlQueryAttributes(typeof params?.query === "string" ? params.query : void 0, CLICKHOUSE_SQL_RULES)
|
|
9017
|
+
};
|
|
9018
|
+
return (0, _sentry_core.startInactiveSpan)({
|
|
9019
|
+
name: require_exports.getLowCardinalitySqlSpanName(attributes, DB_SYSTEM_CLICKHOUSE),
|
|
9020
|
+
attributes,
|
|
9021
|
+
onlyIfParent: true
|
|
9022
|
+
});
|
|
9023
|
+
});
|
|
9024
|
+
}
|
|
9025
|
+
function getInsertAttributes(params) {
|
|
9026
|
+
const table = typeof params?.table === "string" && params.table ? params.table : void 0;
|
|
9027
|
+
return {
|
|
9028
|
+
[_sentry_conventions_attributes.DB_OPERATION_NAME]: "INSERT",
|
|
9029
|
+
[_sentry_conventions_attributes.DB_COLLECTION_NAME]: table,
|
|
9030
|
+
[_sentry_conventions_attributes.DB_QUERY_SUMMARY]: table ? `INSERT ${table}` : "INSERT"
|
|
9031
|
+
};
|
|
9032
|
+
}
|
|
9033
|
+
function getConnectionAttributes(connectionParams, params) {
|
|
9034
|
+
const url = connectionParams?.url;
|
|
9035
|
+
const user = params?.auth?.username ?? connectionParams?.auth?.username ?? connectionParams?.username;
|
|
9036
|
+
return {
|
|
9037
|
+
[_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_CLICKHOUSE,
|
|
9038
|
+
[_sentry_conventions_attributes.DB_NAMESPACE]: connectionParams?.database,
|
|
9039
|
+
[_sentry_conventions_attributes.DB_USER]: typeof user === "string" ? user : void 0,
|
|
9040
|
+
[_sentry_conventions_attributes.SERVER_ADDRESS]: url?.hostname || void 0,
|
|
9041
|
+
[_sentry_conventions_attributes.SERVER_PORT]: url ? getServerPort$1(url) : void 0
|
|
9042
|
+
};
|
|
9043
|
+
}
|
|
9044
|
+
function getServerPort$1(url) {
|
|
9045
|
+
if (url.port) return Number(url.port);
|
|
9046
|
+
return url.protocol === "https:" ? 443 : 80;
|
|
9047
|
+
}
|
|
9048
|
+
/**
|
|
9049
|
+
* Diagnostics-channel-based `@clickhouse/client` and `@clickhouse/client-web` integration.
|
|
9050
|
+
*
|
|
9051
|
+
* Subscribes to the channels Sentry's code transform injects into `ClickHouseClient`'s `query`,
|
|
9052
|
+
* `command`, `exec` and `insert` methods, and emits a `db` span for each call. Requires the Sentry
|
|
9053
|
+
* runtime hook or bundler plugin to be active.
|
|
9054
|
+
*/
|
|
9055
|
+
const clickhouseIntegration = (0, _sentry_core.defineIntegration)(_clickhouseIntegration);
|
|
8910
9056
|
// src/integrations/tedious.ts
|
|
8911
9057
|
const INTEGRATION_NAME$3 = "Tedious";
|
|
8912
9058
|
const ORIGIN$3 = "auto.db.tedious";
|
|
@@ -9205,6 +9351,93 @@ function accumulateChunk(state, chunk) {
|
|
|
9205
9351
|
default: return;
|
|
9206
9352
|
}
|
|
9207
9353
|
}
|
|
9354
|
+
/** Maps each object value of `record` and keeps the other values as they are. */
|
|
9355
|
+
function mapObjectValues(record, fn) {
|
|
9356
|
+
return Object.fromEntries(Object.entries(record).map(([key, value]) => [key, (0, _sentry_core.isObjectLike)(value) ? fn(value, key) : value]));
|
|
9357
|
+
}
|
|
9358
|
+
// src/integrations/vercel-ai/extract.ts
|
|
9359
|
+
/** Maps the AI SDK `experimental_extract` input and output to the Clairic shape of the `gen_ai.extract` schemas. */
|
|
9360
|
+
/**
|
|
9361
|
+
* Joins the text of the AI SDK state parts into one Clairic `state` string. The gateway does this join on
|
|
9362
|
+
* the server and does not show its separator, so this one is our choice. It only makes the recorded text
|
|
9363
|
+
* easier to read: the answer spans stay correct with any separator, because we add each part's offset.
|
|
9364
|
+
*/
|
|
9365
|
+
const EXTRACT_STATE_SEPARATOR = "\n\n";
|
|
9366
|
+
const BLOB_SUBSTITUTE = "[Blob substitute]";
|
|
9367
|
+
/**
|
|
9368
|
+
* Clairic takes the text as one `state` string, with images and PDF documents in their own arrays. The AI SDK
|
|
9369
|
+
* also takes a JSON object, or an array of text, JSON and file parts. Join the text of the parts and keep the
|
|
9370
|
+
* offset of each part, so that the answer spans point into the joined `state`.
|
|
9371
|
+
*/
|
|
9372
|
+
function toExtractState(state) {
|
|
9373
|
+
const images = [];
|
|
9374
|
+
const documents = [];
|
|
9375
|
+
let joined = "";
|
|
9376
|
+
const parts = (Array.isArray(state) ? state : [{
|
|
9377
|
+
type: "json",
|
|
9378
|
+
value: state
|
|
9379
|
+
}]).map((part) => {
|
|
9380
|
+
if (!(0, _sentry_core.isObjectLike)(part)) return;
|
|
9381
|
+
if (part.type === "file") {
|
|
9382
|
+
if (String(part.mediaType).split("/")[0] === "image") {
|
|
9383
|
+
images.push(BLOB_SUBSTITUTE);
|
|
9384
|
+
return "image";
|
|
9385
|
+
}
|
|
9386
|
+
if (part.mediaType === "application/pdf") documents.push(BLOB_SUBSTITUTE);
|
|
9387
|
+
return;
|
|
9388
|
+
}
|
|
9389
|
+
const text = part.type === "text" ? part.text : (0, _sentry_core.stringify)(part.value);
|
|
9390
|
+
if (typeof text !== "string") return;
|
|
9391
|
+
joined += EXTRACT_STATE_SEPARATOR + text;
|
|
9392
|
+
return joined.length - text.length - 2;
|
|
9393
|
+
});
|
|
9394
|
+
return {
|
|
9395
|
+
request: {
|
|
9396
|
+
state: joined ? joined.slice(2) : void 0,
|
|
9397
|
+
images: images.length ? images : void 0,
|
|
9398
|
+
documents: documents.length ? documents : void 0
|
|
9399
|
+
},
|
|
9400
|
+
parts
|
|
9401
|
+
};
|
|
9402
|
+
}
|
|
9403
|
+
/**
|
|
9404
|
+
* The AI SDK also takes JSON or `null` as field `instructions`, but the schema allows only a string.
|
|
9405
|
+
*/
|
|
9406
|
+
function toExtractFields(fields) {
|
|
9407
|
+
return (0, _sentry_core.isObjectLike)(fields) ? mapObjectValues(fields, (field) => ({
|
|
9408
|
+
...field,
|
|
9409
|
+
instructions: field.instructions === null ? void 0 : (0, _sentry_core.stringify)(field.instructions)
|
|
9410
|
+
})) : fields;
|
|
9411
|
+
}
|
|
9412
|
+
/**
|
|
9413
|
+
* The AI SDK normalizes the provider's extraction answers. Map them back to the provider shape of
|
|
9414
|
+
* `gen_ai.output.messages` on `gen_ai.extract` spans. The AI SDK does not expose `truncated`.
|
|
9415
|
+
*/
|
|
9416
|
+
function toExtractAnswers(answers, parts) {
|
|
9417
|
+
return mapObjectValues(answers, ({ pNull, source, items, ...rest }) => {
|
|
9418
|
+
const mapped = {
|
|
9419
|
+
...rest,
|
|
9420
|
+
p_null: pNull
|
|
9421
|
+
};
|
|
9422
|
+
const span = toExtractSpan(source, parts);
|
|
9423
|
+
if (span) {
|
|
9424
|
+
mapped.source = "input";
|
|
9425
|
+
mapped.span = span;
|
|
9426
|
+
} else if ((0, _sentry_core.isObjectLike)(source) && parts[Number(source.part)] === "image") mapped.source = "image";
|
|
9427
|
+
if (Array.isArray(items)) {
|
|
9428
|
+
const confidences = items.map((item) => (0, _sentry_core.isObjectLike)(item) ? item.confidence : void 0);
|
|
9429
|
+
if (confidences.every((confidence) => typeof confidence === "number")) mapped.confidences = confidences;
|
|
9430
|
+
const spans = items.map((item) => toExtractSpan((0, _sentry_core.isObjectLike)(item) ? item.source : void 0, parts));
|
|
9431
|
+
if (spans.some(Boolean)) mapped.spans = spans;
|
|
9432
|
+
}
|
|
9433
|
+
return mapped;
|
|
9434
|
+
});
|
|
9435
|
+
}
|
|
9436
|
+
function toExtractSpan(source, parts) {
|
|
9437
|
+
if (!(0, _sentry_core.isObjectLike)(source) || source.type !== "text") return null;
|
|
9438
|
+
const offset = parts[Number(source.part)];
|
|
9439
|
+
return typeof offset === "number" ? [offset + Number(source.start), offset + Number(source.end)] : null;
|
|
9440
|
+
}
|
|
9208
9441
|
// src/integrations/vercel-ai/vercel-ai-dc-subscriber.ts
|
|
9209
9442
|
/**
|
|
9210
9443
|
* The single tracing channel the `ai` package (>= 7) publishes all telemetry lifecycle events to
|
|
@@ -9217,6 +9450,7 @@ const GEN_AI_OPERATION_SPAN_OPS = {
|
|
|
9217
9450
|
embeddings: _sentry_conventions_op.GEN_AI_EMBEDDINGS,
|
|
9218
9451
|
rerank: _sentry_conventions_op.GEN_AI_RERANK,
|
|
9219
9452
|
decide: _sentry_conventions_op.GEN_AI_DECIDE,
|
|
9453
|
+
extract: _sentry_conventions_op.GEN_AI_EXTRACT,
|
|
9220
9454
|
invoke_agent: _sentry_conventions_op.GEN_AI_INVOKE_AGENT,
|
|
9221
9455
|
execute_tool: _sentry_conventions_op.GEN_AI_EXECUTE_TOOL,
|
|
9222
9456
|
generate_content: _sentry_conventions_op.GEN_AI_GENERATE_CONTENT
|
|
@@ -9503,6 +9737,14 @@ function startSpanFromEvent(type, event, recordInputs) {
|
|
|
9503
9737
|
questions: event.questions
|
|
9504
9738
|
}]) } : {}
|
|
9505
9739
|
});
|
|
9740
|
+
case "experimental_extract": return startGenAiSpan("extract", modelId, {
|
|
9741
|
+
...baseAttributes,
|
|
9742
|
+
...recordInputs && !(isStrippedInput(event.state) && isStrippedInput(event.fields)) ? { [_sentry_conventions_attributes.GEN_AI_INPUT_MESSAGES]: (0, _sentry_core.stringify)([{
|
|
9743
|
+
...toExtractState(event.state).request,
|
|
9744
|
+
fields: toExtractFields(event.fields),
|
|
9745
|
+
reference_date: event.referenceDate
|
|
9746
|
+
}]) } : {}
|
|
9747
|
+
});
|
|
9506
9748
|
default: return;
|
|
9507
9749
|
}
|
|
9508
9750
|
}
|
|
@@ -9627,12 +9869,13 @@ function enrichSpanOnEnd(span, data) {
|
|
|
9627
9869
|
dropLastStepOnlyUsage(providerAttributes, type);
|
|
9628
9870
|
span.setAttributes(providerAttributes);
|
|
9629
9871
|
if (recordOutputs) {
|
|
9630
|
-
const outputMessages = getOutputMessages(type, result, finishReason);
|
|
9872
|
+
const outputMessages = getOutputMessages(type, result, finishReason, data.event);
|
|
9631
9873
|
if (outputMessages) span.setAttribute(_sentry_conventions_attributes.GEN_AI_OUTPUT_MESSAGES, outputMessages);
|
|
9632
9874
|
}
|
|
9633
9875
|
}
|
|
9634
|
-
function getOutputMessages(type, result, finishReason) {
|
|
9876
|
+
function getOutputMessages(type, result, finishReason, event) {
|
|
9635
9877
|
if (type === "experimental_evaluate" || type === "experimental_decide") return require_exports.getEvaluationOutputMessages(withProviderAnswerFields(result));
|
|
9878
|
+
if (type === "experimental_extract") return (0, _sentry_core.isObjectLike)(result.answers) ? (0, _sentry_core.stringify)([{ answers: toExtractAnswers(result.answers, toExtractState(event.state).parts) }]) : void 0;
|
|
9636
9879
|
return buildOutputMessages(type === "languageModelCall" && Array.isArray(result.content) ? partsFromContent(result.content) : partsFromTextAndToolCalls(result.text, result.toolCalls), finishReason);
|
|
9637
9880
|
}
|
|
9638
9881
|
/**
|
|
@@ -9646,17 +9889,16 @@ function withProviderAnswerFields(result) {
|
|
|
9646
9889
|
const { openrouter } = providerMetadata;
|
|
9647
9890
|
const openrouterById = (0, _sentry_core.isObjectLike)(openrouter) && (0, _sentry_core.isObjectLike)(openrouter.answers) ? openrouter.answers : void 0;
|
|
9648
9891
|
if (!confidenceById && !openrouterById) return answers;
|
|
9649
|
-
return
|
|
9650
|
-
if (!(0, _sentry_core.isObjectLike)(answer)) return [id, answer];
|
|
9892
|
+
return mapObjectValues(answers, (answer, id) => {
|
|
9651
9893
|
const openrouterAnswer = openrouterById?.[id];
|
|
9652
9894
|
const fields = (0, _sentry_core.isObjectLike)(openrouterAnswer) ? openrouterAnswer : {};
|
|
9653
9895
|
const { confidence = asNumber(confidenceById?.[id]) ?? asNumber(fields.confidence), legend = (0, _sentry_core.isObjectLike)(fields.legend) ? fields.legend : void 0 } = answer;
|
|
9654
|
-
return
|
|
9896
|
+
return {
|
|
9655
9897
|
...answer,
|
|
9656
9898
|
confidence,
|
|
9657
9899
|
legend
|
|
9658
|
-
}
|
|
9659
|
-
})
|
|
9900
|
+
};
|
|
9901
|
+
});
|
|
9660
9902
|
}
|
|
9661
9903
|
/** Maps a Vercel AI finish reason to the OTel `gen_ai.output.messages` form (`tool-calls` → `tool_call`). */
|
|
9662
9904
|
function normalizeFinishReason(finishReason) {
|
|
@@ -10604,6 +10846,7 @@ function getSpanForLayer(data, options) {
|
|
|
10604
10846
|
*/
|
|
10605
10847
|
function getMatchedLayerPath(layer) {
|
|
10606
10848
|
if (layer.route) return getLayerPath([layer.route.path]);
|
|
10849
|
+
if (layer.rawPath !== void 0) return getLayerPath([layer.rawPath]);
|
|
10607
10850
|
return layer.keys?.length ? void 0 : layer.path || void 0;
|
|
10608
10851
|
}
|
|
10609
10852
|
function getLayerType(layer) {
|
|
@@ -11290,6 +11533,7 @@ function getTracingIntegrations() {
|
|
|
11290
11533
|
typesafeIntegration(),
|
|
11291
11534
|
postgresJsIntegration(),
|
|
11292
11535
|
neonIntegration(),
|
|
11536
|
+
clickhouseIntegration(),
|
|
11293
11537
|
firebaseIntegration(),
|
|
11294
11538
|
mcpServerIntegration()
|
|
11295
11539
|
];
|
|
@@ -11317,8 +11561,6 @@ const attachHapiErrorHandler = attachHapiErrorHandler$1;
|
|
|
11317
11561
|
exports.BullMQTelemetry = BullMQTelemetry;
|
|
11318
11562
|
exports.SentryMastraExporter = require_exports.SentryMastraExporter;
|
|
11319
11563
|
exports._INTERNAL_cronExpressionToMonitorConfig = cronExpressionToMonitorConfig;
|
|
11320
|
-
exports._INTERNAL_instrumentTunnelServer = instrumentTunnelServer;
|
|
11321
|
-
exports._INTERNAL_instrumentTunnelServers = instrumentTunnelServers;
|
|
11322
11564
|
exports.amqplibIntegration = amqplibIntegration;
|
|
11323
11565
|
exports.anthropicAIIntegration = anthropicAIIntegration;
|
|
11324
11566
|
exports.applyHonoPatches = require_exports.applyHonoPatches;
|
|
@@ -11326,7 +11568,10 @@ exports.attachHapiErrorHandler = attachHapiErrorHandler;
|
|
|
11326
11568
|
exports.attachKoaErrorHandler = attachKoaErrorHandler;
|
|
11327
11569
|
exports.awsIntegration = awsIntegration;
|
|
11328
11570
|
exports.bindTracingChannelToSpan = bindTracingChannelToSpan;
|
|
11571
|
+
exports.clickhouseIntegration = clickhouseIntegration;
|
|
11572
|
+
exports.collectInstalledModules = require_exports.collectInstalledModules;
|
|
11329
11573
|
exports.createFlueInstrumentation = require_exports.createFlueInstrumentation;
|
|
11574
|
+
exports.createGetModuleFromFilename = createGetModuleFromFilename;
|
|
11330
11575
|
exports.createHonoRequestMiddleware = require_exports.createHonoRequestMiddleware;
|
|
11331
11576
|
exports.createLangChainCallbackHandler = require_exports.createLangChainCallbackHandler;
|
|
11332
11577
|
exports.createSentryWinstonTransport = createSentryWinstonTransport;
|
|
@@ -11367,6 +11612,8 @@ exports.instrumentOpenAiClient = require_exports.instrumentOpenAiClient;
|
|
|
11367
11612
|
exports.instrumentPostgresJsSql = require_exports.instrumentPostgresJsSql;
|
|
11368
11613
|
exports.instrumentStateGraph = require_exports.instrumentStateGraph;
|
|
11369
11614
|
exports.instrumentStateGraphCompile = require_exports.instrumentStateGraphCompile;
|
|
11615
|
+
exports.instrumentTunnelServer = instrumentTunnelServer;
|
|
11616
|
+
exports.instrumentTunnelServers = instrumentTunnelServers;
|
|
11370
11617
|
exports.instrumentTypeSafeClient = require_exports.instrumentTypeSafeClient;
|
|
11371
11618
|
exports.instrumentWorkersAiClient = require_exports.instrumentWorkersAiClient;
|
|
11372
11619
|
exports.isBun = require_exports.isBun;
|
|
@@ -11405,6 +11652,7 @@ exports.setAsyncLocalStorageAsyncContextStrategy = require_exports.setAsyncLocal
|
|
|
11405
11652
|
exports.setHttpServerSpanRouteAttribute = require_exports.setHttpServerSpanRouteAttribute;
|
|
11406
11653
|
exports.setupExpressErrorHandler = setupExpressErrorHandler;
|
|
11407
11654
|
exports.setupFastifyErrorHandler = setupFastifyErrorHandler;
|
|
11655
|
+
exports.setupHapiErrorHandler = setupHapiErrorHandler;
|
|
11408
11656
|
exports.subscribeDiagnosticsChannel = subscribe;
|
|
11409
11657
|
exports.tediousIntegration = tediousIntegration;
|
|
11410
11658
|
exports.togetherAIIntegration = togetherAIIntegration;
|