@opentelemetry/otlp-exporter-base 0.55.0 → 0.57.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.
- package/README.md +1 -7
- package/build/esm/OTLPExporterBase.d.ts +7 -28
- package/build/esm/OTLPExporterBase.js +6 -69
- package/build/esm/OTLPExporterBase.js.map +1 -1
- package/build/esm/bounded-queue-export-promise-handler.d.ts +13 -0
- package/build/esm/bounded-queue-export-promise-handler.js +96 -0
- package/build/esm/bounded-queue-export-promise-handler.js.map +1 -0
- package/build/esm/configuration/convert-legacy-browser-http-options.d.ts +11 -0
- package/build/esm/configuration/convert-legacy-browser-http-options.js +34 -0
- package/build/esm/configuration/convert-legacy-browser-http-options.js.map +1 -0
- package/build/esm/configuration/convert-legacy-node-http-options.d.ts +11 -0
- package/build/esm/configuration/convert-legacy-node-http-options.js +45 -0
- package/build/esm/configuration/convert-legacy-node-http-options.js.map +1 -0
- package/build/esm/configuration/create-legacy-browser-delegate.d.ts +12 -0
- package/build/esm/configuration/create-legacy-browser-delegate.js +20 -0
- package/build/esm/configuration/create-legacy-browser-delegate.js.map +1 -0
- package/build/esm/configuration/legacy-base-configuration.d.ts +9 -0
- package/build/esm/configuration/legacy-base-configuration.js +2 -0
- package/build/esm/configuration/legacy-base-configuration.js.map +1 -0
- package/build/{esnext/platform/node/types.d.ts → esm/configuration/legacy-node-configuration.d.ts} +2 -2
- package/build/esm/{platform/node/index.js → configuration/legacy-node-configuration.js} +6 -3
- package/build/esm/configuration/legacy-node-configuration.js.map +1 -0
- package/build/esm/configuration/otlp-http-configuration.d.ts +5 -1
- package/build/esm/configuration/otlp-http-configuration.js +16 -14
- package/build/esm/configuration/otlp-http-configuration.js.map +1 -1
- package/build/esm/configuration/otlp-http-env-configuration.js +3 -2
- package/build/esm/configuration/otlp-http-env-configuration.js.map +1 -1
- package/build/esm/configuration/shared-configuration.d.ts +1 -0
- package/build/esm/configuration/shared-configuration.js +6 -0
- package/build/esm/configuration/shared-configuration.js.map +1 -1
- package/build/esm/index-browser-http.d.ts +4 -0
- package/build/esm/index-browser-http.js +19 -0
- package/build/esm/index-browser-http.js.map +1 -0
- package/build/esm/index-node-http.d.ts +4 -0
- package/build/esm/index-node-http.js +19 -0
- package/build/esm/index-node-http.js.map +1 -0
- package/build/esm/index.d.ts +5 -4
- package/build/esm/index.js +3 -7
- package/build/esm/index.js.map +1 -1
- package/build/esm/logging-response-handler.d.ts +6 -0
- package/build/esm/logging-response-handler.js +38 -0
- package/build/esm/logging-response-handler.js.map +1 -0
- package/build/esm/otlp-browser-http-export-delegate.d.ts +6 -0
- package/build/esm/otlp-browser-http-export-delegate.js +18 -0
- package/build/esm/otlp-browser-http-export-delegate.js.map +1 -0
- package/build/esm/otlp-export-delegate.d.ts +24 -0
- package/build/esm/otlp-export-delegate.js +155 -0
- package/build/esm/otlp-export-delegate.js.map +1 -0
- package/build/esm/otlp-http-export-delegate.d.ts +5 -0
- package/build/esm/otlp-http-export-delegate.js +29 -0
- package/build/esm/otlp-http-export-delegate.js.map +1 -0
- package/build/esm/otlp-network-export-delegate.d.ts +6 -0
- package/build/esm/otlp-network-export-delegate.js +25 -0
- package/build/esm/otlp-network-export-delegate.js.map +1 -0
- package/build/esm/response-handler.d.ts +12 -0
- package/build/esm/{platform/browser/index.js → response-handler.js} +2 -2
- package/build/esm/response-handler.js.map +1 -0
- package/build/esm/{platform/node → transport}/http-exporter-transport.d.ts +1 -1
- package/build/esm/transport/http-exporter-transport.js.map +1 -0
- package/build/{esnext/platform/node → esm/transport}/http-transport-types.d.ts +2 -2
- package/build/esm/transport/http-transport-types.js.map +1 -0
- package/build/{esnext/platform/node → esm/transport}/http-transport-utils.d.ts +1 -1
- package/build/esm/{platform/node → transport}/http-transport-utils.js +4 -4
- package/build/esm/transport/http-transport-utils.js.map +1 -0
- package/build/esm/{platform/browser → transport}/send-beacon-transport.d.ts +1 -1
- package/build/esm/transport/send-beacon-transport.js.map +1 -0
- package/build/{esnext/platform/browser → esm/transport}/xhr-transport.d.ts +2 -2
- package/build/esm/{platform/browser → transport}/xhr-transport.js +4 -3
- package/build/esm/transport/xhr-transport.js.map +1 -0
- package/build/esm/types.d.ts +0 -11
- package/build/esm/types.js.map +1 -1
- package/build/esm/util.d.ts +1 -1
- package/build/esm/util.js +14 -12
- package/build/esm/util.js.map +1 -1
- package/build/esm/version.d.ts +1 -1
- package/build/esm/version.js +1 -1
- package/build/esm/version.js.map +1 -1
- package/build/esnext/OTLPExporterBase.d.ts +7 -28
- package/build/esnext/OTLPExporterBase.js +6 -67
- package/build/esnext/OTLPExporterBase.js.map +1 -1
- package/build/esnext/bounded-queue-export-promise-handler.d.ts +13 -0
- package/build/esnext/bounded-queue-export-promise-handler.js +49 -0
- package/build/esnext/bounded-queue-export-promise-handler.js.map +1 -0
- package/build/esnext/configuration/convert-legacy-browser-http-options.d.ts +11 -0
- package/build/esnext/configuration/convert-legacy-browser-http-options.js +34 -0
- package/build/esnext/configuration/convert-legacy-browser-http-options.js.map +1 -0
- package/build/esnext/configuration/convert-legacy-node-http-options.d.ts +11 -0
- package/build/esnext/configuration/convert-legacy-node-http-options.js +45 -0
- package/build/esnext/configuration/convert-legacy-node-http-options.js.map +1 -0
- package/build/esnext/configuration/create-legacy-browser-delegate.d.ts +12 -0
- package/build/esnext/configuration/create-legacy-browser-delegate.js +20 -0
- package/build/esnext/configuration/create-legacy-browser-delegate.js.map +1 -0
- package/build/esnext/configuration/legacy-base-configuration.d.ts +9 -0
- package/build/esnext/configuration/legacy-base-configuration.js +2 -0
- package/build/esnext/configuration/legacy-base-configuration.js.map +1 -0
- package/build/{src/platform/node/types.d.ts → esnext/configuration/legacy-node-configuration.d.ts} +2 -2
- package/build/{esm/platform/index.js → esnext/configuration/legacy-node-configuration.js} +6 -3
- package/build/esnext/configuration/legacy-node-configuration.js.map +1 -0
- package/build/esnext/configuration/otlp-http-configuration.d.ts +5 -1
- package/build/esnext/configuration/otlp-http-configuration.js +16 -14
- package/build/esnext/configuration/otlp-http-configuration.js.map +1 -1
- package/build/esnext/configuration/otlp-http-env-configuration.js +3 -2
- package/build/esnext/configuration/otlp-http-env-configuration.js.map +1 -1
- package/build/esnext/configuration/shared-configuration.d.ts +1 -0
- package/build/esnext/configuration/shared-configuration.js +6 -0
- package/build/esnext/configuration/shared-configuration.js.map +1 -1
- package/build/esnext/index-browser-http.d.ts +4 -0
- package/build/esnext/index-browser-http.js +19 -0
- package/build/esnext/index-browser-http.js.map +1 -0
- package/build/esnext/index-node-http.d.ts +4 -0
- package/build/esnext/index-node-http.js +19 -0
- package/build/esnext/index-node-http.js.map +1 -0
- package/build/esnext/index.d.ts +5 -4
- package/build/esnext/index.js +3 -7
- package/build/esnext/index.js.map +1 -1
- package/build/esnext/logging-response-handler.d.ts +6 -0
- package/build/esnext/logging-response-handler.js +38 -0
- package/build/esnext/logging-response-handler.js.map +1 -0
- package/build/esnext/otlp-browser-http-export-delegate.d.ts +6 -0
- package/build/esnext/otlp-browser-http-export-delegate.js +18 -0
- package/build/esnext/otlp-browser-http-export-delegate.js.map +1 -0
- package/build/esnext/otlp-export-delegate.d.ts +24 -0
- package/build/esnext/otlp-export-delegate.js +105 -0
- package/build/esnext/otlp-export-delegate.js.map +1 -0
- package/build/esnext/otlp-http-export-delegate.d.ts +5 -0
- package/build/esnext/otlp-http-export-delegate.js +29 -0
- package/build/esnext/otlp-http-export-delegate.js.map +1 -0
- package/build/esnext/otlp-network-export-delegate.d.ts +6 -0
- package/build/esnext/otlp-network-export-delegate.js +25 -0
- package/build/esnext/otlp-network-export-delegate.js.map +1 -0
- package/build/esnext/response-handler.d.ts +12 -0
- package/build/esnext/{platform/browser/index.js → response-handler.js} +2 -2
- package/build/esnext/response-handler.js.map +1 -0
- package/build/esnext/{platform/node → transport}/http-exporter-transport.d.ts +1 -1
- package/build/esnext/transport/http-exporter-transport.js.map +1 -0
- package/build/{src/platform/node → esnext/transport}/http-transport-types.d.ts +2 -2
- package/build/esnext/transport/http-transport-types.js.map +1 -0
- package/build/{esm/platform/node → esnext/transport}/http-transport-utils.d.ts +1 -1
- package/build/esnext/{platform/node → transport}/http-transport-utils.js +4 -4
- package/build/esnext/transport/http-transport-utils.js.map +1 -0
- package/build/{src/platform/browser → esnext/transport}/send-beacon-transport.d.ts +1 -1
- package/build/esnext/transport/send-beacon-transport.js.map +1 -0
- package/build/{src/platform/browser → esnext/transport}/xhr-transport.d.ts +2 -2
- package/build/esnext/{platform/browser → transport}/xhr-transport.js +4 -3
- package/build/esnext/transport/xhr-transport.js.map +1 -0
- package/build/esnext/types.d.ts +0 -11
- package/build/esnext/types.js.map +1 -1
- package/build/esnext/util.d.ts +1 -1
- package/build/esnext/util.js +14 -11
- package/build/esnext/util.js.map +1 -1
- package/build/esnext/version.d.ts +1 -1
- package/build/esnext/version.js +1 -1
- package/build/esnext/version.js.map +1 -1
- package/build/src/OTLPExporterBase.d.ts +7 -28
- package/build/src/OTLPExporterBase.js +6 -67
- package/build/src/OTLPExporterBase.js.map +1 -1
- package/build/src/bounded-queue-export-promise-handler.d.ts +13 -0
- package/build/src/bounded-queue-export-promise-handler.js +53 -0
- package/build/src/bounded-queue-export-promise-handler.js.map +1 -0
- package/build/src/configuration/convert-legacy-browser-http-options.d.ts +11 -0
- package/build/src/configuration/convert-legacy-browser-http-options.js +38 -0
- package/build/src/configuration/convert-legacy-browser-http-options.js.map +1 -0
- package/build/src/configuration/convert-legacy-node-http-options.d.ts +11 -0
- package/build/src/configuration/convert-legacy-node-http-options.js +49 -0
- package/build/src/configuration/convert-legacy-node-http-options.js.map +1 -0
- package/build/src/configuration/create-legacy-browser-delegate.d.ts +12 -0
- package/build/src/configuration/create-legacy-browser-delegate.js +24 -0
- package/build/src/configuration/create-legacy-browser-delegate.js.map +1 -0
- package/build/src/configuration/legacy-base-configuration.d.ts +9 -0
- package/build/src/configuration/legacy-base-configuration.js +3 -0
- package/build/src/configuration/legacy-base-configuration.js.map +1 -0
- package/build/{esm/platform/node/types.d.ts → src/configuration/legacy-node-configuration.d.ts} +2 -2
- package/build/src/{platform/browser/index.js → configuration/legacy-node-configuration.js} +7 -4
- package/build/src/configuration/legacy-node-configuration.js.map +1 -0
- package/build/src/configuration/otlp-http-configuration.d.ts +5 -1
- package/build/src/configuration/otlp-http-configuration.js +16 -14
- package/build/src/configuration/otlp-http-configuration.js.map +1 -1
- package/build/src/configuration/otlp-http-env-configuration.js +3 -2
- package/build/src/configuration/otlp-http-env-configuration.js.map +1 -1
- package/build/src/configuration/shared-configuration.d.ts +1 -0
- package/build/src/configuration/shared-configuration.js +8 -1
- package/build/src/configuration/shared-configuration.js.map +1 -1
- package/build/src/index-browser-http.d.ts +4 -0
- package/build/src/index-browser-http.js +26 -0
- package/build/src/index-browser-http.js.map +1 -0
- package/build/src/index-node-http.d.ts +4 -0
- package/build/src/index-node-http.js +25 -0
- package/build/src/index-node-http.js.map +1 -0
- package/build/src/index.d.ts +5 -4
- package/build/src/index.js +5 -19
- package/build/src/index.js.map +1 -1
- package/build/src/logging-response-handler.d.ts +6 -0
- package/build/src/logging-response-handler.js +42 -0
- package/build/src/logging-response-handler.js.map +1 -0
- package/build/src/otlp-browser-http-export-delegate.d.ts +6 -0
- package/build/src/otlp-browser-http-export-delegate.js +23 -0
- package/build/src/otlp-browser-http-export-delegate.js.map +1 -0
- package/build/src/otlp-export-delegate.d.ts +24 -0
- package/build/src/otlp-export-delegate.js +109 -0
- package/build/src/otlp-export-delegate.js.map +1 -0
- package/build/src/otlp-http-export-delegate.d.ts +5 -0
- package/build/src/otlp-http-export-delegate.js +33 -0
- package/build/src/otlp-http-export-delegate.js.map +1 -0
- package/build/src/otlp-network-export-delegate.d.ts +6 -0
- package/build/src/otlp-network-export-delegate.js +29 -0
- package/build/src/otlp-network-export-delegate.js.map +1 -0
- package/build/src/response-handler.d.ts +12 -0
- package/build/src/response-handler.js +18 -0
- package/build/src/response-handler.js.map +1 -0
- package/build/src/{platform/node → transport}/http-exporter-transport.d.ts +1 -1
- package/build/src/transport/http-exporter-transport.js.map +1 -0
- package/build/{esm/platform/node → src/transport}/http-transport-types.d.ts +2 -2
- package/build/src/transport/http-transport-types.js.map +1 -0
- package/build/src/{platform/node → transport}/http-transport-utils.d.ts +1 -1
- package/build/src/{platform/node → transport}/http-transport-utils.js +4 -4
- package/build/src/transport/http-transport-utils.js.map +1 -0
- package/build/{esnext/platform/browser → src/transport}/send-beacon-transport.d.ts +1 -1
- package/build/src/transport/send-beacon-transport.js.map +1 -0
- package/build/{esm/platform/browser → src/transport}/xhr-transport.d.ts +2 -2
- package/build/src/{platform/browser → transport}/xhr-transport.js +4 -3
- package/build/src/transport/xhr-transport.js.map +1 -0
- package/build/src/types.d.ts +0 -11
- package/build/src/types.js.map +1 -1
- package/build/src/util.d.ts +1 -1
- package/build/src/util.js +14 -11
- package/build/src/util.js.map +1 -1
- package/build/src/version.d.ts +1 -1
- package/build/src/version.js +1 -1
- package/build/src/version.js.map +1 -1
- package/package.json +38 -11
- package/build/esm/platform/browser/OTLPExporterBrowserBase.d.ts +0 -21
- package/build/esm/platform/browser/OTLPExporterBrowserBase.js +0 -118
- package/build/esm/platform/browser/OTLPExporterBrowserBase.js.map +0 -1
- package/build/esm/platform/browser/index.d.ts +0 -2
- package/build/esm/platform/browser/index.js.map +0 -1
- package/build/esm/platform/browser/send-beacon-transport.js.map +0 -1
- package/build/esm/platform/browser/xhr-transport.js.map +0 -1
- package/build/esm/platform/index.d.ts +0 -3
- package/build/esm/platform/index.js.map +0 -1
- package/build/esm/platform/node/OTLPExporterNodeBase.d.ts +0 -16
- package/build/esm/platform/node/OTLPExporterNodeBase.js +0 -109
- package/build/esm/platform/node/OTLPExporterNodeBase.js.map +0 -1
- package/build/esm/platform/node/convert-legacy-agent-options.d.ts +0 -12
- package/build/esm/platform/node/convert-legacy-agent-options.js +0 -27
- package/build/esm/platform/node/convert-legacy-agent-options.js.map +0 -1
- package/build/esm/platform/node/http-exporter-transport.js.map +0 -1
- package/build/esm/platform/node/http-transport-types.js.map +0 -1
- package/build/esm/platform/node/http-transport-utils.js.map +0 -1
- package/build/esm/platform/node/index.d.ts +0 -3
- package/build/esm/platform/node/index.js.map +0 -1
- package/build/esm/platform/node/types.js +0 -6
- package/build/esm/platform/node/types.js.map +0 -1
- package/build/esnext/platform/browser/OTLPExporterBrowserBase.d.ts +0 -21
- package/build/esnext/platform/browser/OTLPExporterBrowserBase.js +0 -97
- package/build/esnext/platform/browser/OTLPExporterBrowserBase.js.map +0 -1
- package/build/esnext/platform/browser/index.d.ts +0 -2
- package/build/esnext/platform/browser/index.js.map +0 -1
- package/build/esnext/platform/browser/send-beacon-transport.js.map +0 -1
- package/build/esnext/platform/browser/xhr-transport.js.map +0 -1
- package/build/esnext/platform/index.d.ts +0 -3
- package/build/esnext/platform/index.js +0 -18
- package/build/esnext/platform/index.js.map +0 -1
- package/build/esnext/platform/node/OTLPExporterNodeBase.d.ts +0 -16
- package/build/esnext/platform/node/OTLPExporterNodeBase.js +0 -88
- package/build/esnext/platform/node/OTLPExporterNodeBase.js.map +0 -1
- package/build/esnext/platform/node/convert-legacy-agent-options.d.ts +0 -12
- package/build/esnext/platform/node/convert-legacy-agent-options.js +0 -27
- package/build/esnext/platform/node/convert-legacy-agent-options.js.map +0 -1
- package/build/esnext/platform/node/http-exporter-transport.js.map +0 -1
- package/build/esnext/platform/node/http-transport-types.js.map +0 -1
- package/build/esnext/platform/node/http-transport-utils.js.map +0 -1
- package/build/esnext/platform/node/index.d.ts +0 -3
- package/build/esnext/platform/node/index.js +0 -18
- package/build/esnext/platform/node/index.js.map +0 -1
- package/build/esnext/platform/node/types.js +0 -6
- package/build/esnext/platform/node/types.js.map +0 -1
- package/build/src/platform/browser/OTLPExporterBrowserBase.d.ts +0 -21
- package/build/src/platform/browser/OTLPExporterBrowserBase.js +0 -101
- package/build/src/platform/browser/OTLPExporterBrowserBase.js.map +0 -1
- package/build/src/platform/browser/index.d.ts +0 -2
- package/build/src/platform/browser/index.js.map +0 -1
- package/build/src/platform/browser/send-beacon-transport.js.map +0 -1
- package/build/src/platform/browser/xhr-transport.js.map +0 -1
- package/build/src/platform/index.d.ts +0 -3
- package/build/src/platform/index.js +0 -24
- package/build/src/platform/index.js.map +0 -1
- package/build/src/platform/node/OTLPExporterNodeBase.d.ts +0 -16
- package/build/src/platform/node/OTLPExporterNodeBase.js +0 -92
- package/build/src/platform/node/OTLPExporterNodeBase.js.map +0 -1
- package/build/src/platform/node/convert-legacy-agent-options.d.ts +0 -12
- package/build/src/platform/node/convert-legacy-agent-options.js +0 -31
- package/build/src/platform/node/convert-legacy-agent-options.js.map +0 -1
- package/build/src/platform/node/http-exporter-transport.js.map +0 -1
- package/build/src/platform/node/http-transport-types.js.map +0 -1
- package/build/src/platform/node/http-transport-utils.js.map +0 -1
- package/build/src/platform/node/index.d.ts +0 -3
- package/build/src/platform/node/index.js +0 -23
- package/build/src/platform/node/index.js.map +0 -1
- package/build/src/platform/node/types.js +0 -9
- package/build/src/platform/node/types.js.map +0 -1
- /package/build/esm/{platform/node → transport}/http-exporter-transport.js +0 -0
- /package/build/esm/{platform/node → transport}/http-transport-types.js +0 -0
- /package/build/esm/{platform/browser → transport}/send-beacon-transport.js +0 -0
- /package/build/esnext/{platform/node → transport}/http-exporter-transport.js +0 -0
- /package/build/esnext/{platform/node → transport}/http-transport-types.js +0 -0
- /package/build/esnext/{platform/browser → transport}/send-beacon-transport.js +0 -0
- /package/build/src/{platform/node → transport}/http-exporter-transport.js +0 -0
- /package/build/src/{platform/node → transport}/http-transport-types.js +0 -0
- /package/build/src/{platform/browser → transport}/send-beacon-transport.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-exporter-transport.js","sourceRoot":"","sources":["../../../../src/platform/node/http-exporter-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAcH,MAAM,qBAAqB;IAIzB,YAAoB,WAAkC;QAAlC,gBAAW,GAAX,WAAW,CAAuB;QAH9C,UAAK,GAAwB,IAAI,CAAC;QAClC,WAAM,GAAoC,IAAI,CAAC;IAEE,CAAC;IAE1D,KAAK,CAAC,IAAI,CAAC,IAAgB,EAAE,aAAqB;QAChD,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE;YACtB,8FAA8F;YAC9F,MAAM,EACJ,YAAY,EACZ,eAAe;YACf,8DAA8D;cAC/D,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;YACtC,IAAI,CAAC,MAAM,GAAG,eAAe,CAC3B,IAAI,CAAC,WAAW,CAAC,GAAG,EACpB,IAAI,CAAC,WAAW,CAAC,YAAY,CAC9B,CAAC;YACF,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC;SAC3B;QAED,OAAO,IAAI,OAAO,CAAiB,OAAO,CAAC,EAAE;;YAC3C,8BAA8B;YAC9B,oEAAoE;YACpE,MAAA,IAAI,CAAC,KAAK,+CAAV,IAAI,EACF,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,MAAO,EACZ,IAAI,EACJ,MAAM,CAAC,EAAE;gBACP,OAAO,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC,EACD,aAAa,CACd,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IACD,QAAQ;QACN,2CAA2C;IAC7C,CAAC;CACF;AAED,MAAM,UAAU,2BAA2B,CACzC,UAAiC;IAEjC,OAAO,IAAI,qBAAqB,CAAC,UAAU,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n HttpRequestParameters,\n sendWithHttp,\n} from './http-transport-types';\n\n// NOTE: do not change these type imports to actual imports. Doing so WILL break `@opentelemetry/instrumentation-http`,\n// as they'd be imported before the http/https modules can be wrapped.\nimport type * as https from 'https';\nimport type * as http from 'http';\nimport { ExportResponse } from '../../export-response';\nimport { IExporterTransport } from '../../exporter-transport';\n\nclass HttpExporterTransport implements IExporterTransport {\n private _send: sendWithHttp | null = null;\n private _agent: http.Agent | https.Agent | null = null;\n\n constructor(private _parameters: HttpRequestParameters) {}\n\n async send(data: Uint8Array, timeoutMillis: number): Promise<ExportResponse> {\n if (this._send == null) {\n // Lazy require to ensure that http/https is not required before instrumentations can wrap it.\n const {\n sendWithHttp,\n createHttpAgent,\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n } = require('./http-transport-utils');\n this._agent = createHttpAgent(\n this._parameters.url,\n this._parameters.agentOptions\n );\n this._send = sendWithHttp;\n }\n\n return new Promise<ExportResponse>(resolve => {\n // this will always be defined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this._send?.(\n this._parameters,\n this._agent!,\n data,\n result => {\n resolve(result);\n },\n timeoutMillis\n );\n });\n }\n shutdown() {\n // intentionally left empty, nothing to do.\n }\n}\n\nexport function createHttpExporterTransport(\n parameters: HttpRequestParameters\n): IExporterTransport {\n return new HttpExporterTransport(parameters);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-transport-types.js","sourceRoot":"","sources":["../../../../src/platform/node/http-transport-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type * as http from 'http';\nimport type * as https from 'https';\nimport { ExportResponse } from '../../export-response';\n\nexport type sendWithHttp = (\n params: HttpRequestParameters,\n agent: http.Agent | https.Agent,\n data: Uint8Array,\n onDone: (response: ExportResponse) => void,\n timeoutMillis: number\n) => void;\n\nexport interface HttpRequestParameters {\n url: string;\n headers: Record<string, string>;\n compression: 'gzip' | 'none';\n agentOptions: http.AgentOptions | https.AgentOptions;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-transport-utils.js","sourceRoot":"","sources":["../../../../src/platform/node/http-transport-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAGlC,OAAO,EACL,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAC1B,MAA6B,EAC7B,KAA+B,EAC/B,IAAgB,EAChB,MAA0C,EAC1C,aAAqB;IAErB,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhE,MAAM,OAAO,GAA+C;QAC1D,QAAQ,EAAE,SAAS,CAAC,QAAQ;QAC5B,IAAI,EAAE,SAAS,CAAC,IAAI;QACpB,IAAI,EAAE,SAAS,CAAC,QAAQ;QACxB,MAAM,EAAE,MAAM;QACd,OAAO,oBACF,MAAM,CAAC,OA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,OAAO,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,sBAAsB,CAAC,IAAyB;IACvD,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;IAChC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEpB,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,MAAc,EACd,YAAoD;IAEpD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;IACxE,OAAO,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;AACjC,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 http from 'http';\nimport * as https from 'https';\nimport * as zlib from 'zlib';\nimport { Readable } from 'stream';\nimport { HttpRequestParameters } from './http-transport-types';\nimport { ExportResponse } from '../../export-response';\nimport {\n isExportRetryable,\n parseRetryAfterToMills,\n} from '../../is-export-retryable';\nimport { OTLPExporterError } from '../../types';\n\n/**\n * Sends data using http\n * @param params\n * @param agent\n * @param data\n * @param onDone\n * @param timeoutMillis\n */\nexport function sendWithHttp(\n params: HttpRequestParameters,\n agent: http.Agent | https.Agent,\n data: Uint8Array,\n onDone: (response: ExportResponse) => void,\n timeoutMillis: number\n): void {\n const parsedUrl = new URL(params.url);\n const nodeVersion = Number(process.versions.node.split('.')[0]);\n\n const options: http.RequestOptions | https.RequestOptions = {\n hostname: parsedUrl.hostname,\n port: parsedUrl.port,\n path: parsedUrl.pathname,\n method: 'POST',\n headers: {\n ...params.headers,\n },\n agent: agent,\n };\n\n const request = parsedUrl.protocol === 'http:' ? http.request : https.request;\n\n const req = request(options, (res: http.IncomingMessage) => {\n const responseData: Buffer[] = [];\n res.on('data', chunk => responseData.push(chunk));\n\n res.on('end', () => {\n if (res.statusCode && res.statusCode < 299) {\n onDone({\n status: 'success',\n data: Buffer.concat(responseData),\n });\n } else if (res.statusCode && isExportRetryable(res.statusCode)) {\n onDone({\n status: 'retryable',\n retryInMillis: parseRetryAfterToMills(res.headers['retry-after']),\n });\n } else {\n const error = new OTLPExporterError(res.statusMessage, res.statusCode);\n onDone({\n status: 'failure',\n error,\n });\n }\n });\n });\n\n req.setTimeout(timeoutMillis, () => {\n req.destroy();\n onDone({\n status: 'failure',\n error: new Error('Request Timeout'),\n });\n });\n req.on('error', (error: Error | any) => {\n onDone({\n status: 'failure',\n error: error,\n });\n });\n\n const reportTimeoutErrorEvent = nodeVersion >= 14 ? 'close' : 'abort';\n req.on(reportTimeoutErrorEvent, () => {\n onDone({\n status: 'failure',\n error: new Error('Request timed out'),\n });\n });\n\n compressAndSend(req, params.compression, data, (error: Error) => {\n onDone({\n status: 'failure',\n error,\n });\n });\n}\n\nexport function compressAndSend(\n req: http.ClientRequest,\n compression: 'gzip' | 'none',\n data: Uint8Array,\n onError: (error: Error) => void\n) {\n let dataStream = readableFromUint8Array(data);\n\n if (compression === 'gzip') {\n req.setHeader('Content-Encoding', 'gzip');\n dataStream = dataStream\n .on('error', onError)\n .pipe(zlib.createGzip())\n .on('error', onError);\n }\n\n dataStream.pipe(req).on('error', onError);\n}\n\nfunction readableFromUint8Array(buff: string | Uint8Array): Readable {\n const readable = new Readable();\n readable.push(buff);\n readable.push(null);\n\n return readable;\n}\n\nexport function createHttpAgent(\n rawUrl: string,\n agentOptions: http.AgentOptions | https.AgentOptions\n) {\n const parsedUrl = new URL(rawUrl);\n const Agent = parsedUrl.protocol === 'http:' ? http.Agent : https.Agent;\n return new Agent(agentOptions);\n}\n"]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright The OpenTelemetry Authors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
export { OTLPExporterNodeBase } from './OTLPExporterNodeBase';
|
|
17
|
-
export { CompressionAlgorithm } from './types';
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/platform/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAA8B,oBAAoB,EAAE,MAAM,SAAS,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 { OTLPExporterNodeBase } from './OTLPExporterNodeBase';\nexport { OTLPExporterNodeConfigBase, CompressionAlgorithm } from './types';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/platform/node/types.ts"],"names":[],"mappings":"AA6BA,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 */\nimport type * as http from 'http';\nimport type * as https from 'https';\n\nimport { OTLPExporterConfigBase } from '../../types';\n\n/**\n * Collector Exporter node base config\n */\nexport interface OTLPExporterNodeConfigBase extends OTLPExporterConfigBase {\n keepAlive?: boolean;\n compression?: CompressionAlgorithm;\n httpAgentOptions?: http.AgentOptions | https.AgentOptions;\n}\n\nexport enum CompressionAlgorithm {\n NONE = 'none',\n GZIP = 'gzip',\n}\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { OTLPExporterBase } from '../../OTLPExporterBase';
|
|
2
|
-
import { OTLPExporterConfigBase, OTLPExporterError } from '../../types';
|
|
3
|
-
import { ISerializer } from '@opentelemetry/otlp-transformer';
|
|
4
|
-
/**
|
|
5
|
-
* Collector Metric Exporter abstract base class
|
|
6
|
-
*/
|
|
7
|
-
export declare abstract class OTLPExporterBrowserBase<ExportItem, ServiceResponse> extends OTLPExporterBase<OTLPExporterConfigBase, ExportItem> {
|
|
8
|
-
private _serializer;
|
|
9
|
-
private _transport;
|
|
10
|
-
private _timeoutMillis;
|
|
11
|
-
/**
|
|
12
|
-
* @param config
|
|
13
|
-
* @param serializer
|
|
14
|
-
* @param requiredHeaders
|
|
15
|
-
* @param signalResourcePath
|
|
16
|
-
*/
|
|
17
|
-
constructor(config: OTLPExporterConfigBase | undefined, serializer: ISerializer<ExportItem[], ServiceResponse>, requiredHeaders: Record<string, string>, signalResourcePath: string);
|
|
18
|
-
onShutdown(): void;
|
|
19
|
-
send(objects: ExportItem[], onSuccess: () => void, onError: (error: OTLPExporterError) => void): void;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=OTLPExporterBrowserBase.d.ts.map
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright The OpenTelemetry Authors
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.OTLPExporterBrowserBase = void 0;
|
|
19
|
-
const OTLPExporterBase_1 = require("../../OTLPExporterBase");
|
|
20
|
-
const types_1 = require("../../types");
|
|
21
|
-
const api_1 = require("@opentelemetry/api");
|
|
22
|
-
const xhr_transport_1 = require("./xhr-transport");
|
|
23
|
-
const send_beacon_transport_1 = require("./send-beacon-transport");
|
|
24
|
-
const retrying_transport_1 = require("../../retrying-transport");
|
|
25
|
-
const otlp_http_configuration_1 = require("../../configuration/otlp-http-configuration");
|
|
26
|
-
/**
|
|
27
|
-
* Collector Metric Exporter abstract base class
|
|
28
|
-
*/
|
|
29
|
-
class OTLPExporterBrowserBase extends OTLPExporterBase_1.OTLPExporterBase {
|
|
30
|
-
/**
|
|
31
|
-
* @param config
|
|
32
|
-
* @param serializer
|
|
33
|
-
* @param requiredHeaders
|
|
34
|
-
* @param signalResourcePath
|
|
35
|
-
*/
|
|
36
|
-
constructor(config = {}, serializer, requiredHeaders, signalResourcePath) {
|
|
37
|
-
super(config);
|
|
38
|
-
this._serializer = serializer;
|
|
39
|
-
const useXhr = !!config.headers || typeof navigator.sendBeacon !== 'function';
|
|
40
|
-
const actualConfig = (0, otlp_http_configuration_1.mergeOtlpHttpConfigurationWithDefaults)({
|
|
41
|
-
url: config.url,
|
|
42
|
-
timeoutMillis: config.timeoutMillis,
|
|
43
|
-
headers: config.headers,
|
|
44
|
-
concurrencyLimit: config.concurrencyLimit,
|
|
45
|
-
}, {}, // no fallback for browser case
|
|
46
|
-
(0, otlp_http_configuration_1.getHttpConfigurationDefaults)(requiredHeaders, signalResourcePath));
|
|
47
|
-
this._timeoutMillis = actualConfig.timeoutMillis;
|
|
48
|
-
this._concurrencyLimit = actualConfig.concurrencyLimit;
|
|
49
|
-
if (useXhr) {
|
|
50
|
-
this._transport = (0, retrying_transport_1.createRetryingTransport)({
|
|
51
|
-
transport: (0, xhr_transport_1.createXhrTransport)({
|
|
52
|
-
headers: actualConfig.headers,
|
|
53
|
-
url: actualConfig.url,
|
|
54
|
-
}),
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
// sendBeacon has no way to signal retry, so we do not wrap it in a RetryingTransport
|
|
59
|
-
this._transport = (0, send_beacon_transport_1.createSendBeaconTransport)({
|
|
60
|
-
url: actualConfig.url,
|
|
61
|
-
blobType: actualConfig.headers['Content-Type'],
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
onShutdown() { }
|
|
66
|
-
send(objects, onSuccess, onError) {
|
|
67
|
-
if (this._shutdownOnce.isCalled) {
|
|
68
|
-
api_1.diag.debug('Shutdown already started. Cannot send objects');
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
const data = this._serializer.serializeRequest(objects);
|
|
72
|
-
if (data == null) {
|
|
73
|
-
onError(new Error('Could not serialize message'));
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
const promise = this._transport
|
|
77
|
-
.send(data, this._timeoutMillis)
|
|
78
|
-
.then(response => {
|
|
79
|
-
if (response.status === 'success') {
|
|
80
|
-
onSuccess();
|
|
81
|
-
}
|
|
82
|
-
else if (response.status === 'failure' && response.error) {
|
|
83
|
-
onError(response.error);
|
|
84
|
-
}
|
|
85
|
-
else if (response.status === 'retryable') {
|
|
86
|
-
onError(new types_1.OTLPExporterError('Export failed with retryable status'));
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
onError(new types_1.OTLPExporterError('Export failed with unknown error'));
|
|
90
|
-
}
|
|
91
|
-
}, onError);
|
|
92
|
-
this._sendingPromises.push(promise);
|
|
93
|
-
const popPromise = () => {
|
|
94
|
-
const index = this._sendingPromises.indexOf(promise);
|
|
95
|
-
this._sendingPromises.splice(index, 1);
|
|
96
|
-
};
|
|
97
|
-
promise.then(popPromise, popPromise);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
exports.OTLPExporterBrowserBase = OTLPExporterBrowserBase;
|
|
101
|
-
//# sourceMappingURL=OTLPExporterBrowserBase.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OTLPExporterBrowserBase.js","sourceRoot":"","sources":["../../../../src/platform/browser/OTLPExporterBrowserBase.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,6DAA0D;AAC1D,uCAAwE;AACxE,4CAA0C;AAG1C,mDAAqD;A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EAAE,UAAU,CAAC,CAAC;IACvC,CAAC;CACF;AA/FD,0DA+FC","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 { OTLPExporterBase } from '../../OTLPExporterBase';\nimport { OTLPExporterConfigBase, OTLPExporterError } from '../../types';\nimport { diag } from '@opentelemetry/api';\nimport { ISerializer } from '@opentelemetry/otlp-transformer';\nimport { IExporterTransport } from '../../exporter-transport';\nimport { createXhrTransport } from './xhr-transport';\nimport { createSendBeaconTransport } from './send-beacon-transport';\nimport { createRetryingTransport } from '../../retrying-transport';\nimport {\n getHttpConfigurationDefaults,\n mergeOtlpHttpConfigurationWithDefaults,\n} from '../../configuration/otlp-http-configuration';\n\n/**\n * Collector Metric Exporter abstract base class\n */\nexport abstract class OTLPExporterBrowserBase<\n ExportItem,\n ServiceResponse,\n> extends OTLPExporterBase<OTLPExporterConfigBase, ExportItem> {\n private _serializer: ISerializer<ExportItem[], ServiceResponse>;\n private _transport: IExporterTransport;\n private _timeoutMillis: number;\n\n /**\n * @param config\n * @param serializer\n * @param requiredHeaders\n * @param signalResourcePath\n */\n constructor(\n config: OTLPExporterConfigBase = {},\n serializer: ISerializer<ExportItem[], ServiceResponse>,\n requiredHeaders: Record<string, string>,\n signalResourcePath: string\n ) {\n super(config);\n this._serializer = serializer;\n const useXhr =\n !!config.headers || typeof navigator.sendBeacon !== 'function';\n\n const actualConfig = mergeOtlpHttpConfigurationWithDefaults(\n {\n url: config.url,\n timeoutMillis: config.timeoutMillis,\n headers: config.headers,\n concurrencyLimit: config.concurrencyLimit,\n },\n {}, // no fallback for browser case\n getHttpConfigurationDefaults(requiredHeaders, signalResourcePath)\n );\n\n this._timeoutMillis = actualConfig.timeoutMillis;\n this._concurrencyLimit = actualConfig.concurrencyLimit;\n\n if (useXhr) {\n this._transport = createRetryingTransport({\n transport: createXhrTransport({\n headers: actualConfig.headers,\n url: actualConfig.url,\n }),\n });\n } else {\n // sendBeacon has no way to signal retry, so we do not wrap it in a RetryingTransport\n this._transport = createSendBeaconTransport({\n url: actualConfig.url,\n blobType: actualConfig.headers['Content-Type'],\n });\n }\n }\n\n onShutdown(): void {}\n\n send(\n objects: ExportItem[],\n onSuccess: () => void,\n onError: (error: OTLPExporterError) => void\n ): void {\n if (this._shutdownOnce.isCalled) {\n diag.debug('Shutdown already started. Cannot send objects');\n return;\n }\n\n const data = this._serializer.serializeRequest(objects);\n\n if (data == null) {\n onError(new Error('Could not serialize message'));\n return;\n }\n\n const promise = this._transport\n .send(data, this._timeoutMillis)\n .then(response => {\n if (response.status === 'success') {\n onSuccess();\n } else if (response.status === 'failure' && response.error) {\n onError(response.error);\n } else if (response.status === 'retryable') {\n onError(new OTLPExporterError('Export failed with retryable status'));\n } else {\n onError(new OTLPExporterError('Export failed with unknown error'));\n }\n }, onError);\n\n this._sendingPromises.push(promise);\n const popPromise = () => {\n const index = this._sendingPromises.indexOf(promise);\n this._sendingPromises.splice(index, 1);\n };\n promise.then(popPromise, popPromise);\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/platform/browser/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,qEAAoE;AAA3D,kIAAA,uBAAuB,OAAA","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 { OTLPExporterBrowserBase } from './OTLPExporterBrowserBase';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"send-beacon-transport.js","sourceRoot":"","sources":["../../../../src/platform/browser/send-beacon-transport.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,4CAA0C;AAU1C,MAAM,mBAAmB;IACvB,YAAoB,OAA6B;QAA7B,YAAO,GAAP,OAAO,CAAsB;IAAG,CAAC;IACrD,IAAI,CAAC,IAAgB;QACnB,OAAO,IAAI,OAAO,CAAiB,OAAO,CAAC,EAAE;YAC3C,IACE,SAAS,CAAC,UAAU,CAClB,IAAI,CAAC,OAAO,CAAC,GAAG,EAChB,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAClD,EACD;gBACA,sDAAsD;gBACtD,UAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;gBACjC,OAAO,CAAC;oBACN,MAAM,EAAE,SAAS;iBAClB,CAAC,CAAC;aACJ;iBAAM;gBACL,OAAO,CAAC;oBACN,MAAM,EAAE,SAAS;oBACjB,KAAK,EAAE,IAAI,KAAK,CAAC,mBAAmB,CAAC;iBACtC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,QAAQ;QACN,2CAA2C;IAC7C,CAAC;CACF;AAED,SAAgB,yBAAyB,CACvC,UAAgC;IAEhC,OAAO,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC;AAC7C,CAAC;AAJD,8DAIC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { IExporterTransport } from '../../exporter-transport';\nimport { ExportResponse } from '../../export-response';\nimport { diag } from '@opentelemetry/api';\n\nexport interface SendBeaconParameters {\n url: string;\n /**\n * for instance 'application/x-protobuf'\n */\n blobType: string;\n}\n\nclass SendBeaconTransport implements IExporterTransport {\n constructor(private _params: SendBeaconParameters) {}\n send(data: Uint8Array): Promise<ExportResponse> {\n return new Promise<ExportResponse>(resolve => {\n if (\n navigator.sendBeacon(\n this._params.url,\n new Blob([data], { type: this._params.blobType })\n )\n ) {\n // no way to signal retry, treat everything as success\n diag.debug('SendBeacon success');\n resolve({\n status: 'success',\n });\n } else {\n resolve({\n status: 'failure',\n error: new Error('SendBeacon failed'),\n });\n }\n });\n }\n\n shutdown(): void {\n // Intentionally left empty, nothing to do.\n }\n}\n\nexport function createSendBeaconTransport(\n parameters: SendBeaconParameters\n): IExporterTransport {\n return new SendBeaconTransport(parameters);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xhr-transport.js","sourceRoot":"","sources":["../../../../src/platform/browser/xhr-transport.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,4CAA0C;AAC1C,mEAGmC;AAOnC,MAAM,YAAY;IAChB,YAAoB,WAAiC;QAAjC,gBAAW,GAAX,WAAW,CAAsB;IAAG,CAAC;IAEzD,IAAI,CAAC,IAAgB,EAAE,aAAqB;QAC1C,OAAO,IAAI,OAAO,CAAiB,OAAO,CAAC,EAAE;YAC3C,MAAM,GAAG,GAAG,IAAI,cAAc,EAAE,CAAC;YACjC,GAAG,CAAC,OAAO,GAAG,aAAa,CAAC;YAC5B,GAAG,CAAC,IAAI,CA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jB,KAAK,EAAE,IAAI,KAAK,CAAC,qBAAqB,CAAC;iBACxC,CAAC,CAAC;YACL,CAAC,CAAC;YACF,GAAG,CAAC,OAAO,GAAG,GAAG,EAAE;gBACjB,OAAO,CAAC;oBACN,MAAM,EAAE,SAAS;oBACjB,KAAK,EAAE,IAAI,KAAK,CAAC,qBAAqB,CAAC;iBACxC,CAAC,CAAC;YACL,CAAC,CAAC;YAEF,GAAG,CAAC,IAAI,CACN,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC,CACrE,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED,QAAQ;QACN,2CAA2C;IAC7C,CAAC;CACF;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAChC,UAAgC;IAEhC,OAAO,IAAI,YAAY,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC;AAJD,gDAIC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { IExporterTransport } from '../../exporter-transport';\nimport { ExportResponse } from '../../export-response';\nimport { diag } from '@opentelemetry/api';\nimport {\n isExportRetryable,\n parseRetryAfterToMills,\n} from '../../is-export-retryable';\n\nexport interface XhrRequestParameters {\n url: string;\n headers: Record<string, string>;\n}\n\nclass XhrTransport implements IExporterTransport {\n constructor(private _parameters: XhrRequestParameters) {}\n\n send(data: Uint8Array, timeoutMillis: number): Promise<ExportResponse> {\n return new Promise<ExportResponse>(resolve => {\n const xhr = new XMLHttpRequest();\n xhr.timeout = timeoutMillis;\n xhr.open('POST', this._parameters.url);\n Object.entries(this._parameters.headers).forEach(([k, v]) => {\n xhr.setRequestHeader(k, v);\n });\n\n xhr.ontimeout = _ => {\n resolve({\n status: 'failure',\n error: new Error('XHR request timed out'),\n });\n };\n\n xhr.onreadystatechange = () => {\n if (xhr.status >= 200 && xhr.status <= 299) {\n diag.debug('XHR success');\n resolve({\n status: 'success',\n });\n } else if (xhr.status && isExportRetryable(xhr.status)) {\n resolve({\n status: 'retryable',\n retryInMillis: parseRetryAfterToMills(\n xhr.getResponseHeader('Retry-After')\n ),\n });\n } else if (xhr.status !== 0) {\n resolve({\n status: 'failure',\n error: new Error('XHR request failed with non-retryable status'),\n });\n }\n };\n\n xhr.onabort = () => {\n resolve({\n status: 'failure',\n error: new Error('XHR request aborted'),\n });\n };\n xhr.onerror = () => {\n resolve({\n status: 'failure',\n error: new Error('XHR request errored'),\n });\n };\n\n xhr.send(\n new Blob([data], { type: this._parameters.headers['Content-Type'] })\n );\n });\n }\n\n shutdown() {\n // Intentionally left empty, nothing to do.\n }\n}\n\n/**\n * Creates an exporter transport that uses XHR to send the data\n * @param parameters applied to each request made by transport\n */\nexport function createXhrTransport(\n parameters: XhrRequestParameters\n): IExporterTransport {\n return new XhrTransport(parameters);\n}\n"]}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright The OpenTelemetry Authors
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.OTLPExporterBrowserBase = exports.CompressionAlgorithm = exports.OTLPExporterNodeBase = void 0;
|
|
19
|
-
var node_1 = require("./node");
|
|
20
|
-
Object.defineProperty(exports, "OTLPExporterNodeBase", { enumerable: true, get: function () { return node_1.OTLPExporterNodeBase; } });
|
|
21
|
-
Object.defineProperty(exports, "CompressionAlgorithm", { enumerable: true, get: function () { return node_1.CompressionAlgorithm; } });
|
|
22
|
-
var browser_1 = require("./browser");
|
|
23
|
-
Object.defineProperty(exports, "OTLPExporterBrowserBase", { enumerable: true, get: function () { return browser_1.OTLPExporterBrowserBase; } });
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platform/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,+BAIgB;AAHd,4GAAA,oBAAoB,OAAA;AAEpB,4GAAA,oBAAoB,OAAA;AAEtB,qCAAoD;AAA3C,kHAAA,uBAAuB,OAAA","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport {\n OTLPExporterNodeBase,\n OTLPExporterNodeConfigBase,\n CompressionAlgorithm,\n} from './node';\nexport { OTLPExporterBrowserBase } from './browser';\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { OTLPExporterBase } from '../../OTLPExporterBase';
|
|
2
|
-
import { OTLPExporterNodeConfigBase } from './types';
|
|
3
|
-
import { ISerializer } from '@opentelemetry/otlp-transformer';
|
|
4
|
-
import { OTLPExporterError } from '../../types';
|
|
5
|
-
/**
|
|
6
|
-
* Collector Metric Exporter abstract base class
|
|
7
|
-
*/
|
|
8
|
-
export declare abstract class OTLPExporterNodeBase<ExportItem, ServiceResponse> extends OTLPExporterBase<OTLPExporterNodeConfigBase, ExportItem> {
|
|
9
|
-
private _serializer;
|
|
10
|
-
private _transport;
|
|
11
|
-
private _timeoutMillis;
|
|
12
|
-
constructor(config: OTLPExporterNodeConfigBase | undefined, serializer: ISerializer<ExportItem[], ServiceResponse>, requiredHeaders: Record<string, string>, signalIdentifier: string, signalResourcePath: string);
|
|
13
|
-
send(objects: ExportItem[], onSuccess: () => void, onError: (error: OTLPExporterError) => void): void;
|
|
14
|
-
onShutdown(): void;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=OTLPExporterNodeBase.d.ts.map
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright The OpenTelemetry Authors
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.OTLPExporterNodeBase = void 0;
|
|
19
|
-
const OTLPExporterBase_1 = require("../../OTLPExporterBase");
|
|
20
|
-
const api_1 = require("@opentelemetry/api");
|
|
21
|
-
const http_exporter_transport_1 = require("./http-exporter-transport");
|
|
22
|
-
const types_1 = require("../../types");
|
|
23
|
-
const retrying_transport_1 = require("../../retrying-transport");
|
|
24
|
-
const convert_legacy_agent_options_1 = require("./convert-legacy-agent-options");
|
|
25
|
-
const otlp_http_configuration_1 = require("../../configuration/otlp-http-configuration");
|
|
26
|
-
const otlp_http_env_configuration_1 = require("../../configuration/otlp-http-env-configuration");
|
|
27
|
-
/**
|
|
28
|
-
* Collector Metric Exporter abstract base class
|
|
29
|
-
*/
|
|
30
|
-
class OTLPExporterNodeBase extends OTLPExporterBase_1.OTLPExporterBase {
|
|
31
|
-
constructor(config = {}, serializer, requiredHeaders, signalIdentifier, signalResourcePath) {
|
|
32
|
-
super(config);
|
|
33
|
-
const actualConfig = (0, otlp_http_configuration_1.mergeOtlpHttpConfigurationWithDefaults)({
|
|
34
|
-
url: config.url,
|
|
35
|
-
headers: config.headers,
|
|
36
|
-
concurrencyLimit: config.concurrencyLimit,
|
|
37
|
-
timeoutMillis: config.timeoutMillis,
|
|
38
|
-
compression: config.compression,
|
|
39
|
-
}, (0, otlp_http_env_configuration_1.getHttpConfigurationFromEnvironment)(signalIdentifier, signalResourcePath), (0, otlp_http_configuration_1.getHttpConfigurationDefaults)(requiredHeaders, signalResourcePath));
|
|
40
|
-
this._timeoutMillis = actualConfig.timeoutMillis;
|
|
41
|
-
this._concurrencyLimit = actualConfig.concurrencyLimit;
|
|
42
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
|
-
if (config.metadata) {
|
|
44
|
-
api_1.diag.warn('Metadata cannot be set when using http');
|
|
45
|
-
}
|
|
46
|
-
this._serializer = serializer;
|
|
47
|
-
this._transport = (0, retrying_transport_1.createRetryingTransport)({
|
|
48
|
-
transport: (0, http_exporter_transport_1.createHttpExporterTransport)({
|
|
49
|
-
agentOptions: (0, convert_legacy_agent_options_1.convertLegacyAgentOptions)(config),
|
|
50
|
-
compression: actualConfig.compression,
|
|
51
|
-
headers: actualConfig.headers,
|
|
52
|
-
url: actualConfig.url,
|
|
53
|
-
}),
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
send(objects, onSuccess, onError) {
|
|
57
|
-
if (this._shutdownOnce.isCalled) {
|
|
58
|
-
api_1.diag.debug('Shutdown already started. Cannot send objects');
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
const data = this._serializer.serializeRequest(objects);
|
|
62
|
-
if (data == null) {
|
|
63
|
-
onError(new Error('Could not serialize message'));
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const promise = this._transport
|
|
67
|
-
.send(data, this._timeoutMillis)
|
|
68
|
-
.then(response => {
|
|
69
|
-
if (response.status === 'success') {
|
|
70
|
-
onSuccess();
|
|
71
|
-
}
|
|
72
|
-
else if (response.status === 'failure' && response.error) {
|
|
73
|
-
onError(response.error);
|
|
74
|
-
}
|
|
75
|
-
else if (response.status === 'retryable') {
|
|
76
|
-
onError(new types_1.OTLPExporterError('Export failed with retryable status'));
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
onError(new types_1.OTLPExporterError('Export failed with unknown error'));
|
|
80
|
-
}
|
|
81
|
-
}, onError);
|
|
82
|
-
this._sendingPromises.push(promise);
|
|
83
|
-
const popPromise = () => {
|
|
84
|
-
const index = this._sendingPromises.indexOf(promise);
|
|
85
|
-
this._sendingPromises.splice(index, 1);
|
|
86
|
-
};
|
|
87
|
-
promise.then(popPromise, popPromise);
|
|
88
|
-
}
|
|
89
|
-
onShutdown() { }
|
|
90
|
-
}
|
|
91
|
-
exports.OTLPExporterNodeBase = OTLPExporterNodeBase;
|
|
92
|
-
//# sourceMappingURL=OTLPExporterNodeBase.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OTLPExporterNodeBase.js","sourceRoot":"","sources":["../../../../src/platform/node/OTLPExporterNodeBase.ts"],"names":[],"mappings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CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACvC,CAAC;IAED,UAAU,KAAU,CAAC;CACtB;AAvFD,oDAuFC","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 { OTLPExporterBase } from '../../OTLPExporterBase';\nimport { OTLPExporterNodeConfigBase } from './types';\nimport { diag } from '@opentelemetry/api';\nimport { ISerializer } from '@opentelemetry/otlp-transformer';\nimport { IExporterTransport } from '../../exporter-transport';\nimport { createHttpExporterTransport } from './http-exporter-transport';\nimport { OTLPExporterError } from '../../types';\nimport { createRetryingTransport } from '../../retrying-transport';\nimport { convertLegacyAgentOptions } from './convert-legacy-agent-options';\nimport {\n getHttpConfigurationDefaults,\n mergeOtlpHttpConfigurationWithDefaults,\n} from '../../configuration/otlp-http-configuration';\nimport { getHttpConfigurationFromEnvironment } from '../../configuration/otlp-http-env-configuration';\n\n/**\n * Collector Metric Exporter abstract base class\n */\nexport abstract class OTLPExporterNodeBase<\n ExportItem,\n ServiceResponse,\n> extends OTLPExporterBase<OTLPExporterNodeConfigBase, ExportItem> {\n private _serializer: ISerializer<ExportItem[], ServiceResponse>;\n private _transport: IExporterTransport;\n private _timeoutMillis: number;\n\n constructor(\n config: OTLPExporterNodeConfigBase = {},\n serializer: ISerializer<ExportItem[], ServiceResponse>,\n requiredHeaders: Record<string, string>,\n signalIdentifier: string,\n signalResourcePath: string\n ) {\n super(config);\n const actualConfig = mergeOtlpHttpConfigurationWithDefaults(\n {\n url: config.url,\n headers: config.headers,\n concurrencyLimit: config.concurrencyLimit,\n timeoutMillis: config.timeoutMillis,\n compression: config.compression,\n },\n getHttpConfigurationFromEnvironment(signalIdentifier, signalResourcePath),\n getHttpConfigurationDefaults(requiredHeaders, signalResourcePath)\n );\n\n this._timeoutMillis = actualConfig.timeoutMillis;\n this._concurrencyLimit = actualConfig.concurrencyLimit;\n\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 this._serializer = serializer;\n\n this._transport = createRetryingTransport({\n transport: createHttpExporterTransport({\n agentOptions: convertLegacyAgentOptions(config),\n compression: actualConfig.compression,\n headers: actualConfig.headers,\n url: actualConfig.url,\n }),\n });\n }\n\n send(\n objects: ExportItem[],\n onSuccess: () => void,\n onError: (error: OTLPExporterError) => void\n ): void {\n if (this._shutdownOnce.isCalled) {\n diag.debug('Shutdown already started. Cannot send objects');\n return;\n }\n\n const data = this._serializer.serializeRequest(objects);\n\n if (data == null) {\n onError(new Error('Could not serialize message'));\n return;\n }\n\n const promise = this._transport\n .send(data, this._timeoutMillis)\n .then(response => {\n if (response.status === 'success') {\n onSuccess();\n } else if (response.status === 'failure' && response.error) {\n onError(response.error);\n } else if (response.status === 'retryable') {\n onError(new OTLPExporterError('Export failed with retryable status'));\n } else {\n onError(new OTLPExporterError('Export failed with unknown error'));\n }\n }, onError);\n\n this._sendingPromises.push(promise);\n const popPromise = () => {\n const index = this._sendingPromises.indexOf(promise);\n this._sendingPromises.splice(index, 1);\n };\n promise.then(popPromise, popPromise);\n }\n\n onShutdown(): void {}\n}\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { OTLPExporterNodeConfigBase } from './types';
|
|
3
|
-
import type * as http from 'http';
|
|
4
|
-
import type * as https from 'https';
|
|
5
|
-
/**
|
|
6
|
-
* Replicates old config behavior where there's two ways to set keepAlive.
|
|
7
|
-
* This function sets keepAlive in AgentOptions if it is defined. In the future, we will remove
|
|
8
|
-
* this duplicate to only allow setting keepAlive in AgentOptions.
|
|
9
|
-
* @param config
|
|
10
|
-
*/
|
|
11
|
-
export declare function convertLegacyAgentOptions(config: OTLPExporterNodeConfigBase): http.AgentOptions | https.AgentOptions;
|
|
12
|
-
//# sourceMappingURL=convert-legacy-agent-options.d.ts.map
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertLegacyAgentOptions = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Replicates old config behavior where there's two ways to set keepAlive.
|
|
6
|
-
* This function sets keepAlive in AgentOptions if it is defined. In the future, we will remove
|
|
7
|
-
* this duplicate to only allow setting keepAlive in AgentOptions.
|
|
8
|
-
* @param config
|
|
9
|
-
*/
|
|
10
|
-
function convertLegacyAgentOptions(config) {
|
|
11
|
-
var _a;
|
|
12
|
-
// populate keepAlive for use with new settings
|
|
13
|
-
if ((config === null || config === void 0 ? void 0 : config.keepAlive) != null) {
|
|
14
|
-
if (config.httpAgentOptions != null) {
|
|
15
|
-
if (config.httpAgentOptions.keepAlive == null) {
|
|
16
|
-
// specific setting is not set, populate with non-specific setting.
|
|
17
|
-
config.httpAgentOptions.keepAlive = config.keepAlive;
|
|
18
|
-
}
|
|
19
|
-
// do nothing, use specific setting otherwise
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
// populate specific option if AgentOptions does not exist.
|
|
23
|
-
config.httpAgentOptions = {
|
|
24
|
-
keepAlive: config.keepAlive,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return (_a = config.httpAgentOptions) !== null && _a !== void 0 ? _a : { keepAlive: true };
|
|
29
|
-
}
|
|
30
|
-
exports.convertLegacyAgentOptions = convertLegacyAgentOptions;
|
|
31
|
-
//# sourceMappingURL=convert-legacy-agent-options.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convert-legacy-agent-options.js","sourceRoot":"","sources":["../../../../src/platform/node/convert-legacy-agent-options.ts"],"names":[],"mappings":";;;AAmBA;;;;;GAKG;AACH,SAAgB,yBAAyB,CACvC,MAAkC;;IAElC,+CAA+C;IAC/C,IAAI,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,SAAS,KAAI,IAAI,EAAE;QAC7B,IAAI,MAAM,CAAC,gBAAgB,IAAI,IAAI,EAAE;YACnC,IAAI,MAAM,CAAC,gBAAgB,CAAC,SAAS,IAAI,IAAI,EAAE;gBAC7C,mEAAmE;gBACnE,MAAM,CAAC,gBAAgB,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;aACtD;YACD,6CAA6C;SAC9C;aAAM;YACL,2DAA2D;YAC3D,MAAM,CAAC,gBAAgB,GAAG;gBACxB,SAAS,EAAE,MAAM,CAAC,SAAS;aAC5B,CAAC;SACH;KACF;IAED,OAAO,MAAA,MAAM,CAAC,gBAAgB,mCAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AACxD,CAAC;AApBD,8DAoBC","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 './types';\nimport type * as http from 'http';\nimport type * as https from 'https';\n\n/**\n * Replicates old config behavior where there's two ways to set keepAlive.\n * This function sets keepAlive in AgentOptions if it is defined. In the future, we will remove\n * this duplicate to only allow setting keepAlive in AgentOptions.\n * @param config\n */\nexport function convertLegacyAgentOptions(\n config: OTLPExporterNodeConfigBase\n): http.AgentOptions | https.AgentOptions {\n // populate keepAlive for use with new settings\n if (config?.keepAlive != null) {\n if (config.httpAgentOptions != null) {\n if (config.httpAgentOptions.keepAlive == null) {\n // specific setting is not set, populate with non-specific setting.\n config.httpAgentOptions.keepAlive = config.keepAlive;\n }\n // do nothing, use specific setting otherwise\n } else {\n // populate specific option if AgentOptions does not exist.\n config.httpAgentOptions = {\n keepAlive: config.keepAlive,\n };\n }\n }\n\n return config.httpAgentOptions ?? { keepAlive: true };\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-exporter-transport.js","sourceRoot":"","sources":["../../../../src/platform/node/http-exporter-transport.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAcH,MAAM,qBAAqB;IAIzB,YAAoB,WAAkC;QAAlC,gBAAW,GAAX,WAAW,CAAuB;QAH9C,UAAK,GAAwB,IAAI,CAAC;QAClC,WAAM,GAAoC,IAAI,CAAC;IAEE,CAAC;IAE1D,KAAK,CAAC,IAAI,CAAC,IAAgB,EAAE,aAAqB;QAChD,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE;YACtB,8FAA8F;YAC9F,MAAM,EACJ,YAAY,EACZ,eAAe;YACf,8DAA8D;cAC/D,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;YACtC,IAAI,CAAC,MAAM,GAAG,eAAe,CAC3B,IAAI,CAAC,WAAW,CAAC,GAAG,EACpB,IAAI,CAAC,WAAW,CAAC,YAAY,CAC9B,CAAC;YACF,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC;SAC3B;QAED,OAAO,IAAI,OAAO,CAAiB,OAAO,CAAC,EAAE;;YAC3C,8BAA8B;YAC9B,oEAAoE;YACpE,MAAA,IAAI,CAAC,KAAK,+CAAV,IAAI,EACF,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,MAAO,EACZ,IAAI,EACJ,MAAM,CAAC,EAAE;gBACP,OAAO,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC,EACD,aAAa,CACd,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IACD,QAAQ;QACN,2CAA2C;IAC7C,CAAC;CACF;AAED,SAAgB,2BAA2B,CACzC,UAAiC;IAEjC,OAAO,IAAI,qBAAqB,CAAC,UAAU,CAAC,CAAC;AAC/C,CAAC;AAJD,kEAIC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n HttpRequestParameters,\n sendWithHttp,\n} from './http-transport-types';\n\n// NOTE: do not change these type imports to actual imports. Doing so WILL break `@opentelemetry/instrumentation-http`,\n// as they'd be imported before the http/https modules can be wrapped.\nimport type * as https from 'https';\nimport type * as http from 'http';\nimport { ExportResponse } from '../../export-response';\nimport { IExporterTransport } from '../../exporter-transport';\n\nclass HttpExporterTransport implements IExporterTransport {\n private _send: sendWithHttp | null = null;\n private _agent: http.Agent | https.Agent | null = null;\n\n constructor(private _parameters: HttpRequestParameters) {}\n\n async send(data: Uint8Array, timeoutMillis: number): Promise<ExportResponse> {\n if (this._send == null) {\n // Lazy require to ensure that http/https is not required before instrumentations can wrap it.\n const {\n sendWithHttp,\n createHttpAgent,\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n } = require('./http-transport-utils');\n this._agent = createHttpAgent(\n this._parameters.url,\n this._parameters.agentOptions\n );\n this._send = sendWithHttp;\n }\n\n return new Promise<ExportResponse>(resolve => {\n // this will always be defined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this._send?.(\n this._parameters,\n this._agent!,\n data,\n result => {\n resolve(result);\n },\n timeoutMillis\n );\n });\n }\n shutdown() {\n // intentionally left empty, nothing to do.\n }\n}\n\nexport function createHttpExporterTransport(\n parameters: HttpRequestParameters\n): IExporterTransport {\n return new HttpExporterTransport(parameters);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-transport-types.js","sourceRoot":"","sources":["../../../../src/platform/node/http-transport-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type * as http from 'http';\nimport type * as https from 'https';\nimport { ExportResponse } from '../../export-response';\n\nexport type sendWithHttp = (\n params: HttpRequestParameters,\n agent: http.Agent | https.Agent,\n data: Uint8Array,\n onDone: (response: ExportResponse) => void,\n timeoutMillis: number\n) => void;\n\nexport interface HttpRequestParameters {\n url: string;\n headers: Record<string, string>;\n compression: 'gzip' | 'none';\n agentOptions: http.AgentOptions | https.AgentOptions;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-transport-utils.js","sourceRoot":"","sources":["../../../../src/platform/node/http-transport-utils.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,6BAA6B;AAC7B,+BAA+B;AAC/B,6BAA6B;AAC7B,mCAAkC;AAGlC,mEAGmC;AACnC,uCAAgD;AAEhD;;;;;;;GAOG;AACH,SAAgB,YAAY,CAC1B,MAA6B,EAC7B,KAA+B,EAC/B,IAAgB,EAChB,MAA0C,EAC1C,aAAqB;IAErB,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,WAAW,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,WAAW,KAAK,MAAM,EAAE;QAC1B,GAAG,CAAC,SAAS,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;QAC1C,UAAU,GAAG,UAAU;aACpB,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;aACpB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;aACvB,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;KACzB;IAED,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC;AAjBD,0CAiBC;AAED,SAAS,sBAAsB,CAAC,IAAyB;IACvD,MAAM,QAAQ,GAAG,IAAI,iBAAQ,EAAE,CAAC;IAChC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEpB,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAgB,eAAe,CAC7B,MAAc,EACd,YAAoD;IAEpD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;IACxE,OAAO,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;AACjC,CAAC;AAPD,0CAOC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport * as http from 'http';\nimport * as https from 'https';\nimport * as zlib from 'zlib';\nimport { Readable } from 'stream';\nimport { HttpRequestParameters } from './http-transport-types';\nimport { ExportResponse } from '../../export-response';\nimport {\n isExportRetryable,\n parseRetryAfterToMills,\n} from '../../is-export-retryable';\nimport { OTLPExporterError } from '../../types';\n\n/**\n * Sends data using http\n * @param params\n * @param agent\n * @param data\n * @param onDone\n * @param timeoutMillis\n */\nexport function sendWithHttp(\n params: HttpRequestParameters,\n agent: http.Agent | https.Agent,\n data: Uint8Array,\n onDone: (response: ExportResponse) => void,\n timeoutMillis: number\n): void {\n const parsedUrl = new URL(params.url);\n const nodeVersion = Number(process.versions.node.split('.')[0]);\n\n const options: http.RequestOptions | https.RequestOptions = {\n hostname: parsedUrl.hostname,\n port: parsedUrl.port,\n path: parsedUrl.pathname,\n method: 'POST',\n headers: {\n ...params.headers,\n },\n agent: agent,\n };\n\n const request = parsedUrl.protocol === 'http:' ? http.request : https.request;\n\n const req = request(options, (res: http.IncomingMessage) => {\n const responseData: Buffer[] = [];\n res.on('data', chunk => responseData.push(chunk));\n\n res.on('end', () => {\n if (res.statusCode && res.statusCode < 299) {\n onDone({\n status: 'success',\n data: Buffer.concat(responseData),\n });\n } else if (res.statusCode && isExportRetryable(res.statusCode)) {\n onDone({\n status: 'retryable',\n retryInMillis: parseRetryAfterToMills(res.headers['retry-after']),\n });\n } else {\n const error = new OTLPExporterError(res.statusMessage, res.statusCode);\n onDone({\n status: 'failure',\n error,\n });\n }\n });\n });\n\n req.setTimeout(timeoutMillis, () => {\n req.destroy();\n onDone({\n status: 'failure',\n error: new Error('Request Timeout'),\n });\n });\n req.on('error', (error: Error | any) => {\n onDone({\n status: 'failure',\n error: error,\n });\n });\n\n const reportTimeoutErrorEvent = nodeVersion >= 14 ? 'close' : 'abort';\n req.on(reportTimeoutErrorEvent, () => {\n onDone({\n status: 'failure',\n error: new Error('Request timed out'),\n });\n });\n\n compressAndSend(req, params.compression, data, (error: Error) => {\n onDone({\n status: 'failure',\n error,\n });\n });\n}\n\nexport function compressAndSend(\n req: http.ClientRequest,\n compression: 'gzip' | 'none',\n data: Uint8Array,\n onError: (error: Error) => void\n) {\n let dataStream = readableFromUint8Array(data);\n\n if (compression === 'gzip') {\n req.setHeader('Content-Encoding', 'gzip');\n dataStream = dataStream\n .on('error', onError)\n .pipe(zlib.createGzip())\n .on('error', onError);\n }\n\n dataStream.pipe(req).on('error', onError);\n}\n\nfunction readableFromUint8Array(buff: string | Uint8Array): Readable {\n const readable = new Readable();\n readable.push(buff);\n readable.push(null);\n\n return readable;\n}\n\nexport function createHttpAgent(\n rawUrl: string,\n agentOptions: http.AgentOptions | https.AgentOptions\n) {\n const parsedUrl = new URL(rawUrl);\n const Agent = parsedUrl.protocol === 'http:' ? http.Agent : https.Agent;\n return new Agent(agentOptions);\n}\n"]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright The OpenTelemetry Authors
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.CompressionAlgorithm = exports.OTLPExporterNodeBase = void 0;
|
|
19
|
-
var OTLPExporterNodeBase_1 = require("./OTLPExporterNodeBase");
|
|
20
|
-
Object.defineProperty(exports, "OTLPExporterNodeBase", { enumerable: true, get: function () { return OTLPExporterNodeBase_1.OTLPExporterNodeBase; } });
|
|
21
|
-
var types_1 = require("./types");
|
|
22
|
-
Object.defineProperty(exports, "CompressionAlgorithm", { enumerable: true, get: function () { return types_1.CompressionAlgorithm; } });
|
|
23
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/platform/node/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAC7B,iCAA2E;AAAtC,6GAAA,oBAAoB,OAAA","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 { OTLPExporterNodeBase } from './OTLPExporterNodeBase';\nexport { OTLPExporterNodeConfigBase, CompressionAlgorithm } from './types';\n"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CompressionAlgorithm = void 0;
|
|
4
|
-
var CompressionAlgorithm;
|
|
5
|
-
(function (CompressionAlgorithm) {
|
|
6
|
-
CompressionAlgorithm["NONE"] = "none";
|
|
7
|
-
CompressionAlgorithm["GZIP"] = "gzip";
|
|
8
|
-
})(CompressionAlgorithm = exports.CompressionAlgorithm || (exports.CompressionAlgorithm = {}));
|
|
9
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/platform/node/types.ts"],"names":[],"mappings":";;;AA6BA,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,qCAAa,CAAA;IACb,qCAAa,CAAA;AACf,CAAC,EAHW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,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 */\nimport type * as http from 'http';\nimport type * as https from 'https';\n\nimport { OTLPExporterConfigBase } from '../../types';\n\n/**\n * Collector Exporter node base config\n */\nexport interface OTLPExporterNodeConfigBase extends OTLPExporterConfigBase {\n keepAlive?: boolean;\n compression?: CompressionAlgorithm;\n httpAgentOptions?: http.AgentOptions | https.AgentOptions;\n}\n\nexport enum CompressionAlgorithm {\n NONE = 'none',\n GZIP = 'gzip',\n}\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|