@opentelemetry/otlp-exporter-base 0.211.0 → 0.213.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 (223) hide show
  1. package/build/esm/OTLPExporterBase.js +1 -12
  2. package/build/esm/OTLPExporterBase.js.map +1 -1
  3. package/build/esm/bounded-queue-export-promise-handler.js +1 -12
  4. package/build/esm/bounded-queue-export-promise-handler.js.map +1 -1
  5. package/build/esm/configuration/convert-legacy-browser-http-options.js +1 -12
  6. package/build/esm/configuration/convert-legacy-browser-http-options.js.map +1 -1
  7. package/build/esm/configuration/convert-legacy-http-options.js +1 -12
  8. package/build/esm/configuration/convert-legacy-http-options.js.map +1 -1
  9. package/build/esm/configuration/convert-legacy-node-http-options.js.map +1 -1
  10. package/build/esm/configuration/create-legacy-browser-delegate.d.ts +0 -2
  11. package/build/esm/configuration/create-legacy-browser-delegate.js +2 -9
  12. package/build/esm/configuration/create-legacy-browser-delegate.js.map +1 -1
  13. package/build/esm/configuration/legacy-base-configuration.js.map +1 -1
  14. package/build/esm/configuration/legacy-node-configuration.js +1 -12
  15. package/build/esm/configuration/legacy-node-configuration.js.map +1 -1
  16. package/build/esm/configuration/otlp-http-configuration.js +1 -12
  17. package/build/esm/configuration/otlp-http-configuration.js.map +1 -1
  18. package/build/esm/configuration/otlp-node-http-configuration.js +1 -12
  19. package/build/esm/configuration/otlp-node-http-configuration.js.map +1 -1
  20. package/build/esm/configuration/otlp-node-http-env-configuration.js +1 -12
  21. package/build/esm/configuration/otlp-node-http-env-configuration.js.map +1 -1
  22. package/build/esm/configuration/shared-configuration.js +1 -12
  23. package/build/esm/configuration/shared-configuration.js.map +1 -1
  24. package/build/esm/configuration/shared-env-configuration.js +1 -12
  25. package/build/esm/configuration/shared-env-configuration.js.map +1 -1
  26. package/build/esm/export-response.js +1 -12
  27. package/build/esm/export-response.js.map +1 -1
  28. package/build/esm/exporter-transport.js +1 -12
  29. package/build/esm/exporter-transport.js.map +1 -1
  30. package/build/esm/index-browser-http.d.ts +3 -0
  31. package/build/esm/index-browser-http.js +4 -12
  32. package/build/esm/index-browser-http.js.map +1 -1
  33. package/build/esm/index-node-http.js +1 -12
  34. package/build/esm/index-node-http.js.map +1 -1
  35. package/build/esm/index.js +1 -12
  36. package/build/esm/index.js.map +1 -1
  37. package/build/esm/is-export-retryable.js +1 -12
  38. package/build/esm/is-export-retryable.js.map +1 -1
  39. package/build/esm/logging-response-handler.js +1 -12
  40. package/build/esm/logging-response-handler.js.map +1 -1
  41. package/build/esm/otlp-browser-http-export-delegate.d.ts +3 -0
  42. package/build/esm/otlp-browser-http-export-delegate.js +4 -7
  43. package/build/esm/otlp-browser-http-export-delegate.js.map +1 -1
  44. package/build/esm/otlp-export-delegate.js +1 -12
  45. package/build/esm/otlp-export-delegate.js.map +1 -1
  46. package/build/esm/otlp-http-export-delegate.js +1 -12
  47. package/build/esm/otlp-http-export-delegate.js.map +1 -1
  48. package/build/esm/otlp-network-export-delegate.js +1 -12
  49. package/build/esm/otlp-network-export-delegate.js.map +1 -1
  50. package/build/esm/response-handler.js +1 -12
  51. package/build/esm/response-handler.js.map +1 -1
  52. package/build/esm/retrying-transport.js +1 -12
  53. package/build/esm/retrying-transport.js.map +1 -1
  54. package/build/esm/transport/fetch-transport.js +65 -19
  55. package/build/esm/transport/fetch-transport.js.map +1 -1
  56. package/build/esm/transport/http-exporter-transport.js +1 -12
  57. package/build/esm/transport/http-exporter-transport.js.map +1 -1
  58. package/build/esm/transport/http-transport-types.js +1 -12
  59. package/build/esm/transport/http-transport-types.js.map +1 -1
  60. package/build/esm/transport/http-transport-utils.d.ts +4 -1
  61. package/build/esm/transport/http-transport-utils.js +30 -2
  62. package/build/esm/transport/http-transport-utils.js.map +1 -1
  63. package/build/esm/transport/node-http-transport-types.js +1 -12
  64. package/build/esm/transport/node-http-transport-types.js.map +1 -1
  65. package/build/esm/types.js +1 -12
  66. package/build/esm/types.js.map +1 -1
  67. package/build/esm/util.js +1 -12
  68. package/build/esm/util.js.map +1 -1
  69. package/build/esm/version.d.ts +1 -1
  70. package/build/esm/version.js +1 -1
  71. package/build/esm/version.js.map +1 -1
  72. package/build/esnext/OTLPExporterBase.js +1 -12
  73. package/build/esnext/OTLPExporterBase.js.map +1 -1
  74. package/build/esnext/bounded-queue-export-promise-handler.js +1 -12
  75. package/build/esnext/bounded-queue-export-promise-handler.js.map +1 -1
  76. package/build/esnext/configuration/convert-legacy-browser-http-options.js +1 -12
  77. package/build/esnext/configuration/convert-legacy-browser-http-options.js.map +1 -1
  78. package/build/esnext/configuration/convert-legacy-http-options.js +1 -12
  79. package/build/esnext/configuration/convert-legacy-http-options.js.map +1 -1
  80. package/build/esnext/configuration/convert-legacy-node-http-options.js.map +1 -1
  81. package/build/esnext/configuration/create-legacy-browser-delegate.d.ts +0 -2
  82. package/build/esnext/configuration/create-legacy-browser-delegate.js +2 -9
  83. package/build/esnext/configuration/create-legacy-browser-delegate.js.map +1 -1
  84. package/build/esnext/configuration/legacy-base-configuration.js.map +1 -1
  85. package/build/esnext/configuration/legacy-node-configuration.js +1 -12
  86. package/build/esnext/configuration/legacy-node-configuration.js.map +1 -1
  87. package/build/esnext/configuration/otlp-http-configuration.js +1 -12
  88. package/build/esnext/configuration/otlp-http-configuration.js.map +1 -1
  89. package/build/esnext/configuration/otlp-node-http-configuration.js +1 -12
  90. package/build/esnext/configuration/otlp-node-http-configuration.js.map +1 -1
  91. package/build/esnext/configuration/otlp-node-http-env-configuration.js +1 -12
  92. package/build/esnext/configuration/otlp-node-http-env-configuration.js.map +1 -1
  93. package/build/esnext/configuration/shared-configuration.js +1 -12
  94. package/build/esnext/configuration/shared-configuration.js.map +1 -1
  95. package/build/esnext/configuration/shared-env-configuration.js +1 -12
  96. package/build/esnext/configuration/shared-env-configuration.js.map +1 -1
  97. package/build/esnext/export-response.js +1 -12
  98. package/build/esnext/export-response.js.map +1 -1
  99. package/build/esnext/exporter-transport.js +1 -12
  100. package/build/esnext/exporter-transport.js.map +1 -1
  101. package/build/esnext/index-browser-http.d.ts +3 -0
  102. package/build/esnext/index-browser-http.js +4 -12
  103. package/build/esnext/index-browser-http.js.map +1 -1
  104. package/build/esnext/index-node-http.js +1 -12
  105. package/build/esnext/index-node-http.js.map +1 -1
  106. package/build/esnext/index.js +1 -12
  107. package/build/esnext/index.js.map +1 -1
  108. package/build/esnext/is-export-retryable.js +1 -12
  109. package/build/esnext/is-export-retryable.js.map +1 -1
  110. package/build/esnext/logging-response-handler.js +1 -12
  111. package/build/esnext/logging-response-handler.js.map +1 -1
  112. package/build/esnext/otlp-browser-http-export-delegate.d.ts +3 -0
  113. package/build/esnext/otlp-browser-http-export-delegate.js +4 -7
  114. package/build/esnext/otlp-browser-http-export-delegate.js.map +1 -1
  115. package/build/esnext/otlp-export-delegate.js +1 -12
  116. package/build/esnext/otlp-export-delegate.js.map +1 -1
  117. package/build/esnext/otlp-http-export-delegate.js +1 -12
  118. package/build/esnext/otlp-http-export-delegate.js.map +1 -1
  119. package/build/esnext/otlp-network-export-delegate.js +1 -12
  120. package/build/esnext/otlp-network-export-delegate.js.map +1 -1
  121. package/build/esnext/response-handler.js +1 -12
  122. package/build/esnext/response-handler.js.map +1 -1
  123. package/build/esnext/retrying-transport.js +1 -12
  124. package/build/esnext/retrying-transport.js.map +1 -1
  125. package/build/esnext/transport/fetch-transport.js +65 -19
  126. package/build/esnext/transport/fetch-transport.js.map +1 -1
  127. package/build/esnext/transport/http-exporter-transport.js +1 -12
  128. package/build/esnext/transport/http-exporter-transport.js.map +1 -1
  129. package/build/esnext/transport/http-transport-types.js +1 -12
  130. package/build/esnext/transport/http-transport-types.js.map +1 -1
  131. package/build/esnext/transport/http-transport-utils.d.ts +4 -1
  132. package/build/esnext/transport/http-transport-utils.js +30 -2
  133. package/build/esnext/transport/http-transport-utils.js.map +1 -1
  134. package/build/esnext/transport/node-http-transport-types.js +1 -12
  135. package/build/esnext/transport/node-http-transport-types.js.map +1 -1
  136. package/build/esnext/types.js +1 -12
  137. package/build/esnext/types.js.map +1 -1
  138. package/build/esnext/util.js +1 -12
  139. package/build/esnext/util.js.map +1 -1
  140. package/build/esnext/version.d.ts +1 -1
  141. package/build/esnext/version.js +1 -1
  142. package/build/esnext/version.js.map +1 -1
  143. package/build/src/OTLPExporterBase.js +1 -12
  144. package/build/src/OTLPExporterBase.js.map +1 -1
  145. package/build/src/bounded-queue-export-promise-handler.js +1 -12
  146. package/build/src/bounded-queue-export-promise-handler.js.map +1 -1
  147. package/build/src/configuration/convert-legacy-browser-http-options.js +1 -12
  148. package/build/src/configuration/convert-legacy-browser-http-options.js.map +1 -1
  149. package/build/src/configuration/convert-legacy-http-options.js +1 -12
  150. package/build/src/configuration/convert-legacy-http-options.js.map +1 -1
  151. package/build/src/configuration/convert-legacy-node-http-options.js.map +1 -1
  152. package/build/src/configuration/create-legacy-browser-delegate.d.ts +0 -2
  153. package/build/src/configuration/create-legacy-browser-delegate.js +2 -10
  154. package/build/src/configuration/create-legacy-browser-delegate.js.map +1 -1
  155. package/build/src/configuration/legacy-base-configuration.js.map +1 -1
  156. package/build/src/configuration/legacy-node-configuration.js +1 -12
  157. package/build/src/configuration/legacy-node-configuration.js.map +1 -1
  158. package/build/src/configuration/otlp-http-configuration.js +1 -12
  159. package/build/src/configuration/otlp-http-configuration.js.map +1 -1
  160. package/build/src/configuration/otlp-node-http-configuration.js +1 -12
  161. package/build/src/configuration/otlp-node-http-configuration.js.map +1 -1
  162. package/build/src/configuration/otlp-node-http-env-configuration.js +1 -12
  163. package/build/src/configuration/otlp-node-http-env-configuration.js.map +1 -1
  164. package/build/src/configuration/shared-configuration.js +1 -12
  165. package/build/src/configuration/shared-configuration.js.map +1 -1
  166. package/build/src/configuration/shared-env-configuration.js +1 -12
  167. package/build/src/configuration/shared-env-configuration.js.map +1 -1
  168. package/build/src/export-response.js +1 -12
  169. package/build/src/export-response.js.map +1 -1
  170. package/build/src/exporter-transport.js +1 -12
  171. package/build/src/exporter-transport.js.map +1 -1
  172. package/build/src/index-browser-http.d.ts +3 -0
  173. package/build/src/index-browser-http.js +4 -12
  174. package/build/src/index-browser-http.js.map +1 -1
  175. package/build/src/index-node-http.js +1 -12
  176. package/build/src/index-node-http.js.map +1 -1
  177. package/build/src/index.js +1 -12
  178. package/build/src/index.js.map +1 -1
  179. package/build/src/is-export-retryable.js +1 -12
  180. package/build/src/is-export-retryable.js.map +1 -1
  181. package/build/src/logging-response-handler.js +1 -12
  182. package/build/src/logging-response-handler.js.map +1 -1
  183. package/build/src/otlp-browser-http-export-delegate.d.ts +3 -0
  184. package/build/src/otlp-browser-http-export-delegate.js +4 -7
  185. package/build/src/otlp-browser-http-export-delegate.js.map +1 -1
  186. package/build/src/otlp-export-delegate.js +1 -12
  187. package/build/src/otlp-export-delegate.js.map +1 -1
  188. package/build/src/otlp-http-export-delegate.js +1 -12
  189. package/build/src/otlp-http-export-delegate.js.map +1 -1
  190. package/build/src/otlp-network-export-delegate.js +1 -12
  191. package/build/src/otlp-network-export-delegate.js.map +1 -1
  192. package/build/src/response-handler.js +1 -12
  193. package/build/src/response-handler.js.map +1 -1
  194. package/build/src/retrying-transport.js +1 -12
  195. package/build/src/retrying-transport.js.map +1 -1
  196. package/build/src/transport/fetch-transport.js +65 -19
  197. package/build/src/transport/fetch-transport.js.map +1 -1
  198. package/build/src/transport/http-exporter-transport.js +1 -12
  199. package/build/src/transport/http-exporter-transport.js.map +1 -1
  200. package/build/src/transport/http-transport-types.js +1 -12
  201. package/build/src/transport/http-transport-types.js.map +1 -1
  202. package/build/src/transport/http-transport-utils.d.ts +4 -1
  203. package/build/src/transport/http-transport-utils.js +30 -2
  204. package/build/src/transport/http-transport-utils.js.map +1 -1
  205. package/build/src/transport/node-http-transport-types.js +1 -12
  206. package/build/src/transport/node-http-transport-types.js.map +1 -1
  207. package/build/src/types.js +1 -12
  208. package/build/src/types.js.map +1 -1
  209. package/build/src/util.js +1 -12
  210. package/build/src/util.js.map +1 -1
  211. package/build/src/version.d.ts +1 -1
  212. package/build/src/version.js +1 -1
  213. package/build/src/version.js.map +1 -1
  214. package/package.json +5 -5
  215. package/build/esm/transport/send-beacon-transport.d.ts +0 -12
  216. package/build/esm/transport/send-beacon-transport.js +0 -47
  217. package/build/esm/transport/send-beacon-transport.js.map +0 -1
  218. package/build/esnext/transport/send-beacon-transport.d.ts +0 -12
  219. package/build/esnext/transport/send-beacon-transport.js +0 -47
  220. package/build/esnext/transport/send-beacon-transport.js.map +0 -1
  221. package/build/src/transport/send-beacon-transport.d.ts +0 -12
  222. package/build/src/transport/send-beacon-transport.js +0 -51
  223. package/build/src/transport/send-beacon-transport.js.map +0 -1
