@sentry/server-utils 11.16.0 → 11.17.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.
Files changed (92) hide show
  1. package/build/cjs/chunks/config.js +60 -0
  2. package/build/cjs/chunks/config.js.map +1 -1
  3. package/build/cjs/chunks/exports.js +116 -56
  4. package/build/cjs/chunks/exports.js.map +1 -1
  5. package/build/cjs/chunks/moduleInjectedTransform.js +8 -0
  6. package/build/cjs/chunks/moduleInjectedTransform.js.map +1 -1
  7. package/build/cjs/index.js +299 -168
  8. package/build/cjs/index.js.map +1 -1
  9. package/build/esm/ai/langchain/embeddings.js +23 -8
  10. package/build/esm/ai/langchain/embeddings.js.map +1 -1
  11. package/build/esm/ai/langchain/index.js +41 -30
  12. package/build/esm/ai/langchain/index.js.map +1 -1
  13. package/build/esm/ai/langgraph/agent-span.js +6 -2
  14. package/build/esm/ai/langgraph/agent-span.js.map +1 -1
  15. package/build/esm/ai/langgraph/index.js +5 -1
  16. package/build/esm/ai/langgraph/index.js.map +1 -1
  17. package/build/esm/ai/langgraph/stream.js +4 -1
  18. package/build/esm/ai/langgraph/stream.js.map +1 -1
  19. package/build/esm/ai/pi-durable/index.js +10 -13
  20. package/build/esm/ai/pi-durable/index.js.map +1 -1
  21. package/build/esm/ai/pi-durable/runs.js +6 -5
  22. package/build/esm/ai/pi-durable/runs.js.map +1 -1
  23. package/build/esm/ai/pi-durable/tools.js +21 -17
  24. package/build/esm/ai/pi-durable/tools.js.map +1 -1
  25. package/build/esm/index.js +3 -2
  26. package/build/esm/index.js.map +1 -1
  27. package/build/esm/integrations/clickhouse-sql.js +31 -0
  28. package/build/esm/integrations/clickhouse-sql.js.map +1 -0
  29. package/build/esm/integrations/clickhouse.js +88 -0
  30. package/build/esm/integrations/clickhouse.js.map +1 -0
  31. package/build/esm/integrations/express/instrumentation.js +1 -0
  32. package/build/esm/integrations/express/instrumentation.js.map +1 -1
  33. package/build/esm/integrations/fastify/instrumentation.js +3 -1
  34. package/build/esm/integrations/fastify/instrumentation.js.map +1 -1
  35. package/build/esm/integrations/hapi/index.js +15 -1
  36. package/build/esm/integrations/hapi/index.js.map +1 -1
  37. package/build/esm/integrations/index.js +2 -0
  38. package/build/esm/integrations/index.js.map +1 -1
  39. package/build/esm/integrations/langchain.js +10 -3
  40. package/build/esm/integrations/langchain.js.map +1 -1
  41. package/build/esm/orchestrion/channels.js +2 -0
  42. package/build/esm/orchestrion/channels.js.map +1 -1
  43. package/build/esm/orchestrion/config/channel-integration-definitions.js +8 -0
  44. package/build/esm/orchestrion/config/channel-integration-definitions.js.map +1 -1
  45. package/build/esm/orchestrion/config/clickhouse.js +51 -0
  46. package/build/esm/orchestrion/config/clickhouse.js.map +1 -0
  47. package/build/esm/orchestrion/config/index.js +2 -0
  48. package/build/esm/orchestrion/config/index.js.map +1 -1
  49. package/build/esm/package.json +1 -1
  50. package/build/esm/utils/sql.js +37 -16
  51. package/build/esm/utils/sql.js.map +1 -1
  52. package/build/types/ai/langchain/embeddings.d.ts +2 -2
  53. package/build/types/ai/langchain/embeddings.d.ts.map +1 -1
  54. package/build/types/ai/langchain/index.d.ts.map +1 -1
  55. package/build/types/ai/langchain/types.d.ts +8 -4
  56. package/build/types/ai/langchain/types.d.ts.map +1 -1
  57. package/build/types/ai/langgraph/agent-span.d.ts +5 -2
  58. package/build/types/ai/langgraph/agent-span.d.ts.map +1 -1
  59. package/build/types/ai/langgraph/index.d.ts.map +1 -1
  60. package/build/types/ai/langgraph/stream.d.ts.map +1 -1
  61. package/build/types/ai/langgraph/types.d.ts +10 -2
  62. package/build/types/ai/langgraph/types.d.ts.map +1 -1
  63. package/build/types/ai/pi-durable/index.d.ts.map +1 -1
  64. package/build/types/ai/pi-durable/runs.d.ts +4 -2
  65. package/build/types/ai/pi-durable/runs.d.ts.map +1 -1
  66. package/build/types/ai/pi-durable/tools.d.ts +4 -6
  67. package/build/types/ai/pi-durable/tools.d.ts.map +1 -1
  68. package/build/types/ai/pi-durable/types.d.ts +10 -1
  69. package/build/types/ai/pi-durable/types.d.ts.map +1 -1
  70. package/build/types/index.d.ts +2 -1
  71. package/build/types/index.d.ts.map +1 -1
  72. package/build/types/integrations/clickhouse-sql.d.ts +8 -0
  73. package/build/types/integrations/clickhouse-sql.d.ts.map +1 -0
  74. package/build/types/integrations/clickhouse.d.ts +11 -0
  75. package/build/types/integrations/clickhouse.d.ts.map +1 -0
  76. package/build/types/integrations/express/types.d.ts +1 -0
  77. package/build/types/integrations/express/types.d.ts.map +1 -1
  78. package/build/types/integrations/fastify/instrumentation.d.ts.map +1 -1
  79. package/build/types/integrations/hapi/index.d.ts +12 -0
  80. package/build/types/integrations/hapi/index.d.ts.map +1 -1
  81. package/build/types/integrations/index.d.ts.map +1 -1
  82. package/build/types/integrations/langchain.d.ts.map +1 -1
  83. package/build/types/orchestrion/channels.d.ts +12 -0
  84. package/build/types/orchestrion/channels.d.ts.map +1 -1
  85. package/build/types/orchestrion/config/channel-integration-definitions.d.ts +3 -0
  86. package/build/types/orchestrion/config/channel-integration-definitions.d.ts.map +1 -1
  87. package/build/types/orchestrion/config/clickhouse.d.ts +18 -0
  88. package/build/types/orchestrion/config/clickhouse.d.ts.map +1 -0
  89. package/build/types/orchestrion/config/index.d.ts.map +1 -1
  90. package/build/types/utils/sql.d.ts +28 -3
  91. package/build/types/utils/sql.d.ts.map +1 -1
  92. package/package.json +4 -4
@@ -618,7 +618,7 @@ function eveTracePolicy() {
618
618
  };
619
619
  }
620
620
  // src/integrations/fastify/utils.ts
621
- const INTEGRATION_NAME$34 = "Fastify";
621
+ const INTEGRATION_NAME$35 = "Fastify";
622
622
  /**
623
623
  * Default function to determine if an error should be sent to Sentry
624
624
  *
@@ -645,7 +645,7 @@ function getErrorStatusCode(error) {
645
645
  // src/integrations/fastify/errors.ts
646
646
  const kErrorCaptured = Symbol("sentry.fastifyErrorCaptured");
647
647
  function getFastifyIntegration() {
648
- return (0, _sentry_core.getClient)()?.getIntegrationByName(INTEGRATION_NAME$34);
648
+ return (0, _sentry_core.getClient)()?.getIntegrationByName(INTEGRATION_NAME$35);
649
649
  }
650
650
  /**
651
651
  * Subscribe to the Fastify v5 error diagnostics channel.
@@ -677,7 +677,7 @@ function handleFastifyError(request, reply, error) {
677
677
  }
678
678
  }
679
679
  // src/integrations/fastify/instrumentation.ts
680
- const ORIGIN$22 = "auto.http.fastify";
680
+ const ORIGIN$23 = "auto.http.fastify";
681
681
  const FASTIFY_HOOKS = [
682
682
  "onRequest",
683
683
  "preParsing",
@@ -770,7 +770,7 @@ function onRequest(request, _reply, hookDone) {
770
770
  const method = request.method || "GET";
771
771
  (0, _sentry_core.getIsolationScope)().setTransactionName(`${method} ${routeName}`);
772
772
  const attributes = {
773
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$22,
773
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$23,
774
774
  [_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.HANDLER,
775
775
  [_sentry_conventions_attributes.HTTP_REQUEST_METHOD]: request.method,
776
776
  [_sentry_conventions_attributes.URL_PATH]: request.url
@@ -866,6 +866,8 @@ function handlerWrapper(handler, hookName, spanAttributes = {}) {
866
866
  const request = getRequestFromArgs(args);
867
867
  if (!request) return handler.call(this, ...args);
868
868
  const parentSpan = request[kRequestSpan] ?? void 0;
869
+ const effectiveParentSpan = parentSpan ?? (0, _sentry_core.getActiveSpan)();
870
+ if (effectiveParentSpan && !(0, _sentry_core.spanIsSampled)(effectiveParentSpan)) return handler.call(this, ...args);
869
871
  const handlerName = handler.name?.length > 0 ? handler.name : this.pluginName ?? ANONYMOUS_FUNCTION_NAME;
870
872
  const hookType = spanAttributes[ATTRIBUTE_FASTIFY_TYPE];
871
873
  const op = hookType === HOOK_TYPE_INSTANCE ? _sentry_conventions_op.MIDDLEWARE : hookType === HOOK_TYPE_HANDLER ? _sentry_conventions_op.HANDLER : void 0;
@@ -878,7 +880,7 @@ function handlerWrapper(handler, hookName, spanAttributes = {}) {
878
880
  attributes: {
879
881
  ...spanAttributes,
880
882
  [_sentry_conventions_attributes.SENTRY_OP]: op,
881
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$22
883
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$23
882
884
  },
883
885
  parentSpan
884
886
  }, () => handler.call(this, ...args));
@@ -901,7 +903,7 @@ function instrumentFastify() {
901
903
  const _fastifyIntegration = (({ shouldHandleError } = {}) => {
902
904
  let _shouldHandleError;
903
905
  return {
904
- name: INTEGRATION_NAME$34,
906
+ name: INTEGRATION_NAME$35,
905
907
  setupOnce() {
906
908
  _shouldHandleError = shouldHandleError || defaultShouldHandleError$1;
907
909
  subscribeToFastifyErrorChannel();
@@ -1357,7 +1359,7 @@ function isLazyResult(value) {
1357
1359
  return typeof value === "object" && value !== null && typeof value.toArray === "function" && typeof value[Symbol.asyncIterator] === "function";
1358
1360
  }
1359
1361
  // src/integrations/prisma/index.ts
1360
- const INTEGRATION_NAME$33 = "Prisma";
1362
+ const INTEGRATION_NAME$34 = "Prisma";
1361
1363
  /**
1362
1364
  * Sets up the global Prisma tracing helper that Prisma looks up on `globalThis` to emit tracing data.
1363
1365
  *
@@ -1372,7 +1374,7 @@ function instrumentPrisma(options) {
1372
1374
  }
1373
1375
  const _prismaIntegration = ((options) => {
1374
1376
  return {
1375
- name: INTEGRATION_NAME$33,
1377
+ name: INTEGRATION_NAME$34,
1376
1378
  setupOnce() {
1377
1379
  instrumentPrisma(options);
1378
1380
  },
@@ -1419,6 +1421,7 @@ const CHANNELS = {
1419
1421
  ...require_config.amqplibChannels,
1420
1422
  ...require_config.anthropicAiChannels,
1421
1423
  ...require_config.awsSdkChannels,
1424
+ ...require_config.clickhouseChannels,
1422
1425
  ...require_config.cronChannels,
1423
1426
  ...require_config.dataloaderChannels,
1424
1427
  ...require_config.expressChannels,
@@ -1461,7 +1464,7 @@ const CHANNELS = {
1461
1464
  ...require_config.vercelAiChannels
1462
1465
  };
1463
1466
  // src/integrations/amqplib.ts
1464
- const INTEGRATION_NAME$32 = "Amqplib";
1467
+ const INTEGRATION_NAME$33 = "Amqplib";
1465
1468
  const PUBLISHER_ORIGIN = "auto.queue.amqplib.publisher";
1466
1469
  const CONSUMER_ORIGIN$1 = "auto.queue.amqplib.consumer";
1467
1470
  const MESSAGING_OPERATION_VALUE_PROCESS = "process";
@@ -1487,7 +1490,7 @@ const CONNECTION_ATTRIBUTES = Symbol("sentry.amqplib.connection.attributes");
1487
1490
  const NOOP$4 = () => {};
1488
1491
  const _amqplibIntegration = (() => {
1489
1492
  return {
1490
- name: INTEGRATION_NAME$32,
1493
+ name: INTEGRATION_NAME$33,
1491
1494
  setup(client) {
1492
1495
  invokeOrchestrionInstrumentation(client, require_config.amqplibModuleNames, instrumentAmqplib, []);
1493
1496
  }
@@ -1889,7 +1892,7 @@ function wrapApiPromiseResponse(result, onResponse, onError) {
1889
1892
  return true;
1890
1893
  }
1891
1894
  // src/integrations/anthropic.ts
1892
- const INTEGRATION_NAME$31 = "Anthropic_AI";
1895
+ const INTEGRATION_NAME$32 = "Anthropic_AI";
1893
1896
  const INSTRUMENTED_CHANNELS$3 = [{
1894
1897
  channel: CHANNELS.ANTHROPIC_CHAT,
1895
1898
  operation: "chat",
@@ -1901,7 +1904,7 @@ const INSTRUMENTED_CHANNELS$3 = [{
1901
1904
  }];
1902
1905
  const _anthropicAIIntegration = ((options = {}) => {
1903
1906
  return {
1904
- name: INTEGRATION_NAME$31,
1907
+ name: INTEGRATION_NAME$32,
1905
1908
  setup(client) {
1906
1909
  invokeOrchestrionInstrumentation(client, require_config.anthropicAiModuleNames, instrumentAnthropic, [options]);
1907
1910
  }
@@ -1947,7 +1950,7 @@ function instrumentAnthropic(options) {
1947
1950
  */
