@opentelemetry/otlp-exporter-base 0.53.0 → 0.54.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/build/esm/OTLPExporterBase.d.ts +0 -8
  2. package/build/esm/OTLPExporterBase.js +0 -8
  3. package/build/esm/OTLPExporterBase.js.map +1 -1
  4. package/build/esm/configuration/otlp-http-configuration.d.ts +13 -0
  5. package/build/esm/configuration/otlp-http-configuration.js +67 -0
  6. package/build/esm/configuration/otlp-http-configuration.js.map +1 -0
  7. package/build/esm/configuration/otlp-http-env-configuration.d.ts +9 -0
  8. package/build/esm/configuration/otlp-http-env-configuration.js +104 -0
  9. package/build/esm/configuration/otlp-http-env-configuration.js.map +1 -0
  10. package/build/esm/configuration/shared-configuration.d.ts +22 -0
  11. package/build/esm/configuration/shared-configuration.js +44 -0
  12. package/build/esm/configuration/shared-configuration.js.map +1 -0
  13. package/build/esm/configuration/shared-env-configuration.d.ts +3 -0
  14. package/build/esm/configuration/shared-env-configuration.js +44 -0
  15. package/build/esm/configuration/shared-env-configuration.js.map +1 -0
  16. package/build/esm/index.d.ts +3 -1
  17. package/build/esm/index.js +3 -1
  18. package/build/esm/index.js.map +1 -1
  19. package/build/esm/platform/browser/OTLPExporterBrowserBase.d.ts +4 -3
  20. package/build/esm/platform/browser/OTLPExporterBrowserBase.js +18 -10
  21. package/build/esm/platform/browser/OTLPExporterBrowserBase.js.map +1 -1
  22. package/build/esm/platform/browser/xhr-transport.js +1 -1
  23. package/build/esm/platform/browser/xhr-transport.js.map +1 -1
  24. package/build/esm/platform/node/OTLPExporterNodeBase.d.ts +2 -2
  25. package/build/esm/platform/node/OTLPExporterNodeBase.js +18 -27
  26. package/build/esm/platform/node/OTLPExporterNodeBase.js.map +1 -1
  27. package/build/esm/platform/node/convert-legacy-agent-options.d.ts +12 -0
  28. package/build/esm/platform/node/convert-legacy-agent-options.js +27 -0
  29. package/build/esm/platform/node/convert-legacy-agent-options.js.map +1 -0
  30. package/build/esm/types.d.ts +1 -2
  31. package/build/esm/types.js.map +1 -1
  32. package/build/esm/util.d.ts +1 -27
  33. package/build/esm/util.js +1 -89
  34. package/build/esm/util.js.map +1 -1
  35. package/build/esm/version.d.ts +1 -1
  36. package/build/esm/version.js +1 -1
  37. package/build/esm/version.js.map +1 -1
  38. package/build/esnext/OTLPExporterBase.d.ts +0 -8
  39. package/build/esnext/OTLPExporterBase.js +0 -8
  40. package/build/esnext/OTLPExporterBase.js.map +1 -1
  41. package/build/esnext/configuration/otlp-http-configuration.d.ts +13 -0
  42. package/build/esnext/configuration/otlp-http-configuration.js +56 -0
  43. package/build/esnext/configuration/otlp-http-configuration.js.map +1 -0
  44. package/build/esnext/configuration/otlp-http-env-configuration.d.ts +9 -0
  45. package/build/esnext/configuration/otlp-http-env-configuration.js +93 -0
  46. package/build/esnext/configuration/otlp-http-env-configuration.js.map +1 -0
  47. package/build/esnext/configuration/shared-configuration.d.ts +22 -0
  48. package/build/esnext/configuration/shared-configuration.js +44 -0
  49. package/build/esnext/configuration/shared-configuration.js.map +1 -0
  50. package/build/esnext/configuration/shared-env-configuration.d.ts +3 -0
  51. package/build/esnext/configuration/shared-env-configuration.js +44 -0
  52. package/build/esnext/configuration/shared-env-configuration.js.map +1 -0
  53. package/build/esnext/index.d.ts +3 -1
  54. package/build/esnext/index.js +3 -1
  55. package/build/esnext/index.js.map +1 -1
  56. package/build/esnext/platform/browser/OTLPExporterBrowserBase.d.ts +4 -3
  57. package/build/esnext/platform/browser/OTLPExporterBrowserBase.js +18 -10
  58. package/build/esnext/platform/browser/OTLPExporterBrowserBase.js.map +1 -1
  59. package/build/esnext/platform/browser/xhr-transport.js +1 -1
  60. package/build/esnext/platform/browser/xhr-transport.js.map +1 -1
  61. package/build/esnext/platform/node/OTLPExporterNodeBase.d.ts +2 -2
  62. package/build/esnext/platform/node/OTLPExporterNodeBase.js +18 -27
  63. package/build/esnext/platform/node/OTLPExporterNodeBase.js.map +1 -1
  64. package/build/esnext/platform/node/convert-legacy-agent-options.d.ts +12 -0
  65. package/build/esnext/platform/node/convert-legacy-agent-options.js +27 -0
  66. package/build/esnext/platform/node/convert-legacy-agent-options.js.map +1 -0
  67. package/build/esnext/types.d.ts +1 -2
  68. package/build/esnext/types.js.map +1 -1
  69. package/build/esnext/util.d.ts +1 -27
  70. package/build/esnext/util.js +1 -89
  71. package/build/esnext/util.js.map +1 -1
  72. package/build/esnext/version.d.ts +1 -1
  73. package/build/esnext/version.js +1 -1
  74. package/build/esnext/version.js.map +1 -1
  75. package/build/src/OTLPExporterBase.d.ts +0 -8
  76. package/build/src/OTLPExporterBase.js +0 -8
  77. package/build/src/OTLPExporterBase.js.map +1 -1
  78. package/build/src/configuration/otlp-http-configuration.d.ts +13 -0
  79. package/build/src/configuration/otlp-http-configuration.js +61 -0
  80. package/build/src/configuration/otlp-http-configuration.js.map +1 -0
  81. package/build/src/configuration/otlp-http-env-configuration.d.ts +9 -0
  82. package/build/src/configuration/otlp-http-env-configuration.js +97 -0
  83. package/build/src/configuration/otlp-http-env-configuration.js.map +1 -0
  84. package/build/src/configuration/shared-configuration.d.ts +22 -0
  85. package/build/src/configuration/shared-configuration.js +50 -0
  86. package/build/src/configuration/shared-configuration.js.map +1 -0
  87. package/build/src/configuration/shared-env-configuration.d.ts +3 -0
  88. package/build/src/configuration/shared-env-configuration.js +48 -0
  89. package/build/src/configuration/shared-env-configuration.js.map +1 -0
  90. package/build/src/index.d.ts +3 -1
  91. package/build/src/index.js +7 -6
  92. package/build/src/index.js.map +1 -1
  93. package/build/src/platform/browser/OTLPExporterBrowserBase.d.ts +4 -3
  94. package/build/src/platform/browser/OTLPExporterBrowserBase.js +18 -10
  95. package/build/src/platform/browser/OTLPExporterBrowserBase.js.map +1 -1
  96. package/build/src/platform/browser/xhr-transport.js +3 -3
  97. package/build/src/platform/browser/xhr-transport.js.map +1 -1
  98. package/build/src/platform/node/OTLPExporterNodeBase.d.ts +2 -2
  99. package/build/src/platform/node/OTLPExporterNodeBase.js +18 -27
  100. package/build/src/platform/node/OTLPExporterNodeBase.js.map +1 -1
  101. package/build/src/platform/node/convert-legacy-agent-options.d.ts +12 -0
  102. package/build/src/platform/node/convert-legacy-agent-options.js +31 -0
  103. package/build/src/platform/node/convert-legacy-agent-options.js.map +1 -0
  104. package/build/src/types.d.ts +1 -2
  105. package/build/src/types.js.map +1 -1
  106. package/build/src/util.d.ts +1 -27
  107. package/build/src/util.js +3 -97
  108. package/build/src/util.js.map +1 -1
  109. package/build/src/version.d.ts +1 -1
  110. package/build/src/version.js +1 -1
  111. package/build/src/version.js.map +1 -1
  112. package/package.json +8 -11
  113. package/build/esm/platform/node/util.d.ts +0 -3
  114. package/build/esm/platform/node/util.js +0 -30
  115. package/build/esm/platform/node/util.js.map +0 -1
  116. package/build/esnext/platform/node/util.d.ts +0 -3
  117. package/build/esnext/platform/node/util.js +0 -30
  118. package/build/esnext/platform/node/util.js.map +0 -1
  119. package/build/src/platform/node/util.d.ts +0 -3
  120. package/build/src/platform/node/util.js +0 -34
  121. package/build/src/platform/node/util.js.map +0 -1
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSharedConfigurationFromEnvironment = void 0;
4
+ const api_1 = require("@opentelemetry/api");
5
+ function parseAndValidateTimeoutFromEnv(timeoutEnvVar) {
6
+ var _a;
7
+ const envTimeout = (_a = process.env[timeoutEnvVar]) === null || _a === void 0 ? void 0 : _a.trim();
8
+ if (envTimeout != null && envTimeout !== '') {
9
+ const definedTimeout = Number(envTimeout);
10
+ if (!Number.isNaN(definedTimeout) &&
11
+ Number.isFinite(definedTimeout) &&
12
+ definedTimeout > 0) {
13
+ return definedTimeout;
14
+ }
15
+ api_1.diag.warn(`Configuration: ${timeoutEnvVar} is invalid, expected number greater than 0 (actual: ${envTimeout})`);
16
+ }
17
+ return undefined;
18
+ }
19
+ function getTimeoutFromEnv(signalIdentifier) {
20
+ const specificTimeout = parseAndValidateTimeoutFromEnv(`OTEL_EXPORTER_OTLP_${signalIdentifier}_TIMEOUT`);
21
+ const nonSpecificTimeout = parseAndValidateTimeoutFromEnv('OTEL_EXPORTER_OTLP_TIMEOUT');
22
+ return specificTimeout !== null && specificTimeout !== void 0 ? specificTimeout : nonSpecificTimeout;
23
+ }
24
+ function parseAndValidateCompressionFromEnv(compressionEnvVar) {
25
+ var _a;
26
+ const compression = (_a = process.env[compressionEnvVar]) === null || _a === void 0 ? void 0 : _a.trim();
27
+ if (compression === '') {
28
+ return undefined;
29
+ }
30
+ if (compression == null || compression === 'none' || compression === 'gzip') {
31
+ return compression;
32
+ }
33
+ api_1.diag.warn(`Configuration: ${compressionEnvVar} is invalid, expected 'none' or 'gzip' (actual: '${compression}')`);
34
+ return undefined;
35
+ }
36
+ function getCompressionFromEnv(signalIdentifier) {
37
+ const specificCompression = parseAndValidateCompressionFromEnv(`OTEL_EXPORTER_OTLP_${signalIdentifier}_COMPRESSION`);
38
+ const nonSpecificCompression = parseAndValidateCompressionFromEnv('OTEL_EXPORTER_OTLP_COMPRESSION');
39
+ return specificCompression !== null && specificCompression !== void 0 ? specificCompression : nonSpecificCompression;
40
+ }
41
+ function getSharedConfigurationFromEnvironment(signalIdentifier) {
42
+ return {
43
+ timeoutMillis: getTimeoutFromEnv(signalIdentifier),
44
+ compression: getCompressionFromEnv(signalIdentifier),
45
+ };
46
+ }
47
+ exports.getSharedConfigurationFromEnvironment = getSharedConfigurationFromEnvironment;
48
+ //# sourceMappingURL=shared-env-configuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-env-configuration.js","sourceRoot":"","sources":["../../../src/configuration/shared-env-configuration.ts"],"names":[],"mappings":";;;AAgBA,4CAA0C;AAE1C,SAAS,8BAA8B,CACrC,aAAqB;;IAErB,MAAM,UAAU,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,0CAAE,IAAI,EAAE,CAAC;IACtD,IAAI,UAAU,IAAI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B,mBAAmB,cAAnB,mBAAmB,GAAI,sBAAsB,CAAC;AACvD,CAAC;AAED,SAAgB,qCAAqC,CACnD,gBAAwB;IAExB,OAAO;QACL,aAAa,EAAE,iBAAiB,CAAC,gBAAgB,CAAC;QAClD,WAAW,EAAE,qBAAqB,CAAC,gBAAgB,CAAC;KACrD,CAAC;AACJ,CAAC;AAPD,sFAOC","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 { OtlpSharedConfiguration } from './shared-configuration';\nimport { diag } from '@opentelemetry/api';\n\nfunction parseAndValidateTimeoutFromEnv(\n timeoutEnvVar: string\n): number | undefined {\n const envTimeout = process.env[timeoutEnvVar]?.trim();\n if (envTimeout != null && envTimeout !== '') {\n const definedTimeout = Number(envTimeout);\n if (\n !Number.isNaN(definedTimeout) &&\n Number.isFinite(definedTimeout) &&\n definedTimeout > 0\n ) {\n return definedTimeout;\n }\n diag.warn(\n `Configuration: ${timeoutEnvVar} is invalid, expected number greater than 0 (actual: ${envTimeout})`\n );\n }\n return undefined;\n}\n\nfunction getTimeoutFromEnv(signalIdentifier: string) {\n const specificTimeout = parseAndValidateTimeoutFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_TIMEOUT`\n );\n const nonSpecificTimeout = parseAndValidateTimeoutFromEnv(\n 'OTEL_EXPORTER_OTLP_TIMEOUT'\n );\n\n return specificTimeout ?? nonSpecificTimeout;\n}\n\nfunction parseAndValidateCompressionFromEnv(\n compressionEnvVar: string\n): 'none' | 'gzip' | undefined {\n const compression = process.env[compressionEnvVar]?.trim();\n if (compression === '') {\n return undefined;\n }\n\n if (compression == null || compression === 'none' || compression === 'gzip') {\n return compression;\n }\n\n diag.warn(\n `Configuration: ${compressionEnvVar} is invalid, expected 'none' or 'gzip' (actual: '${compression}')`\n );\n return undefined;\n}\n\nfunction getCompressionFromEnv(\n signalIdentifier: string\n): 'none' | 'gzip' | undefined {\n const specificCompression = parseAndValidateCompressionFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_COMPRESSION`\n );\n const nonSpecificCompression = parseAndValidateCompressionFromEnv(\n 'OTEL_EXPORTER_OTLP_COMPRESSION'\n );\n\n return specificCompression ?? nonSpecificCompression;\n}\n\nexport function getSharedConfigurationFromEnvironment(\n signalIdentifier: string\n): Partial<OtlpSharedConfiguration> {\n return {\n timeoutMillis: getTimeoutFromEnv(signalIdentifier),\n compression: getCompressionFromEnv(signalIdentifier),\n };\n}\n"]}
@@ -1,7 +1,9 @@
1
1
  export * from './platform';
