@sentry/node 10.60.0 → 10.62.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 (182) hide show
  1. package/build/cjs/index.js +2 -0
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/cjs/integrations/fs/index.js +8 -17
  4. package/build/cjs/integrations/fs/index.js.map +1 -1
  5. package/build/cjs/integrations/fs/vendored/instrumentation.js +110 -161
  6. package/build/cjs/integrations/fs/vendored/instrumentation.js.map +1 -1
  7. package/build/cjs/integrations/node-fetch/vendored/undici.js +1 -2
  8. package/build/cjs/integrations/node-fetch/vendored/undici.js.map +1 -1
  9. package/build/cjs/integrations/tracing/amqplib/index.js +2 -10
  10. package/build/cjs/integrations/tracing/amqplib/index.js.map +1 -1
  11. package/build/cjs/integrations/tracing/amqplib/vendored/instrumentation.js +117 -0
  12. package/build/cjs/integrations/tracing/amqplib/vendored/instrumentation.js.map +1 -0
  13. package/build/cjs/integrations/tracing/amqplib/vendored/patches.js +185 -0
  14. package/build/cjs/integrations/tracing/amqplib/vendored/patches.js.map +1 -0
  15. package/build/cjs/integrations/tracing/amqplib/vendored/semconv.js +21 -1
  16. package/build/cjs/integrations/tracing/amqplib/vendored/semconv.js.map +1 -1
  17. package/build/cjs/integrations/tracing/amqplib/vendored/types.js +0 -6
  18. package/build/cjs/integrations/tracing/amqplib/vendored/types.js.map +1 -1
  19. package/build/cjs/integrations/tracing/amqplib/vendored/utils.js +71 -80
  20. package/build/cjs/integrations/tracing/amqplib/vendored/utils.js.map +1 -1
  21. package/build/cjs/integrations/tracing/dataloader/vendored/instrumentation.js +5 -6
  22. package/build/cjs/integrations/tracing/dataloader/vendored/instrumentation.js.map +1 -1
  23. package/build/cjs/integrations/tracing/firebase/firebase.js +1 -24
  24. package/build/cjs/integrations/tracing/firebase/firebase.js.map +1 -1
  25. package/build/cjs/integrations/tracing/firebase/otel/firebaseInstrumentation.js +3 -11
  26. package/build/cjs/integrations/tracing/firebase/otel/firebaseInstrumentation.js.map +1 -1
  27. package/build/cjs/integrations/tracing/firebase/otel/patches/firestore.js +33 -72
  28. package/build/cjs/integrations/tracing/firebase/otel/patches/firestore.js.map +1 -1
  29. package/build/cjs/integrations/tracing/firebase/otel/patches/functions.js +46 -105
  30. package/build/cjs/integrations/tracing/firebase/otel/patches/functions.js.map +1 -1
  31. package/build/cjs/integrations/tracing/kafka/vendored/utils.js +2 -2
  32. package/build/cjs/integrations/tracing/kafka/vendored/utils.js.map +1 -1
  33. package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js +1 -2
  34. package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js.map +1 -1
  35. package/build/cjs/integrations/tracing/mongo/vendored/utils.js +1 -2
  36. package/build/cjs/integrations/tracing/mongo/vendored/utils.js.map +1 -1
  37. package/build/cjs/integrations/tracing/mongoose/vendored/mongoose.js +1 -2
  38. package/build/cjs/integrations/tracing/mongoose/vendored/mongoose.js.map +1 -1
  39. package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js +1 -2
  40. package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -1
  41. package/build/cjs/integrations/tracing/postgres/vendored/instrumentation.js +2 -3
  42. package/build/cjs/integrations/tracing/postgres/vendored/instrumentation.js.map +1 -1
  43. package/build/cjs/integrations/tracing/postgres/vendored/utils.js +1 -2
  44. package/build/cjs/integrations/tracing/postgres/vendored/utils.js.map +1 -1
  45. package/build/cjs/integrations/tracing/redis/index.js +6 -2
  46. package/build/cjs/integrations/tracing/redis/index.js.map +1 -1
  47. package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js +2 -3
  48. package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -1
  49. package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js +3 -4
  50. package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -1
  51. package/build/cjs/integrations/tracing/tedious/vendored/instrumentation.js +1 -2
  52. package/build/cjs/integrations/tracing/tedious/vendored/instrumentation.js.map +1 -1
  53. package/build/cjs/integrations/tracing/vercelai/index.js +3 -0
  54. package/build/cjs/integrations/tracing/vercelai/index.js.map +1 -1
  55. package/build/esm/index.js +1 -1
  56. package/build/esm/integrations/fs/index.js +9 -18
  57. package/build/esm/integrations/fs/index.js.map +1 -1
  58. package/build/esm/integrations/fs/vendored/instrumentation.js +111 -162
  59. package/build/esm/integrations/fs/vendored/instrumentation.js.map +1 -1
  60. package/build/esm/integrations/node-fetch/vendored/undici.js +2 -3
  61. package/build/esm/integrations/node-fetch/vendored/undici.js.map +1 -1
  62. package/build/esm/integrations/tracing/amqplib/index.js +3 -11
  63. package/build/esm/integrations/tracing/amqplib/index.js.map +1 -1
  64. package/build/esm/integrations/tracing/amqplib/vendored/instrumentation.js +115 -0
  65. package/build/esm/integrations/tracing/amqplib/vendored/instrumentation.js.map +1 -0
  66. package/build/esm/integrations/tracing/amqplib/vendored/patches.js +177 -0
  67. package/build/esm/integrations/tracing/amqplib/vendored/patches.js.map +1 -0
  68. package/build/esm/integrations/tracing/amqplib/vendored/semconv.js +12 -2
  69. package/build/esm/integrations/tracing/amqplib/vendored/semconv.js.map +1 -1
  70. package/build/esm/integrations/tracing/amqplib/vendored/types.js +1 -6
  71. package/build/esm/integrations/tracing/amqplib/vendored/types.js.map +1 -1
  72. package/build/esm/integrations/tracing/amqplib/vendored/utils.js +68 -78
  73. package/build/esm/integrations/tracing/amqplib/vendored/utils.js.map +1 -1
  74. package/build/esm/integrations/tracing/dataloader/vendored/instrumentation.js +6 -7
  75. package/build/esm/integrations/tracing/dataloader/vendored/instrumentation.js.map +1 -1
  76. package/build/esm/integrations/tracing/firebase/firebase.js +3 -26
  77. package/build/esm/integrations/tracing/firebase/firebase.js.map +1 -1
  78. package/build/esm/integrations/tracing/firebase/otel/firebaseInstrumentation.js +3 -11
  79. package/build/esm/integrations/tracing/firebase/otel/firebaseInstrumentation.js.map +1 -1
  80. package/build/esm/integrations/tracing/firebase/otel/patches/firestore.js +34 -73
  81. package/build/esm/integrations/tracing/firebase/otel/patches/firestore.js.map +1 -1
  82. package/build/esm/integrations/tracing/firebase/otel/patches/functions.js +47 -106
  83. package/build/esm/integrations/tracing/firebase/otel/patches/functions.js.map +1 -1
  84. package/build/esm/integrations/tracing/kafka/vendored/utils.js +4 -4
  85. package/build/esm/integrations/tracing/kafka/vendored/utils.js.map +1 -1
  86. package/build/esm/integrations/tracing/knex/vendored/instrumentation.js +2 -3
  87. package/build/esm/integrations/tracing/knex/vendored/instrumentation.js.map +1 -1
  88. package/build/esm/integrations/tracing/mongo/vendored/utils.js +2 -3
  89. package/build/esm/integrations/tracing/mongo/vendored/utils.js.map +1 -1
  90. package/build/esm/integrations/tracing/mongoose/vendored/mongoose.js +2 -3
  91. package/build/esm/integrations/tracing/mongoose/vendored/mongoose.js.map +1 -1
  92. package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js +2 -3
  93. package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -1
  94. package/build/esm/integrations/tracing/postgres/vendored/instrumentation.js +3 -4
  95. package/build/esm/integrations/tracing/postgres/vendored/instrumentation.js.map +1 -1
  96. package/build/esm/integrations/tracing/postgres/vendored/utils.js +2 -3
  97. package/build/esm/integrations/tracing/postgres/vendored/utils.js.map +1 -1
  98. package/build/esm/integrations/tracing/redis/index.js +6 -2
  99. package/build/esm/integrations/tracing/redis/index.js.map +1 -1
  100. package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js +3 -4
  101. package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -1
  102. package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js +4 -5
  103. package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -1
  104. package/build/esm/integrations/tracing/tedious/vendored/instrumentation.js +2 -3
  105. package/build/esm/integrations/tracing/tedious/vendored/instrumentation.js.map +1 -1
  106. package/build/esm/integrations/tracing/vercelai/index.js +3 -0
  107. package/build/esm/integrations/tracing/vercelai/index.js.map +1 -1
  108. package/build/esm/package.json +1 -1
  109. package/build/types/index.d.ts +1 -1
  110. package/build/types/index.d.ts.map +1 -1
  111. package/build/types/integrations/fs/index.d.ts +2 -14
  112. package/build/types/integrations/fs/index.d.ts.map +1 -1
  113. package/build/types/integrations/fs/vendored/instrumentation.d.ts +2 -10
  114. package/build/types/integrations/fs/vendored/instrumentation.d.ts.map +1 -1
  115. package/build/types/integrations/fs/vendored/types.d.ts +1 -2
  116. package/build/types/integrations/fs/vendored/types.d.ts.map +1 -1
  117. package/build/types/integrations/node-fetch/vendored/undici.d.ts.map +1 -1
  118. package/build/types/integrations/tracing/amqplib/index.d.ts +1 -1
  119. package/build/types/integrations/tracing/amqplib/index.d.ts.map +1 -1
  120. package/build/types/integrations/tracing/amqplib/vendored/instrumentation.d.ts +11 -0
  121. package/build/types/integrations/tracing/amqplib/vendored/instrumentation.d.ts.map +1 -0
  122. package/build/types/integrations/tracing/amqplib/vendored/patches.d.ts +11 -0
  123. package/build/types/integrations/tracing/amqplib/vendored/patches.d.ts.map +1 -0
  124. package/build/types/integrations/tracing/amqplib/vendored/semconv.d.ts +25 -37
  125. package/build/types/integrations/tracing/amqplib/vendored/semconv.d.ts.map +1 -1
  126. package/build/types/integrations/tracing/amqplib/vendored/types.d.ts +0 -81
  127. package/build/types/integrations/tracing/amqplib/vendored/types.d.ts.map +1 -1
  128. package/build/types/integrations/tracing/amqplib/vendored/utils.d.ts +16 -9
  129. package/build/types/integrations/tracing/amqplib/vendored/utils.d.ts.map +1 -1
  130. package/build/types/integrations/tracing/dataloader/vendored/instrumentation.d.ts.map +1 -1
  131. package/build/types/integrations/tracing/firebase/firebase.d.ts.map +1 -1
  132. package/build/types/integrations/tracing/firebase/otel/firebaseInstrumentation.d.ts +4 -9
  133. package/build/types/integrations/tracing/firebase/otel/firebaseInstrumentation.d.ts.map +1 -1
  134. package/build/types/integrations/tracing/firebase/otel/patches/firestore.d.ts +2 -5
  135. package/build/types/integrations/tracing/firebase/otel/patches/firestore.d.ts.map +1 -1
  136. package/build/types/integrations/tracing/firebase/otel/patches/functions.d.ts +3 -8
  137. package/build/types/integrations/tracing/firebase/otel/patches/functions.d.ts.map +1 -1
  138. package/build/types/integrations/tracing/firebase/otel/types.d.ts +0 -20
  139. package/build/types/integrations/tracing/firebase/otel/types.d.ts.map +1 -1
  140. package/build/types/integrations/tracing/kafka/vendored/utils.d.ts.map +1 -1
  141. package/build/types/integrations/tracing/knex/vendored/instrumentation.d.ts.map +1 -1
  142. package/build/types/integrations/tracing/mongo/vendored/utils.d.ts.map +1 -1
  143. package/build/types/integrations/tracing/mongoose/vendored/mongoose.d.ts.map +1 -1
  144. package/build/types/integrations/tracing/mysql2/vendored/instrumentation.d.ts.map +1 -1
  145. package/build/types/integrations/tracing/postgres/vendored/instrumentation.d.ts.map +1 -1
  146. package/build/types/integrations/tracing/postgres/vendored/utils.d.ts.map +1 -1
  147. package/build/types/integrations/tracing/redis/index.d.ts.map +1 -1
  148. package/build/types/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts.map +1 -1
  149. package/build/types/integrations/tracing/redis/vendored/redis-instrumentation.d.ts.map +1 -1
  150. package/build/types/integrations/tracing/tedious/vendored/instrumentation.d.ts.map +1 -1
  151. package/build/types/integrations/tracing/vercelai/index.d.ts +0 -1
  152. package/build/types/integrations/tracing/vercelai/index.d.ts.map +1 -1
  153. package/build/types-ts3.8/index.d.ts +1 -1
  154. package/build/types-ts3.8/integrations/fs/index.d.ts +2 -14
  155. package/build/types-ts3.8/integrations/fs/vendored/instrumentation.d.ts +2 -10
  156. package/build/types-ts3.8/integrations/fs/vendored/types.d.ts +1 -2
  157. package/build/types-ts3.8/integrations/tracing/amqplib/index.d.ts +1 -1
  158. package/build/types-ts3.8/integrations/tracing/amqplib/vendored/instrumentation.d.ts +11 -0
  159. package/build/types-ts3.8/integrations/tracing/amqplib/vendored/patches.d.ts +11 -0
  160. package/build/types-ts3.8/integrations/tracing/amqplib/vendored/semconv.d.ts +25 -37
  161. package/build/types-ts3.8/integrations/tracing/amqplib/vendored/types.d.ts +0 -81
  162. package/build/types-ts3.8/integrations/tracing/amqplib/vendored/utils.d.ts +16 -9
  163. package/build/types-ts3.8/integrations/tracing/firebase/otel/firebaseInstrumentation.d.ts +4 -9
  164. package/build/types-ts3.8/integrations/tracing/firebase/otel/patches/firestore.d.ts +2 -5
  165. package/build/types-ts3.8/integrations/tracing/firebase/otel/patches/functions.d.ts +3 -8
  166. package/build/types-ts3.8/integrations/tracing/firebase/otel/types.d.ts +0 -20
  167. package/build/types-ts3.8/integrations/tracing/vercelai/index.d.ts +0 -1
  168. package/package.json +5 -5
  169. package/build/cjs/integrations/tracing/amqplib/vendored/amqplib.js +0 -452
  170. package/build/cjs/integrations/tracing/amqplib/vendored/amqplib.js.map +0 -1
  171. package/build/cjs/integrations/tracing/amqplib/vendored/semconv-obsolete.js +0 -24
  172. package/build/cjs/integrations/tracing/amqplib/vendored/semconv-obsolete.js.map +0 -1
  173. package/build/esm/integrations/tracing/amqplib/vendored/amqplib.js +0 -450
  174. package/build/esm/integrations/tracing/amqplib/vendored/amqplib.js.map +0 -1
  175. package/build/esm/integrations/tracing/amqplib/vendored/semconv-obsolete.js +0 -13
  176. package/build/esm/integrations/tracing/amqplib/vendored/semconv-obsolete.js.map +0 -1
  177. package/build/types/integrations/tracing/amqplib/vendored/amqplib.d.ts +0 -26
  178. package/build/types/integrations/tracing/amqplib/vendored/amqplib.d.ts.map +0 -1
  179. package/build/types/integrations/tracing/amqplib/vendored/semconv-obsolete.d.ts +0 -63
  180. package/build/types/integrations/tracing/amqplib/vendored/semconv-obsolete.d.ts.map +0 -1
  181. package/build/types-ts3.8/integrations/tracing/amqplib/vendored/amqplib.d.ts +0 -26
  182. package/build/types-ts3.8/integrations/tracing/amqplib/vendored/semconv-obsolete.d.ts +0 -63
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../../../../../../src/integrations/tracing/amqplib/vendored/types.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-amqplib\n * - Upstream version: @opentelemetry/instrumentation-amqplib@0.65.0\n */\n/* eslint-disable */\n\nimport { Span } from '@opentelemetry/api';\nimport { InstrumentationConfig } from '@opentelemetry/instrumentation';\n\nexport interface PublishInfo {\n moduleVersion: string | undefined;\n exchange: string;\n routingKey: string;\n content: Buffer;\n options?: AmqplibPublishOptions;\n isConfirmChannel?: boolean;\n}\n\nexport interface PublishConfirmedInfo extends PublishInfo {\n confirmError?: any;\n}\n\nexport interface ConsumeInfo {\n moduleVersion: string | undefined;\n msg: ConsumeMessage;\n}\n\nexport interface ConsumeEndInfo {\n msg: ConsumeMessage;\n rejected: boolean | null;\n endOperation: EndOperation;\n}\n\nexport interface AmqplibPublishCustomAttributeFunction {\n (span: Span, publishInfo: PublishInfo): void;\n}\n\nexport interface AmqplibPublishConfirmCustomAttributeFunction {\n (span: Span, publishConfirmedInto: PublishConfirmedInfo): void;\n}\n\nexport interface AmqplibConsumeCustomAttributeFunction {\n (span: Span, consumeInfo: ConsumeInfo): void;\n}\n\nexport interface AmqplibConsumeEndCustomAttributeFunction {\n (span: Span, consumeEndInfo: ConsumeEndInfo): void;\n}\n\nexport enum EndOperation {\n AutoAck = 'auto ack',\n Ack = 'ack',\n AckAll = 'ackAll',\n Reject = 'reject',\n Nack = 'nack',\n NackAll = 'nackAll',\n ChannelClosed = 'channel closed',\n ChannelError = 'channel error',\n InstrumentationTimeout = 'instrumentation timeout',\n}\n\nexport interface AmqplibInstrumentationConfig extends InstrumentationConfig {\n /** hook for adding custom attributes before publish message is sent */\n publishHook?: AmqplibPublishCustomAttributeFunction;\n\n /** hook for adding custom attributes after publish message is confirmed by the broker */\n publishConfirmHook?: AmqplibPublishConfirmCustomAttributeFunction;\n\n /** hook for adding custom attributes before consumer message is processed */\n consumeHook?: AmqplibConsumeCustomAttributeFunction;\n\n /** hook for adding custom attributes after consumer message is acked to server */\n consumeEndHook?: AmqplibConsumeEndCustomAttributeFunction;\n\n /**\n * When user is setting up consume callback, it is user's responsibility to call\n * ack/nack etc on the msg to resolve it in the server.\n * If user is not calling the ack, the message will stay in the queue until\n * channel is closed, or until server timeout expires (if configured).\n * While we wait for the ack, a reference to the message is stored in plugin, which\n * will never be garbage collected.\n * To prevent memory leak, plugin has it's own configuration of timeout, which\n * will close the span if user did not call ack after this timeout.\n * If timeout is not big enough, span might be closed with 'InstrumentationTimeout',\n * and then received valid ack from the user later which will not be instrumented.\n *\n * Default is 1 minute\n */\n consumeTimeoutMs?: number;\n\n /** option to use a span link for the consume message instead of continuing a trace */\n useLinksForConsume?: boolean;\n}\n\nexport const DEFAULT_CONFIG: AmqplibInstrumentationConfig = {\n consumeTimeoutMs: 1000 * 60, // 1 minute\n useLinksForConsume: false,\n};\n\n// The following types are vendored from `@types/amqplib@0.10.1` - commit SHA: 4205e03127692a40b4871709a7134fe4e2ed5510\n\n// Vendored from: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/4205e03127692a40b4871709a7134fe4e2ed5510/types/amqplib/properties.d.ts#L108\n// This exists in `@types/amqplib` as `Options.Publish`. We're renaming things\n// here to avoid importing the whole Options namespace.\nexport interface AmqplibPublishOptions {\n expiration?: string | number;\n userId?: string;\n CC?: string | string[];\n\n mandatory?: boolean;\n persistent?: boolean;\n deliveryMode?: boolean | number;\n BCC?: string | string[];\n\n contentType?: string;\n contentEncoding?: string;\n headers?: any;\n priority?: number;\n correlationId?: string;\n replyTo?: string;\n messageId?: string;\n timestamp?: number;\n type?: string;\n appId?: string;\n}\n\n// Vendored from: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/4205e03127692a40b4871709a7134fe4e2ed5510/types/amqplib/properties.d.ts#L142\nexport interface Message {\n content: Buffer;\n fields: MessageFields;\n properties: MessageProperties;\n}\n\nexport interface ConsumeMessage extends Message {\n fields: ConsumeMessageFields;\n}\n\nexport interface CommonMessageFields {\n deliveryTag: number;\n redelivered: boolean;\n exchange: string;\n routingKey: string;\n}\n\nexport interface MessageFields extends CommonMessageFields {\n messageCount?: number;\n consumerTag?: string;\n}\n\nexport interface ConsumeMessageFields extends CommonMessageFields {\n deliveryTag: number;\n}\n\nexport interface MessageProperties {\n contentType: any | undefined;\n contentEncoding: any | undefined;\n headers: any;\n deliveryMode: any | undefined;\n priority: any | undefined;\n correlationId: any | undefined;\n replyTo: any | undefined;\n expiration: any | undefined;\n messageId: any | undefined;\n timestamp: any | undefined;\n type: any | undefined;\n userId: any | undefined;\n appId: any | undefined;\n clusterId: any | undefined;\n}\n"],"names":["EndOperation"],"mappings":";;AAqDO,IAAK,YAAA,qBAAAA,aAAAA,KAAL;AACL,EAAAA,cAAA,SAAA,CAAA,GAAU,UAAA;AACV,EAAAA,cAAA,KAAA,CAAA,GAAM,KAAA;AACN,EAAAA,cAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,cAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,cAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,cAAA,SAAA,CAAA,GAAU,SAAA;AACV,EAAAA,cAAA,eAAA,CAAA,GAAgB,gBAAA;AAChB,EAAAA,cAAA,cAAA,CAAA,GAAe,eAAA;AACf,EAAAA,cAAA,wBAAA,CAAA,GAAyB,yBAAA;AATf,EAAA,OAAAA,aAAAA;AAAA,CAAA,EAAA,YAAA,IAAA,EAAA;AA6CL,MAAM,cAAA,GAA+C;AAAA,EAC1D,kBAAkB,GAAA,GAAO,EAAA;AAAA;AAAA,EACzB,kBAAA,EAAoB;AACtB;;;;;"}
1
+ {"version":3,"file":"types.js","sources":["../../../../../../src/integrations/tracing/amqplib/vendored/types.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-amqplib\n * - Upstream version: @opentelemetry/instrumentation-amqplib@0.65.0\n * - Some types vendored from @types/amqplib with simplifications\n * - Dropped the instrumentation config and all hooks; the SDK folds origin into span creation instead\n */\n\nexport enum EndOperation {\n AutoAck = 'auto ack',\n Ack = 'ack',\n AckAll = 'ackAll',\n Reject = 'reject',\n Nack = 'nack',\n NackAll = 'nackAll',\n ChannelClosed = 'channel closed',\n ChannelError = 'channel error',\n InstrumentationTimeout = 'instrumentation timeout',\n}\n\n// The following types are vendored from `@types/amqplib@0.10.1` - commit SHA: 4205e03127692a40b4871709a7134fe4e2ed5510\n\n// Vendored from: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/4205e03127692a40b4871709a7134fe4e2ed5510/types/amqplib/properties.d.ts#L142\nexport interface Message {\n content: Buffer;\n fields: MessageFields;\n properties: MessageProperties;\n}\n\nexport interface ConsumeMessage extends Message {\n fields: ConsumeMessageFields;\n}\n\nexport interface CommonMessageFields {\n deliveryTag: number;\n redelivered: boolean;\n exchange: string;\n routingKey: string;\n}\n\nexport interface MessageFields extends CommonMessageFields {\n messageCount?: number;\n consumerTag?: string;\n}\n\nexport interface ConsumeMessageFields extends CommonMessageFields {\n deliveryTag: number;\n}\n\nexport interface MessageProperties {\n contentType: any | undefined;\n contentEncoding: any | undefined;\n headers: any;\n deliveryMode: any | undefined;\n priority: any | undefined;\n correlationId: any | undefined;\n replyTo: any | undefined;\n expiration: any | undefined;\n messageId: any | undefined;\n timestamp: any | undefined;\n type: any | undefined;\n userId: any | undefined;\n appId: any | undefined;\n clusterId: any | undefined;\n}\n"],"names":["EndOperation"],"mappings":";;AAWO,IAAK,YAAA,qBAAAA,aAAAA,KAAL;AACL,EAAAA,cAAA,SAAA,CAAA,GAAU,UAAA;AACV,EAAAA,cAAA,KAAA,CAAA,GAAM,KAAA;AACN,EAAAA,cAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,cAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,cAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,cAAA,SAAA,CAAA,GAAU,SAAA;AACV,EAAAA,cAAA,eAAA,CAAA,GAAgB,gBAAA;AAChB,EAAAA,cAAA,cAAA,CAAA,GAAe,eAAA;AACf,EAAAA,cAAA,wBAAA,CAAA,GAAyB,yBAAA;AATf,EAAA,OAAAA,aAAAA;AAAA,CAAA,EAAA,YAAA,IAAA,EAAA;;;;"}
@@ -1,18 +1,18 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const api = require('@opentelemetry/api');
4
- const instrumentation = require('@opentelemetry/instrumentation');
5
- const semanticConventions = require('@opentelemetry/semantic-conventions');
4
+ const core = require('@sentry/core');
6
5
  const semconv = require('./semconv.js');
7
- const semconvObsolete = require('./semconv-obsolete.js');
8
6
 
7
+ const PUBLISHER_ORIGIN = "auto.amqplib.otel.publisher";
8
+ const CONSUMER_ORIGIN = "auto.amqplib.otel.consumer";
9
9
  const MESSAGE_STORED_SPAN = /* @__PURE__ */ Symbol("opentelemetry.amqplib.message.stored-span");
10
10
  const CHANNEL_SPANS_NOT_ENDED = /* @__PURE__ */ Symbol("opentelemetry.amqplib.channel.spans-not-ended");
11
11
  const CHANNEL_CONSUME_TIMEOUT_TIMER = /* @__PURE__ */ Symbol(
12
12
  "opentelemetry.amqplib.channel.consumer-timeout-timer"
13
13
  );
14
14
  const CONNECTION_ATTRIBUTES = /* @__PURE__ */ Symbol("opentelemetry.amqplib.connection.attributes");
15
- const IS_CONFIRM_CHANNEL_CONTEXT_KEY = api.createContextKey("opentelemetry.amqplib.channel.is-confirm-channel");
15
+ const CHANNEL_IS_CONFIRM_PUBLISHING = /* @__PURE__ */ Symbol("sentry.amqplib.channel.is-confirm-publishing");
16
16
  const normalizeExchange = (exchangeName) => exchangeName !== "" ? exchangeName : "<default>";
17
17
  const censorPassword = (url) => {
18
18
  return url.replace(/:[^:@/]*@/, ":***@");
@@ -28,16 +28,6 @@ const getProtocol = (protocolFromUrl) => {
28
28
  const getHostname = (hostnameFromUrl) => {
29
29
  return hostnameFromUrl || "localhost";
30
30
  };
31
- const extractConnectionAttributeOrLog = (url, attributeKey, attributeValue, nameForLog) => {
32
- if (attributeValue) {
33
- return { [attributeKey]: attributeValue };
34
- } else {
35
- api.diag.error(`amqplib instrumentation: could not extract connection attribute ${nameForLog} from user supplied url`, {
36
- url
37
- });
38
- return {};
39
- }
40
- };
41
31
  const getConnectionAttributesFromServer = (conn) => {
42
32
  const product = conn.serverProperties.product?.toLowerCase?.();
43
33
  if (product) {
@@ -48,90 +38,91 @@ const getConnectionAttributesFromServer = (conn) => {
48
38
  return {};
49
39
  }
50
40
  };
51
- const getConnectionAttributesFromUrl = (url, netSemconvStability) => {
41
+ const getConnectionAttributesFromUrl = (url) => {
52
42
  const attributes = {
53
- [semconvObsolete.ATTR_MESSAGING_PROTOCOL_VERSION]: "0.9.1"
43
+ [semconv.ATTR_MESSAGING_PROTOCOL_VERSION]: "0.9.1"
54
44
  // this is the only protocol supported by the instrumented library
55
45
  };
56
- url = url || "amqp://localhost";
57
- if (typeof url === "object") {
58
- const connectOptions = url;
46
+ const resolvedUrl = url || "amqp://localhost";
47
+ if (typeof resolvedUrl === "object") {
48
+ const connectOptions = resolvedUrl;
59
49
  const protocol = getProtocol(connectOptions?.protocol);
60
- Object.assign(attributes, {
61
- ...extractConnectionAttributeOrLog(url, semconvObsolete.ATTR_MESSAGING_PROTOCOL, protocol, "protocol")
62
- });
63
- const hostname = getHostname(connectOptions?.hostname);
64
- if (netSemconvStability & instrumentation.SemconvStability.OLD) {
65
- Object.assign(attributes, {
66
- ...extractConnectionAttributeOrLog(url, semconv.ATTR_NET_PEER_NAME, hostname, "hostname")
67
- });
68
- }
69
- if (netSemconvStability & instrumentation.SemconvStability.STABLE) {
70
- Object.assign(attributes, {
71
- ...extractConnectionAttributeOrLog(url, semanticConventions.ATTR_SERVER_ADDRESS, hostname, "hostname")
72
- });
73
- }
74
- const port = getPort(connectOptions.port, protocol);
75
- if (netSemconvStability & instrumentation.SemconvStability.OLD) {
76
- Object.assign(attributes, extractConnectionAttributeOrLog(url, semconv.ATTR_NET_PEER_PORT, port, "port"));
77
- }
78
- if (netSemconvStability & instrumentation.SemconvStability.STABLE) {
79
- Object.assign(attributes, extractConnectionAttributeOrLog(url, semanticConventions.ATTR_SERVER_PORT, port, "port"));
80
- }
50
+ attributes[semconv.ATTR_MESSAGING_PROTOCOL] = protocol;
51
+ attributes[semconv.ATTR_NET_PEER_NAME] = getHostname(connectOptions?.hostname);
52
+ attributes[semconv.ATTR_NET_PEER_PORT] = getPort(connectOptions.port, protocol);
81
53
  } else {
82
- const censoredUrl = censorPassword(url);
83
- attributes[semconvObsolete.ATTR_MESSAGING_URL] = censoredUrl;
54
+ const censoredUrl = censorPassword(resolvedUrl);
55
+ attributes[semconv.ATTR_MESSAGING_URL] = censoredUrl;
84
56
  try {
85
57
  const urlParts = new URL(censoredUrl);
86
58
  const protocol = getProtocol(urlParts.protocol);
87
- Object.assign(attributes, {
88
- ...extractConnectionAttributeOrLog(censoredUrl, semconvObsolete.ATTR_MESSAGING_PROTOCOL, protocol, "protocol")
89
- });
90
- const hostname = getHostname(urlParts.hostname);
91
- if (netSemconvStability & instrumentation.SemconvStability.OLD) {
92
- Object.assign(attributes, {
93
- ...extractConnectionAttributeOrLog(censoredUrl, semconv.ATTR_NET_PEER_NAME, hostname, "hostname")
94
- });
95
- }
96
- if (netSemconvStability & instrumentation.SemconvStability.STABLE) {
97
- Object.assign(attributes, {
98
- ...extractConnectionAttributeOrLog(censoredUrl, semanticConventions.ATTR_SERVER_ADDRESS, hostname, "hostname")
99
- });
100
- }
101
- const port = getPort(urlParts.port ? parseInt(urlParts.port) : void 0, protocol);
102
- if (netSemconvStability & instrumentation.SemconvStability.OLD) {
103
- Object.assign(attributes, extractConnectionAttributeOrLog(censoredUrl, semconv.ATTR_NET_PEER_PORT, port, "port"));
104
- }
105
- if (netSemconvStability & instrumentation.SemconvStability.STABLE) {
106
- Object.assign(attributes, extractConnectionAttributeOrLog(censoredUrl, semanticConventions.ATTR_SERVER_PORT, port, "port"));
107
- }
108
- } catch (err) {
109
- api.diag.error("amqplib instrumentation: error while extracting connection details from connection url", {
110
- censoredUrl,
111
- err
112
- });
59
+ attributes[semconv.ATTR_MESSAGING_PROTOCOL] = protocol;
60
+ attributes[semconv.ATTR_NET_PEER_NAME] = getHostname(urlParts.hostname);
61
+ attributes[semconv.ATTR_NET_PEER_PORT] = getPort(urlParts.port ? parseInt(urlParts.port) : void 0, protocol);
62
+ } catch {
113
63
  }
114
64
  }
115
65
  return attributes;
116
66
  };
117
- const markConfirmChannelTracing = (context) => {
118
- return context.setValue(IS_CONFIRM_CHANNEL_CONTEXT_KEY, true);
119
- };
120
- const unmarkConfirmChannelTracing = (context) => {
121
- return context.deleteValue(IS_CONFIRM_CHANNEL_CONTEXT_KEY);
122
- };
123
- const isConfirmChannelTracing = (context) => {
124
- return context.getValue(IS_CONFIRM_CHANNEL_CONTEXT_KEY) === true;
125
- };
67
+ function getHeaderAsString(headers, key) {
68
+ const value = headers?.[key];
69
+ if (value == null) {
70
+ return void 0;
71
+ }
72
+ return Array.isArray(value) ? String(value[0]) : String(value);
73
+ }
74
+ function startPublishSpan(exchange, routingKey, channel, options) {
75
+ const normalizedExchange = normalizeExchange(exchange);
76
+ const span = core.startInactiveSpan({
77
+ name: `publish ${normalizedExchange}`,
78
+ kind: api.SpanKind.PRODUCER,
79
+ attributes: {
80
+ ...channel.connection[CONNECTION_ATTRIBUTES],
81
+ [semconv.ATTR_MESSAGING_DESTINATION]: exchange,
82
+ [semconv.ATTR_MESSAGING_DESTINATION_KIND]: semconv.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,
83
+ [semconv.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]: routingKey,
84
+ [semconv.OLD_ATTR_MESSAGING_MESSAGE_ID]: options?.messageId,
85
+ [semconv.ATTR_MESSAGING_CONVERSATION_ID]: options?.correlationId,
86
+ [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: PUBLISHER_ORIGIN
87
+ }
88
+ });
89
+ const modifiedOptions = options ?? {};
90
+ modifiedOptions.headers = modifiedOptions.headers ?? {};
91
+ const traceData = core.getTraceData({ span });
92
+ if (traceData["sentry-trace"]) {
93
+ modifiedOptions.headers["sentry-trace"] = traceData["sentry-trace"];
94
+ }
95
+ if (traceData.baggage) {
96
+ modifiedOptions.headers["baggage"] = traceData.baggage;
97
+ }
98
+ return { span, modifiedOptions };
99
+ }
100
+ function startConsumeSpan(queue, msg, channel) {
101
+ return core.startInactiveSpan({
102
+ name: `${queue} process`,
103
+ kind: api.SpanKind.CONSUMER,
104
+ attributes: {
105
+ ...channel?.connection?.[CONNECTION_ATTRIBUTES],
106
+ [semconv.ATTR_MESSAGING_DESTINATION]: msg.fields?.exchange,
107
+ [semconv.ATTR_MESSAGING_DESTINATION_KIND]: semconv.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,
108
+ [semconv.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]: msg.fields?.routingKey,
109
+ [semconv.ATTR_MESSAGING_OPERATION]: semconv.MESSAGING_OPERATION_VALUE_PROCESS,
110
+ [semconv.OLD_ATTR_MESSAGING_MESSAGE_ID]: msg?.properties.messageId,
111
+ [semconv.ATTR_MESSAGING_CONVERSATION_ID]: msg?.properties.correlationId,
112
+ [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: CONSUMER_ORIGIN
113
+ }
114
+ });
115
+ }
126
116
 
127
117
  exports.CHANNEL_CONSUME_TIMEOUT_TIMER = CHANNEL_CONSUME_TIMEOUT_TIMER;
118
+ exports.CHANNEL_IS_CONFIRM_PUBLISHING = CHANNEL_IS_CONFIRM_PUBLISHING;
128
119
  exports.CHANNEL_SPANS_NOT_ENDED = CHANNEL_SPANS_NOT_ENDED;
129
120
  exports.CONNECTION_ATTRIBUTES = CONNECTION_ATTRIBUTES;
130
121
  exports.MESSAGE_STORED_SPAN = MESSAGE_STORED_SPAN;
131
122
  exports.getConnectionAttributesFromServer = getConnectionAttributesFromServer;
132
123
  exports.getConnectionAttributesFromUrl = getConnectionAttributesFromUrl;
133
- exports.isConfirmChannelTracing = isConfirmChannelTracing;
134
- exports.markConfirmChannelTracing = markConfirmChannelTracing;
124
+ exports.getHeaderAsString = getHeaderAsString;
135
125
  exports.normalizeExchange = normalizeExchange;
136
- exports.unmarkConfirmChannelTracing = unmarkConfirmChannelTracing;
126
+ exports.startConsumeSpan = startConsumeSpan;
127
+ exports.startPublishSpan = startPublishSpan;
137
128
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../../src/integrations/tracing/amqplib/vendored/utils.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-amqplib\n * - Upstream version: @opentelemetry/instrumentation-amqplib@0.65.0\n * - Some types vendored from @types/amqplib with simplifications\n */\n/* eslint-disable */\n\nimport { Context, createContextKey, diag, Span, Attributes, AttributeValue } from '@opentelemetry/api';\nimport { SemconvStability } from '@opentelemetry/instrumentation';\nimport { ATTR_SERVER_ADDRESS, ATTR_SERVER_PORT } from '@opentelemetry/semantic-conventions';\nimport { ATTR_MESSAGING_SYSTEM, ATTR_NET_PEER_NAME, ATTR_NET_PEER_PORT } from './semconv';\nimport { ATTR_MESSAGING_PROTOCOL, ATTR_MESSAGING_PROTOCOL_VERSION, ATTR_MESSAGING_URL } from './semconv-obsolete';\nimport type { Connection, Channel, ConfirmChannel, Options } from './amqplib-types';\nimport type { ConsumeMessage, Message } from './types';\n\nexport const MESSAGE_STORED_SPAN: unique symbol = Symbol('opentelemetry.amqplib.message.stored-span');\nexport const CHANNEL_SPANS_NOT_ENDED: unique symbol = Symbol('opentelemetry.amqplib.channel.spans-not-ended');\nexport const CHANNEL_CONSUME_TIMEOUT_TIMER: unique symbol = Symbol(\n 'opentelemetry.amqplib.channel.consumer-timeout-timer',\n);\nexport const CONNECTION_ATTRIBUTES: unique symbol = Symbol('opentelemetry.amqplib.connection.attributes');\n\nexport type InstrumentationConnection = Connection & {\n [CONNECTION_ATTRIBUTES]?: Attributes;\n};\nexport type InstrumentationPublishChannel = (Channel | ConfirmChannel) & {\n connection: InstrumentationConnection;\n};\nexport type InstrumentationConsumeChannel = Channel & {\n connection: InstrumentationConnection;\n [CHANNEL_SPANS_NOT_ENDED]?: {\n msg: ConsumeMessage;\n timeOfConsume: number;\n }[];\n [CHANNEL_CONSUME_TIMEOUT_TIMER]?: NodeJS.Timeout;\n};\nexport type InstrumentationMessage = Message & {\n [MESSAGE_STORED_SPAN]?: Span;\n};\nexport type InstrumentationConsumeMessage = ConsumeMessage & {\n [MESSAGE_STORED_SPAN]?: Span;\n};\n\nconst IS_CONFIRM_CHANNEL_CONTEXT_KEY: symbol = createContextKey('opentelemetry.amqplib.channel.is-confirm-channel');\n\nexport const normalizeExchange = (exchangeName: string) => (exchangeName !== '' ? exchangeName : '<default>');\n\nconst censorPassword = (url: string): string => {\n return url.replace(/:[^:@/]*@/, ':***@');\n};\n\nconst getPort = (portFromUrl: number | undefined, resolvedProtocol: string): number => {\n // we are using the resolved protocol which is upper case\n // this code mimic the behavior of the amqplib which is used to set connection params\n return portFromUrl || (resolvedProtocol === 'AMQP' ? 5672 : 5671);\n};\n\nconst getProtocol = (protocolFromUrl: string | undefined): string => {\n const resolvedProtocol = protocolFromUrl || 'amqp';\n // the substring removed the ':' part of the protocol ('amqp:' -> 'amqp')\n const noEndingColon = resolvedProtocol.endsWith(':')\n ? resolvedProtocol.substring(0, resolvedProtocol.length - 1)\n : resolvedProtocol;\n // upper cases to match spec\n return noEndingColon.toUpperCase();\n};\n\nconst getHostname = (hostnameFromUrl: string | undefined): string => {\n // if user supplies empty hostname, it gets forwarded to 'net' package which default it to localhost.\n // https://nodejs.org/docs/latest-v12.x/api/net.html#net_socket_connect_options_connectlistener\n return hostnameFromUrl || 'localhost';\n};\n\nconst extractConnectionAttributeOrLog = (\n url: string | Options.Connect,\n attributeKey: string,\n attributeValue: AttributeValue,\n nameForLog: string,\n): Attributes => {\n if (attributeValue) {\n return { [attributeKey]: attributeValue };\n } else {\n diag.error(`amqplib instrumentation: could not extract connection attribute ${nameForLog} from user supplied url`, {\n url,\n });\n return {};\n }\n};\n\nexport const getConnectionAttributesFromServer = (conn: Connection): Attributes => {\n const product = conn.serverProperties.product?.toLowerCase?.();\n if (product) {\n return {\n [ATTR_MESSAGING_SYSTEM]: product,\n };\n } else {\n return {};\n }\n};\n\nexport const getConnectionAttributesFromUrl = (\n url: string | Options.Connect,\n netSemconvStability: SemconvStability,\n): Attributes => {\n const attributes: Attributes = {\n [ATTR_MESSAGING_PROTOCOL_VERSION]: '0.9.1', // this is the only protocol supported by the instrumented library\n };\n\n url = url || 'amqp://localhost';\n if (typeof url === 'object') {\n const connectOptions = url as Options.Connect;\n\n const protocol = getProtocol(connectOptions?.protocol);\n Object.assign(attributes, {\n ...extractConnectionAttributeOrLog(url, ATTR_MESSAGING_PROTOCOL, protocol, 'protocol'),\n });\n\n const hostname = getHostname(connectOptions?.hostname);\n if (netSemconvStability & SemconvStability.OLD) {\n Object.assign(attributes, {\n ...extractConnectionAttributeOrLog(url, ATTR_NET_PEER_NAME, hostname, 'hostname'),\n });\n }\n if (netSemconvStability & SemconvStability.STABLE) {\n Object.assign(attributes, {\n ...extractConnectionAttributeOrLog(url, ATTR_SERVER_ADDRESS, hostname, 'hostname'),\n });\n }\n\n const port = getPort(connectOptions.port, protocol);\n if (netSemconvStability & SemconvStability.OLD) {\n Object.assign(attributes, extractConnectionAttributeOrLog(url, ATTR_NET_PEER_PORT, port, 'port'));\n }\n if (netSemconvStability & SemconvStability.STABLE) {\n Object.assign(attributes, extractConnectionAttributeOrLog(url, ATTR_SERVER_PORT, port, 'port'));\n }\n } else {\n const censoredUrl = censorPassword(url);\n attributes[ATTR_MESSAGING_URL] = censoredUrl;\n try {\n const urlParts = new URL(censoredUrl);\n\n const protocol = getProtocol(urlParts.protocol);\n Object.assign(attributes, {\n ...extractConnectionAttributeOrLog(censoredUrl, ATTR_MESSAGING_PROTOCOL, protocol, 'protocol'),\n });\n\n const hostname = getHostname(urlParts.hostname);\n if (netSemconvStability & SemconvStability.OLD) {\n Object.assign(attributes, {\n ...extractConnectionAttributeOrLog(censoredUrl, ATTR_NET_PEER_NAME, hostname, 'hostname'),\n });\n }\n if (netSemconvStability & SemconvStability.STABLE) {\n Object.assign(attributes, {\n ...extractConnectionAttributeOrLog(censoredUrl, ATTR_SERVER_ADDRESS, hostname, 'hostname'),\n });\n }\n\n const port = getPort(urlParts.port ? parseInt(urlParts.port) : undefined, protocol);\n if (netSemconvStability & SemconvStability.OLD) {\n Object.assign(attributes, extractConnectionAttributeOrLog(censoredUrl, ATTR_NET_PEER_PORT, port, 'port'));\n }\n if (netSemconvStability & SemconvStability.STABLE) {\n Object.assign(attributes, extractConnectionAttributeOrLog(censoredUrl, ATTR_SERVER_PORT, port, 'port'));\n }\n } catch (err) {\n diag.error('amqplib instrumentation: error while extracting connection details from connection url', {\n censoredUrl,\n err,\n });\n }\n }\n return attributes;\n};\n\nexport const markConfirmChannelTracing = (context: Context) => {\n return context.setValue(IS_CONFIRM_CHANNEL_CONTEXT_KEY, true);\n};\n\nexport const unmarkConfirmChannelTracing = (context: Context) => {\n return context.deleteValue(IS_CONFIRM_CHANNEL_CONTEXT_KEY);\n};\n\nexport const isConfirmChannelTracing = (context: Context) => {\n return context.getValue(IS_CONFIRM_CHANNEL_CONTEXT_KEY) === true;\n};\n"],"names":["createContextKey","diag","ATTR_MESSAGING_SYSTEM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,EAAA,OAAO,OAAA,CAAQ,QAAA,CAAS,8BAA8B,CAAA,KAAM,IAAA;AAC9D;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../../src/integrations/tracing/amqplib/vendored/utils.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-amqplib\n * - Upstream version: @opentelemetry/instrumentation-amqplib@0.65.0\n * - Some types vendored from @types/amqplib with simplifications\n * - Span creation extracted here and migrated to the @sentry/core API; origin folded into span creation\n * - Cross-service trace propagation uses Sentry's `getTraceData` instead of the OTel propagator\n * - Dropped the env-gated stable-semconv dual emission; only the (default) old semantic conventions are emitted\n * - Replaced the OTel context-key confirm-channel marker with a synchronous flag on the channel instance\n */\n\nimport { SpanKind } from '@opentelemetry/api';\nimport type { Span, SpanAttributes } from '@sentry/core';\nimport { getTraceData, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core';\nimport type { Channel, ConfirmChannel, Connection, Options } from './amqplib-types';\nimport {\n ATTR_MESSAGING_CONVERSATION_ID,\n ATTR_MESSAGING_DESTINATION,\n ATTR_MESSAGING_DESTINATION_KIND,\n ATTR_MESSAGING_OPERATION,\n ATTR_MESSAGING_PROTOCOL,\n ATTR_MESSAGING_PROTOCOL_VERSION,\n ATTR_MESSAGING_RABBITMQ_ROUTING_KEY,\n ATTR_MESSAGING_SYSTEM,\n ATTR_MESSAGING_URL,\n ATTR_NET_PEER_NAME,\n ATTR_NET_PEER_PORT,\n MESSAGING_DESTINATION_KIND_VALUE_TOPIC,\n MESSAGING_OPERATION_VALUE_PROCESS,\n OLD_ATTR_MESSAGING_MESSAGE_ID,\n} from './semconv';\nimport type { ConsumeMessage, Message } from './types';\n\nconst PUBLISHER_ORIGIN = 'auto.amqplib.otel.publisher';\nconst CONSUMER_ORIGIN = 'auto.amqplib.otel.consumer';\n\nexport const MESSAGE_STORED_SPAN: unique symbol = Symbol('opentelemetry.amqplib.message.stored-span');\nexport const CHANNEL_SPANS_NOT_ENDED: unique symbol = Symbol('opentelemetry.amqplib.channel.spans-not-ended');\nexport const CHANNEL_CONSUME_TIMEOUT_TIMER: unique symbol = Symbol(\n 'opentelemetry.amqplib.channel.consumer-timeout-timer',\n);\nexport const CONNECTION_ATTRIBUTES: unique symbol = Symbol('opentelemetry.amqplib.connection.attributes');\nexport const CHANNEL_IS_CONFIRM_PUBLISHING: unique symbol = Symbol('sentry.amqplib.channel.is-confirm-publishing');\n\nexport type InstrumentationConnection = Connection & {\n [CONNECTION_ATTRIBUTES]?: SpanAttributes;\n};\nexport type InstrumentationPublishChannel = (Channel | ConfirmChannel) & {\n connection: InstrumentationConnection;\n [CHANNEL_IS_CONFIRM_PUBLISHING]?: boolean;\n};\nexport type InstrumentationConsumeChannel = Channel & {\n connection: InstrumentationConnection;\n [CHANNEL_SPANS_NOT_ENDED]?: {\n msg: ConsumeMessage;\n timeOfConsume: number;\n }[];\n [CHANNEL_CONSUME_TIMEOUT_TIMER]?: NodeJS.Timeout;\n};\nexport type InstrumentationMessage = Message & {\n [MESSAGE_STORED_SPAN]?: Span;\n};\nexport type InstrumentationConsumeMessage = ConsumeMessage & {\n [MESSAGE_STORED_SPAN]?: Span;\n};\n\nexport const normalizeExchange = (exchangeName: string): string => (exchangeName !== '' ? exchangeName : '<default>');\n\nconst censorPassword = (url: string): string => {\n return url.replace(/:[^:@/]*@/, ':***@');\n};\n\nconst getPort = (portFromUrl: number | undefined, resolvedProtocol: string): number => {\n // we are using the resolved protocol which is upper case\n // this code mimics the behavior of amqplib which is used to set connection params\n return portFromUrl || (resolvedProtocol === 'AMQP' ? 5672 : 5671);\n};\n\nconst getProtocol = (protocolFromUrl: string | undefined): string => {\n const resolvedProtocol = protocolFromUrl || 'amqp';\n // the substring removes the ':' part of the protocol ('amqp:' -> 'amqp')\n const noEndingColon = resolvedProtocol.endsWith(':')\n ? resolvedProtocol.substring(0, resolvedProtocol.length - 1)\n : resolvedProtocol;\n // upper case to match spec\n return noEndingColon.toUpperCase();\n};\n\nconst getHostname = (hostnameFromUrl: string | undefined): string => {\n // if user supplies empty hostname, it gets forwarded to 'net' package which defaults it to localhost.\n // https://nodejs.org/docs/latest-v12.x/api/net.html#net_socket_connect_options_connectlistener\n return hostnameFromUrl || 'localhost';\n};\n\nexport const getConnectionAttributesFromServer = (conn: Connection): SpanAttributes => {\n const product = conn.serverProperties.product?.toLowerCase?.();\n if (product) {\n return {\n [ATTR_MESSAGING_SYSTEM]: product,\n };\n } else {\n return {};\n }\n};\n\nexport const getConnectionAttributesFromUrl = (url: string | Options.Connect): SpanAttributes => {\n const attributes: SpanAttributes = {\n [ATTR_MESSAGING_PROTOCOL_VERSION]: '0.9.1', // this is the only protocol supported by the instrumented library\n };\n\n const resolvedUrl = url || 'amqp://localhost';\n if (typeof resolvedUrl === 'object') {\n const connectOptions = resolvedUrl;\n\n const protocol = getProtocol(connectOptions?.protocol);\n attributes[ATTR_MESSAGING_PROTOCOL] = protocol;\n attributes[ATTR_NET_PEER_NAME] = getHostname(connectOptions?.hostname);\n attributes[ATTR_NET_PEER_PORT] = getPort(connectOptions.port, protocol);\n } else {\n const censoredUrl = censorPassword(resolvedUrl);\n attributes[ATTR_MESSAGING_URL] = censoredUrl;\n try {\n const urlParts = new URL(censoredUrl);\n\n const protocol = getProtocol(urlParts.protocol);\n attributes[ATTR_MESSAGING_PROTOCOL] = protocol;\n attributes[ATTR_NET_PEER_NAME] = getHostname(urlParts.hostname);\n attributes[ATTR_NET_PEER_PORT] = getPort(urlParts.port ? parseInt(urlParts.port) : undefined, protocol);\n } catch {\n // best-effort: a malformed url simply yields fewer connection attributes\n }\n }\n return attributes;\n};\n\n/** Reads a propagation header value off an amqplib message as a string. */\nexport function getHeaderAsString(headers: Record<string, unknown> | undefined, key: string): string | undefined {\n const value = headers?.[key];\n if (value == null) {\n return undefined;\n }\n return Array.isArray(value) ? String(value[0]) : String(value);\n}\n\n/** Starts an inactive producer span and propagates its trace into the publish `options.headers`. */\nexport function startPublishSpan(\n exchange: string,\n routingKey: string,\n channel: InstrumentationPublishChannel,\n options?: Options.Publish,\n): { span: Span; modifiedOptions: Options.Publish } {\n const normalizedExchange = normalizeExchange(exchange);\n\n const span = startInactiveSpan({\n name: `publish ${normalizedExchange}`,\n kind: SpanKind.PRODUCER,\n attributes: {\n ...channel.connection[CONNECTION_ATTRIBUTES],\n [ATTR_MESSAGING_DESTINATION]: exchange,\n [ATTR_MESSAGING_DESTINATION_KIND]: MESSAGING_DESTINATION_KIND_VALUE_TOPIC,\n [ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]: routingKey,\n [OLD_ATTR_MESSAGING_MESSAGE_ID]: options?.messageId,\n [ATTR_MESSAGING_CONVERSATION_ID]: options?.correlationId,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: PUBLISHER_ORIGIN,\n },\n });\n\n const modifiedOptions = options ?? {};\n modifiedOptions.headers = modifiedOptions.headers ?? {};\n\n const traceData = getTraceData({ span });\n if (traceData['sentry-trace']) {\n modifiedOptions.headers['sentry-trace'] = traceData['sentry-trace'];\n }\n if (traceData.baggage) {\n modifiedOptions.headers['baggage'] = traceData.baggage;\n }\n\n return { span, modifiedOptions };\n}\n\n/** Starts an inactive consumer (process) span carrying the amqplib messaging attributes. */\nexport function startConsumeSpan(\n queue: string,\n msg: InstrumentationConsumeMessage,\n channel: InstrumentationConsumeChannel,\n): Span {\n return startInactiveSpan({\n name: `${queue} process`,\n kind: SpanKind.CONSUMER,\n attributes: {\n ...channel?.connection?.[CONNECTION_ATTRIBUTES],\n [ATTR_MESSAGING_DESTINATION]: msg.fields?.exchange,\n [ATTR_MESSAGING_DESTINATION_KIND]: MESSAGING_DESTINATION_KIND_VALUE_TOPIC,\n [ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]: msg.fields?.routingKey,\n [ATTR_MESSAGING_OPERATION]: MESSAGING_OPERATION_VALUE_PROCESS,\n [OLD_ATTR_MESSAGING_MESSAGE_ID]: msg?.properties.messageId,\n [ATTR_MESSAGING_CONVERSATION_ID]: msg?.properties.correlationId,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: CONSUMER_ORIGIN,\n },\n });\n}\n"],"names":["ATTR_MESSAGING_SYSTEM","ATTR_MESSAGING_PROTOCOL_VERSION","ATTR_MESSAGING_PROTOCOL","ATTR_NET_PEER_NAME","ATTR_NET_PEER_PORT","ATTR_MESSAGING_URL","startInactiveSpan","SpanKind","ATTR_MESSAGING_DESTINATION","ATTR_MESSAGING_DESTINATION_KIND","MESSAGING_DESTINATION_KIND_VALUE_TOPIC","ATTR_MESSAGING_RABBITMQ_ROUTING_KEY","OLD_ATTR_MESSAGING_MESSAGE_ID","ATTR_MESSAGING_CONVERSATION_ID","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","getTraceData","ATTR_MESSAGING_OPERATION","MESSAGING_OPERATION_VALUE_PROCESS"],"mappings":";;;;;;AAoCA,MAAM,gBAAA,GAAmB,6BAAA;AACzB,MAAM,eAAA,GAAkB,4BAAA;AAEjB,MAAM,mBAAA,0BAA4C,2CAA2C;AAC7F,MAAM,uBAAA,0BAAgD,+CAA+C;AACrG,MAAM,6BAAA,mBAA+C,MAAA;AAAA,EAC1D;AACF;AACO,MAAM,qBAAA,0BAA8C,6CAA6C;AACjG,MAAM,6BAAA,0BAAsD,8CAA8C;AAwB1G,MAAM,iBAAA,GAAoB,CAAC,YAAA,KAAkC,YAAA,KAAiB,KAAK,YAAA,GAAe;AAEzG,MAAM,cAAA,GAAiB,CAAC,GAAA,KAAwB;AAC9C,EAAA,OAAO,GAAA,CAAI,OAAA,CAAQ,WAAA,EAAa,OAAO,CAAA;AACzC,CAAA;AAEA,MAAM,OAAA,GAAU,CAAC,WAAA,EAAiC,gBAAA,KAAqC;AAGr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,MAC1C,CAACC,uCAA+B,GAAGC,8CAAA;AAAA,MACnC,CAACC,2CAAmC,GAAG,GAAA,CAAI,MAAA,EAAQ,UAAA;AAAA,MACnD,CAACK,gCAAwB,GAAGC,yCAAA;AAAA,MAC5B,CAACL,qCAA6B,GAAG,GAAA,EAAK,UAAA,CAAW,SAAA;AAAA,MACjD,CAACC,sCAA8B,GAAG,GAAA,EAAK,UAAA,CAAW,aAAA;AAAA,MAClD,CAACC,qCAAgC,GAAG;AAAA;AACtC,GACD,CAAA;AACH;;;;;;;;;;;;;;"}
@@ -1,7 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const instrumentation = require('@opentelemetry/instrumentation');
4
- const api = require('@opentelemetry/api');
5
4
  const core = require('@sentry/core');
6
5
 
7
6
  const MODULE_NAME = "dataloader";
@@ -104,7 +103,7 @@ class DataloaderInstrumentation extends instrumentation.InstrumentationBase {
104
103
  return core.startSpan(
105
104
  {
106
105
  name: getSpanName(this, "load"),
107
- kind: api.SpanKind.CLIENT,
106
+ kind: core.SPAN_KIND.CLIENT,
108
107
  attributes: {
109
108
  [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
110
109
  [core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp("load")
@@ -135,7 +134,7 @@ class DataloaderInstrumentation extends instrumentation.InstrumentationBase {
135
134
  return core.startSpan(
136
135
  {
137
136
  name: getSpanName(this, "loadMany"),
138
- kind: api.SpanKind.CLIENT,
137
+ kind: core.SPAN_KIND.CLIENT,
139
138
  attributes: {
140
139
  [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
141
140
  [core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp("loadMany")
@@ -157,7 +156,7 @@ class DataloaderInstrumentation extends instrumentation.InstrumentationBase {
157
156
  return core.startSpan(
158
157
  {
159
158
  name: getSpanName(this, "prime"),
160
- kind: api.SpanKind.CLIENT,
159
+ kind: core.SPAN_KIND.CLIENT,
161
160
  attributes: {
162
161
  [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
163
162
  [core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp("prime")
@@ -179,7 +178,7 @@ class DataloaderInstrumentation extends instrumentation.InstrumentationBase {
179
178
  return core.startSpan(
180
179
  {
181
180
  name: getSpanName(this, "clear"),
182
- kind: api.SpanKind.CLIENT,
181
+ kind: core.SPAN_KIND.CLIENT,
183
182
  attributes: {
184
183
  [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
185
184
  [core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp("clear")
@@ -201,7 +200,7 @@ class DataloaderInstrumentation extends instrumentation.InstrumentationBase {
201
200
  return core.startSpan(
202
201
  {
203
202
  name: getSpanName(this, "clearAll"),
204
- kind: api.SpanKind.CLIENT,
203
+ kind: core.SPAN_KIND.CLIENT,
205
204
  attributes: {
206
205
  [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
207
206
  [core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp("clearAll")
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/dataloader/vendored/instrumentation.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-dataloader\n * - Upstream version: @opentelemetry/instrumentation-dataloader@0.35.0\n * - Minor TypeScript strictness adjustments for this repository's compiler settings\n */\n\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';\nimport { SpanKind } from '@opentelemetry/api';\nimport type { BatchLoadFn, DataLoader, DataLoaderConstructor } from './types';\nimport { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core';\n\nconst MODULE_NAME = 'dataloader';\nconst PACKAGE_NAME = '@sentry/instrumentation-dataloader';\nconst ORIGIN = 'auto.db.otel.dataloader';\n\ntype LoadFn = DataLoader['load'];\ntype LoadManyFn = DataLoader['loadMany'];\ntype PrimeFn = DataLoader['prime'];\ntype ClearFn = DataLoader['clear'];\ntype ClearAllFn = DataLoader['clearAll'];\n\nfunction isModule(module: unknown): module is { [Symbol.toStringTag]: 'Module'; default: DataLoaderConstructor } {\n return (module as { [Symbol.toStringTag]: string })[Symbol.toStringTag] === 'Module';\n}\n\nfunction extractModuleExports(module: unknown): DataLoaderConstructor {\n return isModule(module)\n ? module.default // ESM\n : (module as DataLoaderConstructor); // CommonJS\n}\n\nfunction getSpanName(\n dataloader: DataLoader,\n operation: 'load' | 'loadMany' | 'batch' | 'prime' | 'clear' | 'clearAll',\n): string {\n const dataloaderName = dataloader.name;\n if (dataloaderName) {\n return `${MODULE_NAME}.${operation} ${dataloaderName}`;\n }\n\n return `${MODULE_NAME}.${operation}`;\n}\n\n// `load`, `loadMany` and `batch` are all cache reads\nfunction getSpanOp(operation: 'load' | 'loadMany' | 'batch' | 'prime' | 'clear' | 'clearAll'): string | undefined {\n if (operation === 'load' || operation === 'loadMany' || operation === 'batch') {\n return 'cache.get';\n }\n\n return undefined;\n}\n\nexport class DataloaderInstrumentation extends InstrumentationBase {\n constructor(config = {}) {\n super(PACKAGE_NAME, SDK_VERSION, config);\n }\n\n protected init() {\n return [\n new InstrumentationNodeModuleDefinition(\n MODULE_NAME,\n ['>=2.0.0 <3'],\n module => {\n const dataloader = extractModuleExports(module);\n this._patchLoad(dataloader.prototype);\n this._patchLoadMany(dataloader.prototype);\n this._patchPrime(dataloader.prototype);\n this._patchClear(dataloader.prototype);\n this._patchClearAll(dataloader.prototype);\n\n return this._getPatchedConstructor(dataloader);\n },\n module => {\n const dataloader = extractModuleExports(module);\n ['load', 'loadMany', 'prime', 'clear', 'clearAll'].forEach(method => {\n if (isWrapped(dataloader.prototype[method])) {\n this._unwrap(dataloader.prototype, method);\n }\n });\n },\n ),\n ];\n }\n\n private _wrapBatchLoadFn(batchLoadFn: BatchLoadFn<unknown, unknown>): BatchLoadFn<unknown, unknown> {\n // oxlint-disable-next-line typescript/no-this-alias\n const instrumentation = this;\n\n return function patchedBatchLoadFn(this: DataLoader, ...args: Parameters<BatchLoadFn<unknown, unknown>>) {\n if (!instrumentation.isEnabled()) {\n return batchLoadFn.call(this, ...args);\n }\n\n return startSpan(\n {\n name: getSpanName(this, 'batch'),\n links: this._batch?.spanLinks,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp('batch'),\n },\n onlyIfParent: true,\n },\n () => batchLoadFn.apply(this, args),\n );\n };\n }\n\n private _getPatchedConstructor(constructor: DataLoaderConstructor): DataLoaderConstructor {\n // oxlint-disable-next-line typescript/no-this-alias\n const instrumentation = this;\n const prototype = constructor.prototype;\n\n if (!instrumentation.isEnabled()) {\n return constructor;\n }\n\n // oxlint-disable-next-line typescript/no-explicit-any\n function PatchedDataloader(this: DataLoader, ...args: any[]) {\n // BatchLoadFn is the first constructor argument\n // https://github.com/graphql/dataloader/blob/77c2cd7ca97e8795242018ebc212ce2487e729d2/src/index.js#L47\n if (typeof args[0] === 'function') {\n if (isWrapped(args[0])) {\n instrumentation._unwrap(args, 0);\n }\n\n args[0] = instrumentation._wrapBatchLoadFn(args[0]);\n }\n\n return constructor.apply(this, args);\n }\n\n PatchedDataloader.prototype = prototype;\n return PatchedDataloader as unknown as DataLoaderConstructor;\n }\n\n private _patchLoad(proto: DataLoader) {\n // oxlint-disable-next-line typescript/unbound-method\n if (isWrapped(proto.load)) {\n this._unwrap(proto, 'load');\n }\n\n this._wrap(proto, 'load', this._getPatchedLoad.bind(this));\n }\n\n private _getPatchedLoad(original: LoadFn): LoadFn {\n return function patchedLoad(this: DataLoader, ...args: Parameters<typeof original>) {\n return startSpan(\n {\n name: getSpanName(this, 'load'),\n kind: SpanKind.CLIENT,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp('load'),\n },\n onlyIfParent: true,\n },\n span => {\n const result = original.call(this, ...args);\n\n if (this._batch && span.isRecording()) {\n if (!this._batch.spanLinks) {\n this._batch.spanLinks = [];\n }\n\n this._batch.spanLinks.push({ context: span.spanContext() });\n }\n\n return result;\n },\n );\n };\n }\n\n private _patchLoadMany(proto: DataLoader) {\n // oxlint-disable-next-line typescript/unbound-method\n if (isWrapped(proto.loadMany)) {\n this._unwrap(proto, 'loadMany');\n }\n\n this._wrap(proto, 'loadMany', this._getPatchedLoadMany.bind(this));\n }\n\n private _getPatchedLoadMany(original: LoadManyFn): LoadManyFn {\n return function patchedLoadMany(this: DataLoader, ...args: Parameters<typeof original>) {\n return startSpan(\n {\n name: getSpanName(this, 'loadMany'),\n kind: SpanKind.CLIENT,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp('loadMany'),\n },\n onlyIfParent: true,\n },\n () => original.call(this, ...args),\n );\n };\n }\n\n private _patchPrime(proto: DataLoader) {\n // oxlint-disable-next-line typescript/unbound-method\n if (isWrapped(proto.prime)) {\n this._unwrap(proto, 'prime');\n }\n\n this._wrap(proto, 'prime', this._getPatchedPrime.bind(this));\n }\n\n private _getPatchedPrime(original: PrimeFn): PrimeFn {\n return function patchedPrime(this: DataLoader, ...args: Parameters<typeof original>) {\n return startSpan(\n {\n name: getSpanName(this, 'prime'),\n kind: SpanKind.CLIENT,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp('prime'),\n },\n onlyIfParent: true,\n },\n () => original.call(this, ...args),\n );\n };\n }\n\n private _patchClear(proto: DataLoader) {\n // oxlint-disable-next-line typescript/unbound-method\n if (isWrapped(proto.clear)) {\n this._unwrap(proto, 'clear');\n }\n\n this._wrap(proto, 'clear', this._getPatchedClear.bind(this));\n }\n\n private _getPatchedClear(original: ClearFn): ClearFn {\n return function patchedClear(this: DataLoader, ...args: Parameters<typeof original>) {\n return startSpan(\n {\n name: getSpanName(this, 'clear'),\n kind: SpanKind.CLIENT,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp('clear'),\n },\n onlyIfParent: true,\n },\n () => original.call(this, ...args),\n );\n };\n }\n\n private _patchClearAll(proto: DataLoader) {\n // oxlint-disable-next-line typescript/unbound-method\n if (isWrapped(proto.clearAll)) {\n this._unwrap(proto, 'clearAll');\n }\n\n this._wrap(proto, 'clearAll', this._getPatchedClearAll.bind(this));\n }\n\n private _getPatchedClearAll(original: ClearAllFn): ClearAllFn {\n return function patchedClearAll(this: DataLoader, ...args: Parameters<typeof original>) {\n return startSpan(\n {\n name: getSpanName(this, 'clearAll'),\n kind: SpanKind.CLIENT,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp('clearAll'),\n },\n onlyIfParent: true,\n },\n () => original.call(this, ...args),\n );\n };\n }\n}\n"],"names":["InstrumentationBase","SDK_VERSION","InstrumentationNodeModuleDefinition","isWrapped","startSpan","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_OP","instrumentation","SpanKind"],"mappings":";;;;;;AAeA,MAAM,WAAA,GAAc,YAAA;AACpB,MAAM,YAAA,GAAe,oCAAA;AACrB,MAAM,MAAA,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,"file":"instrumentation.js","sources":["../../../../../../src/integrations/tracing/dataloader/vendored/instrumentation.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-dataloader\n * - Upstream version: @opentelemetry/instrumentation-dataloader@0.35.0\n * - Minor TypeScript strictness adjustments for this repository's compiler settings\n */\n\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';\nimport type { BatchLoadFn, DataLoader, DataLoaderConstructor } from './types';\nimport {\n SDK_VERSION,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n startSpan,\n} from '@sentry/core';\n\nconst MODULE_NAME = 'dataloader';\nconst PACKAGE_NAME = '@sentry/instrumentation-dataloader';\nconst ORIGIN = 'auto.db.otel.dataloader';\n\ntype LoadFn = DataLoader['load'];\ntype LoadManyFn = DataLoader['loadMany'];\ntype PrimeFn = DataLoader['prime'];\ntype ClearFn = DataLoader['clear'];\ntype ClearAllFn = DataLoader['clearAll'];\n\nfunction isModule(module: unknown): module is { [Symbol.toStringTag]: 'Module'; default: DataLoaderConstructor } {\n return (module as { [Symbol.toStringTag]: string })[Symbol.toStringTag] === 'Module';\n}\n\nfunction extractModuleExports(module: unknown): DataLoaderConstructor {\n return isModule(module)\n ? module.default // ESM\n : (module as DataLoaderConstructor); // CommonJS\n}\n\nfunction getSpanName(\n dataloader: DataLoader,\n operation: 'load' | 'loadMany' | 'batch' | 'prime' | 'clear' | 'clearAll',\n): string {\n const dataloaderName = dataloader.name;\n if (dataloaderName) {\n return `${MODULE_NAME}.${operation} ${dataloaderName}`;\n }\n\n return `${MODULE_NAME}.${operation}`;\n}\n\n// `load`, `loadMany` and `batch` are all cache reads\nfunction getSpanOp(operation: 'load' | 'loadMany' | 'batch' | 'prime' | 'clear' | 'clearAll'): string | undefined {\n if (operation === 'load' || operation === 'loadMany' || operation === 'batch') {\n return 'cache.get';\n }\n\n return undefined;\n}\n\nexport class DataloaderInstrumentation extends InstrumentationBase {\n constructor(config = {}) {\n super(PACKAGE_NAME, SDK_VERSION, config);\n }\n\n protected init() {\n return [\n new InstrumentationNodeModuleDefinition(\n MODULE_NAME,\n ['>=2.0.0 <3'],\n module => {\n const dataloader = extractModuleExports(module);\n this._patchLoad(dataloader.prototype);\n this._patchLoadMany(dataloader.prototype);\n this._patchPrime(dataloader.prototype);\n this._patchClear(dataloader.prototype);\n this._patchClearAll(dataloader.prototype);\n\n return this._getPatchedConstructor(dataloader);\n },\n module => {\n const dataloader = extractModuleExports(module);\n ['load', 'loadMany', 'prime', 'clear', 'clearAll'].forEach(method => {\n if (isWrapped(dataloader.prototype[method])) {\n this._unwrap(dataloader.prototype, method);\n }\n });\n },\n ),\n ];\n }\n\n private _wrapBatchLoadFn(batchLoadFn: BatchLoadFn<unknown, unknown>): BatchLoadFn<unknown, unknown> {\n // oxlint-disable-next-line typescript/no-this-alias\n const instrumentation = this;\n\n return function patchedBatchLoadFn(this: DataLoader, ...args: Parameters<BatchLoadFn<unknown, unknown>>) {\n if (!instrumentation.isEnabled()) {\n return batchLoadFn.call(this, ...args);\n }\n\n return startSpan(\n {\n name: getSpanName(this, 'batch'),\n links: this._batch?.spanLinks,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp('batch'),\n },\n onlyIfParent: true,\n },\n () => batchLoadFn.apply(this, args),\n );\n };\n }\n\n private _getPatchedConstructor(constructor: DataLoaderConstructor): DataLoaderConstructor {\n // oxlint-disable-next-line typescript/no-this-alias\n const instrumentation = this;\n const prototype = constructor.prototype;\n\n if (!instrumentation.isEnabled()) {\n return constructor;\n }\n\n // oxlint-disable-next-line typescript/no-explicit-any\n function PatchedDataloader(this: DataLoader, ...args: any[]) {\n // BatchLoadFn is the first constructor argument\n // https://github.com/graphql/dataloader/blob/77c2cd7ca97e8795242018ebc212ce2487e729d2/src/index.js#L47\n if (typeof args[0] === 'function') {\n if (isWrapped(args[0])) {\n instrumentation._unwrap(args, 0);\n }\n\n args[0] = instrumentation._wrapBatchLoadFn(args[0]);\n }\n\n return constructor.apply(this, args);\n }\n\n PatchedDataloader.prototype = prototype;\n return PatchedDataloader as unknown as DataLoaderConstructor;\n }\n\n private _patchLoad(proto: DataLoader) {\n // oxlint-disable-next-line typescript/unbound-method\n if (isWrapped(proto.load)) {\n this._unwrap(proto, 'load');\n }\n\n this._wrap(proto, 'load', this._getPatchedLoad.bind(this));\n }\n\n private _getPatchedLoad(original: LoadFn): LoadFn {\n return function patchedLoad(this: DataLoader, ...args: Parameters<typeof original>) {\n return startSpan(\n {\n name: getSpanName(this, 'load'),\n kind: SPAN_KIND.CLIENT,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp('load'),\n },\n onlyIfParent: true,\n },\n span => {\n const result = original.call(this, ...args);\n\n if (this._batch && span.isRecording()) {\n if (!this._batch.spanLinks) {\n this._batch.spanLinks = [];\n }\n\n this._batch.spanLinks.push({ context: span.spanContext() });\n }\n\n return result;\n },\n );\n };\n }\n\n private _patchLoadMany(proto: DataLoader) {\n // oxlint-disable-next-line typescript/unbound-method\n if (isWrapped(proto.loadMany)) {\n this._unwrap(proto, 'loadMany');\n }\n\n this._wrap(proto, 'loadMany', this._getPatchedLoadMany.bind(this));\n }\n\n private _getPatchedLoadMany(original: LoadManyFn): LoadManyFn {\n return function patchedLoadMany(this: DataLoader, ...args: Parameters<typeof original>) {\n return startSpan(\n {\n name: getSpanName(this, 'loadMany'),\n kind: SPAN_KIND.CLIENT,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp('loadMany'),\n },\n onlyIfParent: true,\n },\n () => original.call(this, ...args),\n );\n };\n }\n\n private _patchPrime(proto: DataLoader) {\n // oxlint-disable-next-line typescript/unbound-method\n if (isWrapped(proto.prime)) {\n this._unwrap(proto, 'prime');\n }\n\n this._wrap(proto, 'prime', this._getPatchedPrime.bind(this));\n }\n\n private _getPatchedPrime(original: PrimeFn): PrimeFn {\n return function patchedPrime(this: DataLoader, ...args: Parameters<typeof original>) {\n return startSpan(\n {\n name: getSpanName(this, 'prime'),\n kind: SPAN_KIND.CLIENT,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp('prime'),\n },\n onlyIfParent: true,\n },\n () => original.call(this, ...args),\n );\n };\n }\n\n private _patchClear(proto: DataLoader) {\n // oxlint-disable-next-line typescript/unbound-method\n if (isWrapped(proto.clear)) {\n this._unwrap(proto, 'clear');\n }\n\n this._wrap(proto, 'clear', this._getPatchedClear.bind(this));\n }\n\n private _getPatchedClear(original: ClearFn): ClearFn {\n return function patchedClear(this: DataLoader, ...args: Parameters<typeof original>) {\n return startSpan(\n {\n name: getSpanName(this, 'clear'),\n kind: SPAN_KIND.CLIENT,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp('clear'),\n },\n onlyIfParent: true,\n },\n () => original.call(this, ...args),\n );\n };\n }\n\n private _patchClearAll(proto: DataLoader) {\n // oxlint-disable-next-line typescript/unbound-method\n if (isWrapped(proto.clearAll)) {\n this._unwrap(proto, 'clearAll');\n }\n\n this._wrap(proto, 'clearAll', this._getPatchedClearAll.bind(this));\n }\n\n private _getPatchedClearAll(original: ClearAllFn): ClearAllFn {\n return function patchedClearAll(this: DataLoader, ...args: Parameters<typeof original>) {\n return startSpan(\n {\n name: getSpanName(this, 'clearAll'),\n kind: SPAN_KIND.CLIENT,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp('clearAll'),\n },\n onlyIfParent: true,\n },\n () => original.call(this, ...args),\n );\n };\n }\n}\n"],"names":["InstrumentationBase","SDK_VERSION","InstrumentationNodeModuleDefinition","isWrapped","startSpan","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_OP","instrumentation","SPAN_KIND"],"mappings":";;;;;AAoBA,MAAM,WAAA,GAAc,YAAA;AACpB,MAAM,YAAA,GAAe,oCAAA;AACrB,MAAM,MAAA,GAAS,yBAAA;AAQf,SAAS,SAAS,MAAA,EAA+F;AAC/G,EAAA,OAAQ,MAAA,CAA4C,MAAA,CAAO,WAAW,CAAA,KAAM,QAAA;AAC9E;AAEA,SAAS,qBAAqB,MAAA,EAAwC;AACpE,EAAA,OAAO,QAAA,CAAS,MAAM,CAAA,GAClB,MAAA,CAAO,OAAA,GACN,MAAA;AACP;AAEA,SAAS,WAAA,CACP,YACA,SAAA,EACQ;AACR,EAAA,MAAM,iBAAiB,UAAA,CAAW,IAAA;AAClC,EAAA,IAAI,cAAA,EAAgB;AAClB,IAAA,OAAO,CAAA,EAAG,WAAW,CAAA,CAAA,EAAI,SAAS,IAAI,cAAc,CAAA,CAAA;AAAA,EACtD;AAEA,EAAA,OAAO,CAAA,EAAG,WAAW,CAAA,CAAA,EAAI,SAAS,CAAA,CAAA;AACpC;AAGA,SAAS,UAAU,SAAA,EAA+F;AAChH,EAAA,IAAI,SAAA,KAAc,MAAA,IAAU,SAAA,KAAc,UAAA,IAAc,cAAc,OAAA,EAAS;AAC7E,IAAA,OAAO,WAAA;AAAA,EACT;AAEA,EAAA,OAAO,MAAA;AACT;AAEO,MAAM,kCAAkCA,mCAAA,CAAoB;AAAA,EACjE,W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oB,QAAA,EAAkC;AAC5D,IAAA,OAAO,SAAS,mBAAqC,IAAA,EAAmC;AACtF,MAAA,OAAOC,cAAA;AAAA,QACL;AAAA,UACE,IAAA,EAAM,WAAA,CAAY,IAAA,EAAM,UAAU,CAAA;AAAA,UAClC,MAAMI,cAAA,CAAU,MAAA;AAAA,UAChB,UAAA,EAAY;AAAA,YACV,CAACH,qCAAgC,GAAG,MAAA;AAAA,YACpC,CAACC,iCAA4B,GAAG,SAAA,CAAU,UAAU;AAAA,WACtD;AAAA,UACA,YAAA,EAAc;AAAA,SAChB;AAAA,QACA,MAAM,QAAA,CAAS,IAAA,CAAK,IAAA,EAAM,GAAG,IAAI;AAAA,OACnC;AAAA,IACF,CAAA;AAAA,EACF;AACF;;;;"}
@@ -5,30 +5,7 @@ const nodeCore = require('@sentry/node-core');
5
5
  const firebaseInstrumentation = require('./otel/firebaseInstrumentation.js');
6
6
 
7
7
  const INTEGRATION_NAME = "Firebase";
8
- const config = {
9
- firestoreSpanCreationHook: (span) => {
10
- nodeCore.addOriginToSpan(span, "auto.firebase.otel.firestore");
11
- span.setAttribute(core.SEMANTIC_ATTRIBUTE_SENTRY_OP, "db.query");
12
- },
13
- functions: {
14
- requestHook: (span) => {
15
- nodeCore.addOriginToSpan(span, "auto.firebase.otel.functions");
16
- span.setAttribute(core.SEMANTIC_ATTRIBUTE_SENTRY_OP, "http.request");
17
- },
18
- errorHook: async (_, error) => {
19
- if (error) {
20
- core.captureException(error, {
21
- mechanism: {
22
- type: "auto.firebase.otel.functions",
23
- handled: false
24
- }
25
- });
26
- await core.flush(2e3);
27
- }
28
- }
29
- }
30
- };
31
- const instrumentFirebase = nodeCore.generateInstrumentOnce(INTEGRATION_NAME, () => new firebaseInstrumentation.FirebaseInstrumentation(config));
8
+ const instrumentFirebase = nodeCore.generateInstrumentOnce(INTEGRATION_NAME, () => new firebaseInstrumentation.FirebaseInstrumentation());
32
9
  const _firebaseIntegration = (() => {
33
10
  return {
34
11
  name: INTEGRATION_NAME,
@@ -1 +1 @@
1
- {"version":3,"file":"firebase.js","sources":["../../../../../src/integrations/tracing/firebase/firebase.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { captureException, defineIntegration, flush, SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core';\nimport { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';\nimport { FirebaseInstrumentation, type FirebaseInstrumentationConfig } from './otel';\n\nconst INTEGRATION_NAME = 'Firebase';\n\nconst config: FirebaseInstrumentationConfig = {\n firestoreSpanCreationHook: span => {\n addOriginToSpan(span, 'auto.firebase.otel.firestore');\n\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'db.query');\n },\n functions: {\n requestHook: span => {\n addOriginToSpan(span, 'auto.firebase.otel.functions');\n\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'http.request');\n },\n errorHook: async (_, error) => {\n if (error) {\n captureException(error, {\n mechanism: {\n type: 'auto.firebase.otel.functions',\n handled: false,\n },\n });\n await flush(2000);\n }\n },\n },\n};\n\nexport const instrumentFirebase = generateInstrumentOnce(INTEGRATION_NAME, () => new FirebaseInstrumentation(config));\n\nconst _firebaseIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentFirebase();\n },\n };\n}) satisfies IntegrationFn;\n\nexport const firebaseIntegration = defineIntegration(_firebaseIntegration);\n"],"names":["addOriginToSpan","SEMANTIC_ATTRIBUTE_SENTRY_OP","captureException","flush","generateInstrumentOnce","FirebaseInstrumentation","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,UAAA;AAEzB,MAAM,MAAA,GAAwC;AAAA,EAC5C,2BAA2B,CAAA,IAAA,KAAQ;AACjC,IAAAA,wBAAA,CAAgB,MAAM,8BAA8B,CAAA;AAEpD,IAAA,IAAA,CAAK,YAAA,CAAaC,mCAA8B,UAAU,CAAA;AAAA,EAC5D,CAAA;AAAA,EACA,SAAA,EAAW;AAAA,IACT,aAAa,CAAA,IAAA,KAAQ;AACnB,MAAAD,wBAAA,CAAgB,MAAM,8BAA8B,CAAA;AAEpD,MAAA,IAAA,CAAK,YAAA,CAAaC,mCAA8B,cAAc,CAAA;AAAA,IAChE,CAAA;AAAA,IACA,SAAA,EAAW,OAAO,CAAA,EAAG,KAAA,KAAU;AAC7B,MAAA,IAAI,KAAA,EAAO;AACT,QAAAC,qBAAA,CAAiB,KAAA,EAAO;AAAA,UACtB,SAAA,EAAW;AAAA,YACT,IAAA,EAAM,8BAAA;AAAA,YACN,OAAA,EAAS;AAAA;AACX,SACD,CAAA;AACD,QAAA,MAAMC,WAAM,GAAI,CAAA;AAAA,MAClB;AAAA,IACF;AAAA;AAEJ,CAAA;AAEO,MAAM,qBAAqBC,+BAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAIC,+CAAA,CAAwB,MAAM,CAAC;AAEpH,MAAM,wBAAwB,MAAM;AAClC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,kBAAA,EAAmB;AAAA,IACrB;AAAA,GACF;AACF,CAAA,CAAA;AAEO,MAAM,mBAAA,GAAsBC,uBAAkB,oBAAoB;;;;;"}
1
+ {"version":3,"file":"firebase.js","sources":["../../../../../src/integrations/tracing/firebase/firebase.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\nimport { FirebaseInstrumentation } from './otel';\n\nconst INTEGRATION_NAME = 'Firebase';\n\nexport const instrumentFirebase = generateInstrumentOnce(INTEGRATION_NAME, () => new FirebaseInstrumentation());\n\nconst _firebaseIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentFirebase();\n },\n };\n}) satisfies IntegrationFn;\n\nexport const firebaseIntegration = defineIntegration(_firebaseIntegration);\n"],"names":["generateInstrumentOnce","FirebaseInstrumentation","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,UAAA;AAElB,MAAM,qBAAqBA,+BAAA,CAAuB,gBAAA,EAAkB,MAAM,IAAIC,iDAAyB;AAE9G,MAAM,wBAAwB,MAAM;AAClC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,kBAAA,EAAmB;AAAA,IACrB;AAAA,GACF;AACF,CAAA,CAAA;AAEO,MAAM,mBAAA,GAAsBC,uBAAkB,oBAAoB;;;;;"}
@@ -5,20 +5,12 @@ const core = require('@sentry/core');
5
5
  const firestore = require('./patches/firestore.js');
6
6
  const functions = require('./patches/functions.js');
7
7
 
8
- const DefaultFirebaseInstrumentationConfig = {};
9
8
  const firestoreSupportedVersions = [">=3.0.0 <5"];
10
9
  const functionsSupportedVersions = [">=6.0.0 <7"];
11
10
  class FirebaseInstrumentation extends instrumentation.InstrumentationBase {
12
- constructor(config = DefaultFirebaseInstrumentationConfig) {
11
+ constructor(config = {}) {
13
12
  super("@sentry/instrumentation-firebase", core.SDK_VERSION, config);
14
13
  }
15
- /**
16
- * sets config
17
- * @param config
18
- */
19
- setConfig(config = {}) {
20
- super.setConfig({ ...DefaultFirebaseInstrumentationConfig, ...config });
21
- }
22
14
  /**
23
15
  *
24
16
  * @protected
@@ -26,8 +18,8 @@ class FirebaseInstrumentation extends instrumentation.InstrumentationBase {
26
18
  // eslint-disable-next-line @typescript-eslint/naming-convention
27
19
  init() {
28
20
  const modules = [];
29
- modules.push(firestore.patchFirestore(this.tracer, firestoreSupportedVersions, this._wrap, this._unwrap, this.getConfig()));
30
- modules.push(functions.patchFunctions(this.tracer, functionsSupportedVersions, this._wrap, this._unwrap, this.getConfig()));
21
+ modules.push(firestore.patchFirestore(firestoreSupportedVersions, this._wrap, this._unwrap));
22
+ modules.push(functions.patchFunctions(functionsSupportedVersions, this._wrap, this._unwrap));
31
23
  return modules;
32
24
  }
33
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"firebaseInstrumentation.js","sources":["../../../../../../src/integrations/tracing/firebase/otel/firebaseInstrumentation.ts"],"sourcesContent":["import { InstrumentationBase, type InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';\nimport { SDK_VERSION } from '@sentry/core';\nimport { patchFirestore } from './patches/firestore';\nimport { patchFunctions } from './patches/functions';\nimport type { FirebaseInstrumentationConfig } from './types';\n\nconst DefaultFirebaseInstrumentationConfig: FirebaseInstrumentationConfig = {};\nconst firestoreSupportedVersions = ['>=3.0.0 <5']; // firebase 9+\nconst functionsSupportedVersions = ['>=6.0.0 <7']; // firebase-functions v2\n\n/**\n * Instrumentation for Firebase services, specifically Firestore.\n */\nexport class FirebaseInstrumentation extends InstrumentationBase<FirebaseInstrumentationConfig> {\n public constructor(config: FirebaseInstrumentationConfig = DefaultFirebaseInstrumentationConfig) {\n super('@sentry/instrumentation-firebase', SDK_VERSION, config);\n }\n\n /**\n * sets config\n * @param config\n */\n public override setConfig(config: FirebaseInstrumentationConfig = {}): void {\n super.setConfig({ ...DefaultFirebaseInstrumentationConfig, ...config });\n }\n\n /**\n *\n * @protected\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected init(): InstrumentationNodeModuleDefinition | InstrumentationNodeModuleDefinition[] | void {\n const modules: InstrumentationNodeModuleDefinition[] = [];\n\n modules.push(patchFirestore(this.tracer, firestoreSupportedVersions, this._wrap, this._unwrap, this.getConfig()));\n modules.push(patchFunctions(this.tracer, functionsSupportedVersions, this._wrap, this._unwrap, this.getConfig()));\n\n return modules;\n }\n}\n"],"names":["InstrumentationBase","SDK_VERSION","patchFirestore","patchFunctions"],"mappings":";;;;;;;AAMA,MAAM,uCAAsE,EAAC;AAC7E,MAAM,0BAAA,GAA6B,CAAC,YAAY,CAAA;AAChD,MAAM,0BAAA,GAA6B,CAAC,YAAY,CAAA;AAKzC,MAAM,gCAAgCA,mCAAA,CAAmD;AAAA,EACvF,WAAA,CAAY,SAAwC,oCAAA,EAAsC;AAC/F,IAAA,KAAA,CAAM,kCAAA,EAAoCC,kBAAa,MAAM,CAAA;AAAA,EAC/D;AAAA;AAAA;AAAA;AAAA;AAAA,EAMgB,SAAA,CAAU,MAAA,GAAwC,EAAC,EAAS;AAC1E,IAAA,KAAA,CAAM,UAAU,EAAE,GAAG,oCAAA,EAAsC,GAAG,QAAQ,CAAA;AAAA,EACxE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOU,IAAA,GAA2F;AACnG,IAAA,MAAM,UAAiD,EAAC;AAExD,IAAA,OAAA,CAAQ,IAAA,CAAKC,wBAAA,CAAe,IAAA,CAAK,MAAA,EAAQ,0BAAA,EAA4B,IAAA,CAAK,KAAA,EAAO,IAAA,CAAK,OAAA,EAAS,IAAA,CAAK,SAAA,EAAW,CAAC,CAAA;AAChH,IAAA,OAAA,CAAQ,IAAA,CAAKC,wBAAA,CAAe,IAAA,CAAK,MAAA,EAAQ,0BAAA,EAA4B,IAAA,CAAK,KAAA,EAAO,IAAA,CAAK,OAAA,EAAS,IAAA,CAAK,SAAA,EAAW,CAAC,CAAA;AAEhH,IAAA,OAAO,OAAA;AAAA,EACT;AACF;;;;"}
1
+ {"version":3,"file":"firebaseInstrumentation.js","sources":["../../../../../../src/integrations/tracing/firebase/otel/firebaseInstrumentation.ts"],"sourcesContent":["import type { InstrumentationConfig, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';\nimport { InstrumentationBase } from '@opentelemetry/instrumentation';\nimport { SDK_VERSION } from '@sentry/core';\nimport { patchFirestore } from './patches/firestore';\nimport { patchFunctions } from './patches/functions';\n\nconst firestoreSupportedVersions = ['>=3.0.0 <5']; // firebase 9+\nconst functionsSupportedVersions = ['>=6.0.0 <7']; // firebase-functions v2\n\n/**\n * Instrumentation for Firebase services, specifically Firestore.\n */\nexport class FirebaseInstrumentation extends InstrumentationBase<InstrumentationConfig> {\n public constructor(config: InstrumentationConfig = {}) {\n super('@sentry/instrumentation-firebase', SDK_VERSION, config);\n }\n\n /**\n *\n * @protected\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected init(): InstrumentationNodeModuleDefinition | InstrumentationNodeModuleDefinition[] | void {\n const modules: InstrumentationNodeModuleDefinition[] = [];\n\n modules.push(patchFirestore(firestoreSupportedVersions, this._wrap, this._unwrap));\n modules.push(patchFunctions(functionsSupportedVersions, this._wrap, this._unwrap));\n\n return modules;\n }\n}\n"],"names":["InstrumentationBase","SDK_VERSION","patchFirestore","patchFunctions"],"mappings":";;;;;;;AAMA,MAAM,0BAAA,GAA6B,CAAC,YAAY,CAAA;AAChD,MAAM,0BAAA,GAA6B,CAAC,YAAY,CAAA;AAKzC,MAAM,gCAAgCA,mCAAA,CAA2C;AAAA,EAC/E,WAAA,CAAY,MAAA,GAAgC,EAAC,EAAG;AACrD,IAAA,KAAA,CAAM,kCAAA,EAAoCC,kBAAa,MAAM,CAAA;AAAA,EAC/D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOU,IAAA,GAA2F;AACnG,IAAA,MAAM,UAAiD,EAAC;AAExD,IAAA,OAAA,CAAQ,KAAKC,wBAAA,CAAe,0BAAA,EAA4B,KAAK,KAAA,EAAO,IAAA,CAAK,OAAO,CAAC,CAAA;AACjF,IAAA,OAAA,CAAQ,KAAKC,wBAAA,CAAe,0BAAA,EAA4B,KAAK,KAAA,EAAO,IAAA,CAAK,OAAO,CAAC,CAAA;AAEjF,IAAA,OAAO,OAAA;AAAA,EACT;AACF;;;;"}