1948
1951
  function createGenAiSpan$4(data, operation, options, stream) {
1949
1952
  const args = data.arguments ?? [];
1950
- if (require_exports.shouldSkipAiProviderSpan(INTEGRATION_NAME$31)) return;
1953
+ if (require_exports.shouldSkipAiProviderSpan(INTEGRATION_NAME$32)) return;
1951
1954
  const requestOptions = args[1];
1952
1955
  if (isStreamHelperRequest(requestOptions?.headers) && isInsideStreamHelperSpan()) return;
1953
1956
  const params = typeof args[0] === "object" && args[0] !== null ? args[0] : void 0;
@@ -2979,7 +2982,7 @@ function extractAttributesFromNormalizedRequest(normalizedRequest) {
2979
2982
  };
2980
2983
  }
2981
2984
  // src/integrations/aws-sdk/index.ts
2982
- const INTEGRATION_NAME$30 = "Aws";
2985
+ const INTEGRATION_NAME$31 = "Aws";
2983
2986
  function setMetadataAttributes(span, metadata) {
2984
2987
  if (!metadata) return;
2985
2988
  if (metadata.requestId) span.setAttribute(_sentry_conventions_attributes._AWS_REQUEST_ID, metadata.requestId);
@@ -2989,7 +2992,7 @@ function setMetadataAttributes(span, metadata) {
2989
2992
  const _awsIntegration = ((options) => {
2990
2993
  const servicesExtensions = new ServicesExtensions(options);
2991
2994
  return {
2992
- name: INTEGRATION_NAME$30,
2995
+ name: INTEGRATION_NAME$31,
2993
2996
  setup(client) {
2994
2997
  invokeOrchestrionInstrumentation(client, require_config.awsSdkModuleNames, instrumentAwsSdk, [servicesExtensions]);
2995
2998
  }
@@ -3093,9 +3096,9 @@ function instrumentAwsSdk(servicesExtensions) {
3093
3096
  */
3094
3097
  const awsIntegration = (0, _sentry_core.defineIntegration)(_awsIntegration);
3095
3098
  // src/integrations/dataloader.ts
3096
- const INTEGRATION_NAME$29 = "Dataloader";
3099
+ const INTEGRATION_NAME$30 = "Dataloader";
3097
3100
  const MODULE_NAME = "dataloader";
3098
- const ORIGIN$21 = "auto.db.dataloader";
3101
+ const ORIGIN$22 = "auto.db.dataloader";
3099
3102
  /**
3100
3103
  * Maps each operation to a convention cache op. `load`, `loadMany` and `batch` are cache reads,
3101
3104
  * `prime` writes an entry, and `clear`/`clearAll` remove entries. The precise operation stays
@@ -3128,7 +3131,7 @@ function makeSpanOptions(loader, operation, keyArg) {
3128
3131
  [_sentry_conventions_attributes.SENTRY_OP]: cacheOperation,
3129
3132
  [_sentry_conventions_attributes.CACHE_OPERATION]: _sentry_core.CACHE_OPERATION_NAMES[cacheOperation],
3130
3133
  [_sentry_conventions_attributes.SENTRY_KIND]: operation === "batch" ? void 0 : "client",
3131
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$21,
3134
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$22,
3132
3135
  [_sentry_conventions_attributes.DB_OPERATION_NAME]: operation,
3133
3136
  [_sentry_conventions_attributes.DB_COLLECTION_NAME]: loader?.name ?? void 0,
3134
3137
  [_sentry_conventions_attributes.CACHE_KEY]: getCacheKey(keyArg)
@@ -3137,7 +3140,7 @@ function makeSpanOptions(loader, operation, keyArg) {
3137
3140
  }
3138
3141
  const _dataloaderIntegration = (() => {
3139
3142
  return {
3140
- name: INTEGRATION_NAME$29,
3143
+ name: INTEGRATION_NAME$30,
3141
3144
  setupOnce() {
3142
3145
  if (!tracingChannel) return;
3143
3146
  require_debug_build.DEBUG_BUILD && _sentry_core.debug.log("[instrumentation:dataloader] subscribing to dataloader tracing channels");
@@ -3207,10 +3210,10 @@ function startInactiveSpanFor(loader, operation, keyArg) {
3207
3210
  */
3208
3211
  const dataloaderIntegration = (0, _sentry_core.defineIntegration)(_dataloaderIntegration);
3209
3212
  // src/integrations/generic-pool.ts
3210
- const INTEGRATION_NAME$28 = "GenericPool";
3213
+ const INTEGRATION_NAME$29 = "GenericPool";
3211
3214
  const _genericPoolIntegration = (() => {
3212
3215
  return {
3213
- name: INTEGRATION_NAME$28,
3216
+ name: INTEGRATION_NAME$29,
3214
3217
  setup(client) {
3215
3218
  invokeOrchestrionInstrumentation(client, require_config.genericPoolModuleNames, instrumentGenericPool, []);
3216
3219
  }
@@ -3485,10 +3488,10 @@ function updateMonitorConfig(job, monitorConfig) {
3485
3488
  if (typeof job === "function" && monitorConfigs.has(job)) monitorConfigs.set(job, monitorConfig);
3486
3489
  }
3487
3490
  // src/integrations/cron.ts
3488
- const INTEGRATION_NAME$27 = "CronJob";
3491
+ const INTEGRATION_NAME$28 = "CronJob";
3489
3492
  const _cronJobIntegration = ((options = {}) => {
3490
3493
  return {
3491
- name: INTEGRATION_NAME$27,
3494
+ name: INTEGRATION_NAME$28,
3492
3495
  setup(client) {
3493
3496
  invokeOrchestrionInstrumentation(client, require_config.cronModuleNames, subscribe$4, [options], { requiresTracingChannelBinding: false });
3494
3497
  }
@@ -3501,8 +3504,8 @@ const _cronJobIntegration = ((options = {}) => {
3501
3504
  */
3502
3505
  const cronJobIntegration = (0, _sentry_core.defineIntegration)(_cronJobIntegration);
3503
3506
  function subscribe$4(options) {
3504
- subscribeToJobCreation(CHANNELS.CRON_JOB_CONSTRUCTOR, INTEGRATION_NAME$27, (args) => wrapJob(args, options));
3505
- subscribeToScheduleChange(CHANNELS.CRON_JOB_SET_TIME, INTEGRATION_NAME$27, onSetTime);
3507
+ subscribeToJobCreation(CHANNELS.CRON_JOB_CONSTRUCTOR, INTEGRATION_NAME$28, (args) => wrapJob(args, options));
3508
+ subscribeToScheduleChange(CHANNELS.CRON_JOB_SET_TIME, INTEGRATION_NAME$28, onSetTime);
3506
3509
  }
3507
3510
  /** Sets the new time's config after `job.setTime(cronTime)`. Without one, the job doesn't check in. */
3508
3511
  function onSetTime({ arguments: [cronTime], self }) {
@@ -3520,10 +3523,10 @@ function wrapJob(args, options) {
3520
3523
  args[1] = wrapScheduledJob(onTick, name, utcOffset == null ? cronExpressionToMonitorConfig(cronTime, timeZone, "cron") : void 0, "auto.function.cron");
3521
3524
  }
3522
3525
  // src/integrations/node-cron.ts
3523
- const INTEGRATION_NAME$26 = "NodeCron";
3526
+ const INTEGRATION_NAME$27 = "NodeCron";
3524
3527
  const _nodeCronIntegration = ((options = {}) => {
3525
3528
  return {
3526
- name: INTEGRATION_NAME$26,
3529
+ name: INTEGRATION_NAME$27,
3527
3530
  setup(client) {
3528
3531
  invokeOrchestrionInstrumentation(client, require_config.nodeCronModuleNames, subscribe$3, [options], { requiresTracingChannelBinding: false });
3529
3532
  }
@@ -3536,9 +3539,9 @@ const _nodeCronIntegration = ((options = {}) => {
3536
3539
  */
3537
3540
  const nodeCronIntegration = (0, _sentry_core.defineIntegration)(_nodeCronIntegration);
3538
3541
  function subscribe$3(options) {
3539
- subscribeToJobCreation(CHANNELS.NODE_CRON_CREATE_TASK, INTEGRATION_NAME$26, (args) => wrapTask(args, options));
3540
- subscribeToJobCreation(CHANNELS.NODE_CRON_V4_CREATE_TASK, INTEGRATION_NAME$26, (args) => wrapTask(args, options, isReadAlikeByNodeCron4));
3541
- subscribeToJobCreation(CHANNELS.NODE_CRON_V3_CREATE_TASK, INTEGRATION_NAME$26, (args) => wrapTask(args, options, isReadAlikeByNodeCron3));
3542
+ subscribeToJobCreation(CHANNELS.NODE_CRON_CREATE_TASK, INTEGRATION_NAME$27, (args) => wrapTask(args, options));
3543
+ subscribeToJobCreation(CHANNELS.NODE_CRON_V4_CREATE_TASK, INTEGRATION_NAME$27, (args) => wrapTask(args, options, isReadAlikeByNodeCron4));
3544
+ subscribeToJobCreation(CHANNELS.NODE_CRON_V3_CREATE_TASK, INTEGRATION_NAME$27, (args) => wrapTask(args, options, isReadAlikeByNodeCron3));
3542
3545
  }
3543
3546
  function wrapTask(args, options, isReadAlike) {
3544
3547
  const [expression, func, taskOptions] = args;
@@ -3580,10 +3583,10 @@ function isReadAlikeByNodeCron3(expression) {
3580
3583
  });
3581
3584
  }
3582
3585
  // src/integrations/node-schedule.ts
3583
- const INTEGRATION_NAME$25 = "NodeSchedule";
3586
+ const INTEGRATION_NAME$26 = "NodeSchedule";
3584
3587
  const _nodeScheduleIntegration = ((options = {}) => {
3585
3588
  return {
3586
- name: INTEGRATION_NAME$25,
3589
+ name: INTEGRATION_NAME$26,
3587
3590
  setup(client) {
3588
3591
  invokeOrchestrionInstrumentation(client, require_config.nodeScheduleModuleNames, subscribe$2, [options], { requiresTracingChannelBinding: false });
3589
3592
  }
@@ -3596,7 +3599,7 @@ const _nodeScheduleIntegration = ((options = {}) => {
3596
3599
  */
3597
3600
  const nodeScheduleIntegration = (0, _sentry_core.defineIntegration)(_nodeScheduleIntegration);
3598
3601
  function subscribe$2(options) {
3599
- subscribeToScheduleChange(CHANNELS.NODE_SCHEDULE_SCHEDULE, INTEGRATION_NAME$25, onSchedule, (change) => beforeSchedule(change, options));
3602
+ subscribeToScheduleChange(CHANNELS.NODE_SCHEDULE_SCHEDULE, INTEGRATION_NAME$26, onSchedule, (change) => beforeSchedule(change, options));
3600
3603
  }
3601
3604
  const ANONYMOUS_NAME = /^<Anonymous Job \d+[ >]/;
3602
3605
  const addsToPendingRuns = /* @__PURE__ */ new WeakSet();
@@ -4150,8 +4153,8 @@ var BullMQTelemetry = class {
4150
4153
  }
4151
4154
  };
4152
4155
  // src/integrations/google-genai.ts
4153
- const INTEGRATION_NAME$24 = "Google_GenAI";
4154
- const ORIGIN$20 = "auto.ai.google_genai";
4156
+ const INTEGRATION_NAME$25 = "Google_GenAI";
4157
+ const ORIGIN$21 = "auto.ai.google_genai";
4155
4158
  const INSTRUMENTED_CHANNELS$2 = [
4156
4159
  {
4157
4160
  channel: CHANNELS.GOOGLE_GENAI_GENERATE_CONTENT,
@@ -4172,7 +4175,7 @@ const INSTRUMENTED_CHANNELS$2 = [
4172
4175
  ];
4173
4176
  const _googleGenAIIntegration = ((options = {}) => {
4174
4177
  return {
4175
- name: INTEGRATION_NAME$24,
4178
+ name: INTEGRATION_NAME$25,
4176
4179
  setup(client) {
4177
4180
  invokeOrchestrionInstrumentation(client, require_config.googleGenAiModuleNames, instrumentGoogleGenai, [options]);
4178
4181
  }
@@ -4196,12 +4199,12 @@ function instrumentGoogleGenai(options) {
4196
4199
  * Returning `undefined` opts the payload out so no span is opened.
4197
4200
  */
4198
4201
  function createGenAiSpan$3(data, operation, options) {
4199
- if (require_exports.shouldSkipAiProviderSpan(INTEGRATION_NAME$24)) return;
4202
+ if (require_exports.shouldSkipAiProviderSpan(INTEGRATION_NAME$25)) return;
4200
4203
  if (operation !== "chat") {
4201
4204
  const activeSpan = (0, _sentry_core.getActiveSpan)();
4202
4205
  if (activeSpan) {
4203
4206
  const { attributes: { [_sentry_conventions_attributes.SENTRY_OP]: op, [_sentry_conventions_attributes.SENTRY_ORIGIN]: origin } } = (0, _sentry_core.spanToJSON)(activeSpan);
4204
- if (origin === ORIGIN$20 && op === "gen_ai.chat") return;
4207
+ if (origin === ORIGIN$21 && op === "gen_ai.chat") return;
4205
4208
  }
4206
4209
  }
4207
4210
  const request = (data.arguments ?? [])[0];
@@ -4214,7 +4217,7 @@ function createGenAiSpan$3(data, operation, options) {
4214
4217
  data._sentryRecordOutputs = recordOutputs;
4215
4218
  const attributes = require_exports.extractRequestAttributes$1(operation, params, data.self, recordInputs);
4216
4219
  const model = attributes[_sentry_conventions_attributes.GEN_AI_REQUEST_MODEL] || "unknown";
4217
- attributes[_sentry_conventions_attributes.SENTRY_ORIGIN] = ORIGIN$20;
4220
+ attributes[_sentry_conventions_attributes.SENTRY_ORIGIN] = ORIGIN$21;
4218
4221
  const client = (0, _sentry_core.getClient)();
4219
4222
  const span = (0, _sentry_core.startInactiveSpan)({
4220
4223
  name: model !== "unknown" || !(client && (0, _sentry_core.hasSpanStreamingEnabled)(client)) ? `${operation} ${model}` : operation,
@@ -4252,7 +4255,7 @@ function wrapStreamResult$2(span, data, operation) {
4252
4255
  */
4253
4256
  const googleGenAIIntegration = (0, _sentry_core.defineIntegration)(_googleGenAIIntegration);
4254
4257
  // src/integrations/graphql/constants.ts
4255
- const ORIGIN$19 = "auto.graphql.graphql";
4258
+ const ORIGIN$20 = "auto.graphql.graphql";
4256
4259
  const SPAN_NAME_PARSE = "graphql.parse";
4257
4260
  const SPAN_NAME_VALIDATE = "graphql.validate";
4258
4261
  const SPAN_NAME_EXECUTE = "graphql.execute";
@@ -4395,7 +4398,7 @@ function setupParseChannel(tracingChannel) {
4395
4398
  return (0, _sentry_core.startInactiveSpan)({
4396
4399
  name: client && (0, _sentry_core.hasSpanStreamingEnabled)(client) ? `GraphQL ${PROCESSING_TYPE_PARSE}` : SPAN_NAME_PARSE,
4397
4400
  attributes: {
4398
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$19,
4401
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$20,
4399
4402
  [_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.GRAPHQL,
4400
4403
  [_sentry_conventions_attributes.GRAPHQL_PROCESSING_TYPE]: PROCESSING_TYPE_PARSE
4401
4404
  }
@@ -4408,7 +4411,7 @@ function setupValidateChannel(tracingChannel) {
4408
4411
  return (0, _sentry_core.startInactiveSpan)({
4409
4412
  name: client && (0, _sentry_core.hasSpanStreamingEnabled)(client) ? `GraphQL ${PROCESSING_TYPE_VALIDATE}` : SPAN_NAME_VALIDATE,
4410
4413
  attributes: {
4411
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$19,
4414
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$20,
4412
4415
  [_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.GRAPHQL,
4413
4416
  [_sentry_conventions_attributes.GRAPHQL_PROCESSING_TYPE]: PROCESSING_TYPE_VALIDATE,
4414
4417
  [_sentry_conventions_attributes.GRAPHQL_DOCUMENT]: collectGraphqlDocument(data.document)
@@ -4428,7 +4431,7 @@ function setupOperationChannel(tracingChannel, channelName, fallbackName, useOpe
4428
4431
  const span = (0, _sentry_core.startInactiveSpan)({
4429
4432
  name: client && (0, _sentry_core.hasSpanStreamingEnabled)(client) ? streamedName : getOperationSpanName(data.operationType, data.operationName, fallbackName),
4430
4433
  attributes: {
4431
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$19,
4434
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$20,
4432
4435
  [_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.GRAPHQL,
4433
4436
  [_sentry_conventions_attributes.GRAPHQL_PROCESSING_TYPE]: PROCESSING_TYPE_EXECUTE,
4434
4437
  [_sentry_conventions_attributes.GRAPHQL_OPERATION_TYPE]: data.operationType,
@@ -4452,7 +4455,7 @@ function setupResolveChannel(tracingChannel, ignoreTrivialResolveSpans) {
4452
4455
  return (0, _sentry_core.startInactiveSpan)({
4453
4456
  name: client && (0, _sentry_core.hasSpanStreamingEnabled)(client) ? `GraphQL ${PROCESSING_TYPE_RESOLVE}` : `${SPAN_NAME_RESOLVE} ${data.fieldPath}`,
4454
4457
  attributes: {
4455
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$19,
4458
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$20,
4456
4459
  [_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.GRAPHQL,
4457
4460
  [_sentry_conventions_attributes.GRAPHQL_PROCESSING_TYPE]: PROCESSING_TYPE_RESOLVE,
4458
4461
  [GRAPHQL_FIELD_NAME]: data.fieldName,
@@ -4537,7 +4540,7 @@ function createFieldIfNotExists(contextValue, info, path) {
4537
4540
  }
4538
4541
  function createResolverSpan(info, path, parentSpan) {
4539
4542
  const attributes = {
4540
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$19,
4543
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$20,
4541
4544
  [_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.GRAPHQL,
4542
4545
  [_sentry_conventions_attributes.GRAPHQL_PROCESSING_TYPE]: PROCESSING_TYPE_RESOLVE,
4543
4546
  [GRAPHQL_FIELD_NAME]: info.fieldName,
@@ -4604,7 +4607,7 @@ function getOperation(document, operationName) {
4604
4607
  }
4605
4608
  // src/integrations/graphql/spans.ts
4606
4609
  const BASE_ATTRIBUTES = {
4607
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$19,
4610
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$20,
4608
4611
  [_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.GRAPHQL
4609
4612
  };
4610
4613
  function startParseSpan() {
@@ -4719,7 +4722,7 @@ function finalizeExecuteSpan(span, result) {
4719
4722
  });
4720
4723
  }
4721
4724
  // src/integrations/graphql/index.ts
4722
- const INTEGRATION_NAME$23 = "Graphql";
4725
+ const INTEGRATION_NAME$24 = "Graphql";
4723
4726
  function getOptionsWithDefaults(options) {
4724
4727
  return {
4725
4728
  ignoreResolveSpans: options.ignoreResolveSpans !== false,
@@ -4731,7 +4734,7 @@ const _graphqlIntegration = ((options = {}) => {
4731
4734
  const config = getOptionsWithDefaults(options);
4732
4735
  const getConfig = () => config;
4733
4736
  return {
4734
- name: INTEGRATION_NAME$23,
4737
+ name: INTEGRATION_NAME$24,
4735
4738
  setup(client) {
4736
4739
  invokeOrchestrionInstrumentation(client, require_config.graphqlModuleNames, instrumentGraphql, [config, getConfig]);
4737
4740
  },
@@ -4757,10 +4760,10 @@ function setupNativeGraphQLInstrumentation(options) {
4757
4760
  */
4758
4761
  const graphqlIntegration = (0, _sentry_core.defineIntegration)(_graphqlIntegration);
4759
4762
  // src/integrations/hapi/index.ts
4760
- const INTEGRATION_NAME$22 = "Hapi";
4763
+ const INTEGRATION_NAME$23 = "Hapi";
4761
4764
  const _hapiIntegration = (({ shouldHandleError } = {}) => {
4762
4765
  return {
4763
- name: INTEGRATION_NAME$22,
4766
+ name: INTEGRATION_NAME$23,
4764
4767
  setup(client) {
4765
4768
  invokeOrchestrionInstrumentation(client, require_config.hapiModuleNames, instrumentHapi, [shouldHandleError], { requiresTracingChannelBinding: false });
4766
4769
  }
@@ -4806,8 +4809,22 @@ function instrumentHapi(shouldHandleError) {
4806
4809
  * `lib/server.js`. Requires the Sentry runtime hook or bundler plugin.
4807
4810
  */
4808
4811
  const hapiIntegration = (0, _sentry_core.defineIntegration)(_hapiIntegration);
4812
+ /**
4813
+ * Add a Hapi plugin to capture errors to Sentry.
4814
+ *
4815
+ * @deprecated The error handler is now registered automatically when the Hapi
4816
+ * server starts (via the orchestrion `@hapi/hapi` instrumentation), so calling
4817
+ * this is no longer necessary. It remains a safe, idempotent operation when the
4818
+ * handler is already attached, and is kept for setups where auto-registration is
4819
+ * unavailable. This will be removed in a future major version.
4820
+ *
4821
+ * @param server The Hapi server to attach the error handler to
4822
+ */
4823
+ async function setupHapiErrorHandler(server) {
4824
+ attachHapiErrorHandler$1(server);
4825
+ }
4809
4826
  // src/integrations/hono/honoIntegration.ts
4810
- const INTEGRATION_NAME$21 = "Hono";
4827
+ const INTEGRATION_NAME$22 = "Hono";
4811
4828
  function getHonoRuntime() {
4812
4829
  return require_exports.isBun() ? "bun" : require_exports.isDeno() ? "deno" : require_exports.isCloudflareWorkers() ? "cloudflare" : "node";
4813
4830
  }
@@ -4900,7 +4917,7 @@ function instrumentHono(options) {
4900
4917
  }
4901
4918
  const _honoIntegration = ((options = {}) => {
4902
4919
  return {
4903
- name: INTEGRATION_NAME$21,
4920
+ name: INTEGRATION_NAME$22,
4904
4921
  setup(client) {
4905
4922
  invokeOrchestrionInstrumentation(client, require_config.honoModuleNames, instrumentHono, [options]);
4906
4923
  }
@@ -4919,8 +4936,8 @@ const _honoIntegration = ((options = {}) => {
4919
4936
  */
4920
4937
  const honoIntegration = (0, _sentry_core.defineIntegration)(_honoIntegration);
4921
4938
  // src/integrations/koa/index.ts
4922
- const INTEGRATION_NAME$20 = "Koa";
4923
- const ORIGIN$18 = "auto.http.koa";
4939
+ const INTEGRATION_NAME$21 = "Koa";
4940
+ const ORIGIN$19 = "auto.http.koa";
4924
4941
  const LAYER_TYPE = {
4925
4942
  ROUTER: "router",
4926
4943
  MIDDLEWARE: "middleware"
@@ -4929,7 +4946,7 @@ const kLayerPatched = Symbol("sentry.koa.layer-patched");
4929
4946
  const _koaIntegration = ((options = {}) => {
4930
4947
  const ignoreLayersType = options.ignoreLayersType ?? [];
4931
4948
  return {
4932
- name: INTEGRATION_NAME$20,
4949
+ name: INTEGRATION_NAME$21,
4933
4950
  setup(client) {
4934
4951
  invokeOrchestrionInstrumentation(client, require_config.koaModuleNames, instrumentKoa, [ignoreLayersType], { requiresTracingChannelBinding: false });
4935
4952
  }
@@ -5007,7 +5024,7 @@ function patchLayer(middlewareLayer, isRouter, ignoreLayersType, layerPath) {
5007
5024
  attributes: {
5008
5025
  ...metadata.attributes,
5009
5026
  [_sentry_conventions_attributes.SENTRY_OP]: layerType === LAYER_TYPE.MIDDLEWARE ? _sentry_conventions_op.MIDDLEWARE : _sentry_conventions_op.ROUTER,
5010
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$18
5027
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$19
5011
5028
  }
5012
5029
  }, () => {
5013
5030
  if (!context["__SENTRY_KOA_SPAN__"]) {
@@ -5254,7 +5271,7 @@ const REDIS_DC_CHANNEL_BATCH = "node-redis:batch";
5254
5271
  const REDIS_DC_CHANNEL_CONNECT = "node-redis:connect";
5255
5272
  const IOREDIS_DC_CHANNEL_COMMAND = "ioredis:command";
5256
5273
  const IOREDIS_DC_CHANNEL_CONNECT = "ioredis:connect";
5257
- const ORIGIN$17 = "auto.db.redis.native_channel";
5274
+ const ORIGIN$18 = "auto.db.redis.native_channel";
5258
5275
  const DB_SYSTEM_NAME_VALUE_REDIS = "redis";
5259
5276
  /**
5260
5277
  * Subscribe Sentry span handlers to node-redis and ioredis diagnostics-channel
@@ -5281,7 +5298,7 @@ function setupCommandChannel(tracingChannel, channelName, getCommandArgs, cacheO
5281
5298
  port: data.serverPort
5282
5299
  });
5283
5300
  const attributes = {
5284
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$17,
5301
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$18,
5285
5302
  [_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB_QUERY,
5286
5303
  [_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_REDIS,
5287
5304
  [_sentry_conventions_attributes.DB_OPERATION_NAME]: data.command,
@@ -5309,7 +5326,7 @@ function setupBatchChannel(tracingChannel, channelName, getOperationName) {
5309
5326
  return (0, _sentry_core.startInactiveSpan)({
5310
5327
  name: operation,
5311
5328
  attributes: {
5312
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$17,
5329
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$18,
5313
5330
  [_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB_QUERY,
5314
5331
  [_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_REDIS,
5315
5332
  [_sentry_conventions_attributes.DB_OPERATION_NAME]: operation,
@@ -5325,7 +5342,7 @@ function setupConnectChannel$1(tracingChannel, channelName) {
5325
5342
  return (0, _sentry_core.startInactiveSpan)({
5326
5343
  name: "redis-connect",
5327
5344
  attributes: {
5328
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$17,
5345
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$18,
5329
5346
  [_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
5330
5347
  [_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_REDIS,
5331
5348
  ...data.serverAddress != null ? { [_sentry_conventions_attributes.SERVER_ADDRESS]: data.serverAddress } : {},
@@ -5335,7 +5352,7 @@ function setupConnectChannel$1(tracingChannel, channelName) {
5335
5352
  });
5336
5353
  }
5337
5354
  // src/integrations/redis/ioredis-channel-subscriber.ts
5338
- const ORIGIN$16 = "auto.db.redis";
5355
+ const ORIGIN$17 = "auto.db.redis";
5339
5356
  const DB_SYSTEM_VALUE_REDIS$1 = "redis";
5340
5357
  function getConnectionOptions(self) {
5341
5358
  return {
@@ -5348,7 +5365,7 @@ function connectionAttributes(host, port) {
5348
5365
  [_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_VALUE_REDIS$1,
5349
5366
  ...host != null ? { [_sentry_conventions_attributes.SERVER_ADDRESS]: host } : {},
5350
5367
  ...port != null ? { [_sentry_conventions_attributes.SERVER_PORT]: port } : {},
5351
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$16
5368
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$17
5352
5369
  };
5353
5370
  }
5354
5371
  const tracedCommands = /* @__PURE__ */ new WeakSet();
@@ -5413,8 +5430,8 @@ function instrumentIoredis(options) {
5413
5430
  });
5414
5431
  }
5415
5432
  // src/integrations/redis/index.ts
5416
- const INTEGRATION_NAME$19 = "Redis";
5417
- const ORIGIN$15 = "auto.db.redis";
5433
+ const INTEGRATION_NAME$20 = "Redis";
5434
+ const ORIGIN$16 = "auto.db.redis";
5418
5435
  const DB_SYSTEM_VALUE_REDIS = "redis";
5419
5436
  function endSpan$1(span, err) {
5420
5437
  if (err) span.setStatus({
@@ -5436,7 +5453,7 @@ function nodeRedisAttributes(options) {
5436
5453
  [_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_VALUE_REDIS,
5437
5454
  [_sentry_conventions_attributes.SERVER_ADDRESS]: host,
5438
5455
  ...port != null ? { [_sentry_conventions_attributes.SERVER_PORT]: port } : {},
5439
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$15
5456
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$16
5440
5457
  };
5441
5458
  }
5442
5459
  function startCommandSpan(commandName, commandArgs, attributes, cacheOptions) {
@@ -5474,7 +5491,7 @@ function subscribeLegacyRedisCommand(cacheOptions) {
5474
5491
  const client = data.self;
5475
5492
  const attributes = {
5476
5493
  [_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_VALUE_REDIS,
5477
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$15
5494
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$16
5478
5495
  };
5479
5496
  if (client?.connection_options?.host != null) attributes[_sentry_conventions_attributes.SERVER_ADDRESS] = client.connection_options.host;
5480
5497
  if (client?.connection_options?.port != null) attributes[_sentry_conventions_attributes.SERVER_PORT] = client.connection_options.port;
@@ -5552,7 +5569,7 @@ function bindNodeRedisBatchChannel(channelName, getOperation) {
5552
5569
  }
5553
5570
  const _redisIntegration = ((options = {}) => {
5554
5571
  return {
5555
- name: INTEGRATION_NAME$19,
5572
+ name: INTEGRATION_NAME$20,
5556
5573
  setup(client) {
5557
5574
  invokeOrchestrionInstrumentation(client, require_config.redisModuleNames, instrumentLegacyRedis, [options], { requiresTracingChannelBinding: false });
5558
5575
  invokeOrchestrionInstrumentation(client, require_config.redisModuleNames, instrumentNodeRedis, [options]);
@@ -5779,7 +5796,7 @@ function wrapEachBatch(original) {
5779
5796
  return wrapped;
5780
5797
  }
5781
5798
  // src/integrations/kafkajs/index.ts
5782
- const INTEGRATION_NAME$18 = "Kafka";
5799
+ const INTEGRATION_NAME$19 = "Kafka";
5783
5800
  function subscribeToProducer() {
5784
5801
  tracingChannel(CHANNELS.KAFKAJS_SEND_BATCH).subscribe({
5785
5802
  start(ctx) {
@@ -5809,7 +5826,7 @@ function subscribeToConsumer() {
5809
5826
  }
5810
5827
  const _kafkaIntegration = (() => {
5811
5828
  return {
5812
- name: INTEGRATION_NAME$18,
5829
+ name: INTEGRATION_NAME$19,
5813
5830
  setup(client) {
5814
5831
  invokeOrchestrionInstrumentation(client, require_config.kafkajsModuleNames, instrumentKafkajs, [], { requiresTracingChannelBinding: false });
5815
5832
  }
@@ -5833,8 +5850,8 @@ function instrumentKafkajs() {
5833
5850
  */
5834
5851
  const kafkaIntegration = (0, _sentry_core.defineIntegration)(_kafkaIntegration);
5835
5852
  // src/integrations/knex.ts
5836
- const INTEGRATION_NAME$17 = "Knex";
5837
- const ORIGIN$14 = "auto.db.knex";
5853
+ const INTEGRATION_NAME$18 = "Knex";
5854
+ const ORIGIN$15 = "auto.db.knex";
5838
5855
  const MAX_QUERY_LENGTH = 1021;
5839
5856
  const ATTR_DB_SQL_TABLE$1 = "db.sql.table";
5840
5857
  const DB_SYSTEM_SQLITE = "sqlite";
@@ -5842,7 +5859,7 @@ const DB_SYSTEM_POSTGRESQL$2 = "postgresql";
5842
5859
  const parentSpanSymbol = Symbol("sentry.orchestrion.knex.parent-span");
5843
5860
  const _knexIntegration = (() => {
5844
5861
  return {
5845
- name: INTEGRATION_NAME$17,
5862
+ name: INTEGRATION_NAME$18,
5846
5863
  setupOnce() {
5847
5864
  if (!tracingChannel) return;
5848
5865
  require_debug_build.DEBUG_BUILD && _sentry_core.debug.log(`[instrumentation:knex] subscribing to channel "${CHANNELS.KNEX_QUERY}"`);
@@ -5888,7 +5905,7 @@ function subscribeQuery$1() {
5888
5905
  const attributes = {
5889
5906
  [_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
5890
5907
  [_sentry_conventions_attributes.SENTRY_KIND]: "client",
5891
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$14,
5908
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$15,
5892
5909
  ...require_exports.getSqlQueryAttributes(query?.sql ? (0, _sentry_core.truncate)(query.sql, MAX_QUERY_LENGTH) : void 0, dialect),
5893
5910
  "knex.version": data.moduleVersion,
5894
5911
  [_sentry_conventions_attributes.DB_SYSTEM_NAME]: dbSystem,
@@ -6087,7 +6104,7 @@ const groqIntegration = (0, _sentry_core.defineIntegration)(createOpenAiCompatib
6087
6104
  }
6088
6105
  }));
6089
6106
  // src/integrations/langchain.ts
6090
- const INTEGRATION_NAME$16 = require_exports.LANGCHAIN_INTEGRATION_NAME;
6107
+ const INTEGRATION_NAME$17 = require_exports.LANGCHAIN_INTEGRATION_NAME;
6091
6108
  const SKIPPED_PROVIDERS = [
6092
6109
  require_exports.OPENAI_INTEGRATION_NAME,
6093
6110
  require_exports.ANTHROPIC_AI_INTEGRATION_NAME,
@@ -6100,7 +6117,7 @@ function markProvidersSkipped() {
6100
6117
  }
6101
6118
  const _langChainIntegration = ((options = {}) => {
6102
6119
  return {
6103
- name: INTEGRATION_NAME$16,
6120
+ name: INTEGRATION_NAME$17,
6104
6121
  setup(client) {
6105
6122
  invokeOrchestrionInstrumentation(client, require_config.langchainModuleNames, instrumentChatModels, [options], { requiresTracingChannelBinding: false });
6106
6123
  invokeOrchestrionInstrumentation(client, require_config.langchainModuleNames, instrumentEmbeddings, [options]);
@@ -6135,12 +6152,18 @@ function instrumentChatModels(options) {
6135
6152
  });
6136
6153
  }
6137
6154
  function instrumentEmbeddings(options) {
6138
- for (const channelName of require_config.langchainEmbeddingsChannels) bindTracingChannelToSpan(tracingChannel(channelName), (data) => createEmbeddingsSpan(data, options));
6155
+ 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
6156
  }
6140
6157
  function createEmbeddingsSpan(data, options) {
6141
6158
  markProvidersSkipped();
6142
- const input = (data.arguments ?? [])[0];
6143
- return (0, _sentry_core.startInactiveSpan)(require_exports._INTERNAL_getLangChainEmbeddingsSpanOptions(data.self, input, options));
6159
+ const call = {
6160
+ operation: "embeddings",
6161
+ input: (data.arguments ?? [])[0]
6162
+ };
6163
+ const span = (0, _sentry_core.startInactiveSpan)(require_exports._INTERNAL_getLangChainEmbeddingsSpanOptions(data.self, call, options));
6164
+ require_exports.runGenAiSpanStart(options, span, call);
6165
+ data._sentryOnSpanEnd = (result) => require_exports.runGenAiSpanEnd(options, span, call, result);
6166
+ return span;
6144
6167
  }
6145
6168
  /**
6146
6169
  * Diagnostics-channel-based LangChain integration. Subscribes to the diagnostics_channels
@@ -6149,11 +6172,11 @@ function createEmbeddingsSpan(data, options) {
6149
6172
  */
6150
6173
  const langChainIntegration = (0, _sentry_core.defineIntegration)(_langChainIntegration);
6151
6174
  // src/integrations/langgraph.ts
6152
- const INTEGRATION_NAME$15 = require_exports.LANGGRAPH_INTEGRATION_NAME;
6175
+ const INTEGRATION_NAME$16 = require_exports.LANGGRAPH_INTEGRATION_NAME;
6153
6176
  let insideCreateReactAgent = false;
6154
6177
  const _langGraphIntegration = ((options = {}) => {
6155
6178
  return {
6156
- name: INTEGRATION_NAME$15,
6179
+ name: INTEGRATION_NAME$16,
6157
6180
  setup(client) {
6158
6181
  invokeOrchestrionInstrumentation(client, require_config.langgraphModuleNames, instrumentLanggraph, [options], { requiresTracingChannelBinding: false });
6159
6182
  }
@@ -6538,7 +6561,8 @@ function endRun(run, runs, status) {
6538
6561
  * function returns shows whether the run survived the commit.
6539
6562
  */
6540
6563
  function observeRunControl(runtime, run, runs) {
6541
- const commit = (change, context) => {
6564
+ const commit = runtime.commit.bind(runtime);
6565
+ runtime.commit = (change, context, ...rest) => {
6542
6566
  let ended = false;
6543
6567
  let settlement;
6544
6568
  const observedChange = async (tx, current) => {
@@ -6569,16 +6593,16 @@ function observeRunControl(runtime, run, runs) {
6569
6593
  run.pendingEnd = ended ? { status: toRunStatus(settlement) } : void 0;
6570
6594
  return result;
6571
6595
  };
6572
- return runtime.commit(observedChange, context).then(() => {
6596
+ return commit(observedChange, context, ...rest).then(() => {
6573
6597
  if (ended) endRun(run, runs, toRunStatus(settlement));
6574
6598
  }, (error) => {
6575
6599
  run.pendingEnd = void 0;
6576
6600
  throw error;
6577
6601
  });
6578
6602
  };
6579
- return new Proxy(runtime, { get(target, property) {
6580
- return property === "commit" ? commit : bound(target, property);
6581
- } });
6603
+ return () => {
6604
+ runtime.commit = commit;
6605
+ };
6582
6606
  }
6583
6607
  function toRunStatus(settlement) {
6584
6608
  if (settlement?.status !== "unanswered") return;
@@ -6602,35 +6626,38 @@ function markBuiltInTool(tool) {
6602
6626
  /**
6603
6627
  * Prepare the runtime of a `pi.tool` phase. The tool task resolves the called tool from its agent,
6604
6628
  * so the runtime hands out traced tools, and it collects the result entries the phase commits.
6605
- * `finish` ends the phase's tool spans with the result the model receives, which pi-durable builds
6606
- * after `execute()` returns: from `api.output()`, through `afterTool` hooks and output limits.
6629
+ * The returned function ends the phase's tool spans with the result the model receives, which
6630
+ * pi-durable builds after `execute()` returns: from `api.output()`, through `afterTool` hooks and
6631
+ * output limits.
6607
6632
  */
6608
- function instrumentToolPhase(runtime, runs, wrapTool) {
6633
+ function instrumentToolPhase(runtime, runs, wrapTool, isNested) {
6609
6634
  const results = /* @__PURE__ */ new Map();
6610
6635
  runs.toolCalls.set(runtime.taskId, []);
6611
- const agent = (context) => runtime.agent(context).then((resolved) => resolved?.tools ? {
6636
+ const agent = runtime.agent.bind(runtime);
6637
+ const commit = runtime.commit.bind(runtime);
6638
+ runtime.agent = (context) => agent(context).then((resolved) => resolved?.tools ? {
6612
6639
  ...resolved,
6613
- tools: resolved.tools.map(wrapTool)
6640
+ tools: resolved.tools.map(wrapTool),
6641
+ ...resolved.callable ? { callable: resolved.callable.map(wrapTool) } : {}
6614
6642
  } : resolved);
6615
- const commit = (change, context) => {
6643
+ runtime.commit = (change, context, ...rest) => {
6616
6644
  let committed = [];
6617
6645
  const observedChange = (tx, current) => {
6618
6646
  committed = [];
6619
6647
  return change(observeToolResultEntries(tx, committed), current);
6620
6648
  };
6621
- return runtime.commit(observedChange, context).then(() => {
6649
+ return commit(observedChange, context, ...rest).then(() => {
6622
6650
  for (const message of committed) results.set(message.toolCallId, message);
6623
6651
  });
6624
6652
  };
6625
- return {
6626
- runtime: new Proxy(runtime, { get(target, property) {
6627
- if (property === "agent") return agent;
6628
- return property === "commit" ? commit : bound(target, property);
6629
- } }),
6630
- finish: () => {
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);
6653
+ return () => {
6654
+ runtime.agent = agent;
6655
+ runtime.commit = commit;
6656
+ for (const call of runs.toolCalls.get(runtime.taskId) ?? []) {
6657
+ const committed = call.callId !== void 0 ? results.get(call.callId) : void 0;
6658
+ finishToolCall(call, isNested ? call.returned : committed);
6633
6659
  }
6660
+ runs.toolCalls.delete(runtime.taskId);
6634
6661
  };
6635
6662
  }
6636
6663
  /** Wrap a tool so each call gets a `gen_ai.execute_tool` span. */
@@ -6670,10 +6697,11 @@ function instrumentTool(tool, runs, options) {
6670
6697
  const result = await tool.execute(args, trackOwnedConversations(api, span, runs), context);
6671
6698
  call.endTimestamp = (0, _sentry_core.timestampInSeconds)();
6672
6699
  call.onSpanEnd = () => require_exports.runGenAiSpanEnd(options, span, toolCall, { response: result });
6673
- if (!calls) finishToolCall(call, {
6700
+ call.returned = {
6674
6701
  content: result?.output ?? result?.content,
6675
6702
  isError: result?.isError
6676
- });
6703
+ };
6704
+ if (!calls) finishToolCall(call, call.returned);
6677
6705
  return result;
6678
6706
  } catch (error) {
6679
6707
  call.endTimestamp = (0, _sentry_core.timestampInSeconds)();
@@ -6842,7 +6870,7 @@ function instrumentRegistry(registry, options, runs) {
6842
6870
  let wrapped = tasks.get(task);
6843
6871
  if (!wrapped) {
6844
6872
  const { definition } = task;
6845
- const wrapPhase = (phase, receiver, isAbort = false) => (taskRecord, runtime, context) => runPhase(definition.name, (observed) => phase.call(receiver, taskRecord, observed, context), runtime, context, runs, wrapTool, isAbort, options);
6873
+ 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
6874
  const phases = {};
6847
6875
  for (const [name, phase] of Object.entries(definition.phases)) phases[name] = typeof phase === "function" ? wrapPhase(phase, definition.phases) : phase;
6848
6876
  wrapped = {
@@ -6874,18 +6902,15 @@ function instrumentRegistry(registry, options, runs) {
6874
6902
  return bound(target, property);
6875
6903
  } });
6876
6904
  }
6877
- function runPhase(kind, phase, runtime, context, runs, wrapTool, isAbort, options) {
6905
+ function runPhase(kind, task, phase, runtime, context, runs, wrapTool, isAbort, options) {
6878
6906
  const { conversationId } = runtime;
6879
6907
  const isRunWork = kind === PI_TASK.GENERATION || kind === PI_TASK.TOOL;
6880
6908
  const run = isRunWork || kind === PI_TASK.COMPACTION ? runs.active.get(conversationId) ?? (isRunWork && !isAbort ? startRun(conversationId, runs) : void 0) : void 0;
6881
- let observed = runtime;
6882
- let finishToolPhase;
6883
- if (run && kind === PI_TASK.GENERATION) observed = observeRunControl(runtime, run, runs);
6884
- else if (kind === PI_TASK.TOOL) {
6885
- const toolPhase = instrumentToolPhase(runtime, runs, wrapTool);
6886
- observed = toolPhase.runtime;
6887
- finishToolPhase = toolPhase.finish;
6888
- }
6909
+ const input = kind === PI_TASK.TOOL ? task?.input : void 0;
6910
+ const callerSpan = input?.kind === "nested" ? runs.toolCalls.get(input.parent)?.find((call) => call.callId === input.parentCallId)?.span : void 0;
6911
+ let finishPhase;
6912
+ if (run && kind === PI_TASK.GENERATION) finishPhase = observeRunControl(runtime, run, runs);
6913
+ else if (kind === PI_TASK.TOOL) finishPhase = instrumentToolPhase(runtime, runs, wrapTool, input?.kind === "nested");
6889
6914
  const runInScope = async (scope) => {
6890
6915
  let sessionId = run?.sessionId;
6891
6916
  if (!sessionId) {
@@ -6902,7 +6927,7 @@ function runPhase(kind, phase, runtime, context, runs, wrapTool, isAbort, option
6902
6927
  context
6903
6928
  });
6904
6929
  try {
6905
- return await phase(observed);
6930
+ return await phase();
6906
6931
  } catch (error) {
6907
6932
  if (!runtime.signal?.aborted) {
6908
6933
  (0, _sentry_core.captureException)(error, { mechanism: {
@@ -6916,11 +6941,11 @@ function runPhase(kind, phase, runtime, context, runs, wrapTool, isAbort, option
6916
6941
  }
6917
6942
  throw error;
6918
6943
  } finally {
6919
- finishToolPhase?.();
6944
+ finishPhase?.();
6920
6945
  }
6921
6946
  };
6922
6947
  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));
6948
+ return require_exports.withCleanScopes(run.isolationScope, () => (0, _sentry_core.withActiveSpan)(callerSpan ?? run.span, runInScope));
6924
6949
  }
6925
6950
  // src/integrations/pi-durable.ts
6926
6951
  const _piDurableIntegration = ((options = {}) => {
@@ -7232,10 +7257,10 @@ function createObservabilityBootstrap(exporter) {
7232
7257
  */
7233
7258
  const mastraIntegration = (0, _sentry_core.defineIntegration)(_mastraIntegration);
7234
7259
  // src/integrations/mcp-server.ts
7235
- const INTEGRATION_NAME$14 = "McpServer";
7260
+ const INTEGRATION_NAME$15 = "McpServer";
7236
7261
  const _mcpServerIntegration = (() => {
7237
7262
  return {
7238
- name: INTEGRATION_NAME$14,
7263
+ name: INTEGRATION_NAME$15,
7239
7264
  setup(client) {
7240
7265
  invokeOrchestrionInstrumentation(client, require_config.mcpServerModuleNames, subscribe$1, [], { requiresTracingChannelBinding: false });
7241
7266
  }
@@ -7311,10 +7336,10 @@ function makeServeTunnelIntegration(instrumentRuntimeServers) {
7311
7336
  });
7312
7337
  }
7313
7338
  // src/integrations/lru-memoizer.ts
7314
- const INTEGRATION_NAME$13 = "LruMemoizer";
7339
+ const INTEGRATION_NAME$14 = "LruMemoizer";
7315
7340
  const _lruMemoizerIntegration = (() => {
7316
7341
  return {
7317
- name: INTEGRATION_NAME$13,
7342
+ name: INTEGRATION_NAME$14,
7318
7343
  setup(client) {
7319
7344
  invokeOrchestrionInstrumentation(client, require_config.lruMemoizerModuleNames, instrumentLruMemoizer, []);
7320
7345
  }
@@ -7457,8 +7482,8 @@ function startMongoSpan(attributes) {
7457
7482
  });
7458
7483
  }
7459
7484
  // src/integrations/mongodb/index.ts
7460
- const INTEGRATION_NAME$12 = "Mongo";
7461
- const ORIGIN$13 = "auto.db.mongo";
7485
+ const INTEGRATION_NAME$13 = "Mongo";
7486
+ const ORIGIN$14 = "auto.db.mongo";
7462
7487
  const V3_DEDICATED_COMMANDS = /* @__PURE__ */ new Set([
7463
7488
  "insert",
7464
7489
  "update",
@@ -7469,7 +7494,7 @@ const V3_DEDICATED_COMMANDS = /* @__PURE__ */ new Set([
7469
7494
  ]);
7470
7495
  const _mongoIntegration = (() => {
7471
7496
  return {
7472
- name: INTEGRATION_NAME$12,
7497
+ name: INTEGRATION_NAME$13,
7473
7498
  setup(client) {
7474
7499
  invokeOrchestrionInstrumentation(client, require_config.mongodbModuleNames, instrumentMongodb, []);
7475
7500
  }
@@ -7492,7 +7517,7 @@ function subscribeV4Command() {
7492
7517
  const cmd = args[1];
7493
7518
  if (!ns || !cmd || typeof cmd !== "object" || cmd.ismaster || cmd.hello) return;
7494
7519
  const operation = Object.keys(cmd)[0];
7495
- return startMongoSpan(getV4SpanAttributes(data.self, ns, cmd, operation, ORIGIN$13));
7520
+ return startMongoSpan(getV4SpanAttributes(data.self, ns, cmd, operation, ORIGIN$14));
7496
7521
  });
7497
7522
  }
7498
7523
  /**
@@ -7551,7 +7576,7 @@ function bindV3(channelName, extract) {
7551
7576
  if (!args) return;
7552
7577
  const info = extract(args);
7553
7578
  if (!info || typeof info.ns !== "string") return;
7554
- return startMongoSpan(getV3SpanAttributes(info.ns, info.topology, info.command, info.operation, ORIGIN$13));
7579
+ return startMongoSpan(getV3SpanAttributes(info.ns, info.topology, info.command, info.operation, ORIGIN$14));
7555
7580
  });
7556
7581
  }
7557
7582
  /**
@@ -7570,7 +7595,7 @@ const MONGOOSE_DC_CHANNEL_MODEL_SAVE = "mongoose:model:save";
7570
7595
  const MONGOOSE_DC_CHANNEL_MODEL_INSERT_MANY = "mongoose:model:insertMany";
7571
7596
  const MONGOOSE_DC_CHANNEL_MODEL_BULK_WRITE = "mongoose:model:bulkWrite";
7572
7597
  const MONGOOSE_DC_CHANNEL_CURSOR_NEXT = "mongoose:cursor:next";
7573
- const ORIGIN$12 = "auto.db.mongoose.native_channel";
7598
+ const ORIGIN$13 = "auto.db.mongoose.native_channel";
7574
7599
  const DB_SYSTEM_NAME_VALUE_MONGODB$1 = "mongodb";
7575
7600
  const MAX_REDACTION_DEPTH = 10;
7576
7601
  let subscribed$1 = false;
@@ -7610,7 +7635,7 @@ function setupChannel(tracingChannel, channelName) {
7610
7635
  return (0, _sentry_core.startInactiveSpan)({
7611
7636
  name,
7612
7637
  attributes: {
7613
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$12,
7638
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$13,
7614
7639
  [_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
7615
7640
  [_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MONGODB$1,
7616
7641
  [_sentry_conventions_attributes.DB_OPERATION_NAME]: data.operation,
@@ -7698,13 +7723,13 @@ function startMongooseLegacySpan({ collection, modelName, operation, origin, par
7698
7723
  });
7699
7724
  }
7700
7725
  // src/integrations/mongoose/index.ts
7701
- const INTEGRATION_NAME$11 = "Mongoose";
7702
- const ORIGIN$11 = "auto.db.mongoose";
7726
+ const INTEGRATION_NAME$12 = "Mongoose";
7727
+ const ORIGIN$12 = "auto.db.mongoose";
7703
7728
  const STORED_PARENT_SPAN = /* @__PURE__ */ new WeakMap();
7704
7729
  let orchestrionSubscribed = false;
7705
7730
  const _mongooseIntegration = (() => {
7706
7731
  return {
7707
- name: INTEGRATION_NAME$11,
7732
+ name: INTEGRATION_NAME$12,
7708
7733
  setupOnce() {
7709
7734
  if (!tracingChannel) return;
7710
7735
  (0, _sentry_core.waitForTracingChannelBinding)(() => {
@@ -7756,7 +7781,7 @@ function startSpan(collection, modelName, operation, parentSpan) {
7756
7781
  collection,
7757
7782
  modelName,
7758
7783
  operation,
7759
- origin: ORIGIN$11,
7784
+ origin: ORIGIN$12,
7760
7785
  parentSpan
7761
7786
  });
7762
7787
  }
@@ -7787,7 +7812,7 @@ function stashParentSpan(self) {
7787
7812
  */
7788
7813
  const mongooseIntegration = (0, _sentry_core.defineIntegration)(_mongooseIntegration);
7789
7814
  // src/integrations/mistral.ts
7790
- const INTEGRATION_NAME$10 = require_exports.MISTRAL_INTEGRATION_NAME;
7815
+ const INTEGRATION_NAME$11 = require_exports.MISTRAL_INTEGRATION_NAME;
7791
7816
  const INSTRUMENTED_CHANNELS$1 = [
7792
7817
  {
7793
7818
  channel: CHANNELS.MISTRAL_CHAT,
@@ -7817,7 +7842,7 @@ const INSTRUMENTED_CHANNELS$1 = [
7817
7842
  ];
7818
7843
  const _mistralAIIntegration = ((options = {}) => {
7819
7844
  return {
7820
- name: INTEGRATION_NAME$10,
7845
+ name: INTEGRATION_NAME$11,
7821
7846
  setup(client) {
7822
7847
  invokeOrchestrionInstrumentation(client, require_config.mistralModuleNames, instrumentMistral, [options]);
7823
7848
  }
@@ -7838,7 +7863,7 @@ function instrumentMistral(options) {
7838
7863
  * Returning `undefined` opts the payload out so no span is opened.
7839
7864
  */
7840
7865
  function createGenAiSpan$1(data, operation, streaming, options) {
7841
- if (require_exports.shouldSkipAiProviderSpan(INTEGRATION_NAME$10)) return;
7866
+ if (require_exports.shouldSkipAiProviderSpan(INTEGRATION_NAME$11)) return;
7842
7867
  const args = data.arguments ?? [];
7843
7868
  const params = args[0];
7844
7869
  const call = {
@@ -7919,11 +7944,11 @@ function instrumentTypeSafe(options) {
7919
7944
  */
7920
7945
  const typesafeIntegration = (0, _sentry_core.defineIntegration)(_typesafeIntegration);
7921
7946
  // src/integrations/mysql.ts
7922
- const INTEGRATION_NAME$9 = "Mysql";
7947
+ const INTEGRATION_NAME$10 = "Mysql";
7923
7948
  const DB_SYSTEM_NAME_VALUE_MYSQL$1 = "mysql";
7924
7949
  const _mysqlIntegration = (() => {
7925
7950
  return {
7926
- name: INTEGRATION_NAME$9,
7951
+ name: INTEGRATION_NAME$10,
7927
7952
  setup(client) {
7928
7953
  invokeOrchestrionInstrumentation(client, require_config.mysqlModuleNames, instrumentMysql, []);
7929
7954
  }
@@ -8001,7 +8026,7 @@ const MYSQL2_DC_CHANNEL_QUERY = "mysql2:query";
8001
8026
  const MYSQL2_DC_CHANNEL_EXECUTE = "mysql2:execute";
8002
8027
  const MYSQL2_DC_CHANNEL_CONNECT = "mysql2:connect";
8003
8028
  const MYSQL2_DC_CHANNEL_POOL_CONNECT = "mysql2:pool:connect";
8004
- const ORIGIN$10 = "auto.db.mysql2.native_channel";
8029
+ const ORIGIN$11 = "auto.db.mysql2.native_channel";
8005
8030
  const DB_SYSTEM_NAME_VALUE_MYSQL = "mysql";
8006
8031
  /**
8007
8032
  * Subscribe Sentry span handlers to mysql2's diagnostics-channel events
@@ -8021,7 +8046,7 @@ function subscribeMysql2DiagnosticChannels(tracingChannel) {
8021
8046
  function setupQueryChannel(tracingChannel, channelName) {
8022
8047
  bindTracingChannelToSpan(tracingChannel(channelName), (data) => {
8023
8048
  const attributes = {
8024
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$10,
8049
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$11,
8025
8050
  [_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
8026
8051
  [_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MYSQL,
8027
8052
  ...require_exports.getSqlQueryAttributes(data.query, "mysql"),
@@ -8042,7 +8067,7 @@ function setupConnectChannel(tracingChannel, channelName, spanName) {
8042
8067
  name: spanName,
8043
8068
  onlyIfParent: true,
8044
8069
  attributes: {
8045
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$10,
8070
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$11,
8046
8071
  [_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
8047
8072
  [_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MYSQL,
8048
8073
  [_sentry_conventions_attributes.DB_NAMESPACE]: data.database || void 0,
@@ -8053,8 +8078,8 @@ function setupConnectChannel(tracingChannel, channelName, spanName) {
8053
8078
  });
8054
8079
  }
8055
8080
  // src/integrations/mysql2/index.ts
8056
- const INTEGRATION_NAME$8 = "Mysql2";
8057
- const ORIGIN$9 = "auto.db.mysql2";
8081
+ const INTEGRATION_NAME$9 = "Mysql2";
8082
+ const ORIGIN$10 = "auto.db.mysql2";
8058
8083
  const DB_SYSTEM_VALUE_MYSQL = "mysql";
8059
8084
  /**
8060
8085
  * Diagnostics-channel-based mysql2 integration.
@@ -8077,11 +8102,11 @@ function subscribeQueryChannel(channelName) {
8077
8102
  const statement = getQueryText$1(data.arguments);
8078
8103
  const attributes = {
8079
8104
  [_sentry_conventions_attributes.SENTRY_KIND]: "client",
8080
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$9,
8105
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$10,
8081
8106
  [_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
8082
8107
  [_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_VALUE_MYSQL,
8083
8108
  ...require_exports.getSqlQueryAttributes(statement, "mysql"),
8084
- ...getConnectionAttributes$1(data.self?.config)
8109
+ ...getConnectionAttributes$2(data.self?.config)
8085
8110
  };
8086
8111
  return (0, _sentry_core.startInactiveSpan)({
8087
8112
  name: require_exports.getSqlSpanName(attributes, "mysql2.query"),
@@ -8103,7 +8128,7 @@ function extractSql$1(firstArg) {
8103
8128
  return typeof sql === "string" ? sql : void 0;
8104
8129
  }
8105
8130
  }
8106
- function getConnectionAttributes$1(config) {
8131
+ function getConnectionAttributes$2(config) {
8107
8132
  const { host, port, database, user } = config?.connectionConfig ?? config ?? {};
8108
8133
  const portNumber = typeof port === "string" ? parseInt(port, 10) : port;
8109
8134
  const portIsNumber = typeof portNumber === "number" && !isNaN(portNumber);
@@ -8116,7 +8141,7 @@ function getConnectionAttributes$1(config) {
8116
8141
  }
8117
8142
  const _mysql2Integration = (() => {
8118
8143
  return {
8119
- name: INTEGRATION_NAME$8,
8144
+ name: INTEGRATION_NAME$9,
8120
8145
  setupOnce() {
8121
8146
  if (!tracingChannel) return;
8122
8147
  (0, _sentry_core.waitForTracingChannelBinding)(() => {
@@ -8352,8 +8377,8 @@ const WINSTON_LEVEL_TO_LOG_SEVERITY_LEVEL_MAP = {
8352
8377
  crit: "fatal"
8353
8378
  };
8354
8379
  // src/integrations/openai.ts
8355
- const INTEGRATION_NAME$7 = "OpenAI";
8356
- const ORIGIN$8 = "auto.ai.openai";
8380
+ const INTEGRATION_NAME$8 = "OpenAI";
8381
+ const ORIGIN$9 = "auto.ai.openai";
8357
8382
  const INSTRUMENTED_CHANNELS = [
8358
8383
  {
8359
8384
  channel: CHANNELS.OPENAI_CHAT,
@@ -8370,7 +8395,7 @@ const INSTRUMENTED_CHANNELS = [
8370
8395
  ];
8371
8396
  const _openAIIntegration = ((options = {}) => {
8372
8397
  return {
8373
- name: INTEGRATION_NAME$7,
8398
+ name: INTEGRATION_NAME$8,
8374
8399
  setup(client) {
8375
8400
  invokeOrchestrionInstrumentation(client, require_config.openaiModuleNames, instrumentOpenai, [options]);
8376
8401
  }
@@ -8394,7 +8419,7 @@ function instrumentOpenai(options) {
8394
8419
  * Returning `undefined` opts the payload out so no span is opened.
8395
8420
  */
8396
8421
  function createGenAiSpan(data, operation, options) {
8397
- if (require_exports.shouldSkipAiProviderSpan(INTEGRATION_NAME$7)) return;
8422
+ if (require_exports.shouldSkipAiProviderSpan(INTEGRATION_NAME$8)) return;
8398
8423
  const args = data.arguments ?? [];
8399
8424
  const params = args[0];
8400
8425
  const call = {
@@ -8404,7 +8429,7 @@ function createGenAiSpan(data, operation, options) {
8404
8429
  const { recordInputs, recordOutputs } = require_exports.resolveGenAiCallRecording(options, call);
8405
8430
  data._sentryRecordOutputs = recordOutputs;
8406
8431
  const attributes = require_exports.extractRequestAttributes$3(args, operation, recordInputs);
8407
- attributes[_sentry_conventions_attributes.SENTRY_ORIGIN] = ORIGIN$8;
8432
+ attributes[_sentry_conventions_attributes.SENTRY_ORIGIN] = ORIGIN$9;
8408
8433
  const model = params?.model || "unknown";
8409
8434
  const client = (0, _sentry_core.getClient)();
8410
8435
  const span = (0, _sentry_core.startInactiveSpan)({
@@ -8444,8 +8469,8 @@ function wrapStreamResult(span, data) {
8444
8469
  */
8445
8470
  const openAIIntegration = (0, _sentry_core.defineIntegration)(_openAIIntegration);
8446
8471
  // src/integrations/pg.ts
8447
- const INTEGRATION_NAME$6 = "Postgres";
8448
- const ORIGIN$7 = "auto.db.postgres";
8472
+ const INTEGRATION_NAME$7 = "Postgres";
8473
+ const ORIGIN$8 = "auto.db.postgres";
8449
8474
  const ATTR_PG_PLAN = "db.postgresql.plan";
8450
8475
  const ATTR_PG_IDLE_TIMEOUT = "db.postgresql.idle.timeout.millis";
8451
8476
  const ATTR_PG_MAX_CLIENT = "db.postgresql.max.client";
@@ -8455,7 +8480,7 @@ const SPAN_CONNECT = "pg.connect";
8455
8480
  const SPAN_POOL_CONNECT = "pg-pool.connect";
8456
8481
  const _postgresIntegration = ((options = {}) => {
8457
8482
  return {
8458
- name: INTEGRATION_NAME$6,
8483
+ name: INTEGRATION_NAME$7,
8459
8484
  setup(client) {
8460
8485
  invokeOrchestrionInstrumentation(client, require_config.pgModuleNames, instrumentPostgres, [options]);
8461
8486
  }
@@ -8463,7 +8488,7 @@ const _postgresIntegration = ((options = {}) => {
8463
8488
  });
8464
8489
  function instrumentPostgres(options) {
8465
8490
  bindPgQueryChannel(CHANNELS.PG_QUERY, {
8466
- origin: ORIGIN$7,
8491
+ origin: ORIGIN$8,
8467
8492
  connectionString: true
8468
8493
  });
8469
8494
  if (!options.ignoreConnectSpans) {
@@ -8512,7 +8537,7 @@ function querySpanOptions(ctx, { origin, connectionString }) {
8512
8537
  const queryConfig = extractQueryConfig(ctx.arguments);
8513
8538
  const attributes = {
8514
8539
  [_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
8515
- ...connectionString ? getPgConnectionAttributes(params) : getConnectionAttributes(params),
8540
+ ...connectionString ? getPgConnectionAttributes(params) : getConnectionAttributes$1(params),
8516
8541
  [_sentry_conventions_attributes.SENTRY_ORIGIN]: origin,
8517
8542
  ...require_exports.getSqlQueryAttributes(queryConfig?.text),
8518
8543
  [ATTR_PG_PLAN]: typeof queryConfig?.name === "string" ? queryConfig.name : void 0
@@ -8557,7 +8582,7 @@ function extractQueryConfig(args) {
8557
8582
  }
8558
8583
  }
8559
8584
  /** The `db.*`/`server.*` attributes for a pg-style set of connection parameters. */
8560
- function getConnectionAttributes(params) {
8585
+ function getConnectionAttributes$1(params) {
8561
8586
  return {
8562
8587
  [_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_POSTGRESQL$1,
8563
8588
  [_sentry_conventions_attributes.DB_NAMESPACE]: params.database,
@@ -8568,7 +8593,7 @@ function getConnectionAttributes(params) {
8568
8593
  }
8569
8594
  function getPgConnectionAttributes(params) {
8570
8595
  return {
8571
- ...getConnectionAttributes(params),
8596
+ ...getConnectionAttributes$1(params),
8572
8597
  [_sentry_conventions_attributes.DB_CONNECTION_STRING]: getConnectionString(params)
8573
8598
  };
8574
8599
  }
@@ -8620,7 +8645,7 @@ const postgresIntegration = (0, _sentry_core.defineIntegration)(_postgresIntegra
8620
8645
  * Tracing channel published by `postgres` >= 4.0.0 for every query (see postgres `src/diagnostics.js`).
8621
8646
  */
8622
8647
  const POSTGRESJS_DC_CHANNEL_QUERY = "postgres:query";
8623
- const ORIGIN$6 = "auto.db.postgresjs";
8648
+ const ORIGIN$7 = "auto.db.postgresjs";
8624
8649
  const DB_SYSTEM_NAME_POSTGRES$1 = "postgres";
8625
8650
  /**
8626
8651
  * Subscribe Sentry span handlers to the `postgres:query` tracing channel published natively by
@@ -8637,7 +8662,7 @@ function subscribePostgresJsDiagnosticChannels(tracingChannel, options = {}) {
8637
8662
  const attributes = {
8638
8663
  [_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
8639
8664
  [_sentry_conventions_attributes.SENTRY_KIND]: "client",
8640
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$6,
8665
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$7,
8641
8666
  [_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_NAME_POSTGRES$1,
8642
8667
  ...queryAttributes,
8643
8668
  ...require_exports._getConnectionAttributes(connectionContext)
@@ -8690,8 +8715,8 @@ function callRequestHook(requestHook, span, sanitizedSqlQuery, connectionContext
8690
8715
  }
8691
8716
  }
8692
8717
  // src/integrations/postgresjs/index.ts
8693
- const INTEGRATION_NAME$5 = "PostgresJs";
8694
- const ORIGIN$5 = "auto.db.postgresjs";
8718
+ const INTEGRATION_NAME$6 = "PostgresJs";
8719
+ const ORIGIN$6 = "auto.db.postgresjs";
8695
8720
  const DB_SYSTEM_NAME_POSTGRES = "postgres";
8696
8721
  const NOOP$3 = () => {};
8697
8722
  const QUERY_FROM_INSTRUMENTED_SQL = Symbol.for("sentry.query.from.instrumented.sql");
@@ -8735,7 +8760,7 @@ function attachConnectionAttributesFromChannel(message) {
8735
8760
  }
8736
8761
  const _postgresJsIntegration = ((options = {}) => {
8737
8762
  return {
8738
- name: INTEGRATION_NAME$5,
8763
+ name: INTEGRATION_NAME$6,
8739
8764
  setupOnce() {
8740
8765
  if (!tracingChannel) return;
8741
8766
  (0, _sentry_core.waitForTracingChannelBinding)(() => {
@@ -8779,7 +8804,7 @@ function instrumentPostgresJs(options) {
8779
8804
  const attributes = {
8780
8805
  [_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
8781
8806
  [_sentry_conventions_attributes.SENTRY_KIND]: "client",
8782
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$5,
8807
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$6,
8783
8808
  [_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_NAME_POSTGRES,
8784
8809
  ...queryAttributes,
8785
8810
  ...context && require_exports._getConnectionAttributes(context)
@@ -8818,22 +8843,22 @@ function instrumentPostgresJs(options) {
8818
8843
  */
8819
8844
  const postgresJsIntegration = (0, _sentry_core.defineIntegration)(_postgresJsIntegration);
8820
8845
  // src/integrations/neon.ts
8821
- const INTEGRATION_NAME$4 = "Neon";
8822
- const ORIGIN$4 = "auto.db.neon";
8846
+ const INTEGRATION_NAME$5 = "Neon";
8847
+ const ORIGIN$5 = "auto.db.neon";
8823
8848
  const DB_SYSTEM_POSTGRESQL = "postgresql";
8824
8849
  const DEFAULT_PORT = 5432;
8825
8850
  const NOOP$2 = () => {};
8826
8851
  const httpQuerySpans = /* @__PURE__ */ new WeakSet();
8827
8852
  const _neonIntegration = (() => {
8828
8853
  return {
8829
- name: INTEGRATION_NAME$4,
8854
+ name: INTEGRATION_NAME$5,
8830
8855
  setup(client) {
8831
8856
  invokeOrchestrionInstrumentation(client, require_config.neonModuleNames, instrumentNeon, []);
8832
8857
  }
8833
8858
  };
8834
8859
  });
8835
8860
  function instrumentNeon() {
8836
- bindPgQueryChannel(CHANNELS.NEON_QUERY, { origin: ORIGIN$4 });
8861
+ bindPgQueryChannel(CHANNELS.NEON_QUERY, { origin: ORIGIN$5 });
8837
8862
  bindTracingChannelToSpan(tracingChannel(CHANNELS.NEON_HTTP_QUERY), (data) => {
8838
8863
  const span = (0, _sentry_core.startInactiveSpan)(httpQuerySpanOptions(data.arguments));
8839
8864
  httpQuerySpans.add(span);
@@ -8848,7 +8873,7 @@ function instrumentNeon() {
8848
8873
  const span = (0, _sentry_core.getActiveSpan)();
8849
8874
  const url = data.result?.resolvedURL;
8850
8875
  if (!span || !httpQuerySpans.has(span) || !url) return;
8851
- span.setAttributes(getConnectionAttributes({
8876
+ span.setAttributes(getConnectionAttributes$1({
8852
8877
  host: url.hostname,
8853
8878
  port: Number(url.port) || DEFAULT_PORT,
8854
8879
  database: url.pathname.slice(1),
@@ -8866,7 +8891,7 @@ function httpQuerySpanOptions(args) {
8866
8891
  const operationName = batchSize === void 0 ? statements[0]?.[_sentry_conventions_attributes.DB_OPERATION_NAME] : getBatchOperationName(statements);
8867
8892
  const attributes = {
8868
8893
  [_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
8869
- [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$4,
8894
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$5,
8870
8895
  [_sentry_conventions_attributes.SENTRY_KIND]: "client",
8871
8896
  [_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_POSTGRESQL,
8872
8897
  [_sentry_conventions_attributes.DB_QUERY_TEXT]: queryText || void 0,
@@ -8907,6 +8932,108 @@ function getQueryText(data) {
8907
8932
  * hook or bundler plugin to be active.
8908
8933
  */
8909
8934
  const neonIntegration = (0, _sentry_core.defineIntegration)(_neonIntegration);
8935
+ // src/integrations/clickhouse-sql.ts
8936
+ const NUMBER_RE = /-?(?:0x[\dA-F_]+|0b[01_]+|(?:\d[\d_]*(?:\.[\d_]*)?|\.\d[\d_]*)(?:e[+-]?[\d_]+)?)(?![\w$])/iy;
8937
+ const FORMAT_RE = /FORMAT(?!\s*[=<>!])(?:\s|\/\*|--|#)/iy;
8938
+ const FORMAT_IDENTIFIER_RE = /(?:\b(?:INTO|TABLE|FROM|JOIN|ON|SELECT|PREWHERE|WHERE|HAVING|QUALIFY|AND|OR|NOT|BY|AS)|[,.=<>(])\s*$/i;
8939
+ /**
8940
+ * ClickHouse SQL: `"` quotes an identifier as in `standard`, but `\` escapes the next character, `#`
8941
+ * starts a line comment, block comments nest, and `$$…$$` heredocs open a literal. Numbers can have
8942
+ * `_` separators.
8943
+ */
8944
+ const CLICKHOUSE_SQL_RULES = {
8945
+ hashComments: true,
8946
+ nestedComments: true,
8947
+ backslashEscapes: true,
8948
+ dollarQuote: /\$\w*\$/y,
8949
+ matchLiteral(sql, start) {
8950
+ if (require_exports.isIdentifierChar(sql[start - 1]) || sql[start - 1] === "?") return 0;
8951
+ NUMBER_RE.lastIndex = start;
8952
+ return NUMBER_RE.exec(sql)?.[0].length ?? 0;
8953
+ },
8954
+ isInlineData(sql, start, out) {
8955
+ if (require_exports.isIdentifierChar(sql[start - 1])) return false;
8956
+ FORMAT_RE.lastIndex = start;
8957
+ if (!FORMAT_RE.test(sql)) return false;
8958
+ const before = out.join("");
8959
+ return /^[\s;]*INSERT\b/i.test(before) && !FORMAT_IDENTIFIER_RE.test(before);
8960
+ }
8961
+ };
8962
+ // src/integrations/clickhouse.ts
8963
+ const INTEGRATION_NAME$4 = "ClickHouse";
8964
+ const ORIGIN$4 = "auto.db.clickhouse";
8965
+ const DB_SYSTEM_CLICKHOUSE = "clickhouse";
8966
+ const _clickhouseIntegration = (() => {
8967
+ return {
8968
+ name: INTEGRATION_NAME$4,
8969
+ setup(client) {
8970
+ invokeOrchestrionInstrumentation(client, require_config.clickhouseModuleNames, instrumentClickhouse, []);
8971
+ }
8972
+ };
8973
+ });
8974
+ function instrumentClickhouse() {
8975
+ const channels = [
8976
+ [CHANNELS.CLICKHOUSE_QUERY, "query"],
8977
+ [CHANNELS.CLICKHOUSE_COMMAND, "command"],
8978
+ [CHANNELS.CLICKHOUSE_EXEC, "exec"],
8979
+ [CHANNELS.CLICKHOUSE_INSERT, "insert"],
8980
+ [CHANNELS.CLICKHOUSE_WEB_QUERY, "query"],
8981
+ [CHANNELS.CLICKHOUSE_WEB_COMMAND, "command"],
8982
+ [CHANNELS.CLICKHOUSE_WEB_EXEC, "exec"],
8983
+ [CHANNELS.CLICKHOUSE_WEB_INSERT, "insert"],
8984
+ [CHANNELS.CLICKHOUSE_COMMON_QUERY, "query"],
8985
+ [CHANNELS.CLICKHOUSE_COMMON_COMMAND, "command"],
8986
+ [CHANNELS.CLICKHOUSE_COMMON_EXEC, "exec"],
8987
+ [CHANNELS.CLICKHOUSE_COMMON_INSERT, "insert"]
8988
+ ];
8989
+ for (const [channelName, method] of channels) bindTracingChannelToSpan(tracingChannel(channelName), (data) => {
8990
+ const params = data.arguments[0];
8991
+ if (method === "insert" && Array.isArray(params?.values) && params.values.length === 0) return;
8992
+ const attributes = {
8993
+ [_sentry_conventions_attributes.SENTRY_OP]: _sentry_conventions_op.DB,
8994
+ [_sentry_conventions_attributes.SENTRY_KIND]: "client",
8995
+ [_sentry_conventions_attributes.SENTRY_ORIGIN]: ORIGIN$4,
8996
+ ...getConnectionAttributes(data.self?.connectionParams, params),
8997
+ ...method === "insert" ? getInsertAttributes(params) : require_exports.getSqlQueryAttributes(typeof params?.query === "string" ? params.query : void 0, CLICKHOUSE_SQL_RULES)
8998
+ };
8999
+ return (0, _sentry_core.startInactiveSpan)({
9000
+ name: require_exports.getLowCardinalitySqlSpanName(attributes, DB_SYSTEM_CLICKHOUSE),
9001
+ attributes,
9002
+ onlyIfParent: true
9003
+ });
9004
+ });
9005
+ }
9006
+ function getInsertAttributes(params) {
9007
+ const table = typeof params?.table === "string" && params.table ? params.table : void 0;
9008
+ return {
9009
+ [_sentry_conventions_attributes.DB_OPERATION_NAME]: "INSERT",
9010
+ [_sentry_conventions_attributes.DB_COLLECTION_NAME]: table,
9011
+ [_sentry_conventions_attributes.DB_QUERY_SUMMARY]: table ? `INSERT ${table}` : "INSERT"
9012
+ };
9013
+ }
9014
+ function getConnectionAttributes(connectionParams, params) {
9015
+ const url = connectionParams?.url;
9016
+ const user = params?.auth?.username ?? connectionParams?.auth?.username ?? connectionParams?.username;
9017
+ return {
9018
+ [_sentry_conventions_attributes.DB_SYSTEM_NAME]: DB_SYSTEM_CLICKHOUSE,
9019
+ [_sentry_conventions_attributes.DB_NAMESPACE]: connectionParams?.database,
9020
+ [_sentry_conventions_attributes.DB_USER]: typeof user === "string" ? user : void 0,
9021
+ [_sentry_conventions_attributes.SERVER_ADDRESS]: url?.hostname || void 0,
9022
+ [_sentry_conventions_attributes.SERVER_PORT]: url ? getServerPort$1(url) : void 0
9023
+ };
9024
+ }
9025
+ function getServerPort$1(url) {
9026
+ if (url.port) return Number(url.port);
9027
+ return url.protocol === "https:" ? 443 : 80;
9028
+ }
9029
+ /**
9030
+ * Diagnostics-channel-based `@clickhouse/client` and `@clickhouse/client-web` integration.
9031
+ *
9032
+ * Subscribes to the channels Sentry's code transform injects into `ClickHouseClient`'s `query`,
9033
+ * `command`, `exec` and `insert` methods, and emits a `db` span for each call. Requires the Sentry
9034
+ * runtime hook or bundler plugin to be active.
9035
+ */
9036
+ const clickhouseIntegration = (0, _sentry_core.defineIntegration)(_clickhouseIntegration);
8910
9037
  // src/integrations/tedious.ts
8911
9038
  const INTEGRATION_NAME$3 = "Tedious";
8912
9039
  const ORIGIN$3 = "auto.db.tedious";
@@ -10604,6 +10731,7 @@ function getSpanForLayer(data, options) {
10604
10731
  */
10605
10732
  function getMatchedLayerPath(layer) {
10606
10733
  if (layer.route) return getLayerPath([layer.route.path]);
10734
+ if (layer.rawPath !== void 0) return getLayerPath([layer.rawPath]);
10607
10735
  return layer.keys?.length ? void 0 : layer.path || void 0;
10608
10736
  }
10609
10737
  function getLayerType(layer) {
@@ -11290,6 +11418,7 @@ function getTracingIntegrations() {
11290
11418
  typesafeIntegration(),
11291
11419
  postgresJsIntegration(),
11292
11420
  neonIntegration(),
11421
+ clickhouseIntegration(),
11293
11422
  firebaseIntegration(),
11294
11423
  mcpServerIntegration()
11295
11424
  ];
@@ -11326,6 +11455,7 @@ exports.attachHapiErrorHandler = attachHapiErrorHandler;
11326
11455
  exports.attachKoaErrorHandler = attachKoaErrorHandler;
11327
11456
  exports.awsIntegration = awsIntegration;
11328
11457
  exports.bindTracingChannelToSpan = bindTracingChannelToSpan;
11458
+ exports.clickhouseIntegration = clickhouseIntegration;
11329
11459
  exports.createFlueInstrumentation = require_exports.createFlueInstrumentation;
11330
11460
  exports.createHonoRequestMiddleware = require_exports.createHonoRequestMiddleware;
11331
11461
  exports.createLangChainCallbackHandler = require_exports.createLangChainCallbackHandler;
@@ -11405,6 +11535,7 @@ exports.setAsyncLocalStorageAsyncContextStrategy = require_exports.setAsyncLocal
11405
11535
  exports.setHttpServerSpanRouteAttribute = require_exports.setHttpServerSpanRouteAttribute;
11406
11536
  exports.setupExpressErrorHandler = setupExpressErrorHandler;
11407
11537
  exports.setupFastifyErrorHandler = setupFastifyErrorHandler;
11538
+ exports.setupHapiErrorHandler = setupHapiErrorHandler;
11408
11539
  exports.subscribeDiagnosticsChannel = subscribe;
11409
11540
  exports.tediousIntegration = tediousIntegration;
11410
11541
  exports.togetherAIIntegration = togetherAIIntegration;