2
2
  export { OTLPExporterBase } from './OTLPExporterBase';
3
3
  export { OTLPExporterError, OTLPExporterConfigBase, ExportServiceError, } from './types';
4
- export { parseHeaders, appendResourcePathToUrl, appendRootPathToUrlIfNeeded, configureExporterTimeout, invalidTimeout, } from './util';
4
+ export { validateAndNormalizeHeaders } from './util';
5
5
  export { ExportResponse, ExportResponseFailure, ExportResponseSuccess, ExportResponseRetryable, } from './export-response';
6
6
  export { IExporterTransport } from './exporter-transport';
7
+ export { OtlpSharedConfiguration, mergeOtlpSharedConfigurationWithDefaults, getSharedConfigurationDefaults, } from './configuration/shared-configuration';
8
+ export { getSharedConfigurationFromEnvironment } from './configuration/shared-env-configuration';
7
9
  //# sourceMappingURL=index.d.ts.map
@@ -25,7 +25,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
25
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
26
26
  };
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.invalidTimeout = exports.configureExporterTimeout = exports.appendRootPathToUrlIfNeeded = exports.appendResourcePathToUrl = exports.parseHeaders = exports.OTLPExporterError = exports.OTLPExporterBase = void 0;
28
+ exports.getSharedConfigurationFromEnvironment = exports.getSharedConfigurationDefaults = exports.mergeOtlpSharedConfigurationWithDefaults = exports.validateAndNormalizeHeaders = exports.OTLPExporterError = exports.OTLPExporterBase = void 0;
29
29
  /* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] --
30
30
  * TODO: Replace export * with named exports before next major version
31
31
  */