@@ -1,17 +1,6 @@
1
1
  /*
2
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.
3
+ * SPDX-License-Identifier: Apache-2.0
15
4
  */
16
5
  export class OTLPExporterBase {
17
6
  _delegate;
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPExporterBase.js","sourceRoot":"","sources":["../../src/OTLPExporterBase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,MAAM,OAAO,gBAAgB;IACnB,SAAS,CAAgC;IACjD,YAAY,QAAuC;QACjD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED;;;;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 private _delegate: IOtlpExportDelegate<Internal>;\n constructor(delegate: IOtlpExportDelegate<Internal>) {\n this._delegate = delegate;\n }\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"]}
1
+ {"version":3,"file":"OTLPExporterBase.js","sourceRoot":"","sources":["../../src/OTLPExporterBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,OAAO,gBAAgB;IACnB,SAAS,CAAgC;IACjD,YAAY,QAAuC;QACjD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED;;;;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 * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ExportResult } from '@opentelemetry/core';\nimport { IOtlpExportDelegate } from './otlp-export-delegate';\n\nexport class OTLPExporterBase<Internal> {\n private _delegate: IOtlpExportDelegate<Internal>;\n constructor(delegate: IOtlpExportDelegate<Internal>) {\n this._delegate = delegate;\n }\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"]}
@@ -1,17 +1,6 @@
1
1
  /*
2
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.
3
+ * SPDX-License-Identifier: Apache-2.0
15
4
  */
16
5
  class BoundedQueueExportPromiseHandler {
17
6
  _concurrencyLimit;
@@ -1 +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;IACnB,iBAAiB,CAAS;IACnC,gBAAgB,GAAuB,EAAE,CAAC;IAElD;;OAEG;IACH,YAAY,gBAAwB;QAClC,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,KAAK,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC9C,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 void 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"]}
1
+ {"version":3,"file":"bounded-queue-export-promise-handler.js","sourceRoot":"","sources":["../../src/bounded-queue-export-promise-handler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,MAAM,gCAAgC;IACnB,iBAAiB,CAAS;IACnC,gBAAgB,GAAuB,EAAE,CAAC;IAElD;;OAEG;IACH,YAAY,gBAAwB;QAClC,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,KAAK,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC9C,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 * SPDX-License-Identifier: Apache-2.0\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 void 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"]}
@@ -1,17 +1,6 @@
1
1
  /*
2
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.
3
+ * SPDX-License-Identifier: Apache-2.0
15
4
  */
16
5
  import { getHttpConfigurationDefaults, mergeOtlpHttpConfigurationWithDefaults, } from './otlp-http-configuration';
17
6
  import { convertLegacyHeaders } from './convert-legacy-http-options';
@@ -1 +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,oBAAoB,EAAE,MAAM,+BAA+B,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,oBAAoB,CAAC,MAAM,CAAC;QACrC,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 { convertLegacyHeaders } from './convert-legacy-http-options';\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: convertLegacyHeaders(config),\n concurrencyLimit: config.concurrencyLimit,\n },\n {}, // no fallback for browser case\n getHttpConfigurationDefaults(requiredHeaders, signalResourcePath)\n );\n}\n"]}
1
+ {"version":3,"file":"convert-legacy-browser-http-options.js","sourceRoot":"","sources":["../../../src/configuration/convert-legacy-browser-http-options.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,4BAA4B,EAC5B,sCAAsC,GAEvC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,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,oBAAoB,CAAC,MAAM,CAAC;QACrC,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 * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n getHttpConfigurationDefaults,\n mergeOtlpHttpConfigurationWithDefaults,\n OtlpHttpConfiguration,\n} from './otlp-http-configuration';\nimport { OTLPExporterNodeConfigBase } from './legacy-node-configuration';\nimport { convertLegacyHeaders } from './convert-legacy-http-options';\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: convertLegacyHeaders(config),\n concurrencyLimit: config.concurrencyLimit,\n },\n {}, // no fallback for browser case\n getHttpConfigurationDefaults(requiredHeaders, signalResourcePath)\n );\n}\n"]}
@@ -1,17 +1,6 @@
1
1
  /*
2
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.
3
+ * SPDX-License-Identifier: Apache-2.0
15
4
  */
16
5
  import { wrapStaticHeadersInFunction } from './shared-configuration';
17
6
  export function convertLegacyHeaders(config) {
@@ -1 +1 @@
1
- {"version":3,"file":"convert-legacy-http-options.js","sourceRoot":"","sources":["../../../src/configuration/convert-legacy-http-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAGrE,MAAM,UAAU,oBAAoB,CAClC,MAA8B;IAE9B,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,UAAU,EAAE;QACxC,OAAO,MAAM,CAAC,OAAO,CAAC;KACvB;IACD,OAAO,2BAA2B,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACrD,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 { OTLPExporterConfigBase } from './legacy-base-configuration';\nimport { wrapStaticHeadersInFunction } from './shared-configuration';\nimport { HeadersFactory } from './otlp-http-configuration';\n\nexport function convertLegacyHeaders(\n config: OTLPExporterConfigBase\n): HeadersFactory | undefined {\n if (typeof config.headers === 'function') {\n return config.headers;\n }\n return wrapStaticHeadersInFunction(config.headers);\n}\n"]}
1
+ {"version":3,"file":"convert-legacy-http-options.js","sourceRoot":"","sources":["../../../src/configuration/convert-legacy-http-options.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAGrE,MAAM,UAAU,oBAAoB,CAClC,MAA8B;IAE9B,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,UAAU,EAAE;QACxC,OAAO,MAAM,CAAC,OAAO,CAAC;KACvB;IACD,OAAO,2BAA2B,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACrD,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { OTLPExporterConfigBase } from './legacy-base-configuration';\nimport { wrapStaticHeadersInFunction } from './shared-configuration';\nimport { HeadersFactory } from './otlp-http-configuration';\n\nexport function convertLegacyHeaders(\n config: OTLPExporterConfigBase\n): HeadersFactory | undefined {\n if (typeof config.headers === 'function') {\n return config.headers;\n }\n return wrapStaticHeadersInFunction(config.headers);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"convert-legacy-node-http-options.js","sourceRoot":"","sources":["../../../src/configuration/convert-legacy-node-http-options.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EACL,gCAAgC,EAEhC,0CAA0C,GAE3C,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,uCAAuC,EAAE,MAAM,oCAAoC,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,SAAS,yBAAyB,CAChC,MAAkC;IAElC,IAAI,OAAO,MAAM,CAAC,gBAAgB,KAAK,UAAU,EAAE;QACjD,OAAO,MAAM,CAAC,gBAAgB,CAAC;KAChC;IAED,IAAI,MAAM,GAAG,MAAM,CAAC,gBAAgB,CAAC;IACrC,IAAI,MAAM,CAAC,SAAS,IAAI,IAAI,EAAE;QAC5B,MAAM,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,MAAM,EAAE,CAAC;KACrD;IAED,IAAI,MAAM,IAAI,IAAI,EAAE;QAClB,OAAO,2BAA2B,CAAC,MAAM,CAAC,CAAC;KAC5C;SAAM;QACL,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAAkC,EAClC,gBAAwB,EACxB,kBAA0B,EAC1B,eAAuC;IAEvC,8DAA8D;IAC9D,IAAK,MAAc,CAAC,QAAQ,EAAE;QAC5B,IAAI,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;KACrD;IAED,OAAO,0CAA0C,CAC/C;QACE,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,OAAO,EAAE,oBAAoB,CAAC,MAAM,CAAC;QACrC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;QACzC,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,YAAY,EAAE,yBAAyB,CAAC,MAAM,CAAC;QAC/C,SAAS,EAAE,MAAM,CAAC,SAAS;KAC5B,EACD,uCAAuC,CACrC,gBAAgB,EAChB,kBAAkB,CACnB,EACD,gCAAgC,CAAC,eAAe,EAAE,kBAAkB,CAAC,CACtE,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 { OTLPExporterNodeConfigBase } from './legacy-node-configuration';\nimport { diag } from '@opentelemetry/api';\nimport {\n getNodeHttpConfigurationDefaults,\n HttpAgentFactory,\n mergeOtlpNodeHttpConfigurationWithDefaults,\n OtlpNodeHttpConfiguration,\n} from './otlp-node-http-configuration';\nimport { httpAgentFactoryFromOptions } from '../index-node-http';\nimport { getNodeHttpConfigurationFromEnvironment } from './otlp-node-http-env-configuration';\nimport { convertLegacyHeaders } from './convert-legacy-http-options';\n\nfunction convertLegacyAgentOptions(\n config: OTLPExporterNodeConfigBase\n): HttpAgentFactory | undefined {\n if (typeof config.httpAgentOptions === 'function') {\n return config.httpAgentOptions;\n }\n\n let legacy = config.httpAgentOptions;\n if (config.keepAlive != null) {\n legacy = { keepAlive: config.keepAlive, ...legacy };\n }\n\n if (legacy != null) {\n return httpAgentFactoryFromOptions(legacy);\n } else {\n return undefined;\n }\n}\n\n/**\n * @deprecated this will be removed in 2.0\n * @param config\n * @param signalIdentifier\n * @param signalResourcePath\n * @param requiredHeaders\n */\nexport function convertLegacyHttpOptions(\n config: OTLPExporterNodeConfigBase,\n signalIdentifier: string,\n signalResourcePath: string,\n requiredHeaders: Record<string, string>\n): OtlpNodeHttpConfiguration {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((config as any).metadata) {\n diag.warn('Metadata cannot be set when using http');\n }\n\n return mergeOtlpNodeHttpConfigurationWithDefaults(\n {\n url: config.url,\n headers: convertLegacyHeaders(config),\n concurrencyLimit: config.concurrencyLimit,\n timeoutMillis: config.timeoutMillis,\n compression: config.compression,\n agentFactory: convertLegacyAgentOptions(config),\n userAgent: config.userAgent,\n },\n getNodeHttpConfigurationFromEnvironment(\n signalIdentifier,\n signalResourcePath\n ),\n getNodeHttpConfigurationDefaults(requiredHeaders, signalResourcePath)\n );\n}\n"]}
1
+ {"version":3,"file":"convert-legacy-node-http-options.js","sourceRoot":"","sources":["../../../src/configuration/convert-legacy-node-http-options.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EACL,gCAAgC,EAEhC,0CAA0C,GAE3C,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,uCAAuC,EAAE,MAAM,oCAAoC,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,SAAS,yBAAyB,CAChC,MAAkC;IAElC,IAAI,OAAO,MAAM,CAAC,gBAAgB,KAAK,UAAU,EAAE;QACjD,OAAO,MAAM,CAAC,gBAAgB,CAAC;KAChC;IAED,IAAI,MAAM,GAAG,MAAM,CAAC,gBAAgB,CAAC;IACrC,IAAI,MAAM,CAAC,SAAS,IAAI,IAAI,EAAE;QAC5B,MAAM,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,MAAM,EAAE,CAAC;KACrD;IAED,IAAI,MAAM,IAAI,IAAI,EAAE;QAClB,OAAO,2BAA2B,CAAC,MAAM,CAAC,CAAC;KAC5C;SAAM;QACL,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAAkC,EAClC,gBAAwB,EACxB,kBAA0B,EAC1B,eAAuC;IAEvC,8DAA8D;IAC9D,IAAK,MAAc,CAAC,QAAQ,EAAE;QAC5B,IAAI,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;KACrD;IAED,OAAO,0CAA0C,CAC/C;QACE,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,OAAO,EAAE,oBAAoB,CAAC,MAAM,CAAC;QACrC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;QACzC,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,YAAY,EAAE,yBAAyB,CAAC,MAAM,CAAC;QAC/C,SAAS,EAAE,MAAM,CAAC,SAAS;KAC5B,EACD,uCAAuC,CACrC,gBAAgB,EAChB,kBAAkB,CACnB,EACD,gCAAgC,CAAC,eAAe,EAAE,kBAAkB,CAAC,CACtE,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { OTLPExporterNodeConfigBase } from './legacy-node-configuration';\nimport { diag } from '@opentelemetry/api';\nimport {\n getNodeHttpConfigurationDefaults,\n HttpAgentFactory,\n mergeOtlpNodeHttpConfigurationWithDefaults,\n OtlpNodeHttpConfiguration,\n} from './otlp-node-http-configuration';\nimport { httpAgentFactoryFromOptions } from '../index-node-http';\nimport { getNodeHttpConfigurationFromEnvironment } from './otlp-node-http-env-configuration';\nimport { convertLegacyHeaders } from './convert-legacy-http-options';\n\nfunction convertLegacyAgentOptions(\n config: OTLPExporterNodeConfigBase\n): HttpAgentFactory | undefined {\n if (typeof config.httpAgentOptions === 'function') {\n return config.httpAgentOptions;\n }\n\n let legacy = config.httpAgentOptions;\n if (config.keepAlive != null) {\n legacy = { keepAlive: config.keepAlive, ...legacy };\n }\n\n if (legacy != null) {\n return httpAgentFactoryFromOptions(legacy);\n } else {\n return undefined;\n }\n}\n\n/**\n * @deprecated this will be removed in 2.0\n * @param config\n * @param signalIdentifier\n * @param signalResourcePath\n * @param requiredHeaders\n */\nexport function convertLegacyHttpOptions(\n config: OTLPExporterNodeConfigBase,\n signalIdentifier: string,\n signalResourcePath: string,\n requiredHeaders: Record<string, string>\n): OtlpNodeHttpConfiguration {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((config as any).metadata) {\n diag.warn('Metadata cannot be set when using http');\n }\n\n return mergeOtlpNodeHttpConfigurationWithDefaults(\n {\n url: config.url,\n headers: convertLegacyHeaders(config),\n concurrencyLimit: config.concurrencyLimit,\n timeoutMillis: config.timeoutMillis,\n compression: config.compression,\n agentFactory: convertLegacyAgentOptions(config),\n userAgent: config.userAgent,\n },\n getNodeHttpConfigurationFromEnvironment(\n signalIdentifier,\n signalResourcePath\n ),\n getNodeHttpConfigurationDefaults(requiredHeaders, signalResourcePath)\n );\n}\n"]}
@@ -1,5 +1,4 @@
1
1
  import { ISerializer } from '@opentelemetry/otlp-transformer';
2
- import { createOtlpSendBeaconExportDelegate } from '../otlp-browser-http-export-delegate';
3
2
  import { IOtlpExportDelegate } from '../otlp-export-delegate';
4
3
  import { OTLPExporterConfigBase } from './legacy-base-configuration';
5
4
  /**
@@ -10,5 +9,4 @@ import { OTLPExporterConfigBase } from './legacy-base-configuration';
10
9
  * @param requiredHeaders
11
10
  */
12
11
  export declare function createLegacyOtlpBrowserExportDelegate<Internal, Response>(config: OTLPExporterConfigBase, serializer: ISerializer<Internal, Response>, signalResourcePath: string, requiredHeaders: Record<string, string>): IOtlpExportDelegate<Internal>;
13
- export declare function inferExportDelegateToUse(configHeaders: OTLPExporterConfigBase['headers']): typeof createOtlpSendBeaconExportDelegate;
14
12
  //# sourceMappingURL=create-legacy-browser-delegate.d.ts.map
@@ -1,4 +1,4 @@
1
- import { createOtlpFetchExportDelegate, createOtlpSendBeaconExportDelegate, } from '../otlp-browser-http-export-delegate';
1
+ import { createOtlpFetchExportDelegate } from '../otlp-browser-http-export-delegate';
2
2
  import { convertLegacyBrowserHttpOptions } from './convert-legacy-browser-http-options';
3
3
  /**
4
4
  * @deprecated
@@ -8,14 +8,7 @@ import { convertLegacyBrowserHttpOptions } from './convert-legacy-browser-http-o
8
8
  * @param requiredHeaders
9
9
  */
10
10
  export function createLegacyOtlpBrowserExportDelegate(config, serializer, signalResourcePath, requiredHeaders) {
11
- const createOtlpExportDelegate = inferExportDelegateToUse(config.headers);
12
11
  const options = convertLegacyBrowserHttpOptions(config, signalResourcePath, requiredHeaders);
13
- return createOtlpExportDelegate(options, serializer);
14
- }
15
- export function inferExportDelegateToUse(configHeaders) {
16
- if (!configHeaders && typeof navigator.sendBeacon === 'function') {
17
- return createOtlpSendBeaconExportDelegate;
18
- }
19
- return createOtlpFetchExportDelegate;
12
+ return createOtlpFetchExportDelegate(options, serializer);
20
13
  }
21
14
  //# sourceMappingURL=create-legacy-browser-delegate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-legacy-browser-delegate.js","sourceRoot":"","sources":["../../../src/configuration/create-legacy-browser-delegate.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,6BAA6B,EAC7B,kCAAkC,GACnC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AAIxF;;;;;;GAMG;AACH,MAAM,UAAU,qCAAqC,CACnD,MAA8B,EAC9B,UAA2C,EAC3C,kBAA0B,EAC1B,eAAuC;IAEvC,MAAM,wBAAwB,GAAG,wBAAwB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAE1E,MAAM,OAAO,GAAG,+BAA+B,CAC7C,MAAM,EACN,kBAAkB,EAClB,eAAe,CAChB,CAAC;IAEF,OAAO,wBAAwB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,aAAgD;IAEhD,IAAI,CAAC,aAAa,IAAI,OAAO,SAAS,CAAC,UAAU,KAAK,UAAU,EAAE;QAChE,OAAO,kCAAkC,CAAC;KAC3C;IAED,OAAO,6BAA6B,CAAC;AACvC,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 { ISerializer } from '@opentelemetry/otlp-transformer';\nimport {\n createOtlpFetchExportDelegate,\n createOtlpSendBeaconExportDelegate,\n} from '../otlp-browser-http-export-delegate';\nimport { convertLegacyBrowserHttpOptions } from './convert-legacy-browser-http-options';\nimport { IOtlpExportDelegate } from '../otlp-export-delegate';\nimport { OTLPExporterConfigBase } from './legacy-base-configuration';\n\n/**\n * @deprecated\n * @param config\n * @param serializer\n * @param signalResourcePath\n * @param requiredHeaders\n */\nexport function createLegacyOtlpBrowserExportDelegate<Internal, Response>(\n config: OTLPExporterConfigBase,\n serializer: ISerializer<Internal, Response>,\n signalResourcePath: string,\n requiredHeaders: Record<string, string>\n): IOtlpExportDelegate<Internal> {\n const createOtlpExportDelegate = inferExportDelegateToUse(config.headers);\n\n const options = convertLegacyBrowserHttpOptions(\n config,\n signalResourcePath,\n requiredHeaders\n );\n\n return createOtlpExportDelegate(options, serializer);\n}\n\nexport function inferExportDelegateToUse(\n configHeaders: OTLPExporterConfigBase['headers']\n) {\n if (!configHeaders && typeof navigator.sendBeacon === 'function') {\n return createOtlpSendBeaconExportDelegate;\n }\n\n return createOtlpFetchExportDelegate;\n}\n"]}
1
+ {"version":3,"file":"create-legacy-browser-delegate.js","sourceRoot":"","sources":["../../../src/configuration/create-legacy-browser-delegate.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AAIxF;;;;;;GAMG;AACH,MAAM,UAAU,qCAAqC,CACnD,MAA8B,EAC9B,UAA2C,EAC3C,kBAA0B,EAC1B,eAAuC;IAEvC,MAAM,OAAO,GAAG,+BAA+B,CAC7C,MAAM,EACN,kBAAkB,EAClB,eAAe,CAChB,CAAC;IAEF,OAAO,6BAA6B,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { ISerializer } from '@opentelemetry/otlp-transformer';\nimport { createOtlpFetchExportDelegate } from '../otlp-browser-http-export-delegate';\nimport { convertLegacyBrowserHttpOptions } from './convert-legacy-browser-http-options';\nimport { IOtlpExportDelegate } from '../otlp-export-delegate';\nimport { OTLPExporterConfigBase } from './legacy-base-configuration';\n\n/**\n * @deprecated\n * @param config\n * @param serializer\n * @param signalResourcePath\n * @param requiredHeaders\n */\nexport function createLegacyOtlpBrowserExportDelegate<Internal, Response>(\n config: OTLPExporterConfigBase,\n serializer: ISerializer<Internal, Response>,\n signalResourcePath: string,\n requiredHeaders: Record<string, string>\n): IOtlpExportDelegate<Internal> {\n const options = convertLegacyBrowserHttpOptions(\n config,\n signalResourcePath,\n requiredHeaders\n );\n\n return createOtlpFetchExportDelegate(options, serializer);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"legacy-base-configuration.js","sourceRoot":"","sources":["../../../src/configuration/legacy-base-configuration.ts"],"names":[],"mappings":"","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 { HeadersFactory } from './otlp-http-configuration';\n\nexport interface OTLPExporterConfigBase {\n /**\n * Custom headers that will be attached to the HTTP request that's sent to the endpoint.\n *\n * @remarks\n * Prefer using a plain object over a factory function wherever possible.\n * If using a factory function (`HttpAgentFactory`), **do not import `http` or `https` at the top of the file**\n * Instead, use dynamic `import()` or `require()` to load the module. This ensures that the `http` or `https`\n * module is not loaded before `@opentelemetry/instrumentation-http` can instrument it.\n *\n * Functions passed to the exporter MUST NOT throw errors.\n *\n * @example <caption> Using headers options directly: </caption>\n * headers: {\n * Authorization: \"Api-Token my-secret-token\",\n * }\n *\n * @example <caption> Using a custom factory function </caption>\n * headers: async () => {\n * // ... do whatever you need to obtain the headers, ensuring you `await import('your-library')` to avoid breaking instrumentations ...\n * return {\n * Authorization: `Bearer ${token}`,\n * };\n * };\n */\n headers?: Record<string, string> | HeadersFactory;\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":"legacy-base-configuration.js","sourceRoot":"","sources":["../../../src/configuration/legacy-base-configuration.ts"],"names":[],"mappings":"","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { HeadersFactory } from './otlp-http-configuration';\n\nexport interface OTLPExporterConfigBase {\n /**\n * Custom headers that will be attached to the HTTP request that's sent to the endpoint.\n *\n * @remarks\n * Prefer using a plain object over a factory function wherever possible.\n * If using a factory function (`HttpAgentFactory`), **do not import `http` or `https` at the top of the file**\n * Instead, use dynamic `import()` or `require()` to load the module. This ensures that the `http` or `https`\n * module is not loaded before `@opentelemetry/instrumentation-http` can instrument it.\n *\n * Functions passed to the exporter MUST NOT throw errors.\n *\n * @example <caption> Using headers options directly: </caption>\n * headers: {\n * Authorization: \"Api-Token my-secret-token\",\n * }\n *\n * @example <caption> Using a custom factory function </caption>\n * headers: async () => {\n * // ... do whatever you need to obtain the headers, ensuring you `await import('your-library')` to avoid breaking instrumentations ...\n * return {\n * Authorization: `Bearer ${token}`,\n * };\n * };\n */\n headers?: Record<string, string> | HeadersFactory;\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,17 +1,6 @@
1
1
  /*
2
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.
3
+ * SPDX-License-Identifier: Apache-2.0
15
4
  */
16
5
  export var CompressionAlgorithm;
17
6
  (function (CompressionAlgorithm) {
@@ -1 +1 @@
1
- {"version":3,"file":"legacy-node-configuration.js","sourceRoot":"","sources":["../../../src/configuration/legacy-node-configuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA8CH,MAAM,CAAN,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,qCAAa,CAAA;IACb,qCAAa,CAAA;AACf,CAAC,EAHW,oBAAoB,KAApB,oBAAoB,QAG/B","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// NOTE: do not change these imports to be actual imports, otherwise they WILL break `@opentelemetry/instrumentation-http`\nimport type * as http from 'http';\nimport type * as https from 'https';\n\nimport type { OTLPExporterConfigBase } from './legacy-base-configuration';\nimport type { HttpAgentFactory } from './otlp-node-http-configuration';\n\n/**\n * Collector Exporter node base config\n */\nexport interface OTLPExporterNodeConfigBase extends OTLPExporterConfigBase {\n keepAlive?: boolean;\n compression?: CompressionAlgorithm;\n /**\n * Custom HTTP agent options or a factory function for creating agents.\n *\n * @remarks\n * Prefer using `http.AgentOptions` or `https.AgentOptions` over a factory function wherever possible.\n * If using a factory function (`HttpAgentFactory`), **do not import `http.Agent` or `https.Agent`\n * statically at the top of the file**.\n * Instead, use dynamic `import()` or `require()` to load the module. This ensures that the `http` or `https`\n * module is not loaded before `@opentelemetry/instrumentation-http` can instrument it.\n *\n * @example <caption> Using agent options directly: </caption>\n * httpAgentOptions: {\n * keepAlive: true,\n * maxSockets: 10\n * }\n *\n * @example <caption> Using a factory with dynamic import: </caption>\n * httpAgentOptions: async (protocol) => {\n * const module = protocol === 'http:' ? await import('http') : await import('https');\n * return new module.Agent({ keepAlive: true });\n * }\n */\n httpAgentOptions?: http.AgentOptions | https.AgentOptions | HttpAgentFactory;\n /**\n * User agent header string to be prepended to the exporter's default value.\n * Availablie since v1.49.0 of the spec.\n * Ref: https://opentelemetry.io/docs/specs/otel/protocol/exporter/#user-agent\n */\n userAgent?: string;\n}\n\nexport enum CompressionAlgorithm {\n NONE = 'none',\n GZIP = 'gzip',\n}\n"]}
1
+ {"version":3,"file":"legacy-node-configuration.js","sourceRoot":"","sources":["../../../src/configuration/legacy-node-configuration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA8CH,MAAM,CAAN,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,qCAAa,CAAA;IACb,qCAAa,CAAA;AACf,CAAC,EAHW,oBAAoB,KAApB,oBAAoB,QAG/B","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// NOTE: do not change these imports to be actual imports, otherwise they WILL break `@opentelemetry/instrumentation-http`\nimport type * as http from 'http';\nimport type * as https from 'https';\n\nimport type { OTLPExporterConfigBase } from './legacy-base-configuration';\nimport type { HttpAgentFactory } from './otlp-node-http-configuration';\n\n/**\n * Collector Exporter node base config\n */\nexport interface OTLPExporterNodeConfigBase extends OTLPExporterConfigBase {\n keepAlive?: boolean;\n compression?: CompressionAlgorithm;\n /**\n * Custom HTTP agent options or a factory function for creating agents.\n *\n * @remarks\n * Prefer using `http.AgentOptions` or `https.AgentOptions` over a factory function wherever possible.\n * If using a factory function (`HttpAgentFactory`), **do not import `http.Agent` or `https.Agent`\n * statically at the top of the file**.\n * Instead, use dynamic `import()` or `require()` to load the module. This ensures that the `http` or `https`\n * module is not loaded before `@opentelemetry/instrumentation-http` can instrument it.\n *\n * @example <caption> Using agent options directly: </caption>\n * httpAgentOptions: {\n * keepAlive: true,\n * maxSockets: 10\n * }\n *\n * @example <caption> Using a factory with dynamic import: </caption>\n * httpAgentOptions: async (protocol) => {\n * const module = protocol === 'http:' ? await import('http') : await import('https');\n * return new module.Agent({ keepAlive: true });\n * }\n */\n httpAgentOptions?: http.AgentOptions | https.AgentOptions | HttpAgentFactory;\n /**\n * User agent header string to be prepended to the exporter's default value.\n * Availablie since v1.49.0 of the spec.\n * Ref: https://opentelemetry.io/docs/specs/otel/protocol/exporter/#user-agent\n */\n userAgent?: string;\n}\n\nexport enum CompressionAlgorithm {\n NONE = 'none',\n GZIP = 'gzip',\n}\n"]}
@@ -1,17 +1,6 @@
1
1
  /*
2
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.
3
+ * SPDX-License-Identifier: Apache-2.0
15
4
  */
16
5
  import { getSharedConfigurationDefaults, mergeOtlpSharedConfigurationWithDefaults, } from './shared-configuration';
17
6
  import { validateAndNormalizeHeaders } from '../util';
@@ -1 +1 @@
1
- {"version":3,"file":"otlp-http-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-http-configuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,8BAA8B,EAC9B,wCAAwC,GAEzC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAStD,SAAS,YAAY,CACnB,mBAAsD,EACtD,eAAkD,EAClD,cAA8B;IAE9B,OAAO,KAAK,IAAI,EAAE;QAChB,MAAM,eAAe,GAAG;YACtB,GAAG,CAAC,MAAM,cAAc,EAAE,CAAC;SAC5B,CAAC;QACF,MAAM,OAAO,GAAG,EAAE,CAAC;QAEnB,0BAA0B;QAC1B,IAAI,eAAe,IAAI,IAAI,EAAE;YAC3B,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,eAAe,EAAE,CAAC,CAAC;SACjD;QAED,mCAAmC;QACn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penTelemetry 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 {\n getSharedConfigurationDefaults,\n mergeOtlpSharedConfigurationWithDefaults,\n OtlpSharedConfiguration,\n} from './shared-configuration';\nimport { validateAndNormalizeHeaders } from '../util';\n\nexport type HeadersFactory = () => Promise<Record<string, string>>;\n\nexport interface OtlpHttpConfiguration extends OtlpSharedConfiguration {\n url: string;\n headers: HeadersFactory;\n}\n\nfunction mergeHeaders(\n userProvidedHeaders: HeadersFactory | undefined | null,\n fallbackHeaders: HeadersFactory | undefined | null,\n defaultHeaders: HeadersFactory\n): HeadersFactory {\n return async () => {\n const requiredHeaders = {\n ...(await defaultHeaders()),\n };\n const headers = {};\n\n // add fallback ones first\n if (fallbackHeaders != null) {\n Object.assign(headers, await fallbackHeaders());\n }\n\n // override with user-provided ones\n if (userProvidedHeaders != null) {\n Object.assign(\n headers,\n validateAndNormalizeHeaders(await userProvidedHeaders())\n );\n }\n\n // override required ones.\n return Object.assign(headers, requiredHeaders);\n };\n}\n\nfunction validateUserProvidedUrl(url: string | undefined): string | undefined {\n if (url == null) {\n return undefined;\n }\n try {\n // NOTE: In non-browser environments, `globalThis.location` will be `undefined`.\n const base = globalThis.location?.href;\n return new URL(url, base).href;\n } catch {\n throw new Error(\n `Configuration: Could not parse user-provided export URL: '${url}'`\n );\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 mergeOtlpHttpConfigurationWithDefaults(\n userProvidedConfiguration: Partial<OtlpHttpConfiguration>,\n fallbackConfiguration: Partial<OtlpHttpConfiguration>,\n defaultConfiguration: OtlpHttpConfiguration\n): OtlpHttpConfiguration {\n return {\n ...mergeOtlpSharedConfigurationWithDefaults(\n userProvidedConfiguration,\n fallbackConfiguration,\n defaultConfiguration\n ),\n headers: mergeHeaders(\n userProvidedConfiguration.headers,\n fallbackConfiguration.headers,\n defaultConfiguration.headers\n ),\n url:\n validateUserProvidedUrl(userProvidedConfiguration.url) ??\n fallbackConfiguration.url ??\n defaultConfiguration.url,\n };\n}\n\nexport function getHttpConfigurationDefaults(\n requiredHeaders: Record<string, string>,\n signalResourcePath: string\n): OtlpHttpConfiguration {\n return {\n ...getSharedConfigurationDefaults(),\n headers: async () => requiredHeaders,\n url: 'http://localhost:4318/' + signalResourcePath,\n };\n}\n"]}
1
+ {"version":3,"file":"otlp-http-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-http-configuration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,8BAA8B,EAC9B,wCAAwC,GAEzC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAStD,SAAS,YAAY,CACnB,mBAAsD,EACtD,eAAkD,EAClD,cAA8B;IAE9B,OAAO,KAAK,IAAI,EAAE;QAChB,MAAM,eAAe,GAAG;YACtB,GAAG,CAAC,MAAM,cAAc,EAAE,CAAC;SAC5B,CAAC;QACF,MAAM,OAAO,GAAG,EAAE,CAAC;QAEnB,0BAA0B;QAC1B,IAAI,eAAe,IAAI,IAAI,EAAE;YAC3B,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,eAAe,EAAE,CAAC,CAAC;SACjD;QAED,mCAAmC;QACnC,IAAI,mBAAmB,IAAI,IAAI,EAAE;YAC/B,MAAM,CAAC,MAAM,CACX,OAAO,EACP,2BAA2B,CAAC,MAAM,mBAAmB,EAAE,CAAC,CACzD,CAAC;SACH;QAED,0BAA0B;QAC1B,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACjD,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB,CAAC,GAAuB;IACtD,IAAI,GAAG,IAAI,IAAI,EAAE;QACf,OAAO,SAAS,CAAC;KAClB;IACD,IAAI;QACF,gFAAgF;QAChF,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC;QACvC,OAAO,IAAI,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;KAChC;IAAC,MAAM;QACN,MAAM,IAAI,KAAK,CACb,6DAA6D,GAAG,GAAG,CACpE,CAAC;KACH;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sCAAsC,CACpD,yBAAyD,EACzD,qBAAqD,EACrD,oBAA2C;IAE3C,OAAO;QACL,GAAG,wCAAwC,CACzC,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,CACrB;QACD,OAAO,EAAE,YAAY,CACnB,yBAAyB,CAAC,OAAO,EACjC,qBAAqB,CAAC,OAAO,EAC7B,oBAAoB,CAAC,OAAO,CAC7B;QACD,GAAG,EACD,uBAAuB,CAAC,yBAAyB,CAAC,GAAG,CAAC;YACtD,qBAAqB,CAAC,GAAG;YACzB,oBAAoB,CAAC,GAAG;KAC3B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,eAAuC,EACvC,kBAA0B;IAE1B,OAAO;QACL,GAAG,8BAA8B,EAAE;QACnC,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,eAAe;QACpC,GAAG,EAAE,wBAAwB,GAAG,kBAAkB;KACnD,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n getSharedConfigurationDefaults,\n mergeOtlpSharedConfigurationWithDefaults,\n OtlpSharedConfiguration,\n} from './shared-configuration';\nimport { validateAndNormalizeHeaders } from '../util';\n\nexport type HeadersFactory = () => Promise<Record<string, string>>;\n\nexport interface OtlpHttpConfiguration extends OtlpSharedConfiguration {\n url: string;\n headers: HeadersFactory;\n}\n\nfunction mergeHeaders(\n userProvidedHeaders: HeadersFactory | undefined | null,\n fallbackHeaders: HeadersFactory | undefined | null,\n defaultHeaders: HeadersFactory\n): HeadersFactory {\n return async () => {\n const requiredHeaders = {\n ...(await defaultHeaders()),\n };\n const headers = {};\n\n // add fallback ones first\n if (fallbackHeaders != null) {\n Object.assign(headers, await fallbackHeaders());\n }\n\n // override with user-provided ones\n if (userProvidedHeaders != null) {\n Object.assign(\n headers,\n validateAndNormalizeHeaders(await userProvidedHeaders())\n );\n }\n\n // override required ones.\n return Object.assign(headers, requiredHeaders);\n };\n}\n\nfunction validateUserProvidedUrl(url: string | undefined): string | undefined {\n if (url == null) {\n return undefined;\n }\n try {\n // NOTE: In non-browser environments, `globalThis.location` will be `undefined`.\n const base = globalThis.location?.href;\n return new URL(url, base).href;\n } catch {\n throw new Error(\n `Configuration: Could not parse user-provided export URL: '${url}'`\n );\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 mergeOtlpHttpConfigurationWithDefaults(\n userProvidedConfiguration: Partial<OtlpHttpConfiguration>,\n fallbackConfiguration: Partial<OtlpHttpConfiguration>,\n defaultConfiguration: OtlpHttpConfiguration\n): OtlpHttpConfiguration {\n return {\n ...mergeOtlpSharedConfigurationWithDefaults(\n userProvidedConfiguration,\n fallbackConfiguration,\n defaultConfiguration\n ),\n headers: mergeHeaders(\n userProvidedConfiguration.headers,\n fallbackConfiguration.headers,\n defaultConfiguration.headers\n ),\n url:\n validateUserProvidedUrl(userProvidedConfiguration.url) ??\n fallbackConfiguration.url ??\n defaultConfiguration.url,\n };\n}\n\nexport function getHttpConfigurationDefaults(\n requiredHeaders: Record<string, string>,\n signalResourcePath: string\n): OtlpHttpConfiguration {\n return {\n ...getSharedConfigurationDefaults(),\n headers: async () => requiredHeaders,\n url: 'http://localhost:4318/' + signalResourcePath,\n };\n}\n"]}
@@ -1,17 +1,6 @@
1
1
  /*
2
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.
3
+ * SPDX-License-Identifier: Apache-2.0
15
4
  */
16
5
  import { getHttpConfigurationDefaults, mergeOtlpHttpConfigurationWithDefaults, } from './otlp-http-configuration';
17
6
  export function httpAgentFactoryFromOptions(options) {
@@ -1 +1 @@
1
- {"version":3,"file":"otlp-node-http-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-node-http-configuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,4BAA4B,EAC5B,sCAAsC,GAEvC,MAAM,2BAA2B,CAAC;AA8BnC,MAAM,UAAU,2BAA2B,CACzC,OAA+C;IAE/C,OAAO,KAAK,EAAC,QAAQ,EAAC,EAAE;QACtB,MAAM,UAAU,GAAG,QAAQ,KAAK,OAAO,CAAC;QACxC,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7D,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC;QAE/B,IAAI,UAAU,EAAE;YACd,gHAAgH;YAChH,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,eAAe,EAAE,GACzC,OAA6B,CAAC;YAChC,OAAO,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;SACnC;QACD,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0CAA0C,CACxD,yBAA6D,EAC7D,qBAAyD,EACzD,oBAA+C;IAE/C,OAAO;QACL,GAAG,sCAAsC,CACvC,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,CACrB;QACD,YAAY,EACV,yBAAyB,CAAC,YAAY;YACtC,qBAAqB,CAAC,YAAY;YAClC,oBAAoB,CAAC,YAAY;QACnC,SAAS,EAAE,yBAAyB,CAAC,SAAS;KAC/C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,eAAuC,EACvC,kBAA0B;IAE1B,OAAO;QACL,GAAG,4BAA4B,CAAC,eAAe,EAAE,kBAAkB,CAAC;QACpE,YAAY,EAAE,2BAA2B,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;KAC/D,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';\n\n// NOTE: do not change these imports to be actual imports, otherwise they WILL break `@opentelemetry/instrumentation-http`\nimport type * as http from 'http';\nimport type * as https from 'https';\n\nexport type HttpAgentFactory = (\n protocol: string\n) => http.Agent | https.Agent | Promise<http.Agent> | Promise<https.Agent>;\n\nexport interface OtlpNodeHttpConfiguration extends OtlpHttpConfiguration {\n /**\n * Factory function for creating agents.\n *\n * @remarks\n * Prefer using {@link httpAgentFactoryFromOptions} over manually writing a factory function wherever possible.\n * If using a factory function (`HttpAgentFactory`), **do not import `http.Agent` or `https.Agent`\n * statically at the top of the file**.\n * Instead, use dynamic `import()` or `require()` to load the module. This ensures that the `http` or `https`\n * module is not loaded before `@opentelemetry/instrumentation-http` can instrument it.\n */\n agentFactory: HttpAgentFactory;\n /**\n * User agent header string to be appended to the exporter's value as a prefix.\n * Availablie since v1.49.0 of the spec.\n * Ref: https://opentelemetry.io/docs/specs/otel/protocol/exporter/#user-agent\n */\n userAgent?: string;\n}\n\nexport function httpAgentFactoryFromOptions(\n options: http.AgentOptions | https.AgentOptions\n): HttpAgentFactory {\n return async protocol => {\n const isInsecure = protocol === 'http:';\n const module = isInsecure ? import('http') : import('https');\n const { Agent } = await module;\n\n if (isInsecure) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars -- these props should not be used in agent options\n const { ca, cert, key, ...insecureOptions } =\n options as https.AgentOptions;\n return new Agent(insecureOptions);\n }\n return new Agent(options);\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 mergeOtlpNodeHttpConfigurationWithDefaults(\n userProvidedConfiguration: Partial<OtlpNodeHttpConfiguration>,\n fallbackConfiguration: Partial<OtlpNodeHttpConfiguration>,\n defaultConfiguration: OtlpNodeHttpConfiguration\n): OtlpNodeHttpConfiguration {\n return {\n ...mergeOtlpHttpConfigurationWithDefaults(\n userProvidedConfiguration,\n fallbackConfiguration,\n defaultConfiguration\n ),\n agentFactory:\n userProvidedConfiguration.agentFactory ??\n fallbackConfiguration.agentFactory ??\n defaultConfiguration.agentFactory,\n userAgent: userProvidedConfiguration.userAgent,\n };\n}\n\nexport function getNodeHttpConfigurationDefaults(\n requiredHeaders: Record<string, string>,\n signalResourcePath: string\n): OtlpNodeHttpConfiguration {\n return {\n ...getHttpConfigurationDefaults(requiredHeaders, signalResourcePath),\n agentFactory: httpAgentFactoryFromOptions({ keepAlive: true }),\n };\n}\n"]}
1
+ {"version":3,"file":"otlp-node-http-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-node-http-configuration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,4BAA4B,EAC5B,sCAAsC,GAEvC,MAAM,2BAA2B,CAAC;AA8BnC,MAAM,UAAU,2BAA2B,CACzC,OAA+C;IAE/C,OAAO,KAAK,EAAC,QAAQ,EAAC,EAAE;QACtB,MAAM,UAAU,GAAG,QAAQ,KAAK,OAAO,CAAC;QACxC,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7D,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC;QAE/B,IAAI,UAAU,EAAE;YACd,gHAAgH;YAChH,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,eAAe,EAAE,GACzC,OAA6B,CAAC;YAChC,OAAO,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;SACnC;QACD,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0CAA0C,CACxD,yBAA6D,EAC7D,qBAAyD,EACzD,oBAA+C;IAE/C,OAAO;QACL,GAAG,sCAAsC,CACvC,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,CACrB;QACD,YAAY,EACV,yBAAyB,CAAC,YAAY;YACtC,qBAAqB,CAAC,YAAY;YAClC,oBAAoB,CAAC,YAAY;QACnC,SAAS,EAAE,yBAAyB,CAAC,SAAS;KAC/C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,eAAuC,EACvC,kBAA0B;IAE1B,OAAO;QACL,GAAG,4BAA4B,CAAC,eAAe,EAAE,kBAAkB,CAAC;QACpE,YAAY,EAAE,2BAA2B,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;KAC/D,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n getHttpConfigurationDefaults,\n mergeOtlpHttpConfigurationWithDefaults,\n OtlpHttpConfiguration,\n} from './otlp-http-configuration';\n\n// NOTE: do not change these imports to be actual imports, otherwise they WILL break `@opentelemetry/instrumentation-http`\nimport type * as http from 'http';\nimport type * as https from 'https';\n\nexport type HttpAgentFactory = (\n protocol: string\n) => http.Agent | https.Agent | Promise<http.Agent> | Promise<https.Agent>;\n\nexport interface OtlpNodeHttpConfiguration extends OtlpHttpConfiguration {\n /**\n * Factory function for creating agents.\n *\n * @remarks\n * Prefer using {@link httpAgentFactoryFromOptions} over manually writing a factory function wherever possible.\n * If using a factory function (`HttpAgentFactory`), **do not import `http.Agent` or `https.Agent`\n * statically at the top of the file**.\n * Instead, use dynamic `import()` or `require()` to load the module. This ensures that the `http` or `https`\n * module is not loaded before `@opentelemetry/instrumentation-http` can instrument it.\n */\n agentFactory: HttpAgentFactory;\n /**\n * User agent header string to be appended to the exporter's value as a prefix.\n * Availablie since v1.49.0 of the spec.\n * Ref: https://opentelemetry.io/docs/specs/otel/protocol/exporter/#user-agent\n */\n userAgent?: string;\n}\n\nexport function httpAgentFactoryFromOptions(\n options: http.AgentOptions | https.AgentOptions\n): HttpAgentFactory {\n return async protocol => {\n const isInsecure = protocol === 'http:';\n const module = isInsecure ? import('http') : import('https');\n const { Agent } = await module;\n\n if (isInsecure) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars -- these props should not be used in agent options\n const { ca, cert, key, ...insecureOptions } =\n options as https.AgentOptions;\n return new Agent(insecureOptions);\n }\n return new Agent(options);\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 mergeOtlpNodeHttpConfigurationWithDefaults(\n userProvidedConfiguration: Partial<OtlpNodeHttpConfiguration>,\n fallbackConfiguration: Partial<OtlpNodeHttpConfiguration>,\n defaultConfiguration: OtlpNodeHttpConfiguration\n): OtlpNodeHttpConfiguration {\n return {\n ...mergeOtlpHttpConfigurationWithDefaults(\n userProvidedConfiguration,\n fallbackConfiguration,\n defaultConfiguration\n ),\n agentFactory:\n userProvidedConfiguration.agentFactory ??\n fallbackConfiguration.agentFactory ??\n defaultConfiguration.agentFactory,\n userAgent: userProvidedConfiguration.userAgent,\n };\n}\n\nexport function getNodeHttpConfigurationDefaults(\n requiredHeaders: Record<string, string>,\n signalResourcePath: string\n): OtlpNodeHttpConfiguration {\n return {\n ...getHttpConfigurationDefaults(requiredHeaders, signalResourcePath),\n agentFactory: httpAgentFactoryFromOptions({ keepAlive: true }),\n };\n}\n"]}
@@ -1,17 +1,6 @@
1
1
  /*
2
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.
3
+ * SPDX-License-Identifier: Apache-2.0
15
4
  */
16
5
  import * as fs from 'fs';
17
6
  import * as path from 'path';
@@ -1 +1 @@
1
- {"version":3,"file":"otlp-node-http-env-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-node-http-env-configuration.ts"],"names":[],"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;YAC/C,IAAI,EAAE,2BAA2B,CAAC,gBAAgB,CAAC;YACnD,GAAG,EAAE,mBAAmB,CAAC,gBAAgB,CAAC;SAC3C,CAAC;KACH,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 * as fs from 'fs';\nimport * as path from 'path';\nimport { getStringFromEnv, parseKeyPairsIntoRecord } from '@opentelemetry/core';\nimport { diag } from '@opentelemetry/api';\nimport { getSharedConfigurationFromEnvironment } from './shared-env-configuration';\nimport { wrapStaticHeadersInFunction } from './shared-configuration';\nimport {\n OtlpNodeHttpConfiguration,\n httpAgentFactoryFromOptions,\n} from './otlp-node-http-configuration';\n\nfunction getStaticHeadersFromEnv(\n signalIdentifier: string\n): Record<string, string> | undefined {\n const signalSpecificRawHeaders = getStringFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_HEADERS`\n );\n const nonSignalSpecificRawHeaders = getStringFromEnv(\n 'OTEL_EXPORTER_OTLP_HEADERS'\n );\n\n const signalSpecificHeaders = parseKeyPairsIntoRecord(\n signalSpecificRawHeaders\n );\n const nonSignalSpecificHeaders = 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 parseKeyPairsIntoRecord(nonSignalSpecificRawHeaders),\n 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 = getStringFromEnv('OTEL_EXPORTER_OTLP_ENDPOINT');\n if (envUrl === undefined) {\n return undefined;\n }\n return appendResourcePathToUrl(envUrl, signalResourcePath);\n}\n\nfunction getSpecificUrlFromEnv(signalIdentifier: string): string | undefined {\n const envUrl = getStringFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_ENDPOINT`\n );\n if (envUrl === undefined) {\n return undefined;\n }\n return appendRootPathToUrlIfNeeded(envUrl);\n}\n\nfunction readFileFromEnv(\n signalSpecificEnvVar: string,\n nonSignalSpecificEnvVar: string,\n warningMessage: string\n): Buffer | undefined {\n const signalSpecificPath = getStringFromEnv(signalSpecificEnvVar);\n const nonSignalSpecificPath = getStringFromEnv(nonSignalSpecificEnvVar);\n const filePath = signalSpecificPath ?? nonSignalSpecificPath;\n\n if (filePath != null) {\n try {\n return fs.readFileSync(path.resolve(process.cwd(), filePath));\n } catch {\n diag.warn(warningMessage);\n return undefined;\n }\n } else {\n return undefined;\n }\n}\n\nfunction getClientCertificateFromEnv(\n signalIdentifier: string\n): Buffer | undefined {\n return readFileFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_CLIENT_CERTIFICATE`,\n 'OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE',\n 'Failed to read client certificate chain file'\n );\n}\n\nfunction getClientKeyFromEnv(signalIdentifier: string): Buffer | undefined {\n return readFileFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_CLIENT_KEY`,\n 'OTEL_EXPORTER_OTLP_CLIENT_KEY',\n 'Failed to read client certificate private key file'\n );\n}\n\nfunction getRootCertificateFromEnv(\n signalIdentifier: string\n): Buffer | undefined {\n return readFileFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_CERTIFICATE`,\n 'OTEL_EXPORTER_OTLP_CERTIFICATE',\n 'Failed to read root certificate file'\n );\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 getNodeHttpConfigurationFromEnvironment(\n signalIdentifier: string,\n signalResourcePath: string\n): Partial<OtlpNodeHttpConfiguration> {\n return {\n ...getSharedConfigurationFromEnvironment(signalIdentifier),\n url:\n getSpecificUrlFromEnv(signalIdentifier) ??\n getNonSpecificUrlFromEnv(signalResourcePath),\n headers: wrapStaticHeadersInFunction(\n getStaticHeadersFromEnv(signalIdentifier)\n ),\n agentFactory: httpAgentFactoryFromOptions({\n keepAlive: true,\n ca: getRootCertificateFromEnv(signalIdentifier),\n cert: getClientCertificateFromEnv(signalIdentifier),\n key: getClientKeyFromEnv(signalIdentifier),\n }),\n };\n}\n"]}
1
+ {"version":3,"file":"otlp-node-http-env-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-node-http-env-configuration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI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AC3C,CAAC;KACH,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { getStringFromEnv, parseKeyPairsIntoRecord } from '@opentelemetry/core';\nimport { diag } from '@opentelemetry/api';\nimport { getSharedConfigurationFromEnvironment } from './shared-env-configuration';\nimport { wrapStaticHeadersInFunction } from './shared-configuration';\nimport {\n OtlpNodeHttpConfiguration,\n httpAgentFactoryFromOptions,\n} from './otlp-node-http-configuration';\n\nfunction getStaticHeadersFromEnv(\n signalIdentifier: string\n): Record<string, string> | undefined {\n const signalSpecificRawHeaders = getStringFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_HEADERS`\n );\n const nonSignalSpecificRawHeaders = getStringFromEnv(\n 'OTEL_EXPORTER_OTLP_HEADERS'\n );\n\n const signalSpecificHeaders = parseKeyPairsIntoRecord(\n signalSpecificRawHeaders\n );\n const nonSignalSpecificHeaders = 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 parseKeyPairsIntoRecord(nonSignalSpecificRawHeaders),\n 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 = getStringFromEnv('OTEL_EXPORTER_OTLP_ENDPOINT');\n if (envUrl === undefined) {\n return undefined;\n }\n return appendResourcePathToUrl(envUrl, signalResourcePath);\n}\n\nfunction getSpecificUrlFromEnv(signalIdentifier: string): string | undefined {\n const envUrl = getStringFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_ENDPOINT`\n );\n if (envUrl === undefined) {\n return undefined;\n }\n return appendRootPathToUrlIfNeeded(envUrl);\n}\n\nfunction readFileFromEnv(\n signalSpecificEnvVar: string,\n nonSignalSpecificEnvVar: string,\n warningMessage: string\n): Buffer | undefined {\n const signalSpecificPath = getStringFromEnv(signalSpecificEnvVar);\n const nonSignalSpecificPath = getStringFromEnv(nonSignalSpecificEnvVar);\n const filePath = signalSpecificPath ?? nonSignalSpecificPath;\n\n if (filePath != null) {\n try {\n return fs.readFileSync(path.resolve(process.cwd(), filePath));\n } catch {\n diag.warn(warningMessage);\n return undefined;\n }\n } else {\n return undefined;\n }\n}\n\nfunction getClientCertificateFromEnv(\n signalIdentifier: string\n): Buffer | undefined {\n return readFileFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_CLIENT_CERTIFICATE`,\n 'OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE',\n 'Failed to read client certificate chain file'\n );\n}\n\nfunction getClientKeyFromEnv(signalIdentifier: string): Buffer | undefined {\n return readFileFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_CLIENT_KEY`,\n 'OTEL_EXPORTER_OTLP_CLIENT_KEY',\n 'Failed to read client certificate private key file'\n );\n}\n\nfunction getRootCertificateFromEnv(\n signalIdentifier: string\n): Buffer | undefined {\n return readFileFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_CERTIFICATE`,\n 'OTEL_EXPORTER_OTLP_CERTIFICATE',\n 'Failed to read root certificate file'\n );\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 getNodeHttpConfigurationFromEnvironment(\n signalIdentifier: string,\n signalResourcePath: string\n): Partial<OtlpNodeHttpConfiguration> {\n return {\n ...getSharedConfigurationFromEnvironment(signalIdentifier),\n url:\n getSpecificUrlFromEnv(signalIdentifier) ??\n getNonSpecificUrlFromEnv(signalResourcePath),\n headers: wrapStaticHeadersInFunction(\n getStaticHeadersFromEnv(signalIdentifier)\n ),\n agentFactory: httpAgentFactoryFromOptions({\n keepAlive: true,\n ca: getRootCertificateFromEnv(signalIdentifier),\n cert: getClientCertificateFromEnv(signalIdentifier),\n key: getClientKeyFromEnv(signalIdentifier),\n }),\n };\n}\n"]}
@@ -1,17 +1,6 @@
1
1
  /*
2
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.
3
+ * SPDX-License-Identifier: Apache-2.0
15
4
  */
16
5
  export function validateTimeoutMillis(timeoutMillis) {
17
6
  if (Number.isFinite(timeoutMillis) && timeoutMillis > 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"shared-configuration.js","sourceRoot":"","sources":["../../../src/configuration/shared-configuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAkBH,MAAM,UAAU,qBAAqB,CAAC,aAAqB;IACzD,IAAI,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,aAAa,GAAG,CAAC,EAAE;QACvD,OAAO,aAAa,CAAC;KACtB;IACD,MAAM,IAAI,KAAK,CACb,qFAAqF,aAAa,IAAI,CACvG,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,OAA2C;IAE3C,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,KAAK,IAAI,EAAE,CAAC,OAAO,CAAC;AAC7B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wCAAwC,CACtD,yBAA2D,EAC3D,qBAAuD,EACvD,oBAA6C;IAE7C,OAAO;QACL,aAAa,EAAE,qBAAqB,CAClC,yBAAyB,CAAC,aAAa;YACrC,qBAAqB,CAAC,aAAa;YACnC,oBAAoB,CAAC,aAAa,CACrC;QACD,gBAAgB,EACd,yBAAyB,CAAC,gBAAgB;YAC1C,qBAAqB,CAAC,gBAAgB;YACtC,oBAAoB,CAAC,gBAAgB;QACvC,WAAW,EACT,yBAAyB,CAAC,WAAW;YACrC,qBAAqB,CAAC,WAAW;YACjC,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\nimport { HeadersFactory } from './otlp-http-configuration';\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 (Number.isFinite(timeoutMillis) && timeoutMillis > 0) {\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): HeadersFactory | undefined {\n if (headers == null) {\n return undefined;\n }\n\n return async () => 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"]}
1
+ {"version":3,"file":"shared-configuration.js","sourceRoot":"","sources":["../../../src/configuration/shared-configuration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkBH,MAAM,UAAU,qBAAqB,CAAC,aAAqB;IACzD,IAAI,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,aAAa,GAAG,CAAC,EAAE;QACvD,OAAO,aAAa,CAAC;KACtB;IACD,MAAM,IAAI,KAAK,CACb,qFAAqF,aAAa,IAAI,CACvG,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,OAA2C;IAE3C,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,KAAK,IAAI,EAAE,CAAC,OAAO,CAAC;AAC7B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wCAAwC,CACtD,yBAA2D,EAC3D,qBAAuD,EACvD,oBAA6C;IAE7C,OAAO;QACL,aAAa,EAAE,qBAAqB,CAClC,yBAAyB,CAAC,aAAa;YACrC,qBAAqB,CAAC,aAAa;YACnC,oBAAoB,CAAC,aAAa,CACrC;QACD,gBAAgB,EACd,yBAAyB,CAAC,gBAAgB;YAC1C,qBAAqB,CAAC,gBAAgB;YACtC,oBAAoB,CAAC,gBAAgB;QACvC,WAAW,EACT,yBAAyB,CAAC,WAAW;YACrC,qBAAqB,CAAC,WAAW;YACjC,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 * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { HeadersFactory } from './otlp-http-configuration';\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 (Number.isFinite(timeoutMillis) && timeoutMillis > 0) {\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): HeadersFactory | undefined {\n if (headers == null) {\n return undefined;\n }\n\n return async () => 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"]}
@@ -1,17 +1,6 @@
1
1
  /*
2
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.
3
+ * SPDX-License-Identifier: Apache-2.0
15
4
  */
16
5
  import { getNumberFromEnv, getStringFromEnv } from '@opentelemetry/core';
17
6
  import { diag } from '@opentelemetry/api';
@@ -1 +1 @@
1
- {"version":3,"file":"shared-env-configuration.js","sourceRoot":"","sources":["../../../src/configuration/shared-env-configuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEzE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,SAAS,8BAA8B,CACrC,aAAqB;IAErB,MAAM,UAAU,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC;IACnD,IAAI,UAAU,IAAI,IAAI,EAAE;QACtB,IAAI,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,UAAU,GAAG,CAAC,EAAE;YACjD,OAAO,UAAU,CAAC;SACnB;QACD,IAAI,CAAC,IAAI,CACP,kBAAkB,aAAa,wDAAwD,UAAU,GAAG,CACrG,CAAC;KACH;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,iBAAiB,CAAC,gBAAwB;IACjD,MAAM,eAAe,GAAG,8BAA8B,CACpD,sBAAsB,gBAAgB,UAAU,CACjD,CAAC;IACF,MAAM,kBAAkB,GAAG,8BAA8B,CACvD,4BAA4B,CAC7B,CAAC;IAEF,OAAO,eAAe,IAAI,kBAAkB,CAAC;AAC/C,CAAC;AAED,SAAS,kCAAkC,CACzC,iBAAyB;IAEzB,MAAM,WAAW,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,EAAE,IAAI,EAAE,CAAC;IAEhE,IAAI,WAAW,IAAI,IAAI,IAAI,WAAW,KAAK,MAAM,IAAI,WAAW,KAAK,MAAM,EAAE;QAC3E,OAAO,WAAW,CAAC;KACpB;IAED,IAAI,CAAC,IAAI,CACP,kBAAkB,iBAAiB,oDAAoD,WAAW,IAAI,CACvG,CAAC;IACF,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,qBAAqB,CAC5B,gBAAwB;IAExB,MAAM,mBAAmB,GAAG,kCAAkC,CAC5D,sBAAsB,gBAAgB,cAAc,CACrD,CAAC;IACF,MAAM,sBAAsB,GAAG,kCAAkC,CAC/D,gCAAgC,CACjC,CAAC;IAEF,OAAO,mBAAmB,IAAI,sBAAsB,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,qCAAqC,CACnD,gBAAwB;IAExB,OAAO;QACL,aAAa,EAAE,iBAAiB,CAAC,gBAAgB,CAAC;QAClD,WAAW,EAAE,qBAAqB,CAAC,gBAAgB,CAAC;KACrD,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 { getNumberFromEnv, getStringFromEnv } from '@opentelemetry/core';\nimport { OtlpSharedConfiguration } from './shared-configuration';\nimport { diag } from '@opentelemetry/api';\n\nfunction parseAndValidateTimeoutFromEnv(\n timeoutEnvVar: string\n): number | undefined {\n const envTimeout = getNumberFromEnv(timeoutEnvVar);\n if (envTimeout != null) {\n if (Number.isFinite(envTimeout) && envTimeout > 0) {\n return envTimeout;\n }\n diag.warn(\n `Configuration: ${timeoutEnvVar} is invalid, expected number greater than 0 (actual: ${envTimeout})`\n );\n }\n\n return undefined;\n}\n\nfunction getTimeoutFromEnv(signalIdentifier: string) {\n const specificTimeout = parseAndValidateTimeoutFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_TIMEOUT`\n );\n const nonSpecificTimeout = parseAndValidateTimeoutFromEnv(\n 'OTEL_EXPORTER_OTLP_TIMEOUT'\n );\n\n return specificTimeout ?? nonSpecificTimeout;\n}\n\nfunction parseAndValidateCompressionFromEnv(\n compressionEnvVar: string\n): 'none' | 'gzip' | undefined {\n const compression = getStringFromEnv(compressionEnvVar)?.trim();\n\n if (compression == null || compression === 'none' || compression === 'gzip') {\n return compression;\n }\n\n diag.warn(\n `Configuration: ${compressionEnvVar} is invalid, expected 'none' or 'gzip' (actual: '${compression}')`\n );\n return undefined;\n}\n\nfunction getCompressionFromEnv(\n signalIdentifier: string\n): 'none' | 'gzip' | undefined {\n const specificCompression = parseAndValidateCompressionFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_COMPRESSION`\n );\n const nonSpecificCompression = parseAndValidateCompressionFromEnv(\n 'OTEL_EXPORTER_OTLP_COMPRESSION'\n );\n\n return specificCompression ?? nonSpecificCompression;\n}\n\nexport function getSharedConfigurationFromEnvironment(\n signalIdentifier: string\n): Partial<OtlpSharedConfiguration> {\n return {\n timeoutMillis: getTimeoutFromEnv(signalIdentifier),\n compression: getCompressionFromEnv(signalIdentifier),\n };\n}\n"]}
1
+ {"version":3,"file":"shared-env-configuration.js","sourceRoot":"","sources":["../../../src/configuration/shared-env-configuration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEzE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,SAAS,8BAA8B,CACrC,aAAqB;IAErB,MAAM,UAAU,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC;IACnD,IAAI,UAAU,IAAI,IAAI,EAAE;QACtB,IAAI,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,UAAU,GAAG,CAAC,EAAE;YACjD,OAAO,UAAU,CAAC;SACnB;QACD,IAAI,CAAC,IAAI,CACP,kBAAkB,aAAa,wDAAwD,UAAU,GAAG,CACrG,CAAC;KACH;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,iBAAiB,CAAC,gBAAwB;IACjD,MAAM,eAAe,GAAG,8BAA8B,CACpD,sBAAsB,gBAAgB,UAAU,CACjD,CAAC;IACF,MAAM,kBAAkB,GAAG,8BAA8B,CACvD,4BAA4B,CAC7B,CAAC;IAEF,OAAO,eAAe,IAAI,kBAAkB,CAAC;AAC/C,CAAC;AAED,SAAS,kCAAkC,CACzC,iBAAyB;IAEzB,MAAM,WAAW,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,EAAE,IAAI,EAAE,CAAC;IAEhE,IAAI,WAAW,IAAI,IAAI,IAAI,WAAW,KAAK,MAAM,IAAI,WAAW,KAAK,MAAM,EAAE;QAC3E,OAAO,WAAW,CAAC;KACpB;IAED,IAAI,CAAC,IAAI,CACP,kBAAkB,iBAAiB,oDAAoD,WAAW,IAAI,CACvG,CAAC;IACF,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,qBAAqB,CAC5B,gBAAwB;IAExB,MAAM,mBAAmB,GAAG,kCAAkC,CAC5D,sBAAsB,gBAAgB,cAAc,CACrD,CAAC;IACF,MAAM,sBAAsB,GAAG,kCAAkC,CAC/D,gCAAgC,CACjC,CAAC;IAEF,OAAO,mBAAmB,IAAI,sBAAsB,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,qCAAqC,CACnD,gBAAwB;IAExB,OAAO;QACL,aAAa,EAAE,iBAAiB,CAAC,gBAAgB,CAAC;QAClD,WAAW,EAAE,qBAAqB,CAAC,gBAAgB,CAAC;KACrD,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { getNumberFromEnv, getStringFromEnv } from '@opentelemetry/core';\nimport { OtlpSharedConfiguration } from './shared-configuration';\nimport { diag } from '@opentelemetry/api';\n\nfunction parseAndValidateTimeoutFromEnv(\n timeoutEnvVar: string\n): number | undefined {\n const envTimeout = getNumberFromEnv(timeoutEnvVar);\n if (envTimeout != null) {\n if (Number.isFinite(envTimeout) && envTimeout > 0) {\n return envTimeout;\n }\n diag.warn(\n `Configuration: ${timeoutEnvVar} is invalid, expected number greater than 0 (actual: ${envTimeout})`\n );\n }\n\n return undefined;\n}\n\nfunction getTimeoutFromEnv(signalIdentifier: string) {\n const specificTimeout = parseAndValidateTimeoutFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_TIMEOUT`\n );\n const nonSpecificTimeout = parseAndValidateTimeoutFromEnv(\n 'OTEL_EXPORTER_OTLP_TIMEOUT'\n );\n\n return specificTimeout ?? nonSpecificTimeout;\n}\n\nfunction parseAndValidateCompressionFromEnv(\n compressionEnvVar: string\n): 'none' | 'gzip' | undefined {\n const compression = getStringFromEnv(compressionEnvVar)?.trim();\n\n if (compression == null || compression === 'none' || compression === 'gzip') {\n return compression;\n }\n\n diag.warn(\n `Configuration: ${compressionEnvVar} is invalid, expected 'none' or 'gzip' (actual: '${compression}')`\n );\n return undefined;\n}\n\nfunction getCompressionFromEnv(\n signalIdentifier: string\n): 'none' | 'gzip' | undefined {\n const specificCompression = parseAndValidateCompressionFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_COMPRESSION`\n );\n const nonSpecificCompression = parseAndValidateCompressionFromEnv(\n 'OTEL_EXPORTER_OTLP_COMPRESSION'\n );\n\n return specificCompression ?? nonSpecificCompression;\n}\n\nexport function getSharedConfigurationFromEnvironment(\n signalIdentifier: string\n): Partial<OtlpSharedConfiguration> {\n return {\n timeoutMillis: getTimeoutFromEnv(signalIdentifier),\n compression: getCompressionFromEnv(signalIdentifier),\n };\n}\n"]}
@@ -1,17 +1,6 @@
1
1
  /*
2
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.
3
+ * SPDX-License-Identifier: Apache-2.0
15
4
  */
16
5
  export {};
17
6
  //# sourceMappingURL=export-response.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"export-response.js","sourceRoot":"","sources":["../../src/export-response.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\nexport interface ExportResponseSuccess {\n status: 'success';\n data?: Uint8Array;\n}\n\nexport interface ExportResponseFailure {\n status: 'failure';\n error: Error;\n}\n\nexport interface ExportResponseRetryable {\n status: 'retryable';\n retryInMillis?: number;\n error?: Error;\n}\n\nexport type ExportResponse =\n | ExportResponseSuccess\n | ExportResponseFailure\n | ExportResponseRetryable;\n"]}
1
+ {"version":3,"file":"export-response.js","sourceRoot":"","sources":["../../src/export-response.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport interface ExportResponseSuccess {\n status: 'success';\n data?: Uint8Array;\n}\n\nexport interface ExportResponseFailure {\n status: 'failure';\n error: Error;\n}\n\nexport interface ExportResponseRetryable {\n status: 'retryable';\n retryInMillis?: number;\n error?: Error;\n}\n\nexport type ExportResponse =\n | ExportResponseSuccess\n | ExportResponseFailure\n | ExportResponseRetryable;\n"]}
@@ -1,17 +1,6 @@
1
1
  /*
2
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.
3
+ * SPDX-License-Identifier: Apache-2.0
15
4
  */
16
5
  export {};
17
6
  //# sourceMappingURL=exporter-transport.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"exporter-transport.js","sourceRoot":"","sources":["../../src/exporter-transport.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 { ExportResponse } from './export-response';\n\nexport interface IExporterTransport {\n send(data: Uint8Array, timeoutMillis: number): Promise<ExportResponse>;\n shutdown(): void;\n}\n"]}
1
+ {"version":3,"file":"exporter-transport.js","sourceRoot":"","sources":["../../src/exporter-transport.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ExportResponse } from './export-response';\n\nexport interface IExporterTransport {\n send(data: Uint8Array, timeoutMillis: number): Promise<ExportResponse>;\n shutdown(): void;\n}\n"]}
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @deprecated Use `createOtlpFetchExportDelegate` instead.
3
+ */
1
4
  export { createOtlpSendBeaconExportDelegate } from './otlp-browser-http-export-delegate';
2
5
  export { convertLegacyBrowserHttpOptions } from './configuration/convert-legacy-browser-http-options';
3
6
  export { createLegacyOtlpBrowserExportDelegate } from './configuration/create-legacy-browser-delegate';
@@ -1,17 +1,9 @@
1
1
  /*
2
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.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /**
6
+ * @deprecated Use `createOtlpFetchExportDelegate` instead.
15
7
  */
16
8
  export { createOtlpSendBeaconExportDelegate } from './otlp-browser-http-export-delegate';
17
9
  export { convertLegacyBrowserHttpOptions } from './configuration/convert-legacy-browser-http-options';
@@ -1 +1 @@
1
- {"version":3,"file":"index-browser-http.js","sourceRoot":"","sources":["../../src/index-browser-http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,kCAAkC,EAAE,MAAM,qCAAqC,CAAC;AAEzF,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 { createOtlpSendBeaconExportDelegate } 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"]}
1
+ {"version":3,"file":"index-browser-http.js","sourceRoot":"","sources":["../../src/index-browser-http.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,OAAO,EAAE,kCAAkC,EAAE,MAAM,qCAAqC,CAAC;AAEzF,OAAO,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAC;AACtG,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @deprecated Use `createOtlpFetchExportDelegate` instead.\n */\nexport { createOtlpSendBeaconExportDelegate } 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"]}