@opentelemetry/otlp-exporter-base 0.54.2 → 0.56.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 (309) hide show
  1. package/README.md +1 -7
  2. package/build/esm/OTLPExporterBase.d.ts +7 -28
  3. package/build/esm/OTLPExporterBase.js +6 -69
  4. package/build/esm/OTLPExporterBase.js.map +1 -1
  5. package/build/esm/bounded-queue-export-promise-handler.d.ts +13 -0
  6. package/build/esm/bounded-queue-export-promise-handler.js +96 -0
  7. package/build/esm/bounded-queue-export-promise-handler.js.map +1 -0
  8. package/build/esm/configuration/convert-legacy-browser-http-options.d.ts +11 -0
  9. package/build/esm/configuration/convert-legacy-browser-http-options.js +34 -0
  10. package/build/esm/configuration/convert-legacy-browser-http-options.js.map +1 -0
  11. package/build/esm/configuration/convert-legacy-node-http-options.d.ts +11 -0
  12. package/build/esm/configuration/convert-legacy-node-http-options.js +45 -0
  13. package/build/esm/configuration/convert-legacy-node-http-options.js.map +1 -0
  14. package/build/esm/configuration/create-legacy-browser-delegate.d.ts +12 -0
  15. package/build/esm/configuration/create-legacy-browser-delegate.js +20 -0
  16. package/build/esm/configuration/create-legacy-browser-delegate.js.map +1 -0
  17. package/build/esm/configuration/legacy-base-configuration.d.ts +9 -0
  18. package/build/esm/configuration/legacy-base-configuration.js +2 -0
  19. package/build/esm/configuration/legacy-base-configuration.js.map +1 -0
  20. package/build/{esnext/platform/node/types.d.ts → esm/configuration/legacy-node-configuration.d.ts} +2 -2
  21. package/build/esm/{platform/node/index.js → configuration/legacy-node-configuration.js} +6 -3
  22. package/build/esm/configuration/legacy-node-configuration.js.map +1 -0
  23. package/build/esm/configuration/otlp-http-configuration.d.ts +5 -1
  24. package/build/esm/configuration/otlp-http-configuration.js +16 -14
  25. package/build/esm/configuration/otlp-http-configuration.js.map +1 -1
  26. package/build/esm/configuration/otlp-http-env-configuration.js +3 -2
  27. package/build/esm/configuration/otlp-http-env-configuration.js.map +1 -1
  28. package/build/esm/configuration/shared-configuration.d.ts +1 -0
  29. package/build/esm/configuration/shared-configuration.js +6 -0
  30. package/build/esm/configuration/shared-configuration.js.map +1 -1
  31. package/build/esm/index-browser-http.d.ts +4 -0
  32. package/build/esm/index-browser-http.js +19 -0
  33. package/build/esm/index-browser-http.js.map +1 -0
  34. package/build/esm/index-node-http.d.ts +4 -0
  35. package/build/esm/index-node-http.js +19 -0
  36. package/build/esm/index-node-http.js.map +1 -0
  37. package/build/esm/index.d.ts +5 -4
  38. package/build/esm/index.js +3 -7
  39. package/build/esm/index.js.map +1 -1
  40. package/build/esm/logging-response-handler.d.ts +6 -0
  41. package/build/esm/logging-response-handler.js +38 -0
  42. package/build/esm/logging-response-handler.js.map +1 -0
  43. package/build/esm/otlp-browser-http-export-delegate.d.ts +6 -0
  44. package/build/esm/otlp-browser-http-export-delegate.js +18 -0
  45. package/build/esm/otlp-browser-http-export-delegate.js.map +1 -0
  46. package/build/esm/otlp-export-delegate.d.ts +24 -0
  47. package/build/esm/otlp-export-delegate.js +155 -0
  48. package/build/esm/otlp-export-delegate.js.map +1 -0
  49. package/build/esm/otlp-http-export-delegate.d.ts +5 -0
  50. package/build/esm/otlp-http-export-delegate.js +29 -0
  51. package/build/esm/otlp-http-export-delegate.js.map +1 -0
  52. package/build/esm/otlp-network-export-delegate.d.ts +6 -0
  53. package/build/esm/otlp-network-export-delegate.js +25 -0
  54. package/build/esm/otlp-network-export-delegate.js.map +1 -0
  55. package/build/esm/response-handler.d.ts +12 -0
  56. package/build/esm/{platform/browser/index.js → response-handler.js} +2 -2
  57. package/build/esm/response-handler.js.map +1 -0
  58. package/build/esm/{platform/node → transport}/http-exporter-transport.d.ts +1 -1
  59. package/build/esm/transport/http-exporter-transport.js.map +1 -0
  60. package/build/{esnext/platform/node → esm/transport}/http-transport-types.d.ts +2 -2
  61. package/build/esm/transport/http-transport-types.js.map +1 -0
  62. package/build/{esnext/platform/node → esm/transport}/http-transport-utils.d.ts +2 -1
  63. package/build/esm/{platform/node → transport}/http-transport-utils.js +6 -6
  64. package/build/esm/transport/http-transport-utils.js.map +1 -0
  65. package/build/esm/{platform/browser → transport}/send-beacon-transport.d.ts +1 -1
  66. package/build/esm/transport/send-beacon-transport.js.map +1 -0
  67. package/build/{esnext/platform/browser → esm/transport}/xhr-transport.d.ts +2 -2
  68. package/build/esm/{platform/browser → transport}/xhr-transport.js +4 -3
  69. package/build/esm/transport/xhr-transport.js.map +1 -0
  70. package/build/esm/types.d.ts +0 -11
  71. package/build/esm/types.js.map +1 -1
  72. package/build/esm/util.d.ts +1 -1
  73. package/build/esm/util.js +14 -12
  74. package/build/esm/util.js.map +1 -1
  75. package/build/esm/version.d.ts +1 -1
  76. package/build/esm/version.js +1 -1
  77. package/build/esm/version.js.map +1 -1
  78. package/build/esnext/OTLPExporterBase.d.ts +7 -28
  79. package/build/esnext/OTLPExporterBase.js +6 -67
  80. package/build/esnext/OTLPExporterBase.js.map +1 -1
  81. package/build/esnext/bounded-queue-export-promise-handler.d.ts +13 -0
  82. package/build/esnext/bounded-queue-export-promise-handler.js +49 -0
  83. package/build/esnext/bounded-queue-export-promise-handler.js.map +1 -0
  84. package/build/esnext/configuration/convert-legacy-browser-http-options.d.ts +11 -0
  85. package/build/esnext/configuration/convert-legacy-browser-http-options.js +34 -0
  86. package/build/esnext/configuration/convert-legacy-browser-http-options.js.map +1 -0
  87. package/build/esnext/configuration/convert-legacy-node-http-options.d.ts +11 -0
  88. package/build/esnext/configuration/convert-legacy-node-http-options.js +45 -0
  89. package/build/esnext/configuration/convert-legacy-node-http-options.js.map +1 -0
  90. package/build/esnext/configuration/create-legacy-browser-delegate.d.ts +12 -0
  91. package/build/esnext/configuration/create-legacy-browser-delegate.js +20 -0
  92. package/build/esnext/configuration/create-legacy-browser-delegate.js.map +1 -0
  93. package/build/esnext/configuration/legacy-base-configuration.d.ts +9 -0
  94. package/build/esnext/configuration/legacy-base-configuration.js +2 -0
  95. package/build/esnext/configuration/legacy-base-configuration.js.map +1 -0
  96. package/build/{src/platform/node/types.d.ts → esnext/configuration/legacy-node-configuration.d.ts} +2 -2
  97. package/build/{esm/platform/index.js → esnext/configuration/legacy-node-configuration.js} +6 -3
  98. package/build/esnext/configuration/legacy-node-configuration.js.map +1 -0
  99. package/build/esnext/configuration/otlp-http-configuration.d.ts +5 -1
  100. package/build/esnext/configuration/otlp-http-configuration.js +16 -14
  101. package/build/esnext/configuration/otlp-http-configuration.js.map +1 -1
  102. package/build/esnext/configuration/otlp-http-env-configuration.js +3 -2
  103. package/build/esnext/configuration/otlp-http-env-configuration.js.map +1 -1
  104. package/build/esnext/configuration/shared-configuration.d.ts +1 -0
  105. package/build/esnext/configuration/shared-configuration.js +6 -0
  106. package/build/esnext/configuration/shared-configuration.js.map +1 -1
  107. package/build/esnext/index-browser-http.d.ts +4 -0
  108. package/build/esnext/index-browser-http.js +19 -0
  109. package/build/esnext/index-browser-http.js.map +1 -0
  110. package/build/esnext/index-node-http.d.ts +4 -0
  111. package/build/esnext/index-node-http.js +19 -0
  112. package/build/esnext/index-node-http.js.map +1 -0
  113. package/build/esnext/index.d.ts +5 -4
  114. package/build/esnext/index.js +3 -7
  115. package/build/esnext/index.js.map +1 -1
  116. package/build/esnext/logging-response-handler.d.ts +6 -0
  117. package/build/esnext/logging-response-handler.js +38 -0
  118. package/build/esnext/logging-response-handler.js.map +1 -0
  119. package/build/esnext/otlp-browser-http-export-delegate.d.ts +6 -0
  120. package/build/esnext/otlp-browser-http-export-delegate.js +18 -0
  121. package/build/esnext/otlp-browser-http-export-delegate.js.map +1 -0
  122. package/build/esnext/otlp-export-delegate.d.ts +24 -0
  123. package/build/esnext/otlp-export-delegate.js +105 -0
  124. package/build/esnext/otlp-export-delegate.js.map +1 -0
  125. package/build/esnext/otlp-http-export-delegate.d.ts +5 -0
  126. package/build/esnext/otlp-http-export-delegate.js +29 -0
  127. package/build/esnext/otlp-http-export-delegate.js.map +1 -0
  128. package/build/esnext/otlp-network-export-delegate.d.ts +6 -0
  129. package/build/esnext/otlp-network-export-delegate.js +25 -0
  130. package/build/esnext/otlp-network-export-delegate.js.map +1 -0
  131. package/build/esnext/response-handler.d.ts +12 -0
  132. package/build/esnext/{platform/browser/index.js → response-handler.js} +2 -2
  133. package/build/esnext/response-handler.js.map +1 -0
  134. package/build/esnext/{platform/node → transport}/http-exporter-transport.d.ts +1 -1
  135. package/build/esnext/transport/http-exporter-transport.js.map +1 -0
  136. package/build/{src/platform/node → esnext/transport}/http-transport-types.d.ts +2 -2
  137. package/build/esnext/transport/http-transport-types.js.map +1 -0
  138. package/build/{esm/platform/node → esnext/transport}/http-transport-utils.d.ts +2 -1
  139. package/build/esnext/{platform/node → transport}/http-transport-utils.js +6 -6
  140. package/build/esnext/transport/http-transport-utils.js.map +1 -0
  141. package/build/{src/platform/browser → esnext/transport}/send-beacon-transport.d.ts +1 -1
  142. package/build/esnext/transport/send-beacon-transport.js.map +1 -0
  143. package/build/{src/platform/browser → esnext/transport}/xhr-transport.d.ts +2 -2
  144. package/build/esnext/{platform/browser → transport}/xhr-transport.js +4 -3
  145. package/build/esnext/transport/xhr-transport.js.map +1 -0
  146. package/build/esnext/types.d.ts +0 -11
  147. package/build/esnext/types.js.map +1 -1
  148. package/build/esnext/util.d.ts +1 -1
  149. package/build/esnext/util.js +14 -11
  150. package/build/esnext/util.js.map +1 -1
  151. package/build/esnext/version.d.ts +1 -1
  152. package/build/esnext/version.js +1 -1
  153. package/build/esnext/version.js.map +1 -1
  154. package/build/src/OTLPExporterBase.d.ts +7 -28
  155. package/build/src/OTLPExporterBase.js +6 -67
  156. package/build/src/OTLPExporterBase.js.map +1 -1
  157. package/build/src/bounded-queue-export-promise-handler.d.ts +13 -0
  158. package/build/src/bounded-queue-export-promise-handler.js +53 -0
  159. package/build/src/bounded-queue-export-promise-handler.js.map +1 -0
  160. package/build/src/configuration/convert-legacy-browser-http-options.d.ts +11 -0
  161. package/build/src/configuration/convert-legacy-browser-http-options.js +38 -0
  162. package/build/src/configuration/convert-legacy-browser-http-options.js.map +1 -0
  163. package/build/src/configuration/convert-legacy-node-http-options.d.ts +11 -0
  164. package/build/src/configuration/convert-legacy-node-http-options.js +49 -0
  165. package/build/src/configuration/convert-legacy-node-http-options.js.map +1 -0
  166. package/build/src/configuration/create-legacy-browser-delegate.d.ts +12 -0
  167. package/build/src/configuration/create-legacy-browser-delegate.js +24 -0
  168. package/build/src/configuration/create-legacy-browser-delegate.js.map +1 -0
  169. package/build/src/configuration/legacy-base-configuration.d.ts +9 -0
  170. package/build/src/configuration/legacy-base-configuration.js +3 -0
  171. package/build/src/configuration/legacy-base-configuration.js.map +1 -0
  172. package/build/{esm/platform/node/types.d.ts → src/configuration/legacy-node-configuration.d.ts} +2 -2
  173. package/build/src/{platform/browser/index.js → configuration/legacy-node-configuration.js} +7 -4
  174. package/build/src/configuration/legacy-node-configuration.js.map +1 -0
  175. package/build/src/configuration/otlp-http-configuration.d.ts +5 -1
  176. package/build/src/configuration/otlp-http-configuration.js +16 -14
  177. package/build/src/configuration/otlp-http-configuration.js.map +1 -1
  178. package/build/src/configuration/otlp-http-env-configuration.js +3 -2
  179. package/build/src/configuration/otlp-http-env-configuration.js.map +1 -1
  180. package/build/src/configuration/shared-configuration.d.ts +1 -0
  181. package/build/src/configuration/shared-configuration.js +8 -1
  182. package/build/src/configuration/shared-configuration.js.map +1 -1
  183. package/build/src/index-browser-http.d.ts +4 -0
  184. package/build/src/index-browser-http.js +26 -0
  185. package/build/src/index-browser-http.js.map +1 -0
  186. package/build/src/index-node-http.d.ts +4 -0
  187. package/build/src/index-node-http.js +25 -0
  188. package/build/src/index-node-http.js.map +1 -0
  189. package/build/src/index.d.ts +5 -4
  190. package/build/src/index.js +5 -19
  191. package/build/src/index.js.map +1 -1
  192. package/build/src/logging-response-handler.d.ts +6 -0
  193. package/build/src/logging-response-handler.js +42 -0
  194. package/build/src/logging-response-handler.js.map +1 -0
  195. package/build/src/otlp-browser-http-export-delegate.d.ts +6 -0
  196. package/build/src/otlp-browser-http-export-delegate.js +23 -0
  197. package/build/src/otlp-browser-http-export-delegate.js.map +1 -0
  198. package/build/src/otlp-export-delegate.d.ts +24 -0
  199. package/build/src/otlp-export-delegate.js +109 -0
  200. package/build/src/otlp-export-delegate.js.map +1 -0
  201. package/build/src/otlp-http-export-delegate.d.ts +5 -0
  202. package/build/src/otlp-http-export-delegate.js +33 -0
  203. package/build/src/otlp-http-export-delegate.js.map +1 -0
  204. package/build/src/otlp-network-export-delegate.d.ts +6 -0
  205. package/build/src/otlp-network-export-delegate.js +29 -0
  206. package/build/src/otlp-network-export-delegate.js.map +1 -0
  207. package/build/src/response-handler.d.ts +12 -0
  208. package/build/src/response-handler.js +18 -0
  209. package/build/src/response-handler.js.map +1 -0
  210. package/build/src/{platform/node → transport}/http-exporter-transport.d.ts +1 -1
  211. package/build/src/transport/http-exporter-transport.js.map +1 -0
  212. package/build/{esm/platform/node → src/transport}/http-transport-types.d.ts +2 -2
  213. package/build/src/transport/http-transport-types.js.map +1 -0
  214. package/build/src/{platform/node → transport}/http-transport-utils.d.ts +2 -1
  215. package/build/src/{platform/node → transport}/http-transport-utils.js +7 -6
  216. package/build/src/transport/http-transport-utils.js.map +1 -0
  217. package/build/{esnext/platform/browser → src/transport}/send-beacon-transport.d.ts +1 -1
  218. package/build/src/transport/send-beacon-transport.js.map +1 -0
  219. package/build/{esm/platform/browser → src/transport}/xhr-transport.d.ts +2 -2
  220. package/build/src/{platform/browser → transport}/xhr-transport.js +4 -3
  221. package/build/src/transport/xhr-transport.js.map +1 -0
  222. package/build/src/types.d.ts +0 -11
  223. package/build/src/types.js.map +1 -1
  224. package/build/src/util.d.ts +1 -1
  225. package/build/src/util.js +14 -11
  226. package/build/src/util.js.map +1 -1
  227. package/build/src/version.d.ts +1 -1
  228. package/build/src/version.js +1 -1
  229. package/build/src/version.js.map +1 -1
  230. package/package.json +42 -15
  231. package/build/esm/platform/browser/OTLPExporterBrowserBase.d.ts +0 -21
  232. package/build/esm/platform/browser/OTLPExporterBrowserBase.js +0 -118
  233. package/build/esm/platform/browser/OTLPExporterBrowserBase.js.map +0 -1
  234. package/build/esm/platform/browser/index.d.ts +0 -2
  235. package/build/esm/platform/browser/index.js.map +0 -1
  236. package/build/esm/platform/browser/send-beacon-transport.js.map +0 -1
  237. package/build/esm/platform/browser/xhr-transport.js.map +0 -1
  238. package/build/esm/platform/index.d.ts +0 -3
  239. package/build/esm/platform/index.js.map +0 -1
  240. package/build/esm/platform/node/OTLPExporterNodeBase.d.ts +0 -16
  241. package/build/esm/platform/node/OTLPExporterNodeBase.js +0 -109
  242. package/build/esm/platform/node/OTLPExporterNodeBase.js.map +0 -1
  243. package/build/esm/platform/node/convert-legacy-agent-options.d.ts +0 -12
  244. package/build/esm/platform/node/convert-legacy-agent-options.js +0 -27
  245. package/build/esm/platform/node/convert-legacy-agent-options.js.map +0 -1
  246. package/build/esm/platform/node/http-exporter-transport.js.map +0 -1
  247. package/build/esm/platform/node/http-transport-types.js.map +0 -1
  248. package/build/esm/platform/node/http-transport-utils.js.map +0 -1
  249. package/build/esm/platform/node/index.d.ts +0 -3
  250. package/build/esm/platform/node/index.js.map +0 -1
  251. package/build/esm/platform/node/types.js +0 -6
  252. package/build/esm/platform/node/types.js.map +0 -1
  253. package/build/esnext/platform/browser/OTLPExporterBrowserBase.d.ts +0 -21
  254. package/build/esnext/platform/browser/OTLPExporterBrowserBase.js +0 -97
  255. package/build/esnext/platform/browser/OTLPExporterBrowserBase.js.map +0 -1
  256. package/build/esnext/platform/browser/index.d.ts +0 -2
  257. package/build/esnext/platform/browser/index.js.map +0 -1
  258. package/build/esnext/platform/browser/send-beacon-transport.js.map +0 -1
  259. package/build/esnext/platform/browser/xhr-transport.js.map +0 -1
  260. package/build/esnext/platform/index.d.ts +0 -3
  261. package/build/esnext/platform/index.js +0 -18
  262. package/build/esnext/platform/index.js.map +0 -1
  263. package/build/esnext/platform/node/OTLPExporterNodeBase.d.ts +0 -16
  264. package/build/esnext/platform/node/OTLPExporterNodeBase.js +0 -88
  265. package/build/esnext/platform/node/OTLPExporterNodeBase.js.map +0 -1
  266. package/build/esnext/platform/node/convert-legacy-agent-options.d.ts +0 -12
  267. package/build/esnext/platform/node/convert-legacy-agent-options.js +0 -27
  268. package/build/esnext/platform/node/convert-legacy-agent-options.js.map +0 -1
  269. package/build/esnext/platform/node/http-exporter-transport.js.map +0 -1
  270. package/build/esnext/platform/node/http-transport-types.js.map +0 -1
  271. package/build/esnext/platform/node/http-transport-utils.js.map +0 -1
  272. package/build/esnext/platform/node/index.d.ts +0 -3
  273. package/build/esnext/platform/node/index.js +0 -18
  274. package/build/esnext/platform/node/index.js.map +0 -1
  275. package/build/esnext/platform/node/types.js +0 -6
  276. package/build/esnext/platform/node/types.js.map +0 -1
  277. package/build/src/platform/browser/OTLPExporterBrowserBase.d.ts +0 -21
  278. package/build/src/platform/browser/OTLPExporterBrowserBase.js +0 -101
  279. package/build/src/platform/browser/OTLPExporterBrowserBase.js.map +0 -1
  280. package/build/src/platform/browser/index.d.ts +0 -2
  281. package/build/src/platform/browser/index.js.map +0 -1
  282. package/build/src/platform/browser/send-beacon-transport.js.map +0 -1
  283. package/build/src/platform/browser/xhr-transport.js.map +0 -1
  284. package/build/src/platform/index.d.ts +0 -3
  285. package/build/src/platform/index.js +0 -24
  286. package/build/src/platform/index.js.map +0 -1
  287. package/build/src/platform/node/OTLPExporterNodeBase.d.ts +0 -16
  288. package/build/src/platform/node/OTLPExporterNodeBase.js +0 -92
  289. package/build/src/platform/node/OTLPExporterNodeBase.js.map +0 -1
  290. package/build/src/platform/node/convert-legacy-agent-options.d.ts +0 -12
  291. package/build/src/platform/node/convert-legacy-agent-options.js +0 -31
  292. package/build/src/platform/node/convert-legacy-agent-options.js.map +0 -1
  293. package/build/src/platform/node/http-exporter-transport.js.map +0 -1
  294. package/build/src/platform/node/http-transport-types.js.map +0 -1
  295. package/build/src/platform/node/http-transport-utils.js.map +0 -1
  296. package/build/src/platform/node/index.d.ts +0 -3
  297. package/build/src/platform/node/index.js +0 -23
  298. package/build/src/platform/node/index.js.map +0 -1
  299. package/build/src/platform/node/types.js +0 -9
  300. package/build/src/platform/node/types.js.map +0 -1
  301. /package/build/esm/{platform/node → transport}/http-exporter-transport.js +0 -0
  302. /package/build/esm/{platform/node → transport}/http-transport-types.js +0 -0
  303. /package/build/esm/{platform/browser → transport}/send-beacon-transport.js +0 -0
  304. /package/build/esnext/{platform/node → transport}/http-exporter-transport.js +0 -0
  305. /package/build/esnext/{platform/node → transport}/http-transport-types.js +0 -0
  306. /package/build/esnext/{platform/browser → transport}/send-beacon-transport.js +0 -0
  307. /package/build/src/{platform/node → transport}/http-exporter-transport.js +0 -0
  308. /package/build/src/{platform/node → transport}/http-transport-types.js +0 -0
  309. /package/build/src/{platform/browser → transport}/send-beacon-transport.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-handler.js","sourceRoot":"","sources":["../../src/response-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Generic export response handler. Can be implemented to handle export responses like partial success.\n */\nexport interface IOtlpResponseHandler<Response> {\n /**\n * Handles an OTLP export response.\n * Implementations MUST NOT throw.\n * @param response\n */\n handleResponse(response: Response): void;\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  import type { HttpRequestParameters } from './http-transport-types';
2
- import { IExporterTransport } from '../../exporter-transport';
2
+ import { IExporterTransport } from '../exporter-transport';
3
3
  export declare function createHttpExporterTransport(parameters: HttpRequestParameters): IExporterTransport;
4
4
  //# sourceMappingURL=http-exporter-transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-exporter-transport.js","sourceRoot":"","sources":["../../../src/transport/http-exporter-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcH;IAIE,+BAAoB,WAAkC;QAAlC,gBAAW,GAAX,WAAW,CAAuB;QAH9C,UAAK,GAAwB,IAAI,CAAC;QAClC,WAAM,GAAoC,IAAI,CAAC;IAEE,CAAC;IAEpD,oCAAI,GAAV,UAAW,IAAgB,EAAE,aAAqB;;;;;gBAChD,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE;oBAEhB,KAIF,OAAO,CAAC,wBAAwB,CAAC,EAHnC,YAAY,kBAAA,EACZ,eAAe,qBAAA,CAEqB;oBACtC,IAAI,CAAC,MAAM,GAAG,eAAe,CAC3B,IAAI,CAAC,WAAW,CAAC,GAAG,EACpB,IAAI,CAAC,WAAW,CAAC,YAAY,CAC9B,CAAC;oBACF,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC;iBAC3B;gBAED,sBAAO,IAAI,OAAO,CAAiB,UAAA,OAAO;;wBACxC,8BAA8B;wBAC9B,oEAAoE;wBACpE,MAAA,KAAI,CAAC,KAAK,+CAAV,KAAI,EACF,KAAI,CAAC,WAAW,EAChB,KAAI,CAAC,MAAO,EACZ,IAAI,EACJ,UAAA,MAAM;4BACJ,OAAO,CAAC,MAAM,CAAC,CAAC;wBAClB,CAAC,EACD,aAAa,CACd,CAAC;oBACJ,CAAC,CAAC,EAAC;;;KACJ;IACD,wCAAQ,GAAR;QACE,2CAA2C;IAC7C,CAAC;IACH,4BAAC;AAAD,CAAC,AAtCD,IAsCC;AAED,MAAM,UAAU,2BAA2B,CACzC,UAAiC;IAEjC,OAAO,IAAI,qBAAqB,CAAC,UAAU,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n HttpRequestParameters,\n sendWithHttp,\n} from './http-transport-types';\n\n// NOTE: do not change these type imports to actual imports. Doing so WILL break `@opentelemetry/instrumentation-http`,\n// as they'd be imported before the http/https modules can be wrapped.\nimport type * as https from 'https';\nimport type * as http from 'http';\nimport { ExportResponse } from '../export-response';\nimport { IExporterTransport } from '../exporter-transport';\n\nclass HttpExporterTransport implements IExporterTransport {\n private _send: sendWithHttp | null = null;\n private _agent: http.Agent | https.Agent | null = null;\n\n constructor(private _parameters: HttpRequestParameters) {}\n\n async send(data: Uint8Array, timeoutMillis: number): Promise<ExportResponse> {\n if (this._send == null) {\n // Lazy require to ensure that http/https is not required before instrumentations can wrap it.\n const {\n sendWithHttp,\n createHttpAgent,\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n } = require('./http-transport-utils');\n this._agent = createHttpAgent(\n this._parameters.url,\n this._parameters.agentOptions\n );\n this._send = sendWithHttp;\n }\n\n return new Promise<ExportResponse>(resolve => {\n // this will always be defined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this._send?.(\n this._parameters,\n this._agent!,\n data,\n result => {\n resolve(result);\n },\n timeoutMillis\n );\n });\n }\n shutdown() {\n // intentionally left empty, nothing to do.\n }\n}\n\nexport function createHttpExporterTransport(\n parameters: HttpRequestParameters\n): IExporterTransport {\n return new HttpExporterTransport(parameters);\n}\n"]}
@@ -1,11 +1,11 @@
1
1
  /// <reference types="node" />
2
2
  import type * as http from 'http';
3
3
  import type * as https from 'https';
4
- import { ExportResponse } from '../../export-response';
4
+ import { ExportResponse } from '../export-response';
5
5
  export declare type sendWithHttp = (params: HttpRequestParameters, agent: http.Agent | https.Agent, data: Uint8Array, onDone: (response: ExportResponse) => void, timeoutMillis: number) => void;
6
6
  export interface HttpRequestParameters {
7
7
  url: string;
8
- headers: Record<string, string>;
8
+ headers: () => Record<string, string>;
9
9
  compression: 'gzip' | 'none';
10
10
  agentOptions: http.AgentOptions | https.AgentOptions;
11
11
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-transport-types.js","sourceRoot":"","sources":["../../../src/transport/http-transport-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type * as http from 'http';\nimport type * as https from 'https';\nimport { ExportResponse } from '../export-response';\n\nexport type sendWithHttp = (\n params: HttpRequestParameters,\n agent: http.Agent | https.Agent,\n data: Uint8Array,\n onDone: (response: ExportResponse) => void,\n timeoutMillis: number\n) => void;\n\nexport interface HttpRequestParameters {\n url: string;\n headers: () => Record<string, string>;\n compression: 'gzip' | 'none';\n agentOptions: http.AgentOptions | https.AgentOptions;\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  import * as http from 'http';
3
3
  import * as https from 'https';
4
4
  import { HttpRequestParameters } from './http-transport-types';
5
- import { ExportResponse } from '../../export-response';
5
+ import { ExportResponse } from '../export-response';
6
6
  /**
7
7
  * Sends data using http
8
8
  * @param params
@@ -12,5 +12,6 @@ import { ExportResponse } from '../../export-response';
12
12
  * @param timeoutMillis
13
13
  */
14
14
  export declare function sendWithHttp(params: HttpRequestParameters, agent: http.Agent | https.Agent, data: Uint8Array, onDone: (response: ExportResponse) => void, timeoutMillis: number): void;
15
+ export declare function compressAndSend(req: http.ClientRequest, compression: 'gzip' | 'none', data: Uint8Array, onError: (error: Error) => void): void;
15
16
  export declare function createHttpAgent(rawUrl: string, agentOptions: http.AgentOptions | https.AgentOptions): http.Agent;
16
17
  //# sourceMappingURL=http-transport-utils.d.ts.map
@@ -28,8 +28,8 @@ import * as http from 'http';
28
28
  import * as https from 'https';
29
29
  import * as zlib from 'zlib';
30
30
  import { Readable } from 'stream';
31
- import { isExportRetryable, parseRetryAfterToMills, } from '../../is-export-retryable';
32
- import { OTLPExporterError } from '../../types';
31
+ import { isExportRetryable, parseRetryAfterToMills, } from '../is-export-retryable';
32
+ import { OTLPExporterError } from '../types';
33
33
  /**
34
34
  * Sends data using http
35
35
  * @param params
@@ -46,7 +46,7 @@ export function sendWithHttp(params, agent, data, onDone, timeoutMillis) {
46
46
  port: parsedUrl.port,
47
47
  path: parsedUrl.pathname,
48
48
  method: 'POST',
49
- headers: __assign({}, params.headers),
49
+ headers: __assign({}, params.headers()),
50
50
  agent: agent,
51
51
  };
52
52
  var request = parsedUrl.protocol === 'http:' ? http.request : https.request;
@@ -67,7 +67,7 @@ export function sendWithHttp(params, agent, data, onDone, timeoutMillis) {
67
67
  });
68
68
  }
69
69
  else {
70
- var error = new OTLPExporterError(res.statusMessage, res.statusCode);
70
+ var error = new OTLPExporterError(res.statusMessage, res.statusCode, Buffer.concat(responseData).toString());
71
71
  onDone({
72
72
  status: 'failure',
73
73
  error: error,
@@ -102,7 +102,7 @@ export function sendWithHttp(params, agent, data, onDone, timeoutMillis) {
102
102
  });
103
103
  });
104
104
  }
105
- function compressAndSend(req, compression, data, onError) {
105
+ export function compressAndSend(req, compression, data, onError) {
106
106
  var dataStream = readableFromUint8Array(data);
107
107
  if (compression === 'gzip') {
108
108
  req.setHeader('Content-Encoding', 'gzip');
@@ -111,7 +111,7 @@ function compressAndSend(req, compression, data, onError) {
111
111
  .pipe(zlib.createGzip())
112
112
  .on('error', onError);
113
113
  }
114
- dataStream.pipe(req);
114
+ dataStream.pipe(req).on('error', onError);
115
115
  }
116
116
  function readableFromUint8Array(buff) {
117
117
  var readable = new Readable();
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-transport-utils.js","sourceRoot":"","sources":["../../../src/transport/http-transport-utils.ts"],"names":[],"mappings":"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","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport * as http from 'http';\nimport * as https from 'https';\nimport * as zlib from 'zlib';\nimport { Readable } from 'stream';\nimport { HttpRequestParameters } from './http-transport-types';\nimport { ExportResponse } from '../export-response';\nimport {\n isExportRetryable,\n parseRetryAfterToMills,\n} from '../is-export-retryable';\nimport { OTLPExporterError } from '../types';\n\n/**\n * Sends data using http\n * @param params\n * @param agent\n * @param data\n * @param onDone\n * @param timeoutMillis\n */\nexport function sendWithHttp(\n params: HttpRequestParameters,\n agent: http.Agent | https.Agent,\n data: Uint8Array,\n onDone: (response: ExportResponse) => void,\n timeoutMillis: number\n): void {\n const parsedUrl = new URL(params.url);\n const nodeVersion = Number(process.versions.node.split('.')[0]);\n\n const options: http.RequestOptions | https.RequestOptions = {\n hostname: parsedUrl.hostname,\n port: parsedUrl.port,\n path: parsedUrl.pathname,\n method: 'POST',\n headers: {\n ...params.headers(),\n },\n agent: agent,\n };\n\n const request = parsedUrl.protocol === 'http:' ? http.request : https.request;\n\n const req = request(options, (res: http.IncomingMessage) => {\n const responseData: Buffer[] = [];\n res.on('data', chunk => responseData.push(chunk));\n\n res.on('end', () => {\n if (res.statusCode && res.statusCode < 299) {\n onDone({\n status: 'success',\n data: Buffer.concat(responseData),\n });\n } else if (res.statusCode && isExportRetryable(res.statusCode)) {\n onDone({\n status: 'retryable',\n retryInMillis: parseRetryAfterToMills(res.headers['retry-after']),\n });\n } else {\n const error = new OTLPExporterError(\n res.statusMessage,\n res.statusCode,\n Buffer.concat(responseData).toString()\n );\n onDone({\n status: 'failure',\n error,\n });\n }\n });\n });\n\n req.setTimeout(timeoutMillis, () => {\n req.destroy();\n onDone({\n status: 'failure',\n error: new Error('Request Timeout'),\n });\n });\n req.on('error', (error: Error | any) => {\n onDone({\n status: 'failure',\n error: error,\n });\n });\n\n const reportTimeoutErrorEvent = nodeVersion >= 14 ? 'close' : 'abort';\n req.on(reportTimeoutErrorEvent, () => {\n onDone({\n status: 'failure',\n error: new Error('Request timed out'),\n });\n });\n\n compressAndSend(req, params.compression, data, (error: Error) => {\n onDone({\n status: 'failure',\n error,\n });\n });\n}\n\nexport function compressAndSend(\n req: http.ClientRequest,\n compression: 'gzip' | 'none',\n data: Uint8Array,\n onError: (error: Error) => void\n) {\n let dataStream = readableFromUint8Array(data);\n\n if (compression === 'gzip') {\n req.setHeader('Content-Encoding', 'gzip');\n dataStream = dataStream\n .on('error', onError)\n .pipe(zlib.createGzip())\n .on('error', onError);\n }\n\n dataStream.pipe(req).on('error', onError);\n}\n\nfunction readableFromUint8Array(buff: string | Uint8Array): Readable {\n const readable = new Readable();\n readable.push(buff);\n readable.push(null);\n\n return readable;\n}\n\nexport function createHttpAgent(\n rawUrl: string,\n agentOptions: http.AgentOptions | https.AgentOptions\n) {\n const parsedUrl = new URL(rawUrl);\n const Agent = parsedUrl.protocol === 'http:' ? http.Agent : https.Agent;\n return new Agent(agentOptions);\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { IExporterTransport } from '../../exporter-transport';
1
+ import { IExporterTransport } from '../exporter-transport';
2
2
  export interface SendBeaconParameters {
3
3
  url: string;
4
4
  /**
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-beacon-transport.js","sourceRoot":"","sources":["../../../src/transport/send-beacon-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAU1C;IACE,6BAAoB,OAA6B;QAA7B,YAAO,GAAP,OAAO,CAAsB;IAAG,CAAC;IACrD,kCAAI,GAAJ,UAAK,IAAgB;QAArB,iBAoBC;QAnBC,OAAO,IAAI,OAAO,CAAiB,UAAA,OAAO;YACxC,IACE,SAAS,CAAC,UAAU,CAClB,KAAI,CAAC,OAAO,CAAC,GAAG,EAChB,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,KAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAClD,EACD;gBACA,sDAAsD;gBACtD,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;gBACjC,OAAO,CAAC;oBACN,MAAM,EAAE,SAAS;iBAClB,CAAC,CAAC;aACJ;iBAAM;gBACL,OAAO,CAAC;oBACN,MAAM,EAAE,SAAS;oBACjB,KAAK,EAAE,IAAI,KAAK,CAAC,mBAAmB,CAAC;iBACtC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,sCAAQ,GAAR;QACE,2CAA2C;IAC7C,CAAC;IACH,0BAAC;AAAD,CAAC,AA3BD,IA2BC;AAED,MAAM,UAAU,yBAAyB,CACvC,UAAgC;IAEhC,OAAO,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { IExporterTransport } from '../exporter-transport';\nimport { ExportResponse } from '../export-response';\nimport { diag } from '@opentelemetry/api';\n\nexport interface SendBeaconParameters {\n url: string;\n /**\n * for instance 'application/x-protobuf'\n */\n blobType: string;\n}\n\nclass SendBeaconTransport implements IExporterTransport {\n constructor(private _params: SendBeaconParameters) {}\n send(data: Uint8Array): Promise<ExportResponse> {\n return new Promise<ExportResponse>(resolve => {\n if (\n navigator.sendBeacon(\n this._params.url,\n new Blob([data], { type: this._params.blobType })\n )\n ) {\n // no way to signal retry, treat everything as success\n diag.debug('SendBeacon success');\n resolve({\n status: 'success',\n });\n } else {\n resolve({\n status: 'failure',\n error: new Error('SendBeacon failed'),\n });\n }\n });\n }\n\n shutdown(): void {\n // Intentionally left empty, nothing to do.\n }\n}\n\nexport function createSendBeaconTransport(\n parameters: SendBeaconParameters\n): IExporterTransport {\n return new SendBeaconTransport(parameters);\n}\n"]}
@@ -1,7 +1,7 @@
1
- import { IExporterTransport } from '../../exporter-transport';
1
+ import { IExporterTransport } from '../exporter-transport';
2
2
  export interface XhrRequestParameters {
3
3
  url: string;
4
- headers: Record<string, string>;
4
+ headers: () => Record<string, string>;
5
5
  }
6
6
  /**
7
7
  * Creates an exporter transport that uses XHR to send the data
@@ -30,7 +30,7 @@ var __read = (this && this.__read) || function (o, n) {
30
30
  return ar;
31
31
  };
32
32
  import { diag } from '@opentelemetry/api';
33
- import { isExportRetryable, parseRetryAfterToMills, } from '../../is-export-retryable';
33
+ import { isExportRetryable, parseRetryAfterToMills, } from '../is-export-retryable';
34
34
  var XhrTransport = /** @class */ (function () {
35
35
  function XhrTransport(_parameters) {
36
36
  this._parameters = _parameters;
@@ -41,7 +41,8 @@ var XhrTransport = /** @class */ (function () {
41
41
  var xhr = new XMLHttpRequest();
42
42
  xhr.timeout = timeoutMillis;
43
43
  xhr.open('POST', _this._parameters.url);
44
- Object.entries(_this._parameters.headers).forEach(function (_a) {
44
+ var headers = _this._parameters.headers();
45
+ Object.entries(headers).forEach(function (_a) {
45
46
  var _b = __read(_a, 2), k = _b[0], v = _b[1];
46
47
  xhr.setRequestHeader(k, v);
47
48
  });
@@ -83,7 +84,7 @@ var XhrTransport = /** @class */ (function () {
83
84
  error: new Error('XHR request errored'),
84
85
  });
85
86
  };
86
- xhr.send(new Blob([data], { type: _this._parameters.headers['Content-Type'] }));
87
+ xhr.send(data);
87
88
  });
88
89
  };
89
90
  XhrTransport.prototype.shutdown = function () {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xhr-transport.js","sourceRoot":"","sources":["../../../src/transport/xhr-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;AAIH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EACL,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAOhC;IACE,sBAAoB,WAAiC;QAAjC,gBAAW,GAAX,WAAW,CAAsB;IAAG,CAAC;IAEzD,2BAAI,GAAJ,UAAK,IAAgB,EAAE,aAAqB;QAA5C,iBAqDC;QApDC,OAAO,IAAI,OAAO,CAAiB,UAAA,OAAO;YACxC,IAAM,GAAG,GAAG,IAAI,cAAc,EAAE,CAAC;YACjC,GAAG,CAAC,OAAO,GAAG,aAAa,CAAC;YAC5B,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,KAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;YACvC,IAAM,OAAO,GAAG,KAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;YAC3C,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,UAAC,EAAM;oBAAN,KAAA,aAAM,EAAL,CAAC,QAAA,EAAE,CAAC,QAAA;gBACpC,GAAG,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC7B,CAAC,CAAC,CAAC;YAEH,GAAG,CAAC,SAAS,GAAG,UAAA,CAAC;gBACf,OAAO,CAAC;oBACN,MAAM,EAAE,SAAS;oBACjB,KAAK,EAAE,IAAI,KAAK,CAAC,uBAAuB,CAAC;iBAC1C,CAAC,CAAC;YACL,CAAC,CAAC;YAEF,GAAG,CAAC,kBAAkB,GAAG;gBACvB,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,EAAE;oBAC1C,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;oBAC1B,OAAO,CAAC;wBACN,MAAM,EAAE,SAAS;qBAClB,CAAC,CAAC;iBACJ;qBAAM,IAAI,GAAG,CAAC,MAAM,IAAI,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;oBACtD,OAAO,CAAC;wBACN,MAAM,EAAE,WAAW;wBACnB,aAAa,EAAE,sBAAsB,CACnC,GAAG,CAAC,iBAAiB,CAAC,aAAa,CAAC,CACrC;qBACF,CAAC,CAAC;iBACJ;qBAAM,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;oBAC3B,OAAO,CAAC;wBACN,MAAM,EAAE,SAAS;wBACjB,KAAK,EAAE,IAAI,KAAK,CAAC,8CAA8C,CAAC;qBACjE,CAAC,CAAC;iBACJ;YACH,CAAC,CAAC;YAEF,GAAG,CAAC,OAAO,GAAG;gBACZ,OAAO,CAAC;oBACN,MAAM,EAAE,SAAS;oBACjB,KAAK,EAAE,IAAI,KAAK,CAAC,qBAAqB,CAAC;iBACxC,CAAC,CAAC;YACL,CAAC,CAAC;YACF,GAAG,CAAC,OAAO,GAAG;gBACZ,OAAO,CAAC;oBACN,MAAM,EAAE,SAAS;oBACjB,KAAK,EAAE,IAAI,KAAK,CAAC,qBAAqB,CAAC;iBACxC,CAAC,CAAC;YACL,CAAC,CAAC;YAEF,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,+BAAQ,GAAR;QACE,2CAA2C;IAC7C,CAAC;IACH,mBAAC;AAAD,CAAC,AA7DD,IA6DC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAAgC;IAEhC,OAAO,IAAI,YAAY,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { IExporterTransport } from '../exporter-transport';\nimport { ExportResponse } from '../export-response';\nimport { diag } from '@opentelemetry/api';\nimport {\n isExportRetryable,\n parseRetryAfterToMills,\n} from '../is-export-retryable';\n\nexport interface XhrRequestParameters {\n url: string;\n headers: () => Record<string, string>;\n}\n\nclass XhrTransport implements IExporterTransport {\n constructor(private _parameters: XhrRequestParameters) {}\n\n send(data: Uint8Array, timeoutMillis: number): Promise<ExportResponse> {\n return new Promise<ExportResponse>(resolve => {\n const xhr = new XMLHttpRequest();\n xhr.timeout = timeoutMillis;\n xhr.open('POST', this._parameters.url);\n const headers = this._parameters.headers();\n Object.entries(headers).forEach(([k, v]) => {\n xhr.setRequestHeader(k, v);\n });\n\n xhr.ontimeout = _ => {\n resolve({\n status: 'failure',\n error: new Error('XHR request timed out'),\n });\n };\n\n xhr.onreadystatechange = () => {\n if (xhr.status >= 200 && xhr.status <= 299) {\n diag.debug('XHR success');\n resolve({\n status: 'success',\n });\n } else if (xhr.status && isExportRetryable(xhr.status)) {\n resolve({\n status: 'retryable',\n retryInMillis: parseRetryAfterToMills(\n xhr.getResponseHeader('Retry-After')\n ),\n });\n } else if (xhr.status !== 0) {\n resolve({\n status: 'failure',\n error: new Error('XHR request failed with non-retryable status'),\n });\n }\n };\n\n xhr.onabort = () => {\n resolve({\n status: 'failure',\n error: new Error('XHR request aborted'),\n });\n };\n xhr.onerror = () => {\n resolve({\n status: 'failure',\n error: new Error('XHR request errored'),\n });\n };\n\n xhr.send(data);\n });\n }\n\n shutdown() {\n // Intentionally left empty, nothing to do.\n }\n}\n\n/**\n * Creates an exporter transport that uses XHR to send the data\n * @param parameters applied to each request made by transport\n */\nexport function createXhrTransport(\n parameters: XhrRequestParameters\n): IExporterTransport {\n return new XhrTransport(parameters);\n}\n"]}
@@ -20,15 +20,4 @@ export interface ExportServiceError {
20
20
  message: string;
21
21
  stack: string;
22
22
  }
23
- /**
24
- * Collector Exporter base config
25
- */
26
- export interface OTLPExporterConfigBase {
27
- headers?: Record<string, string>;
28
- url?: string;
29
- concurrencyLimit?: number;
30
- /** Maximum time the OTLP exporter will wait for each batch export.
31
- * The default value is 10000ms. */
32
- timeoutMillis?: number;
33
- }
34
23
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH;IAAuC,qCAAK;IAK1C,2BAAY,OAAgB,EAAE,IAAa,EAAE,IAAa;QAA1D,YACE,kBAAM,OAAO,CAAC,SAGf;QAPiB,UAAI,GAAW,mBAAmB,CAAC;QAKnD,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;;IACnB,CAAC;IACH,wBAAC;AAAD,CAAC,AAVD,CAAuC,KAAK,GAU3C","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Interface for handling error\n */\nexport class OTLPExporterError extends Error {\n readonly code?: number;\n override readonly name: string = 'OTLPExporterError';\n readonly data?: string;\n\n constructor(message?: string, code?: number, data?: string) {\n super(message);\n this.data = data;\n this.code = code;\n }\n}\n\n/**\n * Interface for handling export service errors\n */\nexport interface ExportServiceError {\n name: string;\n code: number;\n details: string;\n metadata: { [key: string]: unknown };\n message: string;\n stack: string;\n}\n\n/**\n * Collector Exporter base config\n */\nexport interface OTLPExporterConfigBase {\n headers?: Record<string, string>;\n url?: string;\n concurrencyLimit?: number;\n /** Maximum time the OTLP exporter will wait for each batch export.\n * The default value is 10000ms. */\n timeoutMillis?: number;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH;IAAuC,qCAAK;IAK1C,2BAAY,OAAgB,EAAE,IAAa,EAAE,IAAa;QAA1D,YACE,kBAAM,OAAO,CAAC,SAGf;QAPiB,UAAI,GAAW,mBAAmB,CAAC;QAKnD,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;;IACnB,CAAC;IACH,wBAAC;AAAD,CAAC,AAVD,CAAuC,KAAK,GAU3C","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Interface for handling error\n */\nexport class OTLPExporterError extends Error {\n readonly code?: number;\n override readonly name: string = 'OTLPExporterError';\n readonly data?: string;\n\n constructor(message?: string, code?: number, data?: string) {\n super(message);\n this.data = data;\n this.code = code;\n }\n}\n\n/**\n * Interface for handling export service errors\n */\nexport interface ExportServiceError {\n name: string;\n code: number;\n details: string;\n metadata: { [key: string]: unknown };\n message: string;\n stack: string;\n}\n"]}
@@ -2,5 +2,5 @@
2
2
  * Parses headers from config leaving only those that have defined values
3
3
  * @param partialHeaders
4
4
  */
5
- export declare function validateAndNormalizeHeaders(partialHeaders?: Partial<Record<string, unknown>>): Record<string, string>;
5
+ export declare function validateAndNormalizeHeaders(partialHeaders: (() => Record<string, string>) | undefined): () => Record<string, string>;
6
6
  //# sourceMappingURL=util.d.ts.map
package/build/esm/util.js CHANGED
@@ -35,17 +35,19 @@ import { diag } from '@opentelemetry/api';
35
35
  * @param partialHeaders
36
36
  */
37
37
  export function validateAndNormalizeHeaders(partialHeaders) {
38
- if (partialHeaders === void 0) { partialHeaders = {}; }
39
- var headers = {};
40
- Object.entries(partialHeaders).forEach(function (_a) {
41
- var _b = __read(_a, 2), key = _b[0], value = _b[1];
42
- if (typeof value !== 'undefined') {
43
- headers[key] = String(value);
44
- }
45
- else {
46
- diag.warn("Header \"" + key + "\" has invalid value (" + value + ") and will be ignored");
47
- }
48
- });
49
- return headers;
38
+ return function () {
39
+ var _a;
40
+ var headers = {};
41
+ Object.entries((_a = partialHeaders === null || partialHeaders === void 0 ? void 0 : partialHeaders()) !== null && _a !== void 0 ? _a : {}).forEach(function (_a) {
42
+ var _b = __read(_a, 2), key = _b[0], value = _b[1];
43
+ if (typeof value !== 'undefined') {
44
+ headers[key] = String(value);
45
+ }
46
+ else {
47
+ diag.warn("Header \"" + key + "\" has invalid value (" + value + ") and will be ignored");
48
+ }
49
+ });
50
+ return headers;
51
+ };
50
52
  }
51
53
  //# sourceMappingURL=util.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CACzC,cAAqD;IAArD,+BAAA,EAAA,mBAAqD;IAErD,IAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,UAAC,EAAY;YAAZ,KAAA,aAAY,EAAX,GAAG,QAAA,EAAE,KAAK,QAAA;QACjD,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;YAChC,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;SAC9B;aAAM;YACL,IAAI,CAAC,IAAI,CACP,cAAW,GAAG,8BAAwB,KAAK,0BAAuB,CACnE,CAAC;SACH;IACH,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { diag } from '@opentelemetry/api';\n\n/**\n * Parses headers from config leaving only those that have defined values\n * @param partialHeaders\n */\nexport function validateAndNormalizeHeaders(\n partialHeaders: Partial<Record<string, unknown>> = {}\n): Record<string, string> {\n const headers: Record<string, string> = {};\n Object.entries(partialHeaders).forEach(([key, value]) => {\n if (typeof value !== 'undefined') {\n headers[key] = String(value);\n } else {\n diag.warn(\n `Header \"${key}\" has invalid value (${value}) and will be ignored`\n );\n }\n });\n return headers;\n}\n"]}
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CACzC,cAA0D;IAE1D,OAAO;;QACL,IAAM,OAAO,GAA2B,EAAE,CAAC;QAC3C,MAAM,CAAC,OAAO,CAAC,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,EAAI,mCAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAC,EAAY;gBAAZ,KAAA,aAAY,EAAX,GAAG,QAAA,EAAE,KAAK,QAAA;YAC3D,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;gBAChC,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;aAC9B;iBAAM;gBACL,IAAI,CAAC,IAAI,CACP,cAAW,GAAG,8BAAwB,KAAK,0BAAuB,CACnE,CAAC;aACH;QACH,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { diag } from '@opentelemetry/api';\n\n/**\n * Parses headers from config leaving only those that have defined values\n * @param partialHeaders\n */\nexport function validateAndNormalizeHeaders(\n partialHeaders: (() => Record<string, string>) | undefined\n): () => Record<string, string> {\n return () => {\n const headers: Record<string, string> = {};\n Object.entries(partialHeaders?.() ?? {}).forEach(([key, value]) => {\n if (typeof value !== 'undefined') {\n headers[key] = String(value);\n } else {\n diag.warn(\n `Header \"${key}\" has invalid value (${value}) and will be ignored`\n );\n }\n });\n return headers;\n };\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.54.2";
1
+ export declare const VERSION = "0.56.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -14,5 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // this is autogenerated file, see scripts/version-update.js
17
- export var VERSION = '0.54.2';
17
+ export var VERSION = '0.56.0';
18
18
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,IAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.54.2';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,IAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.56.0';\n"]}
@@ -1,36 +1,15 @@
1
- import { ExportResult, BindOnceFuture } from '@opentelemetry/core';
2
- import { OTLPExporterError, OTLPExporterConfigBase } from './types';
3
- /**
4
- * Collector Exporter abstract base class
5
- */
6
- export declare abstract class OTLPExporterBase<T extends OTLPExporterConfigBase, ExportItem> {
7
- protected _concurrencyLimit: number;
8
- protected _sendingPromises: Promise<unknown>[];
9
- protected _shutdownOnce: BindOnceFuture<void>;
10
- /**
11
- * @param config
12
- */
13
- constructor(config?: T);
1
+ import { ExportResult } from '@opentelemetry/core';
2
+ import { IOtlpExportDelegate } from './otlp-export-delegate';
3
+ export declare class OTLPExporterBase<Internal> {
4
+ private _delegate;
5
+ constructor(_delegate: IOtlpExportDelegate<Internal>);
14
6
  /**
15
7
  * Export items.
16
8
  * @param items
17
9
  * @param resultCallback
18
10
  */
19
- export(items: ExportItem[], resultCallback: (result: ExportResult) => void): void;
20
- private _export;
21
- /**
22
- * Shutdown the exporter.
23
- */
24
- shutdown(): Promise<void>;
25
- /**
26
- * Exports any pending spans in the exporter
27
- */
11
+ export(items: Internal, resultCallback: (result: ExportResult) => void): void;
28
12
  forceFlush(): Promise<void>;
29
- /**
30
- * Called by _shutdownOnce with BindOnceFuture
31
- */
32
- private _shutdown;
33
- abstract onShutdown(): void;
34
- abstract send(items: ExportItem[], onSuccess: () => void, onError: (error: OTLPExporterError) => void): void;
13
+ shutdown(): Promise<void>;
35
14
  }
36
15
  //# sourceMappingURL=OTLPExporterBase.d.ts.map
@@ -13,23 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { diag } from '@opentelemetry/api';
17
- import { ExportResultCode, BindOnceFuture, } from '@opentelemetry/core';
18
- /**
19
- * Collector Exporter abstract base class
20
- */
21
16
  export class OTLPExporterBase {
22
- /**
23
- * @param config
24
- */
25
- constructor(config = {}) {
26
- this._sendingPromises = [];
27
- this.shutdown = this.shutdown.bind(this);
28
- this._shutdownOnce = new BindOnceFuture(this._shutdown, this);
29
- this._concurrencyLimit =
30
- typeof config.concurrencyLimit === 'number'
31
- ? config.concurrencyLimit
32
- : 30;
17
+ constructor(_delegate) {
18
+ this._delegate = _delegate;
33
19
  }
34
20
  /**
35
21
  * Export items.
@@ -37,60 +23,13 @@ export class OTLPExporterBase {
37
23
  * @param resultCallback
38
24
  */
39
25
  export(items, resultCallback) {
40
- if (this._shutdownOnce.isCalled) {
41
- resultCallback({
42
- code: ExportResultCode.FAILED,
43
- error: new Error('Exporter has been shutdown'),
44
- });
45
- return;
46
- }
47
- if (this._sendingPromises.length >= this._concurrencyLimit) {
48
- resultCallback({
49
- code: ExportResultCode.FAILED,
50
- error: new Error('Concurrent export limit reached'),
51
- });
52
- return;
53
- }
54
- this._export(items)
55
- .then(() => {
56
- resultCallback({ code: ExportResultCode.SUCCESS });
57
- })
58
- .catch((error) => {
59
- resultCallback({ code: ExportResultCode.FAILED, error });
60
- });
61
- }
62
- _export(items) {
63
- return new Promise((resolve, reject) => {
64
- try {
65
- diag.debug('items to be sent', items);
66
- this.send(items, resolve, reject);
67
- }
68
- catch (e) {
69
- reject(e);
70
- }
71
- });
26
+ this._delegate.export(items, resultCallback);
72
27
  }
73
- /**
74
- * Shutdown the exporter.
75
- */
76
- shutdown() {
77
- return this._shutdownOnce.call();
78
- }
79
- /**
80
- * Exports any pending spans in the exporter
81
- */
82
28
  forceFlush() {
83
- return Promise.all(this._sendingPromises).then(() => {
84
- /** ignore resolved values */
85
- });
29
+ return this._delegate.forceFlush();
86
30
  }
87
- /**
88
- * Called by _shutdownOnce with BindOnceFuture
89
- */
90
- _shutdown() {
91
- diag.debug('shutdown started');
92
- this.onShutdown();
93
- return this.forceFlush();
31
+ shutdown() {
32
+ return this._delegate.shutdown();
94
33
  }
95
34
  }
96
35
  //# sourceMappingURL=OTLPExporterBase.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPExporterBase.js","sourceRoot":"","sources":["../../src/OTLPExporterBase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAEL,gBAAgB,EAChB,cAAc,GACf,MAAM,qBAAqB,CAAC;AAO7B;;GAEG;AACH,MAAM,OAAgB,gBAAgB;IAQpC;;OAEG;IACH,YAAY,SAAY,EAAO;QANrB,qBAAgB,GAAuB,EAAE,CAAC;QAOlD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,aAAa,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAE9D,IAAI,CAAC,iBAAiB;YACpB,OAAO,MAAM,CAAC,gBAAgB,KAAK,QAAQ;gBACzC,CAAC,CAAC,MAAM,CAAC,gBAAgB;gBACzB,CAAC,CAAC,EAAE,CAAC;IACX,CAAC;IAED;;;;OAIG;IACH,MAAM,CACJ,KAAmB,EACnB,cAA8C;QAE9C,IAAI,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE;YAC/B,cAAc,CAAC;gBACb,IAAI,EAAE,gBAAgB,CAAC,MAAM;gBAC7B,KAAK,EAAE,IAAI,KAAK,CAAC,4BAA4B,CAAC;aAC/C,CAAC,CAAC;YACH,OAAO;SACR;QAED,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,IAAI,IAAI,CAAC,iBAAiB,EAAE;YAC1D,cAAc,CAAC;gBACb,IAAI,EAAE,gBAAgB,CAAC,MAAM;gBAC7B,KAAK,EAAE,IAAI,KAAK,CAAC,iCAAiC,CAAC;aACpD,CAAC,CAAC;YACH,OAAO;SACR;QAED,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;aAChB,IAAI,CAAC,GAAG,EAAE;YACT,cAAc,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC;QACrD,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,KAAyB,EAAE,EAAE;YACnC,cAAc,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,OAAO,CAAC,KAAmB;QACjC,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3C,IAAI;gBACF,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;gBACtC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;aACnC;YAAC,OAAO,CAAC,EAAE;gBACV,MAAM,CAAC,CAAC,CAAC,CAAC;aACX;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,UAAU;QACR,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YAClD,6BAA6B;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACK,SAAS;QACf,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QAC/B,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;CAQF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { diag } from '@opentelemetry/api';\nimport {\n ExportResult,\n ExportResultCode,\n BindOnceFuture,\n} from '@opentelemetry/core';\nimport {\n OTLPExporterError,\n OTLPExporterConfigBase,\n ExportServiceError,\n} from './types';\n\n/**\n * Collector Exporter abstract base class\n */\nexport abstract class OTLPExporterBase<\n T extends OTLPExporterConfigBase,\n ExportItem,\n> {\n protected _concurrencyLimit: number;\n protected _sendingPromises: Promise<unknown>[] = [];\n protected _shutdownOnce: BindOnceFuture<void>;\n\n /**\n * @param config\n */\n constructor(config: T = {} as T) {\n this.shutdown = this.shutdown.bind(this);\n this._shutdownOnce = new BindOnceFuture(this._shutdown, this);\n\n this._concurrencyLimit =\n typeof config.concurrencyLimit === 'number'\n ? config.concurrencyLimit\n : 30;\n }\n\n /**\n * Export items.\n * @param items\n * @param resultCallback\n */\n export(\n items: ExportItem[],\n resultCallback: (result: ExportResult) => void\n ): void {\n if (this._shutdownOnce.isCalled) {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Exporter has been shutdown'),\n });\n return;\n }\n\n if (this._sendingPromises.length >= this._concurrencyLimit) {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Concurrent export limit reached'),\n });\n return;\n }\n\n this._export(items)\n .then(() => {\n resultCallback({ code: ExportResultCode.SUCCESS });\n })\n .catch((error: ExportServiceError) => {\n resultCallback({ code: ExportResultCode.FAILED, error });\n });\n }\n\n private _export(items: ExportItem[]): Promise<unknown> {\n return new Promise<void>((resolve, reject) => {\n try {\n diag.debug('items to be sent', items);\n this.send(items, resolve, reject);\n } catch (e) {\n reject(e);\n }\n });\n }\n\n /**\n * Shutdown the exporter.\n */\n shutdown(): Promise<void> {\n return this._shutdownOnce.call();\n }\n\n /**\n * Exports any pending spans in the exporter\n */\n forceFlush(): Promise<void> {\n return Promise.all(this._sendingPromises).then(() => {\n /** ignore resolved values */\n });\n }\n\n /**\n * Called by _shutdownOnce with BindOnceFuture\n */\n private _shutdown(): Promise<void> {\n diag.debug('shutdown started');\n this.onShutdown();\n return this.forceFlush();\n }\n\n abstract onShutdown(): void;\n abstract send(\n items: ExportItem[],\n onSuccess: () => void,\n onError: (error: OTLPExporterError) => void\n ): void;\n}\n"]}
1
+ {"version":3,"file":"OTLPExporterBase.js","sourceRoot":"","sources":["../../src/OTLPExporterBase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,MAAM,OAAO,gBAAgB;IAC3B,YAAoB,SAAwC;QAAxC,cAAS,GAAT,SAAS,CAA+B;IAAG,CAAC;IAEhE;;;;OAIG;IACH,MAAM,CACJ,KAAe,EACf,cAA8C;QAE9C,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IAC/C,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ExportResult } from '@opentelemetry/core';\nimport { IOtlpExportDelegate } from './otlp-export-delegate';\n\nexport class OTLPExporterBase<Internal> {\n constructor(private _delegate: IOtlpExportDelegate<Internal>) {}\n\n /**\n * Export items.\n * @param items\n * @param resultCallback\n */\n export(\n items: Internal,\n resultCallback: (result: ExportResult) => void\n ): void {\n this._delegate.export(items, resultCallback);\n }\n\n forceFlush(): Promise<void> {\n return this._delegate.forceFlush();\n }\n\n shutdown(): Promise<void> {\n return this._delegate.shutdown();\n }\n}\n"]}
@@ -0,0 +1,13 @@
1
+ export interface IExportPromiseHandler {
2
+ pushPromise(promise: Promise<void>): void;
3
+ hasReachedLimit(): boolean;
4
+ awaitAll(): Promise<void>;
5
+ }
6
+ /**
7
+ * Promise queue for keeping track of export promises. Finished promises will be auto-dequeued.
8
+ * Allows for awaiting all promises in the queue.
9
+ */
10
+ export declare function createBoundedQueueExportPromiseHandler(options: {
11
+ concurrencyLimit: number;
12
+ }): IExportPromiseHandler;
13
+ //# sourceMappingURL=bounded-queue-export-promise-handler.d.ts.map
@@ -0,0 +1,49 @@
1
+ /*
2
+ * Copyright The OpenTelemetry Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ class BoundedQueueExportPromiseHandler {
17
+ /**
18
+ * @param concurrencyLimit maximum promises allowed in a queue at the same time.
19
+ */
20
+ constructor(concurrencyLimit) {
21
+ this._sendingPromises = [];
22
+ this._concurrencyLimit = concurrencyLimit;
23
+ }
24
+ pushPromise(promise) {
25
+ if (this.hasReachedLimit()) {
26
+ throw new Error('Concurrency Limit reached');
27
+ }
28
+ this._sendingPromises.push(promise);
29
+ const popPromise = () => {
30
+ const index = this._sendingPromises.indexOf(promise);
31
+ this._sendingPromises.splice(index, 1);
32
+ };
33
+ promise.then(popPromise, popPromise);
34
+ }
35
+ hasReachedLimit() {
36
+ return this._sendingPromises.length >= this._concurrencyLimit;
37
+ }
38
+ async awaitAll() {
39
+ await Promise.all(this._sendingPromises);
40
+ }
41
+ }
42
+ /**
43
+ * Promise queue for keeping track of export promises. Finished promises will be auto-dequeued.
44
+ * Allows for awaiting all promises in the queue.
45
+ */
46
+ export function createBoundedQueueExportPromiseHandler(options) {
47
+ return new BoundedQueueExportPromiseHandler(options.concurrencyLimit);
48
+ }
49
+ //# sourceMappingURL=bounded-queue-export-promise-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bounded-queue-export-promise-handler.js","sourceRoot":"","sources":["../../src/bounded-queue-export-promise-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAQH,MAAM,gCAAgC;IAIpC;;OAEG;IACH,YAAY,gBAAwB;QAL5B,qBAAgB,GAAuB,EAAE,CAAC;QAMhD,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IAC5C,CAAC;IAEM,WAAW,CAAC,OAAsB;QACvC,IAAI,IAAI,CAAC,eAAe,EAAE,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;SAC9C;QAED,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpC,MAAM,UAAU,GAAG,GAAG,EAAE;YACtB,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACrD,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACzC,CAAC,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACvC,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,IAAI,IAAI,CAAC,iBAAiB,CAAC;IAChE,CAAC;IAEM,KAAK,CAAC,QAAQ;QACnB,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC3C,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,sCAAsC,CAAC,OAEtD;IACC,OAAO,IAAI,gCAAgC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACxE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface IExportPromiseHandler {\n pushPromise(promise: Promise<void>): void;\n hasReachedLimit(): boolean;\n awaitAll(): Promise<void>;\n}\n\nclass BoundedQueueExportPromiseHandler implements IExportPromiseHandler {\n private readonly _concurrencyLimit: number;\n private _sendingPromises: Promise<unknown>[] = [];\n\n /**\n * @param concurrencyLimit maximum promises allowed in a queue at the same time.\n */\n constructor(concurrencyLimit: number) {\n this._concurrencyLimit = concurrencyLimit;\n }\n\n public pushPromise(promise: Promise<void>): void {\n if (this.hasReachedLimit()) {\n throw new Error('Concurrency Limit reached');\n }\n\n this._sendingPromises.push(promise);\n const popPromise = () => {\n const index = this._sendingPromises.indexOf(promise);\n this._sendingPromises.splice(index, 1);\n };\n promise.then(popPromise, popPromise);\n }\n\n public hasReachedLimit(): boolean {\n return this._sendingPromises.length >= this._concurrencyLimit;\n }\n\n public async awaitAll(): Promise<void> {\n await Promise.all(this._sendingPromises);\n }\n}\n\n/**\n * Promise queue for keeping track of export promises. Finished promises will be auto-dequeued.\n * Allows for awaiting all promises in the queue.\n */\nexport function createBoundedQueueExportPromiseHandler(options: {\n concurrencyLimit: number;\n}): IExportPromiseHandler {\n return new BoundedQueueExportPromiseHandler(options.concurrencyLimit);\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { OtlpHttpConfiguration } from './otlp-http-configuration';
2
+ import { OTLPExporterNodeConfigBase } from './legacy-node-configuration';
3
+ /**
4
+ * @deprecated this will be removed in 2.0
5
+ *
6
+ * @param config
7
+ * @param signalResourcePath
8
+ * @param requiredHeaders
9
+ */
10
+ export declare function convertLegacyBrowserHttpOptions(config: OTLPExporterNodeConfigBase, signalResourcePath: string, requiredHeaders: Record<string, string>): OtlpHttpConfiguration;
11
+ //# sourceMappingURL=convert-legacy-browser-http-options.d.ts.map
@@ -0,0 +1,34 @@
1
+ /*
2
+ * Copyright The OpenTelemetry Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { getHttpConfigurationDefaults, mergeOtlpHttpConfigurationWithDefaults, } from './otlp-http-configuration';
17
+ import { wrapStaticHeadersInFunction } from './shared-configuration';
18
+ /**
19
+ * @deprecated this will be removed in 2.0
20
+ *
21
+ * @param config
22
+ * @param signalResourcePath
23
+ * @param requiredHeaders
24
+ */
25
+ export function convertLegacyBrowserHttpOptions(config, signalResourcePath, requiredHeaders) {
26
+ return mergeOtlpHttpConfigurationWithDefaults({
27
+ url: config.url,
28
+ timeoutMillis: config.timeoutMillis,
29
+ headers: wrapStaticHeadersInFunction(config.headers),
30
+ concurrencyLimit: config.concurrencyLimit,
31
+ }, {}, // no fallback for browser case
32
+ getHttpConfigurationDefaults(requiredHeaders, signalResourcePath));
33
+ }
34
+ //# sourceMappingURL=convert-legacy-browser-http-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert-legacy-browser-http-options.js","sourceRoot":"","sources":["../../../src/configuration/convert-legacy-browser-http-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,4BAA4B,EAC5B,sCAAsC,GAEvC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAErE;;;;;;GAMG;AACH,MAAM,UAAU,+BAA+B,CAC7C,MAAkC,EAClC,kBAA0B,EAC1B,eAAuC;IAEvC,OAAO,sCAAsC,CAC3C;QACE,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,OAAO,EAAE,2BAA2B,CAAC,MAAM,CAAC,OAAO,CAAC;QACpD,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;KAC1C,EACD,EAAE,EAAE,+BAA+B;IACnC,4BAA4B,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAClE,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n getHttpConfigurationDefaults,\n mergeOtlpHttpConfigurationWithDefaults,\n OtlpHttpConfiguration,\n} from './otlp-http-configuration';\nimport { OTLPExporterNodeConfigBase } from './legacy-node-configuration';\nimport { wrapStaticHeadersInFunction } from './shared-configuration';\n\n/**\n * @deprecated this will be removed in 2.0\n *\n * @param config\n * @param signalResourcePath\n * @param requiredHeaders\n */\nexport function convertLegacyBrowserHttpOptions(\n config: OTLPExporterNodeConfigBase,\n signalResourcePath: string,\n requiredHeaders: Record<string, string>\n): OtlpHttpConfiguration {\n return mergeOtlpHttpConfigurationWithDefaults(\n {\n url: config.url,\n timeoutMillis: config.timeoutMillis,\n headers: wrapStaticHeadersInFunction(config.headers),\n concurrencyLimit: config.concurrencyLimit,\n },\n {}, // no fallback for browser case\n getHttpConfigurationDefaults(requiredHeaders, signalResourcePath)\n );\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { OTLPExporterNodeConfigBase } from './legacy-node-configuration';
2
+ import { OtlpHttpConfiguration } from './otlp-http-configuration';
3
+ /**
4
+ * @deprecated this will be removed in 2.0
5
+ * @param config
6
+ * @param signalIdentifier
7
+ * @param signalResourcePath
8
+ * @param requiredHeaders
9
+ */
10
+ export declare function convertLegacyHttpOptions(config: OTLPExporterNodeConfigBase, signalIdentifier: string, signalResourcePath: string, requiredHeaders: Record<string, string>): OtlpHttpConfiguration;
11
+ //# sourceMappingURL=convert-legacy-node-http-options.d.ts.map