@@ -35,9 +35,10 @@ Object.defineProperty(exports, "OTLPExporterBase", { enumerable: true, get: func
35
35
  var types_1 = require("./types");
36
36
  Object.defineProperty(exports, "OTLPExporterError", { enumerable: true, get: function () { return types_1.OTLPExporterError; } });
37
37
  var util_1 = require("./util");
38
- Object.defineProperty(exports, "parseHeaders", { enumerable: true, get: function () { return util_1.parseHeaders; } });
39
- Object.defineProperty(exports, "appendResourcePathToUrl", { enumerable: true, get: function () { return util_1.appendResourcePathToUrl; } });
40
- Object.defineProperty(exports, "appendRootPathToUrlIfNeeded", { enumerable: true, get: function () { return util_1.appendRootPathToUrlIfNeeded; } });
41
- Object.defineProperty(exports, "configureExporterTimeout", { enumerable: true, get: function () { return util_1.configureExporterTimeout; } });
42
- Object.defineProperty(exports, "invalidTimeout", { enumerable: true, get: function () { return util_1.invalidTimeout; } });
38
+ Object.defineProperty(exports, "validateAndNormalizeHeaders", { enumerable: true, get: function () { return util_1.validateAndNormalizeHeaders; } });
39
+ var shared_configuration_1 = require("./configuration/shared-configuration");
40
+ Object.defineProperty(exports, "mergeOtlpSharedConfigurationWithDefaults", { enumerable: true, get: function () { return shared_configuration_1.mergeOtlpSharedConfigurationWithDefaults; } });
41
+ Object.defineProperty(exports, "getSharedConfigurationDefaults", { enumerable: true, get: function () { return shared_configuration_1.getSharedConfigurationDefaults; } });
42
+ var shared_env_configuration_1 = require("./configuration/shared-env-configuration");
43
+ Object.defineProperty(exports, "getSharedConfigurationFromEnvironment", { enumerable: true, get: function () { return shared_env_configuration_1.getSharedConfigurationFromEnvironment; } });
43
44
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;AAEH;;GAEG;AACH,6CAA2B;AAC3B,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,iCAIiB;AAHf,0GAAA,iBAAiB,OAAA;AAInB,+BAMgB;AALd,oGAAA,YAAY,OAAA;AACZ,+GAAA,uBAAuB,OAAA;AACvB,mHAAA,2BAA2B,OAAA;AAC3B,gHAAA,wBAAwB,OAAA;AACxB,sGAAA,cAAc,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\n/* eslint no-restricted-syntax: [\"warn\", \"ExportAllDeclaration\"] --\n * TODO: Replace export * with named exports before next major version\n */\nexport * from './platform';\nexport { OTLPExporterBase } from './OTLPExporterBase';\nexport {\n OTLPExporterError,\n OTLPExporterConfigBase,\n ExportServiceError,\n} from './types';\nexport {\n parseHeaders,\n appendResourcePathToUrl,\n appendRootPathToUrlIfNeeded,\n configureExporterTimeout,\n invalidTimeout,\n} from './util';\n\nexport {\n ExportResponse,\n ExportResponseFailure,\n ExportResponseSuccess,\n ExportResponseRetryable,\n} from './export-response';\n\nexport { IExporterTransport } from './exporter-transport';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;AAEH;;GAEG;AACH,6CAA2B;AAC3B,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,iCAIiB;AAHf,0GAAA,iBAAiB,OAAA;AAInB,+BAAqD;AAA5C,mHAAA,2BAA2B,OAAA;AAWpC,6EAI8C;AAF5C,gJAAA,wCAAwC,OAAA;AACxC,sIAAA,8BAA8B,OAAA;AAGhC,qFAAiG;AAAxF,iJAAA,qCAAqC,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\n/* eslint no-restricted-syntax: [\"warn\", \"ExportAllDeclaration\"] --\n * TODO: Replace export * with named exports before next major version\n */\nexport * from './platform';\nexport { OTLPExporterBase } from './OTLPExporterBase';\nexport {\n OTLPExporterError,\n OTLPExporterConfigBase,\n ExportServiceError,\n} from './types';\nexport { validateAndNormalizeHeaders } from './util';\n\nexport {\n ExportResponse,\n ExportResponseFailure,\n ExportResponseSuccess,\n ExportResponseRetryable,\n} from './export-response';\n\nexport { IExporterTransport } from './exporter-transport';\n\nexport {\n OtlpSharedConfiguration,\n mergeOtlpSharedConfigurationWithDefaults,\n getSharedConfigurationDefaults,\n} from './configuration/shared-configuration';\n\nexport { getSharedConfigurationFromEnvironment } from './configuration/shared-env-configuration';\n"]}
@@ -7,13 +7,14 @@ import { ISerializer } from '@opentelemetry/otlp-transformer';
7
7
  export declare abstract class OTLPExporterBrowserBase<ExportItem, ServiceResponse> extends OTLPExporterBase<OTLPExporterConfigBase, ExportItem> {
8
8
  private _serializer;
9
9
  private _transport;
10
+ private _timeoutMillis;
10
11
  /**
11
12
  * @param config
12
13
  * @param serializer
13
- * @param contentType
14
+ * @param requiredHeaders
15
+ * @param signalResourcePath
14
16
  */
15
- constructor(config: OTLPExporterConfigBase | undefined, serializer: ISerializer<ExportItem[], ServiceResponse>, contentType: string);
16
- onInit(): void;
17
+ constructor(config: OTLPExporterConfigBase | undefined, serializer: ISerializer<ExportItem[], ServiceResponse>, requiredHeaders: Record<string, string>, signalResourcePath: string);
17
18
  onShutdown(): void;
18
19
  send(objects: ExportItem[], onSuccess: () => void, onError: (error: OTLPExporterError) => void): void;
19
20
  }
@@ -18,12 +18,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.OTLPExporterBrowserBase = void 0;
19
19
  const OTLPExporterBase_1 = require("../../OTLPExporterBase");
20
20
  const types_1 = require("../../types");
21
- const util_1 = require("../../util");
22
21
  const api_1 = require("@opentelemetry/api");
23
- const core_1 = require("@opentelemetry/core");
24
22
  const xhr_transport_1 = require("./xhr-transport");
25
23
  const send_beacon_transport_1 = require("./send-beacon-transport");
26
24
  const retrying_transport_1 = require("../../retrying-transport");
25
+ const otlp_http_configuration_1 = require("../../configuration/otlp-http-configuration");
27
26
  /**
28
27
  * Collector Metric Exporter abstract base class
29
28
  */
@@ -31,29 +30,38 @@ class OTLPExporterBrowserBase extends OTLPExporterBase_1.OTLPExporterBase {
31
30
  /**
32
31
  * @param config
33
32
  * @param serializer
34
- * @param contentType
33
+ * @param requiredHeaders
34
+ * @param signalResourcePath
35
35
  */
36
- constructor(config = {}, serializer, contentType) {
36
+ constructor(config = {}, serializer, requiredHeaders, signalResourcePath) {
37
37
  super(config);
38
38
  this._serializer = serializer;
39
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;
40
49
  if (useXhr) {
41
50
  this._transport = (0, retrying_transport_1.createRetryingTransport)({
42
51
  transport: (0, xhr_transport_1.createXhrTransport)({
43
- headers: Object.assign({}, (0, util_1.parseHeaders)(config.headers), core_1.baggageUtils.parseKeyPairsIntoRecord((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_HEADERS), { 'Content-Type': contentType }),
44
- url: this.url,
52
+ headers: actualConfig.headers,
53
+ url: actualConfig.url,
45
54
  }),
46
55
  });
47
56
  }
48
57
  else {
49
58
  // sendBeacon has no way to signal retry, so we do not wrap it in a RetryingTransport
50
59
  this._transport = (0, send_beacon_transport_1.createSendBeaconTransport)({
51
- url: this.url,
52
- blobType: contentType,
60
+ url: actualConfig.url,
61
+ blobType: actualConfig.headers['Content-Type'],
53
62
  });
54
63
  }
55
64
  }
56
- onInit() { }
57
65
  onShutdown() { }
58
66
  send(objects, onSuccess, onError) {
59
67
  if (this._shutdownOnce.isCalled) {
@@ -66,7 +74,7 @@ class OTLPExporterBrowserBase extends OTLPExporterBase_1.OTLPExporterBase {
66
74
  return;
67
75
  }
68
76
  const promise = this._transport
69
- .send(data, this.timeoutMillis)
77
+ .send(data, this._timeoutMillis)
70
78
  .then(response => {
71
79
  if (response.status === 'success') {
72
80
  onSuccess();
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPExporterBrowserBase.js","sourceRoot":"","sources":["../../../../src/platform/browser/OTLPExporterBrowserBase.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,6DAA0D;AAC1D,uCAAwE;AACxE,qCAA0C;AAC1C,4CAA0C;AAC1C,8CAA2D;AAG3D,mDAAqD;AACrD,mEAAoE;AACpE,iEAAmE;AAEnE;;GAEG;AACH,MAAsB,uBAGpB,SAAQ,mCAAoD;IAI5D;;;;O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AAG,IAAI,CAAC,UAAU;aAC5B,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC;aAC9B,IAAI,CAAC,QAAQ,CAAC,EAAE;YACf,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE;gBACjC,SAAS,EAAE,CAAC;aACb;iBAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,IAAI,QAAQ,CAAC,KAAK,EAAE;gBAC1D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;aACzB;iBAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,WAAW,EAAE;gBAC1C,OAAO,CAAC,IAAI,yBAAiB,CAAC,qCAAqC,CAAC,CAAC,CAAC;aACvE;iBAAM;gBACL,OAAO,CAAC,IAAI,yBAAiB,CAAC,kCAAkC,CAAC,CAAC,CAAC;aACpE;QACH,CAAC,EAAE,OAAO,CAAC,CAAC;QAEd,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpC,MAAM,UAAU,GAAG,GAAG,EAAE;YACtB,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACrD,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACzC,CAAC,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACvC,CAAC;CACF;AAtFD,0DAsFC","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 { parseHeaders } from '../../util';\nimport { diag } from '@opentelemetry/api';\nimport { getEnv, baggageUtils } from '@opentelemetry/core';\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';\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\n /**\n * @param config\n * @param serializer\n * @param contentType\n */\n constructor(\n config: OTLPExporterConfigBase = {},\n serializer: ISerializer<ExportItem[], ServiceResponse>,\n contentType: string\n ) {\n super(config);\n this._serializer = serializer;\n const useXhr =\n !!config.headers || typeof navigator.sendBeacon !== 'function';\n if (useXhr) {\n this._transport = createRetryingTransport({\n transport: createXhrTransport({\n headers: Object.assign(\n {},\n parseHeaders(config.headers),\n baggageUtils.parseKeyPairsIntoRecord(\n getEnv().OTEL_EXPORTER_OTLP_HEADERS\n ),\n { 'Content-Type': contentType }\n ),\n url: this.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: this.url,\n blobType: contentType,\n });\n }\n }\n\n onInit(): void {}\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
+ {"version":3,"file":"OTLPExporterBrowserBase.js","sourceRoot":"","sources":["../../../../src/platform/browser/OTLPExporterBrowserBase.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,6DAA0D;AAC1D,uCAAwE;AACxE,4CAA0C;AAG1C,mDAAqD;AACrD,mEAAoE;AACpE,iEAAmE;AACnE,yFAGqD;AAErD;;GAEG;AACH,MAAsB,uBAGpB,SAAQ,mCAAoD;IAK5D;;;;;OAKG;IACH,YACE,SAAiC,EAAE,EACnC,UAAsD,EACtD,eAAuC,EACvC,kBAA0B;QAE1B,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,MAAM,MAAM,GACV,CAAC,CAAC,MAAM,CAAC,OAAO,IAAI,OAAO,SAAS,CAAC,UAAU,KAAK,UAAU,CAAC;QAEjE,MAAM,YAAY,GAAG,IAAA,gEAAsC,EACzD;YACE,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;SAC1C,EACD,EAAE,EAAE,+BAA+B;QACnC,IAAA,sDAA4B,EAAC,eAAe,EAAE,kBAAkB,CAAC,CAClE,CAAC;QAEF,IAAI,CAAC,cAAc,GAAG,YAAY,CAAC,aAAa,CAAC;QACjD,IAAI,CAAC,iBAAiB,GAAG,YAAY,CAAC,gBAAgB,CAAC;QAE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AAI,yBAAiB,CAAC,qCAAqC,CAAC,CAAC,CAAC;aACvE;iBAAM;gBACL,OAAO,CAAC,IAAI,yBAAiB,CAAC,kCAAkC,CAAC,CAAC,CAAC;aACpE;QACH,CAAC,EAAE,OAAO,CAAC,CAAC;QAEd,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpC,MAAM,UAAU,GAAG,GAAG,EAAE;YACtB,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACrD,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACzC,CAAC,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACvC,CAAC;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"]}
@@ -16,8 +16,8 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.createXhrTransport = void 0;
19
- const util_1 = require("../../util");
20
19
  const api_1 = require("@opentelemetry/api");
20
+ const is_export_retryable_1 = require("../../is-export-retryable");
21
21
  class XhrTransport {
22
22
  constructor(_parameters) {
23
23
  this._parameters = _parameters;
@@ -43,10 +43,10 @@ class XhrTransport {
43
43
  status: 'success',
44
44
  });
45
45
  }
46
- else if (xhr.status && (0, util_1.isExportRetryable)(xhr.status)) {
46
+ else if (xhr.status && (0, is_export_retryable_1.isExportRetryable)(xhr.status)) {
47
47
  resolve({
48
48
  status: 'retryable',
49
- retryInMillis: (0, util_1.parseRetryAfterToMills)(xhr.getResponseHeader('Retry-After')),
49
+ retryInMillis: (0, is_export_retryable_1.parseRetryAfterToMills)(xhr.getResponseHeader('Retry-After')),
50
50
  });
51
51
  }
52
52
  else if (xhr.status !== 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"xhr-transport.js","sourceRoot":"","sources":["../../../../src/platform/browser/xhr-transport.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,qCAAuE;AACvE,4CAA0C;AAO1C,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,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;YACvC,MAAM,CAAC,OAAO,CA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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 { isExportRetryable, parseRetryAfterToMills } from '../../util';\nimport { diag } from '@opentelemetry/api';\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
+ {"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,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;YACvC,MAAM,CAAC,OAAO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AC;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"]}
@@ -8,8 +8,8 @@ import { OTLPExporterError } from '../../types';
8
8
  export declare abstract class OTLPExporterNodeBase<ExportItem, ServiceResponse> extends OTLPExporterBase<OTLPExporterNodeConfigBase, ExportItem> {
9
9
  private _serializer;
10
10
  private _transport;
11
- constructor(config: OTLPExporterNodeConfigBase | undefined, serializer: ISerializer<ExportItem[], ServiceResponse>, signalSpecificHeaders: Record<string, string>);
12
- onInit(_config: OTLPExporterNodeConfigBase): void;
11
+ private _timeoutMillis;
12
+ constructor(config: OTLPExporterNodeConfigBase | undefined, serializer: ISerializer<ExportItem[], ServiceResponse>, requiredHeaders: Record<string, string>, signalIdentifier: string, signalResourcePath: string);
13
13
  send(objects: ExportItem[], onSuccess: () => void, onError: (error: OTLPExporterError) => void): void;
14
14
  onShutdown(): void;
15
15
  }
@@ -17,51 +17,42 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.OTLPExporterNodeBase = void 0;
19
19
  const OTLPExporterBase_1 = require("../../OTLPExporterBase");
20
- const util_1 = require("./util");
21
20
  const api_1 = require("@opentelemetry/api");
22
- const core_1 = require("@opentelemetry/core");
23
21
  const http_exporter_transport_1 = require("./http-exporter-transport");
24
22
  const types_1 = require("../../types");
25
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");
26
27
  /**
27
28
  * Collector Metric Exporter abstract base class
28
29
  */
29
30
  class OTLPExporterNodeBase extends OTLPExporterBase_1.OTLPExporterBase {
30
- constructor(config = {}, serializer, signalSpecificHeaders) {
31
- var _a;
31
+ constructor(config = {}, serializer, requiredHeaders, signalIdentifier, signalResourcePath) {
32
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;
33
42
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
43
  if (config.metadata) {
35
44
  api_1.diag.warn('Metadata cannot be set when using http');
36
45
  }
37
46
  this._serializer = serializer;
38
- // populate keepAlive for use with new settings
39
- if ((config === null || config === void 0 ? void 0 : config.keepAlive) != null) {
40
- if (config.httpAgentOptions != null) {
41
- if (config.httpAgentOptions.keepAlive == null) {
42
- // specific setting is not set, populate with non-specific setting.
43
- config.httpAgentOptions.keepAlive = config.keepAlive;
44
- }
45
- // do nothing, use specific setting otherwise
46
- }
47
- else {
48
- // populate specific option if AgentOptions does not exist.
49
- config.httpAgentOptions = {
50
- keepAlive: config.keepAlive,
51
- };
52
- }
53
- }
54
- const nonSignalSpecificHeaders = core_1.baggageUtils.parseKeyPairsIntoRecord((0, core_1.getEnv)().OTEL_EXPORTER_OTLP_HEADERS);
55
47
  this._transport = (0, retrying_transport_1.createRetryingTransport)({
56
48
  transport: (0, http_exporter_transport_1.createHttpExporterTransport)({
57
- agentOptions: (_a = config.httpAgentOptions) !== null && _a !== void 0 ? _a : { keepAlive: true },
58
- compression: (0, util_1.configureCompression)(config.compression),
59
- headers: Object.assign({}, nonSignalSpecificHeaders, signalSpecificHeaders),
60
- url: this.url,
49
+ agentOptions: (0, convert_legacy_agent_options_1.convertLegacyAgentOptions)(config),
50
+ compression: actualConfig.compression,
51
+ headers: actualConfig.headers,
52
+ url: actualConfig.url,
61
53
  }),
62
54
  });
63
55
  }
64
- onInit(_config) { }
65
56
  send(objects, onSuccess, onError) {
66
57
  if (this._shutdownOnce.isCalled) {
67
58
  api_1.diag.debug('Shutdown already started. Cannot send objects');
@@ -73,7 +64,7 @@ class OTLPExporterNodeBase extends OTLPExporterBase_1.OTLPExporterBase {
73
64
  return;
74
65
  }
75
66
  const promise = this._transport
76
- .send(data, this.timeoutMillis)
67
+ .send(data, this._timeoutMillis)
77
68
  .then(response => {
78
69
  if (response.status === 'success') {
79
70
  onSuccess();
@@ -1 +1 @@
1
- {"version":3,"file":"OTLPExporterNodeBase.js","sourceRoot":"","sources":["../../../../src/platform/node/OTLPExporterNodeBase.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,6DAA0D;AAE1D,iCAA8C;AAC9C,4CAA0C;AAC1C,8CAA2D;AAG3D,uEAAwE;AACxE,uCAAgD;AAChD,iEAAmE;AAEnE;;GAEG;AACH,MA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C;QACF,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACvC,CAAC;IAED,UAAU,KAAU,CAAC;CACtB;AA9FD,oDA8FC","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 { configureCompression } from './util';\nimport { diag } from '@opentelemetry/api';\nimport { getEnv, baggageUtils } from '@opentelemetry/core';\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';\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\n constructor(\n config: OTLPExporterNodeConfigBase = {},\n serializer: ISerializer<ExportItem[], ServiceResponse>,\n signalSpecificHeaders: Record<string, string>\n ) {\n super(config);\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 // 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 const nonSignalSpecificHeaders = baggageUtils.parseKeyPairsIntoRecord(\n getEnv().OTEL_EXPORTER_OTLP_HEADERS\n );\n\n this._transport = createRetryingTransport({\n transport: createHttpExporterTransport({\n agentOptions: config.httpAgentOptions ?? { keepAlive: true },\n compression: configureCompression(config.compression),\n headers: Object.assign(\n {},\n nonSignalSpecificHeaders,\n signalSpecificHeaders\n ),\n url: this.url,\n }),\n });\n }\n\n onInit(_config: OTLPExporterNodeConfigBase): 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 onShutdown(): void {}\n}\n"]}
1
+ {"version":3,"file":"OTLPExporterNodeBase.js","sourceRoot":"","sources":["../../../../src/platform/node/OTLPExporterNodeBase.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,6DAA0D;AAE1D,4CAA0C;AAG1C,uEAAwE;AACxE,uCAAgD;AAChD,iEAAmE;AACnE,iFAA2E;AAC3E,yFAGqD;AACrD,iGAAsG;AAEtG;;GAEG;AACH,MAAsB,oBAGpB,SAA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AG,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAExD,IAAI,IAAI,IAAI,IAAI,EAAE;YAChB,OAAO,CAAC,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC,CAAC;YAClD,OAAO;SACR;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU;aAC5B,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC;aAC/B,IAAI,CAAC,QAAQ,CAAC,EAAE;YACf,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE;gBACjC,SAAS,EAAE,CAAC;aACb;iBAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,IAAI,QAAQ,CAAC,KAAK,EAAE;gBAC1D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;aACzB;iBAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,WAAW,EAAE;gBAC1C,OAAO,CAAC,IAAI,yBAAiB,CAAC,qCAAqC,CAAC,CAAC,CAAC;aACvE;iBAAM;gBACL,OAAO,CAAC,IAAI,yBAAiB,CAAC,kCAAkC,CAAC,CAAC,CAAC;aACpE;QACH,CAAC,EAAE,OAAO,CAAC,CAAC;QAEd,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpC,MAAM,UAAU,GAAG,GAAG,EAAE;YACtB,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACrD,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACzC,CAAC,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACvC,CAAC;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"]}
@@ -0,0 +1,12 @@
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
@@ -0,0 +1,31 @@
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
@@ -0,0 +1 @@
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"]}
@@ -24,8 +24,7 @@ export interface ExportServiceError {
24
24
  * Collector Exporter base config
25
25
  */
26
26
  export interface OTLPExporterConfigBase {
27
- headers?: Partial<Record<string, unknown>>;
28
- hostname?: string;
27
+ headers?: Record<string, string>;
29
28
  url?: string;
30
29
  concurrencyLimit?: number;
31
30
  /** Maximum time the OTLP exporter will wait for each batch export.
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;GAEG;AACH,MAAa,iBAAkB,SAAQ,KAAK;IAK1C,YAAY,OAAgB,EAAE,IAAa,EAAE,IAAa;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,SAAI,GAAW,mBAAmB,CAAC;QAKnD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAVD,8CAUC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Interface for handling error\n */\nexport class OTLPExporterError extends Error {\n readonly code?: number;\n override readonly name: string = 'OTLPExporterError';\n readonly data?: string;\n\n constructor(message?: string, code?: number, data?: string) {\n super(message);\n this.data = data;\n this.code = code;\n }\n}\n\n/**\n * Interface for handling export service errors\n */\nexport interface ExportServiceError {\n name: string;\n code: number;\n details: string;\n metadata: { [key: string]: unknown };\n message: string;\n stack: string;\n}\n\n/**\n * Collector Exporter base config\n */\nexport interface OTLPExporterConfigBase {\n headers?: Partial<Record<string, unknown>>;\n hostname?: string;\n url?: string;\n concurrencyLimit?: number;\n /** Maximum time the OTLP exporter will wait for each batch export.\n * The default value is 10000ms. */\n timeoutMillis?: number;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;GAEG;AACH,MAAa,iBAAkB,SAAQ,KAAK;IAK1C,YAAY,OAAgB,EAAE,IAAa,EAAE,IAAa;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,SAAI,GAAW,mBAAmB,CAAC;QAKnD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAVD,8CAUC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Interface for handling error\n */\nexport class OTLPExporterError extends Error {\n readonly code?: number;\n override readonly name: string = 'OTLPExporterError';\n readonly data?: string;\n\n constructor(message?: string, code?: number, data?: string) {\n super(message);\n this.data = data;\n this.code = code;\n }\n}\n\n/**\n * Interface for handling export service errors\n */\nexport interface ExportServiceError {\n name: string;\n code: number;\n details: string;\n metadata: { [key: string]: unknown };\n message: string;\n stack: string;\n}\n\n/**\n * Collector Exporter base config\n */\nexport interface OTLPExporterConfigBase {\n headers?: Record<string, string>;\n url?: string;\n concurrencyLimit?: number;\n /** Maximum time the OTLP exporter will wait for each batch export.\n * The default value is 10000ms. */\n timeoutMillis?: number;\n}\n"]}
@@ -1,32 +1,6 @@
1
- export declare const DEFAULT_EXPORT_MAX_ATTEMPTS = 5;
2
- export declare const DEFAULT_EXPORT_INITIAL_BACKOFF = 1000;
3
- export declare const DEFAULT_EXPORT_MAX_BACKOFF = 5000;
4
- export declare const DEFAULT_EXPORT_BACKOFF_MULTIPLIER = 1.5;
5
1
  /**
6
2
  * Parses headers from config leaving only those that have defined values
7
3
  * @param partialHeaders
8
4
  */
9
- export declare function parseHeaders(partialHeaders?: Partial<Record<string, unknown>>): Record<string, string>;
10
- /**
11
- * Adds path (version + signal) to a no per-signal endpoint
12
- * @param url
13
- * @param path
14
- * @returns url + path
15
- */
16
- export declare function appendResourcePathToUrl(url: string, path: string): string;
17
- /**
18
- * Adds root path to signal specific endpoint when endpoint contains no path part and no root path
19
- * @param url
20
- * @returns url
21
- */
22
- export declare function appendRootPathToUrlIfNeeded(url: string): string;
23
- /**
24
- * Configure exporter trace timeout value from passed in value or environment variables
25
- * @param timeoutMillis
26
- * @returns timeout value in milliseconds
27
- */
28
- export declare function configureExporterTimeout(timeoutMillis: number | undefined): number;
29
- export declare function invalidTimeout(timeout: number, defaultTimeout: number): number;
30
- export declare function isExportRetryable(statusCode: number): boolean;
31
- export declare function parseRetryAfterToMills(retryAfter?: string | null): number;
5
+ export declare function validateAndNormalizeHeaders(partialHeaders?: Partial<Record<string, unknown>>): Record<string, string>;
32
6
  //# sourceMappingURL=util.d.ts.map