@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
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { getHttpConfigurationDefaults, mergeOtlpHttpConfigurationWithDefaults, } from './otlp-http-configuration';
|
|
2
|
+
import { getHttpConfigurationFromEnvironment } from './otlp-http-env-configuration';
|
|
3
|
+
import { diag } from '@opentelemetry/api';
|
|
4
|
+
import { wrapStaticHeadersInFunction } from './shared-configuration';
|
|
5
|
+
function convertLegacyAgentOptions(config) {
|
|
6
|
+
// populate keepAlive for use with new settings
|
|
7
|
+
if ((config === null || config === void 0 ? void 0 : config.keepAlive) != null) {
|
|
8
|
+
if (config.httpAgentOptions != null) {
|
|
9
|
+
if (config.httpAgentOptions.keepAlive == null) {
|
|
10
|
+
// specific setting is not set, populate with non-specific setting.
|
|
11
|
+
config.httpAgentOptions.keepAlive = config.keepAlive;
|
|
12
|
+
}
|
|
13
|
+
// do nothing, use specific setting otherwise
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
// populate specific option if AgentOptions does not exist.
|
|
17
|
+
config.httpAgentOptions = {
|
|
18
|
+
keepAlive: config.keepAlive,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return config.httpAgentOptions;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated this will be removed in 2.0
|
|
26
|
+
* @param config
|
|
27
|
+
* @param signalIdentifier
|
|
28
|
+
* @param signalResourcePath
|
|
29
|
+
* @param requiredHeaders
|
|
30
|
+
*/
|
|
31
|
+
export function convertLegacyHttpOptions(config, signalIdentifier, signalResourcePath, requiredHeaders) {
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
+
if (config.metadata) {
|
|
34
|
+
diag.warn('Metadata cannot be set when using http');
|
|
35
|
+
}
|
|
36
|
+
return mergeOtlpHttpConfigurationWithDefaults({
|
|
37
|
+
url: config.url,
|
|
38
|
+
headers: wrapStaticHeadersInFunction(config.headers),
|
|
39
|
+
concurrencyLimit: config.concurrencyLimit,
|
|
40
|
+
timeoutMillis: config.timeoutMillis,
|
|
41
|
+
compression: config.compression,
|
|
42
|
+
agentOptions: convertLegacyAgentOptions(config),
|
|
43
|
+
}, getHttpConfigurationFromEnvironment(signalIdentifier, signalResourcePath), getHttpConfigurationDefaults(requiredHeaders, signalResourcePath));
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=convert-legacy-node-http-options.js.map
|
|
@@ -0,0 +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,EACL,4BAA4B,EAC5B,sCAAsC,GAEvC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,mCAAmC,EAAE,MAAM,+BAA+B,CAAC;AAGpF,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAErE,SAAS,yBAAyB,CAChC,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,MAAM,CAAC,gBAAgB,CAAC;AACjC,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,sCAAsC,CAC3C;QACE,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,OAAO,EAAE,2BAA2B,CAAC,MAAM,CAAC,OAAO,CAAC;QACpD,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;KAChD,EACD,mCAAmC,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,EACzE,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 { OTLPExporterNodeConfigBase } from './legacy-node-configuration';\nimport {\n getHttpConfigurationDefaults,\n mergeOtlpHttpConfigurationWithDefaults,\n OtlpHttpConfiguration,\n} from './otlp-http-configuration';\nimport { getHttpConfigurationFromEnvironment } from './otlp-http-env-configuration';\nimport type * as http from 'http';\nimport type * as https from 'https';\nimport { diag } from '@opentelemetry/api';\nimport { wrapStaticHeadersInFunction } from './shared-configuration';\n\nfunction convertLegacyAgentOptions(\n config: OTLPExporterNodeConfigBase\n): http.AgentOptions | https.AgentOptions | undefined {\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;\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): OtlpHttpConfiguration {\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 mergeOtlpHttpConfigurationWithDefaults(\n {\n url: config.url,\n headers: wrapStaticHeadersInFunction(config.headers),\n concurrencyLimit: config.concurrencyLimit,\n timeoutMillis: config.timeoutMillis,\n compression: config.compression,\n agentOptions: convertLegacyAgentOptions(config),\n },\n getHttpConfigurationFromEnvironment(signalIdentifier, signalResourcePath),\n getHttpConfigurationDefaults(requiredHeaders, signalResourcePath)\n );\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ISerializer } from '@opentelemetry/otlp-transformer';
|
|
2
|
+
import { IOtlpExportDelegate } from '../otlp-export-delegate';
|
|
3
|
+
import { OTLPExporterConfigBase } from './legacy-base-configuration';
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated
|
|
6
|
+
* @param config
|
|
7
|
+
* @param serializer
|
|
8
|
+
* @param signalResourcePath
|
|
9
|
+
* @param requiredHeaders
|
|
10
|
+
*/
|
|
11
|
+
export declare function createLegacyOtlpBrowserExportDelegate<Internal, Response>(config: OTLPExporterConfigBase, serializer: ISerializer<Internal, Response>, signalResourcePath: string, requiredHeaders: Record<string, string>): IOtlpExportDelegate<Internal>;
|
|
12
|
+
//# sourceMappingURL=create-legacy-browser-delegate.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createOtlpSendBeaconExportDelegate, createOtlpXhrExportDelegate, } from '../otlp-browser-http-export-delegate';
|
|
2
|
+
import { convertLegacyBrowserHttpOptions } from './convert-legacy-browser-http-options';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated
|
|
5
|
+
* @param config
|
|
6
|
+
* @param serializer
|
|
7
|
+
* @param signalResourcePath
|
|
8
|
+
* @param requiredHeaders
|
|
9
|
+
*/
|
|
10
|
+
export function createLegacyOtlpBrowserExportDelegate(config, serializer, signalResourcePath, requiredHeaders) {
|
|
11
|
+
const useXhr = !!config.headers || typeof navigator.sendBeacon !== 'function';
|
|
12
|
+
const options = convertLegacyBrowserHttpOptions(config, signalResourcePath, requiredHeaders);
|
|
13
|
+
if (useXhr) {
|
|
14
|
+
return createOtlpXhrExportDelegate(options, serializer);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return createOtlpSendBeaconExportDelegate(options, serializer);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=create-legacy-browser-delegate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-legacy-browser-delegate.js","sourceRoot":"","sources":["../../../src/configuration/create-legacy-browser-delegate.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,kCAAkC,EAClC,2BAA2B,GAC5B,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,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,IAAI,OAAO,SAAS,CAAC,UAAU,KAAK,UAAU,CAAC;IAE9E,MAAM,OAAO,GAAG,+BAA+B,CAC7C,MAAM,EACN,kBAAkB,EAClB,eAAe,CAChB,CAAC;IAEF,IAAI,MAAM,EAAE;QACV,OAAO,2BAA2B,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;KACzD;SAAM;QACL,OAAO,kCAAkC,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;KAChE;AACH,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 createOtlpSendBeaconExportDelegate,\n createOtlpXhrExportDelegate,\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 useXhr = !!config.headers || typeof navigator.sendBeacon !== 'function';\n\n const options = convertLegacyBrowserHttpOptions(\n config,\n signalResourcePath,\n requiredHeaders\n );\n\n if (useXhr) {\n return createOtlpXhrExportDelegate(options, serializer);\n } else {\n return createOtlpSendBeaconExportDelegate(options, serializer);\n }\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface OTLPExporterConfigBase {
|
|
2
|
+
headers?: Record<string, string>;
|
|
3
|
+
url?: string;
|
|
4
|
+
concurrencyLimit?: number;
|
|
5
|
+
/** Maximum time the OTLP exporter will wait for each batch export.
|
|
6
|
+
* The default value is 10000ms. */
|
|
7
|
+
timeoutMillis?: number;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=legacy-base-configuration.d.ts.map
|
|
@@ -0,0 +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 */\nexport interface OTLPExporterConfigBase {\n headers?: Record<string, string>;\n url?: string;\n concurrencyLimit?: number;\n /** Maximum time the OTLP exporter will wait for each batch export.\n * The default value is 10000ms. */\n timeoutMillis?: number;\n}\n"]}
|
package/build/{src/platform/node/types.d.ts → esnext/configuration/legacy-node-configuration.d.ts}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type * as http from 'http';
|
|
3
3
|
import type * as https from 'https';
|
|
4
|
-
import { OTLPExporterConfigBase } from '
|
|
4
|
+
import { OTLPExporterConfigBase } from './legacy-base-configuration';
|
|
5
5
|
/**
|
|
6
6
|
* Collector Exporter node base config
|
|
7
7
|
*/
|
|
@@ -14,4 +14,4 @@ export declare enum CompressionAlgorithm {
|
|
|
14
14
|
NONE = "none",
|
|
15
15
|
GZIP = "gzip"
|
|
16
16
|
}
|
|
17
|
-
//# sourceMappingURL=
|
|
17
|
+
//# sourceMappingURL=legacy-node-configuration.d.ts.map
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
export var CompressionAlgorithm;
|
|
17
|
+
(function (CompressionAlgorithm) {
|
|
18
|
+
CompressionAlgorithm["NONE"] = "none";
|
|
19
|
+
CompressionAlgorithm["GZIP"] = "gzip";
|
|
20
|
+
})(CompressionAlgorithm || (CompressionAlgorithm = {}));
|
|
21
|
+
//# sourceMappingURL=legacy-node-configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-node-configuration.js","sourceRoot":"","sources":["../../../src/configuration/legacy-node-configuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAiBH,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 { OTLPExporterConfigBase } from './legacy-base-configuration';\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,7 +1,11 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { OtlpSharedConfiguration } from './shared-configuration';
|
|
3
|
+
import type * as http from 'http';
|
|
4
|
+
import type * as https from 'https';
|
|
2
5
|
export interface OtlpHttpConfiguration extends OtlpSharedConfiguration {
|
|
3
6
|
url: string;
|
|
4
|
-
headers: Record<string, string>;
|
|
7
|
+
headers: () => Record<string, string>;
|
|
8
|
+
agentOptions: http.AgentOptions | https.AgentOptions;
|
|
5
9
|
}
|
|
6
10
|
/**
|
|
7
11
|
* @param userProvidedConfiguration Configuration options provided by the user in code.
|
|
@@ -16,18 +16,20 @@
|
|
|
16
16
|
import { getSharedConfigurationDefaults, mergeOtlpSharedConfigurationWithDefaults, } from './shared-configuration';
|
|
17
17
|
import { validateAndNormalizeHeaders } from '../util';
|
|
18
18
|
function mergeHeaders(userProvidedHeaders, fallbackHeaders, defaultHeaders) {
|
|
19
|
-
const requiredHeaders = Object.assign({}, defaultHeaders);
|
|
19
|
+
const requiredHeaders = Object.assign({}, defaultHeaders());
|
|
20
20
|
const headers = {};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
return () => {
|
|
22
|
+
// add fallback ones first
|
|
23
|
+
if (fallbackHeaders != null) {
|
|
24
|
+
Object.assign(headers, fallbackHeaders());
|
|
25
|
+
}
|
|
26
|
+
// override with user-provided ones
|
|
27
|
+
if (userProvidedHeaders != null) {
|
|
28
|
+
Object.assign(headers, userProvidedHeaders());
|
|
29
|
+
}
|
|
30
|
+
// override required ones.
|
|
31
|
+
return Object.assign(headers, requiredHeaders);
|
|
32
|
+
};
|
|
31
33
|
}
|
|
32
34
|
function validateUserProvidedUrl(url) {
|
|
33
35
|
if (url == null) {
|
|
@@ -47,10 +49,10 @@ function validateUserProvidedUrl(url) {
|
|
|
47
49
|
* @param defaultConfiguration The defaults as defined by the exporter specification
|
|
48
50
|
*/
|
|
49
51
|
export function mergeOtlpHttpConfigurationWithDefaults(userProvidedConfiguration, fallbackConfiguration, defaultConfiguration) {
|
|
50
|
-
var _a, _b;
|
|
51
|
-
return Object.assign(Object.assign({}, mergeOtlpSharedConfigurationWithDefaults(userProvidedConfiguration, fallbackConfiguration, defaultConfiguration)), { headers: mergeHeaders(validateAndNormalizeHeaders(userProvidedConfiguration.headers), fallbackConfiguration.headers, defaultConfiguration.headers), url: (_b = (_a = validateUserProvidedUrl(userProvidedConfiguration.url)) !== null && _a !== void 0 ? _a : fallbackConfiguration.url) !== null && _b !== void 0 ? _b : defaultConfiguration.url });
|
|
52
|
+
var _a, _b, _c, _d;
|
|
53
|
+
return Object.assign(Object.assign({}, mergeOtlpSharedConfigurationWithDefaults(userProvidedConfiguration, fallbackConfiguration, defaultConfiguration)), { headers: mergeHeaders(validateAndNormalizeHeaders(userProvidedConfiguration.headers), fallbackConfiguration.headers, defaultConfiguration.headers), url: (_b = (_a = validateUserProvidedUrl(userProvidedConfiguration.url)) !== null && _a !== void 0 ? _a : fallbackConfiguration.url) !== null && _b !== void 0 ? _b : defaultConfiguration.url, agentOptions: (_d = (_c = userProvidedConfiguration.agentOptions) !== null && _c !== void 0 ? _c : fallbackConfiguration.agentOptions) !== null && _d !== void 0 ? _d : defaultConfiguration.agentOptions });
|
|
52
54
|
}
|
|
53
55
|
export function getHttpConfigurationDefaults(requiredHeaders, signalResourcePath) {
|
|
54
|
-
return Object.assign(Object.assign({}, getSharedConfigurationDefaults()), { headers: requiredHeaders, url: 'http://localhost:4318/' + signalResourcePath });
|
|
56
|
+
return Object.assign(Object.assign({}, getSharedConfigurationDefaults()), { headers: () => requiredHeaders, url: 'http://localhost:4318/' + signalResourcePath, agentOptions: { keepAlive: true } });
|
|
55
57
|
}
|
|
56
58
|
//# sourceMappingURL=otlp-http-configuration.js.map
|
|
@@ -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;
|
|
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;AAYtD,SAAS,YAAY,CACnB,mBAAsE,EACtE,eAAkE,EAClE,cAA4C;IAE5C,MAAM,eAAe,qBAChB,cAAc,EAAE,CACpB,CAAC;IACF,MAAM,OAAO,GAAG,EAAE,CAAC;IAEnB,OAAO,GAAG,EAAE;QACV,0BAA0B;QAC1B,IAAI,eAAe,IAAI,IAAI,EAAE;YAC3B,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;SAC3C;QAED,mCAAmC;QACnC,IAAI,mBAAmB,IAAI,IAAI,EAAE;YAC/B,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,mBAAmB,EAAE,CAAC,CAAC;SAC/C;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,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QACb,OAAO,GAAG,CAAC;KACZ;IAAC,OAAO,CAAC,EAAE;QACV,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,uCACK,wCAAwC,CACzC,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,CACrB,KACD,OAAO,EAAE,YAAY,CACnB,2BAA2B,CAAC,yBAAyB,CAAC,OAAO,CAAC,EAC9D,qBAAqB,CAAC,OAAO,EAC7B,oBAAoB,CAAC,OAAO,CAC7B,EACD,GAAG,EACD,MAAA,MAAA,uBAAuB,CAAC,yBAAyB,CAAC,GAAG,CAAC,mCACtD,qBAAqB,CAAC,GAAG,mCACzB,oBAAoB,CAAC,GAAG,EAC1B,YAAY,EACV,MAAA,MAAA,yBAAyB,CAAC,YAAY,mCACtC,qBAAqB,CAAC,YAAY,mCAClC,oBAAoB,CAAC,YAAY,IACnC;AACJ,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,eAAuC,EACvC,kBAA0B;IAE1B,uCACK,8BAA8B,EAAE,KACnC,OAAO,EAAE,GAAG,EAAE,CAAC,eAAe,EAC9B,GAAG,EAAE,wBAAwB,GAAG,kBAAkB,EAClD,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IACjC;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 {\n getSharedConfigurationDefaults,\n mergeOtlpSharedConfigurationWithDefaults,\n OtlpSharedConfiguration,\n} from './shared-configuration';\nimport { validateAndNormalizeHeaders } from '../util';\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 interface OtlpHttpConfiguration extends OtlpSharedConfiguration {\n url: string;\n headers: () => Record<string, string>;\n agentOptions: http.AgentOptions | https.AgentOptions;\n}\n\nfunction mergeHeaders(\n userProvidedHeaders: (() => Record<string, string>) | undefined | null,\n fallbackHeaders: (() => Record<string, string>) | undefined | null,\n defaultHeaders: () => Record<string, string>\n): () => Record<string, string> {\n const requiredHeaders = {\n ...defaultHeaders(),\n };\n const headers = {};\n\n return () => {\n // add fallback ones first\n if (fallbackHeaders != null) {\n Object.assign(headers, fallbackHeaders());\n }\n\n // override with user-provided ones\n if (userProvidedHeaders != null) {\n Object.assign(headers, userProvidedHeaders());\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 new URL(url);\n return url;\n } catch (e) {\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 validateAndNormalizeHeaders(userProvidedConfiguration.headers),\n fallbackConfiguration.headers,\n defaultConfiguration.headers\n ),\n url:\n validateUserProvidedUrl(userProvidedConfiguration.url) ??\n fallbackConfiguration.url ??\n defaultConfiguration.url,\n agentOptions:\n userProvidedConfiguration.agentOptions ??\n fallbackConfiguration.agentOptions ??\n defaultConfiguration.agentOptions,\n };\n}\n\nexport function getHttpConfigurationDefaults(\n requiredHeaders: Record<string, string>,\n signalResourcePath: string\n): OtlpHttpConfiguration {\n return {\n ...getSharedConfigurationDefaults(),\n headers: () => requiredHeaders,\n url: 'http://localhost:4318/' + signalResourcePath,\n agentOptions: { keepAlive: true },\n };\n}\n"]}
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
import { baggageUtils } from '@opentelemetry/core';
|
|
17
17
|
import { diag } from '@opentelemetry/api';
|
|
18
18
|
import { getSharedConfigurationFromEnvironment } from './shared-env-configuration';
|
|
19
|
-
|
|
19
|
+
import { wrapStaticHeadersInFunction } from './shared-configuration';
|
|
20
|
+
function getStaticHeadersFromEnv(signalIdentifier) {
|
|
20
21
|
var _a, _b;
|
|
21
22
|
const signalSpecificRawHeaders = (_a = process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_HEADERS`]) === null || _a === void 0 ? void 0 : _a.trim();
|
|
22
23
|
const nonSignalSpecificRawHeaders = (_b = process.env['OTEL_EXPORTER_OTLP_HEADERS']) === null || _b === void 0 ? void 0 : _b.trim();
|
|
@@ -88,6 +89,6 @@ function getSpecificUrlFromEnv(signalIdentifier) {
|
|
|
88
89
|
*/
|
|
89
90
|
export function getHttpConfigurationFromEnvironment(signalIdentifier, signalResourcePath) {
|
|
90
91
|
var _a;
|
|
91
|
-
return Object.assign(Object.assign({}, getSharedConfigurationFromEnvironment(signalIdentifier)), { url: (_a = getSpecificUrlFromEnv(signalIdentifier)) !== null && _a !== void 0 ? _a : getNonSpecificUrlFromEnv(signalResourcePath), headers:
|
|
92
|
+
return Object.assign(Object.assign({}, getSharedConfigurationFromEnvironment(signalIdentifier)), { url: (_a = getSpecificUrlFromEnv(signalIdentifier)) !== null && _a !== void 0 ? _a : getNonSpecificUrlFromEnv(signalResourcePath), headers: wrapStaticHeadersInFunction(getStaticHeadersFromEnv(signalIdentifier)) });
|
|
92
93
|
}
|
|
93
94
|
//# sourceMappingURL=otlp-http-env-configuration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otlp-http-env-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-http-env-configuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,qCAAqC,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"otlp-http-env-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-http-env-configuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,qCAAqC,EAAE,MAAM,4BAA4B,CAAC;AAEnF,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAErE,SAAS,uBAAuB,CAC9B,gBAAwB;;IAExB,MAAM,wBAAwB,GAC5B,MAAA,OAAO,CAAC,GAAG,CAAC,sBAAsB,gBAAgB,UAAU,CAAC,0CAAE,IAAI,EAAE,CAAC;IACxE,MAAM,2BAA2B,GAC/B,MAAA,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,0CAAE,IAAI,EAAE,CAAC;IAEpD,MAAM,qBAAqB,GAAG,YAAY,CAAC,uBAAuB,CAChE,wBAAwB,CACzB,CAAC;IACF,MAAM,wBAAwB,GAAG,YAAY,CAAC,uBAAuB,CACnE,2BAA2B,CAC5B,CAAC;IAEF,IACE,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,MAAM,KAAK,CAAC;QAC/C,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,MAAM,KAAK,CAAC,EAClD;QACA,OAAO,SAAS,CAAC;KAClB;IAED,gGAAgG;IAChG,yBAAyB;IACzB,OAAO,MAAM,CAAC,MAAM,CAClB,EAAE,EACF,YAAY,CAAC,uBAAuB,CAAC,2BAA2B,CAAC,EACjE,YAAY,CAAC,uBAAuB,CAAC,wBAAwB,CAAC,CAC/D,CAAC;AACJ,CAAC;AAED,SAAS,2BAA2B,CAAC,GAAW;IAC9C,IAAI;QACF,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,8DAA8D;QAC9D,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC;KAC7B;IAAC,WAAM;QACN,IAAI,CAAC,IAAI,CACP,oEAAoE,GAAG,8BAA8B,CACtG,CAAC;QACF,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAED,SAAS,uBAAuB,CAC9B,GAAW,EACX,IAAY;IAEZ,IAAI;QACF,oDAAoD;QACpD,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;KACd;IAAC,WAAM;QACN,IAAI,CAAC,IAAI,CACP,oEAAoE,GAAG,8BAA8B,CACtG,CAAC;QACF,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACtB,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;KACjB;IACD,GAAG,IAAI,IAAI,CAAC;IAEZ,IAAI;QACF,oDAAoD;QACpD,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;KACd;IAAC,WAAM;QACN,IAAI,CAAC,IAAI,CACP,8CAA8C,IAAI,uDAAuD,GAAG,GAAG,CAChH,CAAC;QACF,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,wBAAwB,CAC/B,kBAA0B;;IAE1B,MAAM,MAAM,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,2BAA2B,0CAAE,IAAI,EAAE,CAAC;IAC/D,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,KAAK,EAAE,EAAE;QACnC,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,uBAAuB,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,qBAAqB,CAAC,gBAAwB;;IACrD,MAAM,MAAM,GACV,MAAA,OAAO,CAAC,GAAG,CAAC,sBAAsB,gBAAgB,WAAW,CAAC,0CAAE,IAAI,EAAE,CAAC;IACzE,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,KAAK,EAAE,EAAE;QACnC,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,2BAA2B,CAAC,MAAM,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mCAAmC,CACjD,gBAAwB,EACxB,kBAA0B;;IAE1B,uCACK,qCAAqC,CAAC,gBAAgB,CAAC,KAC1D,GAAG,EACD,MAAA,qBAAqB,CAAC,gBAAgB,CAAC,mCACvC,wBAAwB,CAAC,kBAAkB,CAAC,EAC9C,OAAO,EAAE,2BAA2B,CAClC,uBAAuB,CAAC,gBAAgB,CAAC,CAC1C,IACD;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { baggageUtils } from '@opentelemetry/core';\nimport { diag } from '@opentelemetry/api';\nimport { getSharedConfigurationFromEnvironment } from './shared-env-configuration';\nimport { OtlpHttpConfiguration } from './otlp-http-configuration';\nimport { wrapStaticHeadersInFunction } from './shared-configuration';\n\nfunction getStaticHeadersFromEnv(\n signalIdentifier: string\n): Record<string, string> | undefined {\n const signalSpecificRawHeaders =\n process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_HEADERS`]?.trim();\n const nonSignalSpecificRawHeaders =\n process.env['OTEL_EXPORTER_OTLP_HEADERS']?.trim();\n\n const signalSpecificHeaders = baggageUtils.parseKeyPairsIntoRecord(\n signalSpecificRawHeaders\n );\n const nonSignalSpecificHeaders = baggageUtils.parseKeyPairsIntoRecord(\n nonSignalSpecificRawHeaders\n );\n\n if (\n Object.keys(signalSpecificHeaders).length === 0 &&\n Object.keys(nonSignalSpecificHeaders).length === 0\n ) {\n return undefined;\n }\n\n // headers are combined instead of overwritten, with the specific headers taking precedence over\n // the non-specific ones.\n return Object.assign(\n {},\n baggageUtils.parseKeyPairsIntoRecord(nonSignalSpecificRawHeaders),\n baggageUtils.parseKeyPairsIntoRecord(signalSpecificRawHeaders)\n );\n}\n\nfunction appendRootPathToUrlIfNeeded(url: string): string | undefined {\n try {\n const parsedUrl = new URL(url);\n // This will automatically append '/' if there's no root path.\n return parsedUrl.toString();\n } catch {\n diag.warn(\n `Configuration: Could not parse environment-provided export URL: '${url}', falling back to undefined`\n );\n return undefined;\n }\n}\n\nfunction appendResourcePathToUrl(\n url: string,\n path: string\n): string | undefined {\n try {\n // just try to parse, if it fails we catch and warn.\n new URL(url);\n } catch {\n diag.warn(\n `Configuration: Could not parse environment-provided export URL: '${url}', falling back to undefined`\n );\n return undefined;\n }\n\n if (!url.endsWith('/')) {\n url = url + '/';\n }\n url += path;\n\n try {\n // just try to parse, if it fails we catch and warn.\n new URL(url);\n } catch {\n diag.warn(\n `Configuration: Provided URL appended with '${path}' is not a valid URL, using 'undefined' instead of '${url}'`\n );\n return undefined;\n }\n\n return url;\n}\n\nfunction getNonSpecificUrlFromEnv(\n signalResourcePath: string\n): string | undefined {\n const envUrl = process.env.OTEL_EXPORTER_OTLP_ENDPOINT?.trim();\n if (envUrl == null || envUrl === '') {\n return undefined;\n }\n return appendResourcePathToUrl(envUrl, signalResourcePath);\n}\n\nfunction getSpecificUrlFromEnv(signalIdentifier: string): string | undefined {\n const envUrl =\n process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_ENDPOINT`]?.trim();\n if (envUrl == null || envUrl === '') {\n return undefined;\n }\n return appendRootPathToUrlIfNeeded(envUrl);\n}\n\n/**\n * Reads and returns configuration from the environment\n *\n * @param signalIdentifier all caps part in environment variables that identifies the signal (e.g.: METRICS, TRACES, LOGS)\n * @param signalResourcePath signal resource path to append if necessary (e.g.: v1/metrics, v1/traces, v1/logs)\n */\nexport function getHttpConfigurationFromEnvironment(\n signalIdentifier: string,\n signalResourcePath: string\n): Partial<OtlpHttpConfiguration> {\n return {\n ...getSharedConfigurationFromEnvironment(signalIdentifier),\n url:\n getSpecificUrlFromEnv(signalIdentifier) ??\n getNonSpecificUrlFromEnv(signalResourcePath),\n headers: wrapStaticHeadersInFunction(\n getStaticHeadersFromEnv(signalIdentifier)\n ),\n };\n}\n"]}
|
|
@@ -12,6 +12,7 @@ export interface OtlpSharedConfiguration {
|
|
|
12
12
|
compression: 'gzip' | 'none';
|
|
13
13
|
}
|
|
14
14
|
export declare function validateTimeoutMillis(timeoutMillis: number): number;
|
|
15
|
+
export declare function wrapStaticHeadersInFunction(headers: Record<string, string> | undefined): (() => Record<string, string>) | undefined;
|
|
15
16
|
/**
|
|
16
17
|
* @param userProvidedConfiguration Configuration options provided by the user in code.
|
|
17
18
|
* @param fallbackConfiguration Fallback to use when the {@link userProvidedConfiguration} does not specify an option.
|
|
@@ -21,6 +21,12 @@ export function validateTimeoutMillis(timeoutMillis) {
|
|
|
21
21
|
}
|
|
22
22
|
throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${timeoutMillis}')`);
|
|
23
23
|
}
|
|
24
|
+
export function wrapStaticHeadersInFunction(headers) {
|
|
25
|
+
if (headers == null) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
return () => headers;
|
|
29
|
+
}
|
|
24
30
|
/**
|
|
25
31
|
* @param userProvidedConfiguration Configuration options provided by the user in code.
|
|
26
32
|
* @param fallbackConfiguration Fallback to use when the {@link userProvidedConfiguration} does not specify an option.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-configuration.js","sourceRoot":"","sources":["../../../src/configuration/shared-configuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAgBH,MAAM,UAAU,qBAAqB,CAAC,aAAqB;IACzD,IACE,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC;QAC5B,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC;QAC9B,aAAa,GAAG,CAAC,EACjB;QACA,OAAO,aAAa,CAAC;KACtB;IACD,MAAM,IAAI,KAAK,CACb,qFAAqF,aAAa,IAAI,CACvG,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wCAAwC,CACtD,yBAA2D,EAC3D,qBAAuD,EACvD,oBAA6C;;IAE7C,OAAO;QACL,aAAa,EAAE,qBAAqB,CAClC,MAAA,MAAA,yBAAyB,CAAC,aAAa,mCACrC,qBAAqB,CAAC,aAAa,mCACnC,oBAAoB,CAAC,aAAa,CACrC;QACD,gBAAgB,EACd,MAAA,MAAA,yBAAyB,CAAC,gBAAgB,mCAC1C,qBAAqB,CAAC,gBAAgB,mCACtC,oBAAoB,CAAC,gBAAgB;QACvC,WAAW,EACT,MAAA,MAAA,yBAAyB,CAAC,WAAW,mCACrC,qBAAqB,CAAC,WAAW,mCACjC,oBAAoB,CAAC,WAAW;KACnC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,8BAA8B;IAC5C,OAAO;QACL,aAAa,EAAE,KAAK;QACpB,gBAAgB,EAAE,EAAE;QACpB,WAAW,EAAE,MAAM;KACpB,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Configuration shared across all OTLP exporters\n *\n * Implementation note: anything added here MUST be\n * - platform-agnostic\n * - signal-agnostic\n * - transport-agnostic\n */\nexport interface OtlpSharedConfiguration {\n timeoutMillis: number;\n concurrencyLimit: number;\n compression: 'gzip' | 'none';\n}\n\nexport function validateTimeoutMillis(timeoutMillis: number) {\n if (\n !Number.isNaN(timeoutMillis) &&\n Number.isFinite(timeoutMillis) &&\n timeoutMillis > 0\n ) {\n return timeoutMillis;\n }\n throw new Error(\n `Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${timeoutMillis}')`\n );\n}\n\n/**\n * @param userProvidedConfiguration Configuration options provided by the user in code.\n * @param fallbackConfiguration Fallback to use when the {@link userProvidedConfiguration} does not specify an option.\n * @param defaultConfiguration The defaults as defined by the exporter specification\n */\nexport function mergeOtlpSharedConfigurationWithDefaults(\n userProvidedConfiguration: Partial<OtlpSharedConfiguration>,\n fallbackConfiguration: Partial<OtlpSharedConfiguration>,\n defaultConfiguration: OtlpSharedConfiguration\n): OtlpSharedConfiguration {\n return {\n timeoutMillis: validateTimeoutMillis(\n userProvidedConfiguration.timeoutMillis ??\n fallbackConfiguration.timeoutMillis ??\n defaultConfiguration.timeoutMillis\n ),\n concurrencyLimit:\n userProvidedConfiguration.concurrencyLimit ??\n fallbackConfiguration.concurrencyLimit ??\n defaultConfiguration.concurrencyLimit,\n compression:\n userProvidedConfiguration.compression ??\n fallbackConfiguration.compression ??\n defaultConfiguration.compression,\n };\n}\n\nexport function getSharedConfigurationDefaults(): OtlpSharedConfiguration {\n return {\n timeoutMillis: 10000,\n concurrencyLimit: 30,\n compression: 'none',\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"shared-configuration.js","sourceRoot":"","sources":["../../../src/configuration/shared-configuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAgBH,MAAM,UAAU,qBAAqB,CAAC,aAAqB;IACzD,IACE,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC;QAC5B,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC;QAC9B,aAAa,GAAG,CAAC,EACjB;QACA,OAAO,aAAa,CAAC;KACtB;IACD,MAAM,IAAI,KAAK,CACb,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,GAAG,EAAE,CAAC,OAAO,CAAC;AACvB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wCAAwC,CACtD,yBAA2D,EAC3D,qBAAuD,EACvD,oBAA6C;;IAE7C,OAAO;QACL,aAAa,EAAE,qBAAqB,CAClC,MAAA,MAAA,yBAAyB,CAAC,aAAa,mCACrC,qBAAqB,CAAC,aAAa,mCACnC,oBAAoB,CAAC,aAAa,CACrC;QACD,gBAAgB,EACd,MAAA,MAAA,yBAAyB,CAAC,gBAAgB,mCAC1C,qBAAqB,CAAC,gBAAgB,mCACtC,oBAAoB,CAAC,gBAAgB;QACvC,WAAW,EACT,MAAA,MAAA,yBAAyB,CAAC,WAAW,mCACrC,qBAAqB,CAAC,WAAW,mCACjC,oBAAoB,CAAC,WAAW;KACnC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,8BAA8B;IAC5C,OAAO;QACL,aAAa,EAAE,KAAK;QACpB,gBAAgB,EAAE,EAAE;QACpB,WAAW,EAAE,MAAM;KACpB,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Configuration shared across all OTLP exporters\n *\n * Implementation note: anything added here MUST be\n * - platform-agnostic\n * - signal-agnostic\n * - transport-agnostic\n */\nexport interface OtlpSharedConfiguration {\n timeoutMillis: number;\n concurrencyLimit: number;\n compression: 'gzip' | 'none';\n}\n\nexport function validateTimeoutMillis(timeoutMillis: number) {\n if (\n !Number.isNaN(timeoutMillis) &&\n Number.isFinite(timeoutMillis) &&\n timeoutMillis > 0\n ) {\n return timeoutMillis;\n }\n throw new Error(\n `Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${timeoutMillis}')`\n );\n}\n\nexport function wrapStaticHeadersInFunction(\n headers: Record<string, string> | undefined\n): (() => Record<string, string>) | undefined {\n if (headers == null) {\n return undefined;\n }\n\n return () => headers;\n}\n\n/**\n * @param userProvidedConfiguration Configuration options provided by the user in code.\n * @param fallbackConfiguration Fallback to use when the {@link userProvidedConfiguration} does not specify an option.\n * @param defaultConfiguration The defaults as defined by the exporter specification\n */\nexport function mergeOtlpSharedConfigurationWithDefaults(\n userProvidedConfiguration: Partial<OtlpSharedConfiguration>,\n fallbackConfiguration: Partial<OtlpSharedConfiguration>,\n defaultConfiguration: OtlpSharedConfiguration\n): OtlpSharedConfiguration {\n return {\n timeoutMillis: validateTimeoutMillis(\n userProvidedConfiguration.timeoutMillis ??\n fallbackConfiguration.timeoutMillis ??\n defaultConfiguration.timeoutMillis\n ),\n concurrencyLimit:\n userProvidedConfiguration.concurrencyLimit ??\n fallbackConfiguration.concurrencyLimit ??\n defaultConfiguration.concurrencyLimit,\n compression:\n userProvidedConfiguration.compression ??\n fallbackConfiguration.compression ??\n defaultConfiguration.compression,\n };\n}\n\nexport function getSharedConfigurationDefaults(): OtlpSharedConfiguration {\n return {\n timeoutMillis: 10000,\n concurrencyLimit: 30,\n compression: 'none',\n };\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createOtlpXhrExportDelegate, createOtlpSendBeaconExportDelegate, } from './otlp-browser-http-export-delegate';
|
|
2
|
+
export { convertLegacyBrowserHttpOptions } from './configuration/convert-legacy-browser-http-options';
|
|
3
|
+
export { createLegacyOtlpBrowserExportDelegate } from './configuration/create-legacy-browser-delegate';
|
|
4
|
+
//# sourceMappingURL=index-browser-http.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { createOtlpXhrExportDelegate, createOtlpSendBeaconExportDelegate, } from './otlp-browser-http-export-delegate';
|
|
17
|
+
export { convertLegacyBrowserHttpOptions } from './configuration/convert-legacy-browser-http-options';
|
|
18
|
+
export { createLegacyOtlpBrowserExportDelegate } from './configuration/create-legacy-browser-delegate';
|
|
19
|
+
//# sourceMappingURL=index-browser-http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-browser-http.js","sourceRoot":"","sources":["../../src/index-browser-http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,2BAA2B,EAC3B,kCAAkC,GACnC,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAC;AACtG,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport {\n createOtlpXhrExportDelegate,\n createOtlpSendBeaconExportDelegate,\n} from './otlp-browser-http-export-delegate';\n\nexport { convertLegacyBrowserHttpOptions } from './configuration/convert-legacy-browser-http-options';\nexport { createLegacyOtlpBrowserExportDelegate } from './configuration/create-legacy-browser-delegate';\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createOtlpHttpExportDelegate } from './otlp-http-export-delegate';
|
|
2
|
+
export { getSharedConfigurationFromEnvironment } from './configuration/shared-env-configuration';
|
|
3
|
+
export { convertLegacyHttpOptions } from './configuration/convert-legacy-node-http-options';
|
|
4
|
+
//# sourceMappingURL=index-node-http.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { createOtlpHttpExportDelegate } from './otlp-http-export-delegate';
|
|
17
|
+
export { getSharedConfigurationFromEnvironment } from './configuration/shared-env-configuration';
|
|
18
|
+
export { convertLegacyHttpOptions } from './configuration/convert-legacy-node-http-options';
|
|
19
|
+
//# sourceMappingURL=index-node-http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-node-http.js","sourceRoot":"","sources":["../../src/index-node-http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,qCAAqC,EAAE,MAAM,0CAA0C,CAAC;AACjG,OAAO,EAAE,wBAAwB,EAAE,MAAM,kDAAkD,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { createOtlpHttpExportDelegate } from './otlp-http-export-delegate';\nexport { getSharedConfigurationFromEnvironment } from './configuration/shared-env-configuration';\nexport { convertLegacyHttpOptions } from './configuration/convert-legacy-node-http-options';\n"]}
|
package/build/esnext/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export * from './platform';
|
|
2
1
|
export { OTLPExporterBase } from './OTLPExporterBase';
|
|
3
|
-
export { OTLPExporterError
|
|
4
|
-
export { validateAndNormalizeHeaders } from './util';
|
|
2
|
+
export { OTLPExporterError } from './types';
|
|
5
3
|
export { ExportResponse, ExportResponseFailure, ExportResponseSuccess, ExportResponseRetryable, } from './export-response';
|
|
6
4
|
export { IExporterTransport } from './exporter-transport';
|
|
7
5
|
export { OtlpSharedConfiguration, mergeOtlpSharedConfigurationWithDefaults, getSharedConfigurationDefaults, } from './configuration/shared-configuration';
|
|
8
|
-
export {
|
|
6
|
+
export { OTLPExporterNodeConfigBase, CompressionAlgorithm, } from './configuration/legacy-node-configuration';
|
|
7
|
+
export { OTLPExporterConfigBase } from './configuration/legacy-base-configuration';
|
|
8
|
+
export { IOtlpExportDelegate } from './otlp-export-delegate';
|
|
9
|
+
export { createOtlpNetworkExportDelegate } from './otlp-network-export-delegate';
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
package/build/esnext/index.js
CHANGED
|
@@ -13,13 +13,9 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] --
|
|
17
|
-
* TODO: Replace export * with named exports before next major version
|
|
18
|
-
*/
|
|
19
|
-
export * from './platform';
|
|
20
16
|
export { OTLPExporterBase } from './OTLPExporterBase';
|
|
21
|
-
export { OTLPExporterError
|
|
22
|
-
export { validateAndNormalizeHeaders } from './util';
|
|
17
|
+
export { OTLPExporterError } from './types';
|
|
23
18
|
export { mergeOtlpSharedConfigurationWithDefaults, getSharedConfigurationDefaults, } from './configuration/shared-configuration';
|
|
24
|
-
export {
|
|
19
|
+
export { CompressionAlgorithm, } from './configuration/legacy-node-configuration';
|
|
20
|
+
export { createOtlpNetworkExportDelegate } from './otlp-network-export-delegate';
|
|
25
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAW5C,OAAO,EAEL,wCAAwC,EACxC,8BAA8B,GAC/B,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAEL,oBAAoB,GACrB,MAAM,2CAA2C,CAAC;AAGnD,OAAO,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { OTLPExporterBase } from './OTLPExporterBase';\nexport { OTLPExporterError } from './types';\n\nexport {\n ExportResponse,\n ExportResponseFailure,\n ExportResponseSuccess,\n ExportResponseRetryable,\n} from './export-response';\n\nexport { IExporterTransport } from './exporter-transport';\n\nexport {\n OtlpSharedConfiguration,\n mergeOtlpSharedConfigurationWithDefaults,\n getSharedConfigurationDefaults,\n} from './configuration/shared-configuration';\n\nexport {\n OTLPExporterNodeConfigBase,\n CompressionAlgorithm,\n} from './configuration/legacy-node-configuration';\nexport { OTLPExporterConfigBase } from './configuration/legacy-base-configuration';\nexport { IOtlpExportDelegate } from './otlp-export-delegate';\nexport { createOtlpNetworkExportDelegate } from './otlp-network-export-delegate';\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IOtlpResponseHandler } from './response-handler';
|
|
2
|
+
/**
|
|
3
|
+
* Default response handler that logs a partial success to the console.
|
|
4
|
+
*/
|
|
5
|
+
export declare function createLoggingPartialSuccessResponseHandler<T>(): IOtlpResponseHandler<T>;
|
|
6
|
+
//# sourceMappingURL=logging-response-handler.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { diag } from '@opentelemetry/api';
|
|
17
|
+
function isPartialSuccessResponse(response) {
|
|
18
|
+
return Object.prototype.hasOwnProperty.call(response, 'partialSuccess');
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Default response handler that logs a partial success to the console.
|
|
22
|
+
*/
|
|
23
|
+
export function createLoggingPartialSuccessResponseHandler() {
|
|
24
|
+
return {
|
|
25
|
+
handleResponse(response) {
|
|
26
|
+
// Partial success MUST never be an empty object according the specification
|
|
27
|
+
// see https://opentelemetry.io/docs/specs/otlp/#partial-success
|
|
28
|
+
if (response == null ||
|
|
29
|
+
!isPartialSuccessResponse(response) ||
|
|
30
|
+
response.partialSuccess == null ||
|
|
31
|
+
Object.keys(response.partialSuccess).length === 0) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
diag.warn('Received Partial Success response:', JSON.stringify(response.partialSuccess));
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=logging-response-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging-response-handler.js","sourceRoot":"","sources":["../../src/logging-response-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG1C,SAAS,wBAAwB,CAC/B,QAAiB;IAEjB,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;AAC1E,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,0CAA0C;IAGxD,OAAO;QACL,cAAc,CAAC,QAAW;YACxB,4EAA4E;YAC5E,gEAAgE;YAChE,IACE,QAAQ,IAAI,IAAI;gBAChB,CAAC,wBAAwB,CAAC,QAAQ,CAAC;gBACnC,QAAQ,CAAC,cAAc,IAAI,IAAI;gBAC/B,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,MAAM,KAAK,CAAC,EACjD;gBACA,OAAO;aACR;YACD,IAAI,CAAC,IAAI,CACP,oCAAoC,EACpC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,CACxC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { diag } from '@opentelemetry/api';\nimport { IOtlpResponseHandler } from './response-handler';\n\nfunction isPartialSuccessResponse(\n response: unknown\n): response is { partialSuccess: never } {\n return Object.prototype.hasOwnProperty.call(response, 'partialSuccess');\n}\n\n/**\n * Default response handler that logs a partial success to the console.\n */\nexport function createLoggingPartialSuccessResponseHandler<\n T,\n>(): IOtlpResponseHandler<T> {\n return {\n handleResponse(response: T) {\n // Partial success MUST never be an empty object according the specification\n // see https://opentelemetry.io/docs/specs/otlp/#partial-success\n if (\n response == null ||\n !isPartialSuccessResponse(response) ||\n response.partialSuccess == null ||\n Object.keys(response.partialSuccess).length === 0\n ) {\n return;\n }\n diag.warn(\n 'Received Partial Success response:',\n JSON.stringify(response.partialSuccess)\n );\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OtlpHttpConfiguration } from './configuration/otlp-http-configuration';
|
|
2
|
+
import { ISerializer } from '@opentelemetry/otlp-transformer';
|
|
3
|
+
import { IOtlpExportDelegate } from './otlp-export-delegate';
|
|
4
|
+
export declare function createOtlpXhrExportDelegate<Internal, Response>(options: OtlpHttpConfiguration, serializer: ISerializer<Internal, Response>): IOtlpExportDelegate<Internal>;
|
|
5
|
+
export declare function createOtlpSendBeaconExportDelegate<Internal, Response>(options: OtlpHttpConfiguration, serializer: ISerializer<Internal, Response>): IOtlpExportDelegate<Internal>;
|
|
6
|
+
//# sourceMappingURL=otlp-browser-http-export-delegate.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createRetryingTransport } from './retrying-transport';
|
|
2
|
+
import { createXhrTransport } from './transport/xhr-transport';
|
|
3
|
+
import { createSendBeaconTransport } from './transport/send-beacon-transport';
|
|
4
|
+
import { createOtlpNetworkExportDelegate } from './otlp-network-export-delegate';
|
|
5
|
+
export function createOtlpXhrExportDelegate(options, serializer) {
|
|
6
|
+
return createOtlpNetworkExportDelegate(options, serializer, createRetryingTransport({
|
|
7
|
+
transport: createXhrTransport(options),
|
|
8
|
+
}));
|
|
9
|
+
}
|
|
10
|
+
export function createOtlpSendBeaconExportDelegate(options, serializer) {
|
|
11
|
+
return createOtlpNetworkExportDelegate(options, serializer, createRetryingTransport({
|
|
12
|
+
transport: createSendBeaconTransport({
|
|
13
|
+
url: options.url,
|
|
14
|
+
blobType: options.headers()['Content-Type'],
|
|
15
|
+
}),
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=otlp-browser-http-export-delegate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otlp-browser-http-export-delegate.js","sourceRoot":"","sources":["../../src/otlp-browser-http-export-delegate.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAC;AAEjF,MAAM,UAAU,2BAA2B,CACzC,OAA8B,EAC9B,UAA2C;IAE3C,OAAO,+BAA+B,CACpC,OAAO,EACP,UAAU,EACV,uBAAuB,CAAC;QACtB,SAAS,EAAE,kBAAkB,CAAC,OAAO,CAAC;KACvC,CAAC,CACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kCAAkC,CAChD,OAA8B,EAC9B,UAA2C;IAE3C,OAAO,+BAA+B,CACpC,OAAO,EACP,UAAU,EACV,uBAAuB,CAAC;QACtB,SAAS,EAAE,yBAAyB,CAAC;YACnC,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,cAAc,CAAC;SAC5C,CAAC;KACH,CAAC,CACH,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { OtlpHttpConfiguration } from './configuration/otlp-http-configuration';\nimport { ISerializer } from '@opentelemetry/otlp-transformer';\nimport { IOtlpExportDelegate } from './otlp-export-delegate';\nimport { createRetryingTransport } from './retrying-transport';\nimport { createXhrTransport } from './transport/xhr-transport';\nimport { createSendBeaconTransport } from './transport/send-beacon-transport';\nimport { createOtlpNetworkExportDelegate } from './otlp-network-export-delegate';\n\nexport function createOtlpXhrExportDelegate<Internal, Response>(\n options: OtlpHttpConfiguration,\n serializer: ISerializer<Internal, Response>\n): IOtlpExportDelegate<Internal> {\n return createOtlpNetworkExportDelegate(\n options,\n serializer,\n createRetryingTransport({\n transport: createXhrTransport(options),\n })\n );\n}\n\nexport function createOtlpSendBeaconExportDelegate<Internal, Response>(\n options: OtlpHttpConfiguration,\n serializer: ISerializer<Internal, Response>\n): IOtlpExportDelegate<Internal> {\n return createOtlpNetworkExportDelegate(\n options,\n serializer,\n createRetryingTransport({\n transport: createSendBeaconTransport({\n url: options.url,\n blobType: options.headers()['Content-Type'],\n }),\n })\n );\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ExportResult } from '@opentelemetry/core';
|
|
2
|
+
import { IExporterTransport } from './exporter-transport';
|
|
3
|
+
import { IExportPromiseHandler } from './bounded-queue-export-promise-handler';
|
|
4
|
+
import { ISerializer } from '@opentelemetry/otlp-transformer';
|
|
5
|
+
/**
|
|
6
|
+
* Internally shared export logic for OTLP.
|
|
7
|
+
*/
|
|
8
|
+
export interface IOtlpExportDelegate<Internal> {
|
|
9
|
+
export(internalRepresentation: Internal, resultCallback: (result: ExportResult) => void): void;
|
|
10
|
+
forceFlush(): Promise<void>;
|
|
11
|
+
shutdown(): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates a generic delegate for OTLP exports which only contains parts of the OTLP export that are shared across all
|
|
15
|
+
* signals.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createOtlpExportDelegate<Internal, Response>(components: {
|
|
18
|
+
transport: IExporterTransport;
|
|
19
|
+
serializer: ISerializer<Internal, Response>;
|
|
20
|
+
promiseHandler: IExportPromiseHandler;
|
|
21
|
+
}, settings: {
|
|
22
|
+
timeout: number;
|
|
23
|
+
}): IOtlpExportDelegate<Internal>;
|
|
24
|
+
//# sourceMappingURL=otlp-export-delegate.d.ts.map
|