@opentelemetry/otlp-exporter-base 0.55.0 → 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 +1 -1
  63. package/build/esm/{platform/node → transport}/http-transport-utils.js +4 -4
  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 +1 -1
  139. package/build/esnext/{platform/node → transport}/http-transport-utils.js +4 -4
  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 +1 -1
  215. package/build/src/{platform/node → transport}/http-transport-utils.js +4 -4
  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 +38 -11
  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
@@ -27,7 +27,8 @@ var __assign = (this && this.__assign) || function () {
27
27
  import { baggageUtils } from '@opentelemetry/core';
28
28
  import { diag } from '@opentelemetry/api';
29
29
  import { getSharedConfigurationFromEnvironment } from './shared-env-configuration';
30
- function getHeadersFromEnv(signalIdentifier) {
30
+ import { wrapStaticHeadersInFunction } from './shared-configuration';
31
+ function getStaticHeadersFromEnv(signalIdentifier) {
31
32
  var _a, _b;
32
33
  var signalSpecificRawHeaders = (_a = process.env["OTEL_EXPORTER_OTLP_" + signalIdentifier + "_HEADERS"]) === null || _a === void 0 ? void 0 : _a.trim();
33
34
  var nonSignalSpecificRawHeaders = (_b = process.env['OTEL_EXPORTER_OTLP_HEADERS']) === null || _b === void 0 ? void 0 : _b.trim();
@@ -99,6 +100,6 @@ function getSpecificUrlFromEnv(signalIdentifier) {
99
100
  */
100
101
  export function getHttpConfigurationFromEnvironment(signalIdentifier, signalResourcePath) {
101
102
  var _a;
102
- return __assign(__assign({}, getSharedConfigurationFromEnvironment(signalIdentifier)), { url: (_a = getSpecificUrlFromEnv(signalIdentifier)) !== null && _a !== void 0 ? _a : getNonSpecificUrlFromEnv(signalResourcePath), headers: getHeadersFromEnv(signalIdentifier) });
103
+ return __assign(__assign({}, getSharedConfigurationFromEnvironment(signalIdentifier)), { url: (_a = getSpecificUrlFromEnv(signalIdentifier)) !== null && _a !== void 0 ? _a : getNonSpecificUrlFromEnv(signalResourcePath), headers: wrapStaticHeadersInFunction(getStaticHeadersFromEnv(signalIdentifier)) });
103
104
  }
104
105
  //# sourceMappingURL=otlp-http-env-configuration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"otlp-http-env-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-http-env-configuration.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 { baggageUtils } from '@opentelemetry/core';\nimport { diag } from '@opentelemetry/api';\nimport { getSharedConfigurationFromEnvironment } from './shared-env-configuration';\nimport { OtlpHttpConfiguration } from './otlp-http-configuration';\n\nfunction getHeadersFromEnv(signalIdentifier: string) {\n const signalSpecificRawHeaders =\n process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_HEADERS`]?.trim();\n const nonSignalSpecificRawHeaders =\n process.env['OTEL_EXPORTER_OTLP_HEADERS']?.trim();\n\n const signalSpecificHeaders = baggageUtils.parseKeyPairsIntoRecord(\n signalSpecificRawHeaders\n );\n const nonSignalSpecificHeaders = baggageUtils.parseKeyPairsIntoRecord(\n nonSignalSpecificRawHeaders\n );\n\n if (\n Object.keys(signalSpecificHeaders).length === 0 &&\n Object.keys(nonSignalSpecificHeaders).length === 0\n ) {\n return undefined;\n }\n\n // headers are combined instead of overwritten, with the specific headers taking precedence over\n // the non-specific ones.\n return Object.assign(\n {},\n baggageUtils.parseKeyPairsIntoRecord(nonSignalSpecificRawHeaders),\n baggageUtils.parseKeyPairsIntoRecord(signalSpecificRawHeaders)\n );\n}\n\nfunction appendRootPathToUrlIfNeeded(url: string): string | undefined {\n try {\n const parsedUrl = new URL(url);\n // This will automatically append '/' if there's no root path.\n return parsedUrl.toString();\n } catch {\n diag.warn(\n `Configuration: Could not parse environment-provided export URL: '${url}', falling back to undefined`\n );\n return undefined;\n }\n}\n\nfunction appendResourcePathToUrl(\n url: string,\n path: string\n): string | undefined {\n try {\n // just try to parse, if it fails we catch and warn.\n new URL(url);\n } catch {\n diag.warn(\n `Configuration: Could not parse environment-provided export URL: '${url}', falling back to undefined`\n );\n return undefined;\n }\n\n if (!url.endsWith('/')) {\n url = url + '/';\n }\n url += path;\n\n try {\n // just try to parse, if it fails we catch and warn.\n new URL(url);\n } catch {\n diag.warn(\n `Configuration: Provided URL appended with '${path}' is not a valid URL, using 'undefined' instead of '${url}'`\n );\n return undefined;\n }\n\n return url;\n}\n\nfunction getNonSpecificUrlFromEnv(\n signalResourcePath: string\n): string | undefined {\n const envUrl = process.env.OTEL_EXPORTER_OTLP_ENDPOINT?.trim();\n if (envUrl == null || envUrl === '') {\n return undefined;\n }\n return appendResourcePathToUrl(envUrl, signalResourcePath);\n}\n\nfunction getSpecificUrlFromEnv(signalIdentifier: string): string | undefined {\n const envUrl =\n process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_ENDPOINT`]?.trim();\n if (envUrl == null || envUrl === '') {\n return undefined;\n }\n return appendRootPathToUrlIfNeeded(envUrl);\n}\n\n/**\n * Reads and returns configuration from the environment\n *\n * @param signalIdentifier all caps part in environment variables that identifies the signal (e.g.: METRICS, TRACES, LOGS)\n * @param signalResourcePath signal resource path to append if necessary (e.g.: v1/metrics, v1/traces, v1/logs)\n */\nexport function getHttpConfigurationFromEnvironment(\n signalIdentifier: string,\n signalResourcePath: string\n): Partial<OtlpHttpConfiguration> {\n return {\n ...getSharedConfigurationFromEnvironment(signalIdentifier),\n url:\n getSpecificUrlFromEnv(signalIdentifier) ??\n getNonSpecificUrlFromEnv(signalResourcePath),\n headers: getHeadersFromEnv(signalIdentifier),\n };\n}\n"]}
1
+ {"version":3,"file":"otlp-http-env-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-http-env-configuration.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,qCAAqC,EAAE,MAAM,4BAA4B,CAAC;AAEnF,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAErE,SAAS,uBAAuB,CAC9B,gBAAwB;;IAExB,IAAM,wBAAwB,GAC5B,MAAA,OAAO,CAAC,GAAG,CAAC,wBAAsB,gBAAgB,aAAU,CAAC,0CAAE,IAAI,EAAE,CAAC;IACxE,IAAM,2BAA2B,GAC/B,MAAA,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,0CAAE,IAAI,EAAE,CAAC;IAEpD,IAAM,qBAAqB,GAAG,YAAY,CAAC,uBAAuB,CAChE,wBAAwB,CACzB,CAAC;IACF,IAAM,wBAAwB,GAAG,YAAY,CAAC,uBAAuB,CACnE,2BAA2B,CAC5B,CAAC;IAEF,IACE,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,MAAM,KAAK,CAAC;QAC/C,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,MAAM,KAAK,CAAC,EAClD;QACA,OAAO,SAAS,CAAC;KAClB;IAED,gGAAgG;IAChG,yBAAyB;IACzB,OAAO,MAAM,CAAC,MAAM,CAClB,EAAE,EACF,YAAY,CAAC,uBAAuB,CAAC,2BAA2B,CAAC,EACjE,YAAY,CAAC,uBAAuB,CAAC,wBAAwB,CAAC,CAC/D,CAAC;AACJ,CAAC;AAED,SAAS,2BAA2B,CAAC,GAAW;IAC9C,IAAI;QACF,IAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,8DAA8D;QAC9D,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC;KAC7B;IAAC,WAAM;QACN,IAAI,CAAC,IAAI,CACP,sEAAoE,GAAG,iCAA8B,CACtG,CAAC;QACF,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAED,SAAS,uBAAuB,CAC9B,GAAW,EACX,IAAY;IAEZ,IAAI;QACF,oDAAoD;QACpD,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;KACd;IAAC,WAAM;QACN,IAAI,CAAC,IAAI,CACP,sEAAoE,GAAG,iCAA8B,CACtG,CAAC;QACF,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACtB,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;KACjB;IACD,GAAG,IAAI,IAAI,CAAC;IAEZ,IAAI;QACF,oDAAoD;QACpD,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;KACd;IAAC,WAAM;QACN,IAAI,CAAC,IAAI,CACP,gDAA8C,IAAI,4DAAuD,GAAG,MAAG,CAChH,CAAC;QACF,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,wBAAwB,CAC/B,kBAA0B;;IAE1B,IAAM,MAAM,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,2BAA2B,0CAAE,IAAI,EAAE,CAAC;IAC/D,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,KAAK,EAAE,EAAE;QACnC,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,uBAAuB,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,qBAAqB,CAAC,gBAAwB;;IACrD,IAAM,MAAM,GACV,MAAA,OAAO,CAAC,GAAG,CAAC,wBAAsB,gBAAgB,cAAW,CAAC,0CAAE,IAAI,EAAE,CAAC;IACzE,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,KAAK,EAAE,EAAE;QACnC,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,2BAA2B,CAAC,MAAM,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mCAAmC,CACjD,gBAAwB,EACxB,kBAA0B;;IAE1B,6BACK,qCAAqC,CAAC,gBAAgB,CAAC,KAC1D,GAAG,EACD,MAAA,qBAAqB,CAAC,gBAAgB,CAAC,mCACvC,wBAAwB,CAAC,kBAAkB,CAAC,EAC9C,OAAO,EAAE,2BAA2B,CAClC,uBAAuB,CAAC,gBAAgB,CAAC,CAC1C,IACD;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 { baggageUtils } from '@opentelemetry/core';\nimport { diag } from '@opentelemetry/api';\nimport { getSharedConfigurationFromEnvironment } from './shared-env-configuration';\nimport { OtlpHttpConfiguration } from './otlp-http-configuration';\nimport { wrapStaticHeadersInFunction } from './shared-configuration';\n\nfunction getStaticHeadersFromEnv(\n signalIdentifier: string\n): Record<string, string> | undefined {\n const signalSpecificRawHeaders =\n process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_HEADERS`]?.trim();\n const nonSignalSpecificRawHeaders =\n process.env['OTEL_EXPORTER_OTLP_HEADERS']?.trim();\n\n const signalSpecificHeaders = baggageUtils.parseKeyPairsIntoRecord(\n signalSpecificRawHeaders\n );\n const nonSignalSpecificHeaders = baggageUtils.parseKeyPairsIntoRecord(\n nonSignalSpecificRawHeaders\n );\n\n if (\n Object.keys(signalSpecificHeaders).length === 0 &&\n Object.keys(nonSignalSpecificHeaders).length === 0\n ) {\n return undefined;\n }\n\n // headers are combined instead of overwritten, with the specific headers taking precedence over\n // the non-specific ones.\n return Object.assign(\n {},\n baggageUtils.parseKeyPairsIntoRecord(nonSignalSpecificRawHeaders),\n baggageUtils.parseKeyPairsIntoRecord(signalSpecificRawHeaders)\n );\n}\n\nfunction appendRootPathToUrlIfNeeded(url: string): string | undefined {\n try {\n const parsedUrl = new URL(url);\n // This will automatically append '/' if there's no root path.\n return parsedUrl.toString();\n } catch {\n diag.warn(\n `Configuration: Could not parse environment-provided export URL: '${url}', falling back to undefined`\n );\n return undefined;\n }\n}\n\nfunction appendResourcePathToUrl(\n url: string,\n path: string\n): string | undefined {\n try {\n // just try to parse, if it fails we catch and warn.\n new URL(url);\n } catch {\n diag.warn(\n `Configuration: Could not parse environment-provided export URL: '${url}', falling back to undefined`\n );\n return undefined;\n }\n\n if (!url.endsWith('/')) {\n url = url + '/';\n }\n url += path;\n\n try {\n // just try to parse, if it fails we catch and warn.\n new URL(url);\n } catch {\n diag.warn(\n `Configuration: Provided URL appended with '${path}' is not a valid URL, using 'undefined' instead of '${url}'`\n );\n return undefined;\n }\n\n return url;\n}\n\nfunction getNonSpecificUrlFromEnv(\n signalResourcePath: string\n): string | undefined {\n const envUrl = process.env.OTEL_EXPORTER_OTLP_ENDPOINT?.trim();\n if (envUrl == null || envUrl === '') {\n return undefined;\n }\n return appendResourcePathToUrl(envUrl, signalResourcePath);\n}\n\nfunction getSpecificUrlFromEnv(signalIdentifier: string): string | undefined {\n const envUrl =\n process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_ENDPOINT`]?.trim();\n if (envUrl == null || envUrl === '') {\n return undefined;\n }\n return appendRootPathToUrlIfNeeded(envUrl);\n}\n\n/**\n * Reads and returns configuration from the environment\n *\n * @param signalIdentifier all caps part in environment variables that identifies the signal (e.g.: METRICS, TRACES, LOGS)\n * @param signalResourcePath signal resource path to append if necessary (e.g.: v1/metrics, v1/traces, v1/logs)\n */\nexport function getHttpConfigurationFromEnvironment(\n signalIdentifier: string,\n signalResourcePath: string\n): Partial<OtlpHttpConfiguration> {\n return {\n ...getSharedConfigurationFromEnvironment(signalIdentifier),\n url:\n getSpecificUrlFromEnv(signalIdentifier) ??\n getNonSpecificUrlFromEnv(signalResourcePath),\n headers: wrapStaticHeadersInFunction(\n getStaticHeadersFromEnv(signalIdentifier)\n ),\n };\n}\n"]}
@@ -12,6 +12,7 @@ export interface OtlpSharedConfiguration {
12
12
  compression: 'gzip' | 'none';
13
13
  }
14
14
  export declare function validateTimeoutMillis(timeoutMillis: number): number;
15
+ export declare function wrapStaticHeadersInFunction(headers: Record<string, string> | undefined): (() => Record<string, string>) | undefined;
15
16
  /**
16
17
  * @param userProvidedConfiguration Configuration options provided by the user in code.
17
18
  * @param fallbackConfiguration Fallback to use when the {@link userProvidedConfiguration} does not specify an option.
@@ -21,6 +21,12 @@ export function validateTimeoutMillis(timeoutMillis) {
21
21
  }
22
22
  throw new Error("Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '" + timeoutMillis + "')");
23
23
  }
24
+ export function wrapStaticHeadersInFunction(headers) {
25
+ if (headers == null) {
26
+ return undefined;
27
+ }
28
+ return function () { return headers; };
29
+ }
24
30
  /**
25
31
  * @param userProvidedConfiguration Configuration options provided by the user in code.
26
32
  * @param fallbackConfiguration Fallback to use when the {@link userProvidedConfiguration} does not specify an option.
@@ -1 +1 @@
1
- {"version":3,"file":"shared-configuration.js","sourceRoot":"","sources":["../../../src/configuration/shared-configuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAgBH,MAAM,UAAU,qBAAqB,CAAC,aAAqB;IACzD,IACE,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC;QAC5B,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC;QAC9B,aAAa,GAAG,CAAC,EACjB;QACA,OAAO,aAAa,CAAC;KACtB;IACD,MAAM,IAAI,KAAK,CACb,uFAAqF,aAAa,OAAI,CACvG,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wCAAwC,CACtD,yBAA2D,EAC3D,qBAAuD,EACvD,oBAA6C;;IAE7C,OAAO;QACL,aAAa,EAAE,qBAAqB,CAClC,MAAA,MAAA,yBAAyB,CAAC,aAAa,mCACrC,qBAAqB,CAAC,aAAa,mCACnC,oBAAoB,CAAC,aAAa,CACrC;QACD,gBAAgB,EACd,MAAA,MAAA,yBAAyB,CAAC,gBAAgB,mCAC1C,qBAAqB,CAAC,gBAAgB,mCACtC,oBAAoB,CAAC,gBAAgB;QACvC,WAAW,EACT,MAAA,MAAA,yBAAyB,CAAC,WAAW,mCACrC,qBAAqB,CAAC,WAAW,mCACjC,oBAAoB,CAAC,WAAW;KACnC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,8BAA8B;IAC5C,OAAO;QACL,aAAa,EAAE,KAAK;QACpB,gBAAgB,EAAE,EAAE;QACpB,WAAW,EAAE,MAAM;KACpB,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\n/**\n * Configuration shared across all OTLP exporters\n *\n * Implementation note: anything added here MUST be\n * - platform-agnostic\n * - signal-agnostic\n * - transport-agnostic\n */\nexport interface OtlpSharedConfiguration {\n timeoutMillis: number;\n concurrencyLimit: number;\n compression: 'gzip' | 'none';\n}\n\nexport function validateTimeoutMillis(timeoutMillis: number) {\n if (\n !Number.isNaN(timeoutMillis) &&\n Number.isFinite(timeoutMillis) &&\n timeoutMillis > 0\n ) {\n return timeoutMillis;\n }\n throw new Error(\n `Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${timeoutMillis}')`\n );\n}\n\n/**\n * @param userProvidedConfiguration Configuration options provided by the user in code.\n * @param fallbackConfiguration Fallback to use when the {@link userProvidedConfiguration} does not specify an option.\n * @param defaultConfiguration The defaults as defined by the exporter specification\n */\nexport function mergeOtlpSharedConfigurationWithDefaults(\n userProvidedConfiguration: Partial<OtlpSharedConfiguration>,\n fallbackConfiguration: Partial<OtlpSharedConfiguration>,\n defaultConfiguration: OtlpSharedConfiguration\n): OtlpSharedConfiguration {\n return {\n timeoutMillis: validateTimeoutMillis(\n userProvidedConfiguration.timeoutMillis ??\n fallbackConfiguration.timeoutMillis ??\n defaultConfiguration.timeoutMillis\n ),\n concurrencyLimit:\n userProvidedConfiguration.concurrencyLimit ??\n fallbackConfiguration.concurrencyLimit ??\n defaultConfiguration.concurrencyLimit,\n compression:\n userProvidedConfiguration.compression ??\n fallbackConfiguration.compression ??\n defaultConfiguration.compression,\n };\n}\n\nexport function getSharedConfigurationDefaults(): OtlpSharedConfiguration {\n return {\n timeoutMillis: 10000,\n concurrencyLimit: 30,\n compression: 'none',\n };\n}\n"]}
1
+ {"version":3,"file":"shared-configuration.js","sourceRoot":"","sources":["../../../src/configuration/shared-configuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAgBH,MAAM,UAAU,qBAAqB,CAAC,aAAqB;IACzD,IACE,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC;QAC5B,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC;QAC9B,aAAa,GAAG,CAAC,EACjB;QACA,OAAO,aAAa,CAAC;KACtB;IACD,MAAM,IAAI,KAAK,CACb,uFAAqF,aAAa,OAAI,CACvG,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,OAA2C;IAE3C,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,cAAM,OAAA,OAAO,EAAP,CAAO,CAAC;AACvB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wCAAwC,CACtD,yBAA2D,EAC3D,qBAAuD,EACvD,oBAA6C;;IAE7C,OAAO;QACL,aAAa,EAAE,qBAAqB,CAClC,MAAA,MAAA,yBAAyB,CAAC,aAAa,mCACrC,qBAAqB,CAAC,aAAa,mCACnC,oBAAoB,CAAC,aAAa,CACrC;QACD,gBAAgB,EACd,MAAA,MAAA,yBAAyB,CAAC,gBAAgB,mCAC1C,qBAAqB,CAAC,gBAAgB,mCACtC,oBAAoB,CAAC,gBAAgB;QACvC,WAAW,EACT,MAAA,MAAA,yBAAyB,CAAC,WAAW,mCACrC,qBAAqB,CAAC,WAAW,mCACjC,oBAAoB,CAAC,WAAW;KACnC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,8BAA8B;IAC5C,OAAO;QACL,aAAa,EAAE,KAAK;QACpB,gBAAgB,EAAE,EAAE;QACpB,WAAW,EAAE,MAAM;KACpB,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\n/**\n * Configuration shared across all OTLP exporters\n *\n * Implementation note: anything added here MUST be\n * - platform-agnostic\n * - signal-agnostic\n * - transport-agnostic\n */\nexport interface OtlpSharedConfiguration {\n timeoutMillis: number;\n concurrencyLimit: number;\n compression: 'gzip' | 'none';\n}\n\nexport function validateTimeoutMillis(timeoutMillis: number) {\n if (\n !Number.isNaN(timeoutMillis) &&\n Number.isFinite(timeoutMillis) &&\n timeoutMillis > 0\n ) {\n return timeoutMillis;\n }\n throw new Error(\n `Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${timeoutMillis}')`\n );\n}\n\nexport function wrapStaticHeadersInFunction(\n headers: Record<string, string> | undefined\n): (() => Record<string, string>) | undefined {\n if (headers == null) {\n return undefined;\n }\n\n return () => headers;\n}\n\n/**\n * @param userProvidedConfiguration Configuration options provided by the user in code.\n * @param fallbackConfiguration Fallback to use when the {@link userProvidedConfiguration} does not specify an option.\n * @param defaultConfiguration The defaults as defined by the exporter specification\n */\nexport function mergeOtlpSharedConfigurationWithDefaults(\n userProvidedConfiguration: Partial<OtlpSharedConfiguration>,\n fallbackConfiguration: Partial<OtlpSharedConfiguration>,\n defaultConfiguration: OtlpSharedConfiguration\n): OtlpSharedConfiguration {\n return {\n timeoutMillis: validateTimeoutMillis(\n userProvidedConfiguration.timeoutMillis ??\n fallbackConfiguration.timeoutMillis ??\n defaultConfiguration.timeoutMillis\n ),\n concurrencyLimit:\n userProvidedConfiguration.concurrencyLimit ??\n fallbackConfiguration.concurrencyLimit ??\n defaultConfiguration.concurrencyLimit,\n compression:\n userProvidedConfiguration.compression ??\n fallbackConfiguration.compression ??\n defaultConfiguration.compression,\n };\n}\n\nexport function getSharedConfigurationDefaults(): OtlpSharedConfiguration {\n return {\n timeoutMillis: 10000,\n concurrencyLimit: 30,\n compression: 'none',\n };\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export { createOtlpXhrExportDelegate, createOtlpSendBeaconExportDelegate, } from './otlp-browser-http-export-delegate';
2
+ export { convertLegacyBrowserHttpOptions } from './configuration/convert-legacy-browser-http-options';
3
+ export { createLegacyOtlpBrowserExportDelegate } from './configuration/create-legacy-browser-delegate';
4
+ //# sourceMappingURL=index-browser-http.d.ts.map
@@ -0,0 +1,19 @@
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
+ export { createOtlpXhrExportDelegate, createOtlpSendBeaconExportDelegate, } from './otlp-browser-http-export-delegate';
17
+ export { convertLegacyBrowserHttpOptions } from './configuration/convert-legacy-browser-http-options';
18
+ export { createLegacyOtlpBrowserExportDelegate } from './configuration/create-legacy-browser-delegate';
19
+ //# sourceMappingURL=index-browser-http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-browser-http.js","sourceRoot":"","sources":["../../src/index-browser-http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,2BAA2B,EAC3B,kCAAkC,GACnC,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAC;AACtG,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,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 {\n createOtlpXhrExportDelegate,\n createOtlpSendBeaconExportDelegate,\n} from './otlp-browser-http-export-delegate';\n\nexport { convertLegacyBrowserHttpOptions } from './configuration/convert-legacy-browser-http-options';\nexport { createLegacyOtlpBrowserExportDelegate } from './configuration/create-legacy-browser-delegate';\n"]}
@@ -0,0 +1,4 @@
1
+ export { createOtlpHttpExportDelegate } from './otlp-http-export-delegate';
2
+ export { getSharedConfigurationFromEnvironment } from './configuration/shared-env-configuration';
3
+ export { convertLegacyHttpOptions } from './configuration/convert-legacy-node-http-options';
4
+ //# sourceMappingURL=index-node-http.d.ts.map
@@ -0,0 +1,19 @@
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
+ export { createOtlpHttpExportDelegate } from './otlp-http-export-delegate';
17
+ export { getSharedConfigurationFromEnvironment } from './configuration/shared-env-configuration';
18
+ export { convertLegacyHttpOptions } from './configuration/convert-legacy-node-http-options';
19
+ //# sourceMappingURL=index-node-http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-node-http.js","sourceRoot":"","sources":["../../src/index-node-http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,qCAAqC,EAAE,MAAM,0CAA0C,CAAC;AACjG,OAAO,EAAE,wBAAwB,EAAE,MAAM,kDAAkD,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 { createOtlpHttpExportDelegate } from './otlp-http-export-delegate';\nexport { getSharedConfigurationFromEnvironment } from './configuration/shared-env-configuration';\nexport { convertLegacyHttpOptions } from './configuration/convert-legacy-node-http-options';\n"]}
@@ -1,9 +1,10 @@
1
- export * from './platform';
2
1
  export { OTLPExporterBase } from './OTLPExporterBase';
3
- export { OTLPExporterError, OTLPExporterConfigBase, ExportServiceError, } from './types';
4
- export { validateAndNormalizeHeaders } from './util';
2
+ export { OTLPExporterError } from './types';
5
3
  export { ExportResponse, ExportResponseFailure, ExportResponseSuccess, ExportResponseRetryable, } from './export-response';
6
4
  export { IExporterTransport } from './exporter-transport';
7
5
  export { OtlpSharedConfiguration, mergeOtlpSharedConfigurationWithDefaults, getSharedConfigurationDefaults, } from './configuration/shared-configuration';
8
- export { getSharedConfigurationFromEnvironment } from './configuration/shared-env-configuration';
6
+ export { OTLPExporterNodeConfigBase, CompressionAlgorithm, } from './configuration/legacy-node-configuration';
7
+ export { OTLPExporterConfigBase } from './configuration/legacy-base-configuration';
8
+ export { IOtlpExportDelegate } from './otlp-export-delegate';
9
+ export { createOtlpNetworkExportDelegate } from './otlp-network-export-delegate';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -13,13 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- /* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] --
17
- * TODO: Replace export * with named exports before next major version
18
- */
19
- export * from './platform';
20
16
  export { OTLPExporterBase } from './OTLPExporterBase';
21
- export { OTLPExporterError, } from './types';
22
- export { validateAndNormalizeHeaders } from './util';
17
+ export { OTLPExporterError } from './types';
23
18
  export { mergeOtlpSharedConfigurationWithDefaults, getSharedConfigurationDefaults, } from './configuration/shared-configuration';
24
- export { getSharedConfigurationFromEnvironment } from './configuration/shared-env-configuration';
19
+ export { CompressionAlgorithm, } from './configuration/legacy-node-configuration';
20
+ export { createOtlpNetworkExportDelegate } from './otlp-network-export-delegate';
25
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;GAEG;AACH,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,iBAAiB,GAGlB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,2BAA2B,EAAE,MAAM,QAAQ,CAAC;AAWrD,OAAO,EAEL,wCAAwC,EACxC,8BAA8B,GAC/B,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,qCAAqC,EAAE,MAAM,0CAA0C,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/* eslint no-restricted-syntax: [\"warn\", \"ExportAllDeclaration\"] --\n * TODO: Replace export * with named exports before next major version\n */\nexport * from './platform';\nexport { OTLPExporterBase } from './OTLPExporterBase';\nexport {\n OTLPExporterError,\n OTLPExporterConfigBase,\n ExportServiceError,\n} from './types';\nexport { validateAndNormalizeHeaders } from './util';\n\nexport {\n ExportResponse,\n ExportResponseFailure,\n ExportResponseSuccess,\n ExportResponseRetryable,\n} from './export-response';\n\nexport { IExporterTransport } from './exporter-transport';\n\nexport {\n OtlpSharedConfiguration,\n mergeOtlpSharedConfigurationWithDefaults,\n getSharedConfigurationDefaults,\n} from './configuration/shared-configuration';\n\nexport { getSharedConfigurationFromEnvironment } from './configuration/shared-env-configuration';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAW5C,OAAO,EAEL,wCAAwC,EACxC,8BAA8B,GAC/B,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAEL,oBAAoB,GACrB,MAAM,2CAA2C,CAAC;AAGnD,OAAO,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,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 { OTLPExporterBase } from './OTLPExporterBase';\nexport { OTLPExporterError } from './types';\n\nexport {\n ExportResponse,\n ExportResponseFailure,\n ExportResponseSuccess,\n ExportResponseRetryable,\n} from './export-response';\n\nexport { IExporterTransport } from './exporter-transport';\n\nexport {\n OtlpSharedConfiguration,\n mergeOtlpSharedConfigurationWithDefaults,\n getSharedConfigurationDefaults,\n} from './configuration/shared-configuration';\n\nexport {\n OTLPExporterNodeConfigBase,\n CompressionAlgorithm,\n} from './configuration/legacy-node-configuration';\nexport { OTLPExporterConfigBase } from './configuration/legacy-base-configuration';\nexport { IOtlpExportDelegate } from './otlp-export-delegate';\nexport { createOtlpNetworkExportDelegate } from './otlp-network-export-delegate';\n"]}
@@ -0,0 +1,6 @@
1
+ import { IOtlpResponseHandler } from './response-handler';
2
+ /**
3
+ * Default response handler that logs a partial success to the console.
4
+ */
5
+ export declare function createLoggingPartialSuccessResponseHandler<T>(): IOtlpResponseHandler<T>;
6
+ //# sourceMappingURL=logging-response-handler.d.ts.map
@@ -0,0 +1,38 @@
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 { diag } from '@opentelemetry/api';
17
+ function isPartialSuccessResponse(response) {
18
+ return Object.prototype.hasOwnProperty.call(response, 'partialSuccess');
19
+ }
20
+ /**
21
+ * Default response handler that logs a partial success to the console.
22
+ */
23
+ export function createLoggingPartialSuccessResponseHandler() {
24
+ return {
25
+ handleResponse: function (response) {
26
+ // Partial success MUST never be an empty object according the specification
27
+ // see https://opentelemetry.io/docs/specs/otlp/#partial-success
28
+ if (response == null ||
29
+ !isPartialSuccessResponse(response) ||
30
+ response.partialSuccess == null ||
31
+ Object.keys(response.partialSuccess).length === 0) {
32
+ return;
33
+ }
34
+ diag.warn('Received Partial Success response:', JSON.stringify(response.partialSuccess));
35
+ },
36
+ };
37
+ }
38
+ //# sourceMappingURL=logging-response-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logging-response-handler.js","sourceRoot":"","sources":["../../src/logging-response-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG1C,SAAS,wBAAwB,CAC/B,QAAiB;IAEjB,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;AAC1E,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,0CAA0C;IAGxD,OAAO;QACL,cAAc,EAAd,UAAe,QAAW;YACxB,4EAA4E;YAC5E,gEAAgE;YAChE,IACE,QAAQ,IAAI,IAAI;gBAChB,CAAC,wBAAwB,CAAC,QAAQ,CAAC;gBACnC,QAAQ,CAAC,cAAc,IAAI,IAAI;gBAC/B,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,MAAM,KAAK,CAAC,EACjD;gBACA,OAAO;aACR;YACD,IAAI,CAAC,IAAI,CACP,oCAAoC,EACpC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,CACxC,CAAC;QACJ,CAAC;KACF,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 { diag } from '@opentelemetry/api';\nimport { IOtlpResponseHandler } from './response-handler';\n\nfunction isPartialSuccessResponse(\n response: unknown\n): response is { partialSuccess: never } {\n return Object.prototype.hasOwnProperty.call(response, 'partialSuccess');\n}\n\n/**\n * Default response handler that logs a partial success to the console.\n */\nexport function createLoggingPartialSuccessResponseHandler<\n T,\n>(): IOtlpResponseHandler<T> {\n return {\n handleResponse(response: T) {\n // Partial success MUST never be an empty object according the specification\n // see https://opentelemetry.io/docs/specs/otlp/#partial-success\n if (\n response == null ||\n !isPartialSuccessResponse(response) ||\n response.partialSuccess == null ||\n Object.keys(response.partialSuccess).length === 0\n ) {\n return;\n }\n diag.warn(\n 'Received Partial Success response:',\n JSON.stringify(response.partialSuccess)\n );\n },\n };\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import { OtlpHttpConfiguration } from './configuration/otlp-http-configuration';
2
+ import { ISerializer } from '@opentelemetry/otlp-transformer';
3
+ import { IOtlpExportDelegate } from './otlp-export-delegate';
4
+ export declare function createOtlpXhrExportDelegate<Internal, Response>(options: OtlpHttpConfiguration, serializer: ISerializer<Internal, Response>): IOtlpExportDelegate<Internal>;
5
+ export declare function createOtlpSendBeaconExportDelegate<Internal, Response>(options: OtlpHttpConfiguration, serializer: ISerializer<Internal, Response>): IOtlpExportDelegate<Internal>;
6
+ //# sourceMappingURL=otlp-browser-http-export-delegate.d.ts.map
@@ -0,0 +1,18 @@
1
+ import { createRetryingTransport } from './retrying-transport';
2
+ import { createXhrTransport } from './transport/xhr-transport';
3
+ import { createSendBeaconTransport } from './transport/send-beacon-transport';
4
+ import { createOtlpNetworkExportDelegate } from './otlp-network-export-delegate';
5
+ export function createOtlpXhrExportDelegate(options, serializer) {
6
+ return createOtlpNetworkExportDelegate(options, serializer, createRetryingTransport({
7
+ transport: createXhrTransport(options),
8
+ }));
9
+ }
10
+ export function createOtlpSendBeaconExportDelegate(options, serializer) {
11
+ return createOtlpNetworkExportDelegate(options, serializer, createRetryingTransport({
12
+ transport: createSendBeaconTransport({
13
+ url: options.url,
14
+ blobType: options.headers()['Content-Type'],
15
+ }),
16
+ }));
17
+ }
18
+ //# sourceMappingURL=otlp-browser-http-export-delegate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otlp-browser-http-export-delegate.js","sourceRoot":"","sources":["../../src/otlp-browser-http-export-delegate.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAC;AAEjF,MAAM,UAAU,2BAA2B,CACzC,OAA8B,EAC9B,UAA2C;IAE3C,OAAO,+BAA+B,CACpC,OAAO,EACP,UAAU,EACV,uBAAuB,CAAC;QACtB,SAAS,EAAE,kBAAkB,CAAC,OAAO,CAAC;KACvC,CAAC,CACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kCAAkC,CAChD,OAA8B,EAC9B,UAA2C;IAE3C,OAAO,+BAA+B,CACpC,OAAO,EACP,UAAU,EACV,uBAAuB,CAAC;QACtB,SAAS,EAAE,yBAAyB,CAAC;YACnC,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,cAAc,CAAC;SAC5C,CAAC;KACH,CAAC,CACH,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 { OtlpHttpConfiguration } from './configuration/otlp-http-configuration';\nimport { ISerializer } from '@opentelemetry/otlp-transformer';\nimport { IOtlpExportDelegate } from './otlp-export-delegate';\nimport { createRetryingTransport } from './retrying-transport';\nimport { createXhrTransport } from './transport/xhr-transport';\nimport { createSendBeaconTransport } from './transport/send-beacon-transport';\nimport { createOtlpNetworkExportDelegate } from './otlp-network-export-delegate';\n\nexport function createOtlpXhrExportDelegate<Internal, Response>(\n options: OtlpHttpConfiguration,\n serializer: ISerializer<Internal, Response>\n): IOtlpExportDelegate<Internal> {\n return createOtlpNetworkExportDelegate(\n options,\n serializer,\n createRetryingTransport({\n transport: createXhrTransport(options),\n })\n );\n}\n\nexport function createOtlpSendBeaconExportDelegate<Internal, Response>(\n options: OtlpHttpConfiguration,\n serializer: ISerializer<Internal, Response>\n): IOtlpExportDelegate<Internal> {\n return createOtlpNetworkExportDelegate(\n options,\n serializer,\n createRetryingTransport({\n transport: createSendBeaconTransport({\n url: options.url,\n blobType: options.headers()['Content-Type'],\n }),\n })\n );\n}\n"]}
@@ -0,0 +1,24 @@
1
+ import { ExportResult } from '@opentelemetry/core';
2
+ import { IExporterTransport } from './exporter-transport';
3
+ import { IExportPromiseHandler } from './bounded-queue-export-promise-handler';
4
+ import { ISerializer } from '@opentelemetry/otlp-transformer';
5
+ /**
6
+ * Internally shared export logic for OTLP.
7
+ */
8
+ export interface IOtlpExportDelegate<Internal> {
9
+ export(internalRepresentation: Internal, resultCallback: (result: ExportResult) => void): void;
10
+ forceFlush(): Promise<void>;
11
+ shutdown(): Promise<void>;
12
+ }
13
+ /**
14
+ * Creates a generic delegate for OTLP exports which only contains parts of the OTLP export that are shared across all
15
+ * signals.
16
+ */
17
+ export declare function createOtlpExportDelegate<Internal, Response>(components: {
18
+ transport: IExporterTransport;
19
+ serializer: ISerializer<Internal, Response>;
20
+ promiseHandler: IExportPromiseHandler;
21
+ }, settings: {
22
+ timeout: number;
23
+ }): IOtlpExportDelegate<Internal>;
24
+ //# sourceMappingURL=otlp-export-delegate.d.ts.map
@@ -0,0 +1,155 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
+ return new (P || (P = Promise))(function (resolve, reject) {
19
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
23
+ });
24
+ };
25
+ var __generator = (this && this.__generator) || function (thisArg, body) {
26
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
27
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
28
+ function verb(n) { return function (v) { return step([n, v]); }; }
29
+ function step(op) {
30
+ if (f) throw new TypeError("Generator is already executing.");
31
+ while (_) try {
32
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33
+ if (y = 0, t) op = [op[0] & 2, t.value];
34
+ switch (op[0]) {
35
+ case 0: case 1: t = op; break;
36
+ case 4: _.label++; return { value: op[1], done: false };
37
+ case 5: _.label++; y = op[1]; op = [0]; continue;
38
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
39
+ default:
40
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
41
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
42
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
43
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
44
+ if (t[2]) _.ops.pop();
45
+ _.trys.pop(); continue;
46
+ }
47
+ op = body.call(thisArg, _);
48
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
49
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
50
+ }
51
+ };
52
+ import { ExportResultCode } from '@opentelemetry/core';
53
+ import { OTLPExporterError } from './types';
54
+ import { createLoggingPartialSuccessResponseHandler } from './logging-response-handler';
55
+ import { diag } from '@opentelemetry/api';
56
+ var OTLPExportDelegate = /** @class */ (function () {
57
+ function OTLPExportDelegate(_transport, _serializer, _responseHandler, _promiseQueue, _timeout) {
58
+ this._transport = _transport;
59
+ this._serializer = _serializer;
60
+ this._responseHandler = _responseHandler;
61
+ this._promiseQueue = _promiseQueue;
62
+ this._timeout = _timeout;
63
+ this._diagLogger = diag.createComponentLogger({
64
+ namespace: 'OTLPExportDelegate',
65
+ });
66
+ }
67
+ OTLPExportDelegate.prototype.export = function (internalRepresentation, resultCallback) {
68
+ var _this = this;
69
+ this._diagLogger.debug('items to be sent', internalRepresentation);
70
+ // don't do any work if too many exports are in progress.
71
+ if (this._promiseQueue.hasReachedLimit()) {
72
+ resultCallback({
73
+ code: ExportResultCode.FAILED,
74
+ error: new Error('Concurrent export limit reached'),
75
+ });
76
+ return;
77
+ }
78
+ var serializedRequest = this._serializer.serializeRequest(internalRepresentation);
79
+ if (serializedRequest == null) {
80
+ resultCallback({
81
+ code: ExportResultCode.FAILED,
82
+ error: new Error('Nothing to send'),
83
+ });
84
+ return;
85
+ }
86
+ this._promiseQueue.pushPromise(this._transport.send(serializedRequest, this._timeout).then(function (response) {
87
+ if (response.status === 'success') {
88
+ if (response.data != null) {
89
+ try {
90
+ _this._responseHandler.handleResponse(_this._serializer.deserializeResponse(response.data));
91
+ }
92
+ catch (e) {
93
+ _this._diagLogger.warn('Export succeeded but could not deserialize response - is the response specification compliant?', e, response.data);
94
+ }
95
+ }
96
+ // No matter the response, we can consider the export still successful.
97
+ resultCallback({
98
+ code: ExportResultCode.SUCCESS,
99
+ });
100
+ return;
101
+ }
102
+ else if (response.status === 'failure' && response.error) {
103
+ resultCallback({
104
+ code: ExportResultCode.FAILED,
105
+ error: response.error,
106
+ });
107
+ return;
108
+ }
109
+ else if (response.status === 'retryable') {
110
+ resultCallback({
111
+ code: ExportResultCode.FAILED,
112
+ error: new OTLPExporterError('Export failed with retryable status'),
113
+ });
114
+ }
115
+ else {
116
+ resultCallback({
117
+ code: ExportResultCode.FAILED,
118
+ error: new OTLPExporterError('Export failed with unknown error'),
119
+ });
120
+ }
121
+ }, function (reason) {
122
+ return resultCallback({
123
+ code: ExportResultCode.FAILED,
124
+ error: reason,
125
+ });
126
+ }));
127
+ };
128
+ OTLPExportDelegate.prototype.forceFlush = function () {
129
+ return this._promiseQueue.awaitAll();
130
+ };
131
+ OTLPExportDelegate.prototype.shutdown = function () {
132
+ return __awaiter(this, void 0, void 0, function () {
133
+ return __generator(this, function (_a) {
134
+ switch (_a.label) {
135
+ case 0:
136
+ this._diagLogger.debug('shutdown started');
137
+ return [4 /*yield*/, this.forceFlush()];
138
+ case 1:
139
+ _a.sent();
140
+ this._transport.shutdown();
141
+ return [2 /*return*/];
142
+ }
143
+ });
144
+ });
145
+ };
146
+ return OTLPExportDelegate;
147
+ }());
148
+ /**
149
+ * Creates a generic delegate for OTLP exports which only contains parts of the OTLP export that are shared across all
150
+ * signals.
151
+ */
152
+ export function createOtlpExportDelegate(components, settings) {
153
+ return new OTLPExportDelegate(components.transport, components.serializer, createLoggingPartialSuccessResponseHandler(), components.promiseHandler, settings.timeout);
154
+ }
155
+ //# sourceMappingURL=otlp-export-delegate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otlp-export-delegate.js","sourceRoot":"","sources":["../../src/otlp-export-delegate.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 */\n\nimport { ExportResult, ExportResultCode } from '@opentelemetry/core';\nimport { IExporterTransport } from './exporter-transport';\nimport { IExportPromiseHandler } from './bounded-queue-export-promise-handler';\nimport { ISerializer } from '@opentelemetry/otlp-transformer';\nimport { OTLPExporterError } from './types';\nimport { IOtlpResponseHandler } from './response-handler';\nimport { createLoggingPartialSuccessResponseHandler } from './logging-response-handler';\nimport { diag, DiagLogger } from '@opentelemetry/api';\n\n/**\n * Internally shared export logic for OTLP.\n */\nexport interface IOtlpExportDelegate<Internal> {\n export(\n internalRepresentation: Internal,\n resultCallback: (result: ExportResult) => void\n ): void;\n forceFlush(): Promise<void>;\n shutdown(): Promise<void>;\n}\n\nclass OTLPExportDelegate<Internal, Response>\n implements IOtlpExportDelegate<Internal>\n{\n private _diagLogger: DiagLogger;\n constructor(\n private _transport: IExporterTransport,\n private _serializer: ISerializer<Internal, Response>,\n private _responseHandler: IOtlpResponseHandler<Response>,\n private _promiseQueue: IExportPromiseHandler,\n private _timeout: number\n ) {\n this._diagLogger = diag.createComponentLogger({\n namespace: 'OTLPExportDelegate',\n });\n }\n\n export(\n internalRepresentation: Internal,\n resultCallback: (result: ExportResult) => void\n ): void {\n this._diagLogger.debug('items to be sent', internalRepresentation);\n\n // don't do any work if too many exports are in progress.\n if (this._promiseQueue.hasReachedLimit()) {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Concurrent export limit reached'),\n });\n return;\n }\n\n const serializedRequest = this._serializer.serializeRequest(\n internalRepresentation\n );\n\n if (serializedRequest == null) {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Nothing to send'),\n });\n return;\n }\n\n this._promiseQueue.pushPromise(\n this._transport.send(serializedRequest, this._timeout).then(\n response => {\n if (response.status === 'success') {\n if (response.data != null) {\n try {\n this._responseHandler.handleResponse(\n this._serializer.deserializeResponse(response.data)\n );\n } catch (e) {\n this._diagLogger.warn(\n 'Export succeeded but could not deserialize response - is the response specification compliant?',\n e,\n response.data\n );\n }\n }\n // No matter the response, we can consider the export still successful.\n resultCallback({\n code: ExportResultCode.SUCCESS,\n });\n return;\n } else if (response.status === 'failure' && response.error) {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: response.error,\n });\n return;\n } else if (response.status === 'retryable') {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new OTLPExporterError(\n 'Export failed with retryable status'\n ),\n });\n } else {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new OTLPExporterError('Export failed with unknown error'),\n });\n }\n },\n reason =>\n resultCallback({\n code: ExportResultCode.FAILED,\n error: reason,\n })\n )\n );\n }\n\n forceFlush(): Promise<void> {\n return this._promiseQueue.awaitAll();\n }\n\n async shutdown(): Promise<void> {\n this._diagLogger.debug('shutdown started');\n await this.forceFlush();\n this._transport.shutdown();\n }\n}\n\n/**\n * Creates a generic delegate for OTLP exports which only contains parts of the OTLP export that are shared across all\n * signals.\n */\nexport function createOtlpExportDelegate<Internal, Response>(\n components: {\n transport: IExporterTransport;\n serializer: ISerializer<Internal, Response>;\n promiseHandler: IExportPromiseHandler;\n },\n settings: { timeout: number }\n): IOtlpExportDelegate<Internal> {\n return new OTLPExportDelegate(\n components.transport,\n components.serializer,\n createLoggingPartialSuccessResponseHandler(),\n components.promiseHandler,\n settings.timeout\n );\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import { IOtlpExportDelegate } from './otlp-export-delegate';
2
+ import { OtlpHttpConfiguration } from './configuration/otlp-http-configuration';
3
+ import { ISerializer } from '@opentelemetry/otlp-transformer';
4
+ export declare function createOtlpHttpExportDelegate<Internal, Response>(options: OtlpHttpConfiguration, serializer: ISerializer<Internal, Response>): IOtlpExportDelegate<Internal>;
5
+ //# sourceMappingURL=otlp-http-export-delegate.d.ts.map
@@ -0,0 +1,29 @@
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 { createOtlpExportDelegate, } from './otlp-export-delegate';
17
+ import { createHttpExporterTransport } from './transport/http-exporter-transport';
18
+ import { createBoundedQueueExportPromiseHandler } from './bounded-queue-export-promise-handler';
19
+ import { createRetryingTransport } from './retrying-transport';
20
+ export function createOtlpHttpExportDelegate(options, serializer) {
21
+ return createOtlpExportDelegate({
22
+ transport: createRetryingTransport({
23
+ transport: createHttpExporterTransport(options),
24
+ }),
25
+ serializer: serializer,
26
+ promiseHandler: createBoundedQueueExportPromiseHandler(options),
27
+ }, { timeout: options.timeoutMillis });
28
+ }
29
+ //# sourceMappingURL=otlp-http-export-delegate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otlp-http-export-delegate.js","sourceRoot":"","sources":["../../src/otlp-http-export-delegate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,wBAAwB,GAEzB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,sCAAsC,EAAE,MAAM,wCAAwC,CAAC;AAChG,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,MAAM,UAAU,4BAA4B,CAC1C,OAA8B,EAC9B,UAA2C;IAE3C,OAAO,wBAAwB,CAC7B;QACE,SAAS,EAAE,uBAAuB,CAAC;YACjC,SAAS,EAAE,2BAA2B,CAAC,OAAO,CAAC;SAChD,CAAC;QACF,UAAU,EAAE,UAAU;QACtB,cAAc,EAAE,sCAAsC,CAAC,OAAO,CAAC;KAChE,EACD,EAAE,OAAO,EAAE,OAAO,CAAC,aAAa,EAAE,CACnC,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 createOtlpExportDelegate,\n IOtlpExportDelegate,\n} from './otlp-export-delegate';\nimport { OtlpHttpConfiguration } from './configuration/otlp-http-configuration';\nimport { ISerializer } from '@opentelemetry/otlp-transformer';\nimport { createHttpExporterTransport } from './transport/http-exporter-transport';\nimport { createBoundedQueueExportPromiseHandler } from './bounded-queue-export-promise-handler';\nimport { createRetryingTransport } from './retrying-transport';\n\nexport function createOtlpHttpExportDelegate<Internal, Response>(\n options: OtlpHttpConfiguration,\n serializer: ISerializer<Internal, Response>\n): IOtlpExportDelegate<Internal> {\n return createOtlpExportDelegate(\n {\n transport: createRetryingTransport({\n transport: createHttpExporterTransport(options),\n }),\n serializer: serializer,\n promiseHandler: createBoundedQueueExportPromiseHandler(options),\n },\n { timeout: options.timeoutMillis }\n );\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import { OtlpSharedConfiguration } from './configuration/shared-configuration';
2
+ import { ISerializer } from '@opentelemetry/otlp-transformer';
3
+ import { IExporterTransport } from './exporter-transport';
4
+ import { IOtlpExportDelegate } from './otlp-export-delegate';
5
+ export declare function createOtlpNetworkExportDelegate<Internal, Response>(options: OtlpSharedConfiguration, serializer: ISerializer<Internal, Response>, transport: IExporterTransport): IOtlpExportDelegate<Internal>;
6
+ //# sourceMappingURL=otlp-network-export-delegate.d.ts.map
@@ -0,0 +1,25 @@
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 { createBoundedQueueExportPromiseHandler } from './bounded-queue-export-promise-handler';
17
+ import { createOtlpExportDelegate, } from './otlp-export-delegate';
18
+ export function createOtlpNetworkExportDelegate(options, serializer, transport) {
19
+ return createOtlpExportDelegate({
20
+ transport: transport,
21
+ serializer: serializer,
22
+ promiseHandler: createBoundedQueueExportPromiseHandler(options),
23
+ }, { timeout: options.timeoutMillis });
24
+ }
25
+ //# sourceMappingURL=otlp-network-export-delegate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otlp-network-export-delegate.js","sourceRoot":"","sources":["../../src/otlp-network-export-delegate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,sCAAsC,EAAE,MAAM,wCAAwC,CAAC;AAIhG,OAAO,EACL,wBAAwB,GAEzB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,UAAU,+BAA+B,CAC7C,OAAgC,EAChC,UAA2C,EAC3C,SAA6B;IAE7B,OAAO,wBAAwB,CAC7B;QACE,SAAS,EAAE,SAAS;QACpB,UAAU,YAAA;QACV,cAAc,EAAE,sCAAsC,CAAC,OAAO,CAAC;KAChE,EACD,EAAE,OAAO,EAAE,OAAO,CAAC,aAAa,EAAE,CACnC,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 { createBoundedQueueExportPromiseHandler } from './bounded-queue-export-promise-handler';\nimport { OtlpSharedConfiguration } from './configuration/shared-configuration';\nimport { ISerializer } from '@opentelemetry/otlp-transformer';\nimport { IExporterTransport } from './exporter-transport';\nimport {\n createOtlpExportDelegate,\n IOtlpExportDelegate,\n} from './otlp-export-delegate';\n\nexport function createOtlpNetworkExportDelegate<Internal, Response>(\n options: OtlpSharedConfiguration,\n serializer: ISerializer<Internal, Response>,\n transport: IExporterTransport\n): IOtlpExportDelegate<Internal> {\n return createOtlpExportDelegate(\n {\n transport: transport,\n serializer,\n promiseHandler: createBoundedQueueExportPromiseHandler(options),\n },\n { timeout: options.timeoutMillis }\n );\n}\n"]}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Generic export response handler. Can be implemented to handle export responses like partial success.
3
+ */
4
+ export interface IOtlpResponseHandler<Response> {
5
+ /**
6
+ * Handles an OTLP export response.
7
+ * Implementations MUST NOT throw.
8
+ * @param response
9
+ */
10
+ handleResponse(response: Response): void;
11
+ }
12
+ //# sourceMappingURL=response-handler.d.ts.map
@@ -13,5 +13,5 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { OTLPExporterBrowserBase } from './OTLPExporterBrowserBase';
17
- //# sourceMappingURL=index.js.map
16
+ export {};
17
+ //# sourceMappingURL=response-handler.js.map