@opentelemetry/otlp-exporter-base 0.213.0 → 0.215.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/build/esm/OTLPExporterBase.d.ts +2 -2
  2. package/build/esm/OTLPExporterBase.js.map +1 -1
  3. package/build/esm/configuration/convert-legacy-browser-http-options.d.ts +2 -2
  4. package/build/esm/configuration/convert-legacy-browser-http-options.js +0 -4
  5. package/build/esm/configuration/convert-legacy-browser-http-options.js.map +1 -1
  6. package/build/esm/configuration/convert-legacy-http-options.d.ts +2 -2
  7. package/build/esm/configuration/convert-legacy-http-options.js.map +1 -1
  8. package/build/esm/configuration/convert-legacy-node-http-options.d.ts +2 -2
  9. package/build/esm/configuration/convert-legacy-node-http-options.js.map +1 -1
  10. package/build/esm/configuration/create-legacy-browser-delegate.d.ts +3 -3
  11. package/build/esm/configuration/create-legacy-browser-delegate.js.map +1 -1
  12. package/build/esm/configuration/legacy-base-configuration.d.ts +1 -1
  13. package/build/esm/configuration/legacy-base-configuration.js.map +1 -1
  14. package/build/esm/configuration/otlp-http-configuration.d.ts +1 -1
  15. package/build/esm/configuration/otlp-http-configuration.js.map +1 -1
  16. package/build/esm/configuration/otlp-node-http-configuration.d.ts +1 -1
  17. package/build/esm/configuration/otlp-node-http-configuration.js +0 -4
  18. package/build/esm/configuration/otlp-node-http-configuration.js.map +1 -1
  19. package/build/esm/configuration/otlp-node-http-env-configuration.d.ts +1 -1
  20. package/build/esm/configuration/otlp-node-http-env-configuration.js +1 -1
  21. package/build/esm/configuration/otlp-node-http-env-configuration.js.map +1 -1
  22. package/build/esm/configuration/shared-configuration.d.ts +1 -1
  23. package/build/esm/configuration/shared-configuration.js.map +1 -1
  24. package/build/esm/configuration/shared-env-configuration.d.ts +1 -1
  25. package/build/esm/configuration/shared-env-configuration.js.map +1 -1
  26. package/build/esm/exporter-transport.d.ts +1 -1
  27. package/build/esm/exporter-transport.js.map +1 -1
  28. package/build/esm/logging-response-handler.d.ts +1 -1
  29. package/build/esm/logging-response-handler.js.map +1 -1
  30. package/build/esm/otlp-browser-http-export-delegate.d.ts +3 -3
  31. package/build/esm/otlp-browser-http-export-delegate.js.map +1 -1
  32. package/build/esm/otlp-export-delegate.d.ts +4 -4
  33. package/build/esm/otlp-export-delegate.js.map +1 -1
  34. package/build/esm/otlp-http-export-delegate.d.ts +3 -3
  35. package/build/esm/otlp-http-export-delegate.js +1 -5
  36. package/build/esm/otlp-http-export-delegate.js.map +1 -1
  37. package/build/esm/otlp-network-export-delegate.d.ts +4 -4
  38. package/build/esm/otlp-network-export-delegate.js +1 -1
  39. package/build/esm/otlp-network-export-delegate.js.map +1 -1
  40. package/build/esm/retrying-transport.d.ts +1 -1
  41. package/build/esm/retrying-transport.js.map +1 -1
  42. package/build/esm/transport/fetch-transport.d.ts +2 -2
  43. package/build/esm/transport/fetch-transport.js.map +1 -1
  44. package/build/esm/transport/http-exporter-transport.d.ts +2 -2
  45. package/build/esm/transport/http-exporter-transport.js +1 -5
  46. package/build/esm/transport/http-exporter-transport.js.map +1 -1
  47. package/build/esm/transport/http-transport-types.d.ts +1 -1
  48. package/build/esm/transport/http-transport-types.js.map +1 -1
  49. package/build/esm/transport/http-transport-utils.d.ts +8 -3
  50. package/build/esm/transport/http-transport-utils.js +103 -79
  51. package/build/esm/transport/http-transport-utils.js.map +1 -1
  52. package/build/esm/transport/node-http-transport-types.d.ts +2 -2
  53. package/build/esm/transport/node-http-transport-types.js.map +1 -1
  54. package/build/esm/version.d.ts +1 -1
  55. package/build/esm/version.js +2 -13
  56. package/build/esm/version.js.map +1 -1
  57. package/build/esnext/OTLPExporterBase.d.ts +2 -2
  58. package/build/esnext/OTLPExporterBase.js.map +1 -1
  59. package/build/esnext/configuration/convert-legacy-browser-http-options.d.ts +2 -2
  60. package/build/esnext/configuration/convert-legacy-browser-http-options.js +0 -4
  61. package/build/esnext/configuration/convert-legacy-browser-http-options.js.map +1 -1
  62. package/build/esnext/configuration/convert-legacy-http-options.d.ts +2 -2
  63. package/build/esnext/configuration/convert-legacy-http-options.js.map +1 -1
  64. package/build/esnext/configuration/convert-legacy-node-http-options.d.ts +2 -2
  65. package/build/esnext/configuration/convert-legacy-node-http-options.js.map +1 -1
  66. package/build/esnext/configuration/create-legacy-browser-delegate.d.ts +3 -3
  67. package/build/esnext/configuration/create-legacy-browser-delegate.js.map +1 -1
  68. package/build/esnext/configuration/legacy-base-configuration.d.ts +1 -1
  69. package/build/esnext/configuration/legacy-base-configuration.js.map +1 -1
  70. package/build/esnext/configuration/otlp-http-configuration.d.ts +1 -1
  71. package/build/esnext/configuration/otlp-http-configuration.js.map +1 -1
  72. package/build/esnext/configuration/otlp-node-http-configuration.d.ts +1 -1
  73. package/build/esnext/configuration/otlp-node-http-configuration.js +0 -4
  74. package/build/esnext/configuration/otlp-node-http-configuration.js.map +1 -1
  75. package/build/esnext/configuration/otlp-node-http-env-configuration.d.ts +1 -1
  76. package/build/esnext/configuration/otlp-node-http-env-configuration.js +1 -1
  77. package/build/esnext/configuration/otlp-node-http-env-configuration.js.map +1 -1
  78. package/build/esnext/configuration/shared-configuration.d.ts +1 -1
  79. package/build/esnext/configuration/shared-configuration.js.map +1 -1
  80. package/build/esnext/configuration/shared-env-configuration.d.ts +1 -1
  81. package/build/esnext/configuration/shared-env-configuration.js.map +1 -1
  82. package/build/esnext/exporter-transport.d.ts +1 -1
  83. package/build/esnext/exporter-transport.js.map +1 -1
  84. package/build/esnext/logging-response-handler.d.ts +1 -1
  85. package/build/esnext/logging-response-handler.js.map +1 -1
  86. package/build/esnext/otlp-browser-http-export-delegate.d.ts +3 -3
  87. package/build/esnext/otlp-browser-http-export-delegate.js.map +1 -1
  88. package/build/esnext/otlp-export-delegate.d.ts +4 -4
  89. package/build/esnext/otlp-export-delegate.js.map +1 -1
  90. package/build/esnext/otlp-http-export-delegate.d.ts +3 -3
  91. package/build/esnext/otlp-http-export-delegate.js +1 -5
  92. package/build/esnext/otlp-http-export-delegate.js.map +1 -1
  93. package/build/esnext/otlp-network-export-delegate.d.ts +4 -4
  94. package/build/esnext/otlp-network-export-delegate.js +1 -1
  95. package/build/esnext/otlp-network-export-delegate.js.map +1 -1
  96. package/build/esnext/retrying-transport.d.ts +1 -1
  97. package/build/esnext/retrying-transport.js.map +1 -1
  98. package/build/esnext/transport/fetch-transport.d.ts +2 -2
  99. package/build/esnext/transport/fetch-transport.js.map +1 -1
  100. package/build/esnext/transport/http-exporter-transport.d.ts +2 -2
  101. package/build/esnext/transport/http-exporter-transport.js +1 -5
  102. package/build/esnext/transport/http-exporter-transport.js.map +1 -1
  103. package/build/esnext/transport/http-transport-types.d.ts +1 -1
  104. package/build/esnext/transport/http-transport-types.js.map +1 -1
  105. package/build/esnext/transport/http-transport-utils.d.ts +8 -3
  106. package/build/esnext/transport/http-transport-utils.js +103 -79
  107. package/build/esnext/transport/http-transport-utils.js.map +1 -1
  108. package/build/esnext/transport/node-http-transport-types.d.ts +2 -2
  109. package/build/esnext/transport/node-http-transport-types.js.map +1 -1
  110. package/build/esnext/version.d.ts +1 -1
  111. package/build/esnext/version.js +2 -13
  112. package/build/esnext/version.js.map +1 -1
  113. package/build/src/OTLPExporterBase.d.ts +2 -2
  114. package/build/src/OTLPExporterBase.js.map +1 -1
  115. package/build/src/configuration/convert-legacy-browser-http-options.d.ts +2 -2
  116. package/build/src/configuration/convert-legacy-browser-http-options.js +0 -4
  117. package/build/src/configuration/convert-legacy-browser-http-options.js.map +1 -1
  118. package/build/src/configuration/convert-legacy-http-options.d.ts +2 -2
  119. package/build/src/configuration/convert-legacy-http-options.js.map +1 -1
  120. package/build/src/configuration/convert-legacy-node-http-options.d.ts +2 -2
  121. package/build/src/configuration/convert-legacy-node-http-options.js.map +1 -1
  122. package/build/src/configuration/create-legacy-browser-delegate.d.ts +3 -3
  123. package/build/src/configuration/create-legacy-browser-delegate.js.map +1 -1
  124. package/build/src/configuration/legacy-base-configuration.d.ts +1 -1
  125. package/build/src/configuration/legacy-base-configuration.js.map +1 -1
  126. package/build/src/configuration/otlp-http-configuration.d.ts +1 -1
  127. package/build/src/configuration/otlp-http-configuration.js.map +1 -1
  128. package/build/src/configuration/otlp-node-http-configuration.d.ts +1 -1
  129. package/build/src/configuration/otlp-node-http-configuration.js +0 -4
  130. package/build/src/configuration/otlp-node-http-configuration.js.map +1 -1
  131. package/build/src/configuration/otlp-node-http-env-configuration.d.ts +1 -1
  132. package/build/src/configuration/otlp-node-http-env-configuration.js.map +1 -1
  133. package/build/src/configuration/shared-configuration.d.ts +1 -1
  134. package/build/src/configuration/shared-configuration.js.map +1 -1
  135. package/build/src/configuration/shared-env-configuration.d.ts +1 -1
  136. package/build/src/configuration/shared-env-configuration.js.map +1 -1
  137. package/build/src/exporter-transport.d.ts +1 -1
  138. package/build/src/exporter-transport.js.map +1 -1
  139. package/build/src/logging-response-handler.d.ts +1 -1
  140. package/build/src/logging-response-handler.js.map +1 -1
  141. package/build/src/otlp-browser-http-export-delegate.d.ts +3 -3
  142. package/build/src/otlp-browser-http-export-delegate.js.map +1 -1
  143. package/build/src/otlp-export-delegate.d.ts +4 -4
  144. package/build/src/otlp-export-delegate.js.map +1 -1
  145. package/build/src/otlp-http-export-delegate.d.ts +3 -3
  146. package/build/src/otlp-http-export-delegate.js +0 -4
  147. package/build/src/otlp-http-export-delegate.js.map +1 -1
  148. package/build/src/otlp-network-export-delegate.d.ts +4 -4
  149. package/build/src/otlp-network-export-delegate.js.map +1 -1
  150. package/build/src/retrying-transport.d.ts +1 -1
  151. package/build/src/retrying-transport.js.map +1 -1
  152. package/build/src/transport/fetch-transport.d.ts +2 -2
  153. package/build/src/transport/fetch-transport.js.map +1 -1
  154. package/build/src/transport/http-exporter-transport.d.ts +2 -2
  155. package/build/src/transport/http-exporter-transport.js +1 -5
  156. package/build/src/transport/http-exporter-transport.js.map +1 -1
  157. package/build/src/transport/http-transport-types.d.ts +1 -1
  158. package/build/src/transport/http-transport-types.js.map +1 -1
  159. package/build/src/transport/http-transport-utils.d.ts +8 -3
  160. package/build/src/transport/http-transport-utils.js +104 -80
  161. package/build/src/transport/http-transport-utils.js.map +1 -1
  162. package/build/src/transport/node-http-transport-types.d.ts +2 -2
  163. package/build/src/transport/node-http-transport-types.js.map +1 -1
  164. package/build/src/version.d.ts +1 -1
  165. package/build/src/version.js +2 -13
  166. package/build/src/version.js.map +1 -1
  167. package/package.json +6 -6
@@ -1,12 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.compressAndSend = exports.sendWithHttp = void 0;
3
+ exports.compressAndSend = exports.sendWithHttp = exports.MAX_RESPONSE_BODY_SIZE = void 0;
4
4
  const zlib = require("zlib");
5
5
  const stream_1 = require("stream");
6
6
  const is_export_retryable_1 = require("../is-export-retryable");
7
7
  const types_1 = require("../types");
8
8
  const version_1 = require("../version");
9
9
  const DEFAULT_USER_AGENT = `OTel-OTLP-Exporter-JavaScript/${version_1.VERSION}`;
10
+ /**
11
+ * Maximum response body size (4 MB) that the HTTP transport will read.
12
+ * If the server sends more data the connection is destroyed and the export
13
+ * is treated as a non-retryable error regardless of status code.
14
+ */
15
+ exports.MAX_RESPONSE_BODY_SIZE = 4 * 1024 * 1024;
10
16
  /**
11
17
  * Sends data using http
12
18
  * @param request
@@ -16,100 +22,118 @@ const DEFAULT_USER_AGENT = `OTel-OTLP-Exporter-JavaScript/${version_1.VERSION}`;
16
22
  * @param userAgent
17
23
  * @param agent
18
24
  * @param data
19
- * @param onDone
20
25
  * @param timeoutMillis
21
26
  */
22
- function sendWithHttp(request, url, headers, compression, userAgent, agent, data, onDone, timeoutMillis) {
23
- const parsedUrl = new URL(url);
24
- if (userAgent) {
25
- headers['User-Agent'] = `${userAgent} ${DEFAULT_USER_AGENT}`;
26
- }
27
- else {
28
- headers['User-Agent'] = DEFAULT_USER_AGENT;
29
- }
30
- const options = {
31
- hostname: parsedUrl.hostname,
32
- port: parsedUrl.port,
33
- path: parsedUrl.pathname,
34
- method: 'POST',
35
- headers,
36
- agent,
37
- };
38
- const req = request(options, (res) => {
39
- const responseData = [];
40
- res.on('data', chunk => responseData.push(chunk));
41
- res.on('end', () => {
42
- if (res.statusCode && res.statusCode <= 299) {
43
- onDone({
44
- status: 'success',
45
- data: Buffer.concat(responseData),
46
- });
47
- }
48
- else if (res.statusCode && (0, is_export_retryable_1.isExportHTTPErrorRetryable)(res.statusCode)) {
49
- onDone({
50
- status: 'retryable',
51
- retryInMillis: (0, is_export_retryable_1.parseRetryAfterToMills)(res.headers['retry-after']),
52
- });
53
- }
54
- else {
55
- const error = new types_1.OTLPExporterError(res.statusMessage, res.statusCode, Buffer.concat(responseData).toString());
56
- onDone({
57
- status: 'failure',
58
- error,
59
- });
60
- }
27
+ function sendWithHttp(request, url, headers, compression, userAgent, agent, data, timeoutMillis) {
28
+ return new Promise(resolve => {
29
+ const parsedUrl = new URL(url);
30
+ if (userAgent) {
31
+ headers['User-Agent'] = `${userAgent} ${DEFAULT_USER_AGENT}`;
32
+ }
33
+ else {
34
+ headers['User-Agent'] = DEFAULT_USER_AGENT;
35
+ }
36
+ const options = {
37
+ hostname: parsedUrl.hostname,
38
+ port: parsedUrl.port,
39
+ path: parsedUrl.pathname,
40
+ method: 'POST',
41
+ headers,
42
+ agent,
43
+ };
44
+ const req = request(options, (res) => {
45
+ const responseData = [];
46
+ let responseSize = 0;
47
+ res.on('data', (chunk) => {
48
+ responseSize += chunk.length;
49
+ if (responseSize > exports.MAX_RESPONSE_BODY_SIZE) {
50
+ const sizeError = new Error(`OTLP export response body exceeded size limit of ${exports.MAX_RESPONSE_BODY_SIZE} bytes`);
51
+ // Oversized responses are treated as non-retryable errors
52
+ // regardless of status code.
53
+ // Resolve before destroying: res.destroy() tears down the socket which
54
+ // triggers ECONNRESET on req.on('error'), so, resolving first makes that
55
+ // a no-op. res.on('error') does not fire because destroy() is called
56
+ // without an error argument.
57
+ resolve({ status: 'failure', error: sizeError });
58
+ res.destroy();
59
+ return;
60
+ }
61
+ responseData.push(chunk);
62
+ });
63
+ res.on('end', () => {
64
+ if (res.statusCode && res.statusCode <= 299) {
65
+ resolve({
66
+ status: 'success',
67
+ data: Buffer.concat(responseData),
68
+ });
69
+ }
70
+ else if (res.statusCode &&
71
+ (0, is_export_retryable_1.isExportHTTPErrorRetryable)(res.statusCode)) {
72
+ resolve({
73
+ status: 'retryable',
74
+ retryInMillis: (0, is_export_retryable_1.parseRetryAfterToMills)(res.headers['retry-after']),
75
+ });
76
+ }
77
+ else {
78
+ const error = new types_1.OTLPExporterError(res.statusMessage, res.statusCode, Buffer.concat(responseData).toString());
79
+ resolve({
80
+ status: 'failure',
81
+ error,
82
+ });
83
+ }
84
+ });
85
+ res.on('error', (error) => {
86
+ // Note: 'end' may still be emitted after 'error' on the same response object, since we're resolving a promise,
87
+ // the first call to resolve() will determine the final state.
88
+ if (res.statusCode && res.statusCode <= 299) {
89
+ // If the response is successful but an error occurs while reading the response,
90
+ // we consider it a success since the data has been sent successfully.
91
+ resolve({
92
+ status: 'success',
93
+ });
94
+ }
95
+ else if (res.statusCode &&
96
+ (0, is_export_retryable_1.isExportHTTPErrorRetryable)(res.statusCode)) {
97
+ resolve({
98
+ status: 'retryable',
99
+ error: error,
100
+ retryInMillis: (0, is_export_retryable_1.parseRetryAfterToMills)(res.headers['retry-after']),
101
+ });
102
+ }
103
+ else {
104
+ resolve({
105
+ status: 'failure',
106
+ error,
107
+ });
108
+ }
109
+ });
61
110
  });
62
- res.on('error', (error) => {
63
- // Note: 'end' may still be emitted after 'error' on the same response object.
64
- // However, since onDone maps to a Promise resolve/reject, only the first call takes effect.
65
- // This will be addressed in https://github.com/open-telemetry/opentelemetry-js/issues/5990
66
- if (res.statusCode && res.statusCode <= 299) {
67
- // If the response is successful but an error occurs while reading the response,
68
- // we consider it a success since the data has been sent successfully.
69
- onDone({
70
- status: 'success',
71
- });
72
- }
73
- else if (res.statusCode && (0, is_export_retryable_1.isExportHTTPErrorRetryable)(res.statusCode)) {
74
- onDone({
111
+ req.setTimeout(timeoutMillis, () => {
112
+ req.destroy();
113
+ resolve({
114
+ status: 'retryable',
115
+ error: new Error('Request timed out'),
116
+ });
117
+ });
118
+ req.on('error', (error) => {
119
+ if (isHttpTransportNetworkErrorRetryable(error)) {
120
+ resolve({
75
121
  status: 'retryable',
76
- error: error,
77
- retryInMillis: (0, is_export_retryable_1.parseRetryAfterToMills)(res.headers['retry-after']),
122
+ error,
78
123
  });
79
124
  }
80
125
  else {
81
- onDone({
126
+ resolve({
82
127
  status: 'failure',
83
128
  error,
84
129
  });
85
130
  }
86
131
  });
87
- });
88
- req.setTimeout(timeoutMillis, () => {
89
- req.destroy();
90
- onDone({
91
- status: 'retryable',
92
- error: new Error('Request timed out'),
93
- });
94
- });
95
- req.on('error', (error) => {
96
- if (isHttpTransportNetworkErrorRetryable(error)) {
97
- onDone({
98
- status: 'retryable',
99
- error,
100
- });
101
- }
102
- else {
103
- onDone({
132
+ compressAndSend(req, compression, data, (error) => {
133
+ resolve({
104
134
  status: 'failure',
105
135
  error,
106
136
  });
107
- }
108
- });
109
- compressAndSend(req, compression, data, (error) => {
110
- onDone({
111
- status: 'failure',
112
- error,
113
137
  });
114
138
  });
115
139
  }
@@ -1 +1 @@
1
- {"version":3,"file":"http-transport-utils.js","sourceRoot":"","sources":["../../../src/transport/http-transport-utils.ts"],"names":[],"mappings":";;;AAMA,6BAA6B;AAC7B,mCAAkC;AAElC,gEAGgC;AAChC,oCAA6C;AAC7C,wCAAqC;AAErC,MAAM,kBAAkB,GAAG,iCAAiC,iBAAO,EAAE,CAAC;AAEtE;;;;;;;;;;;GAWG;AACH,SAAgB,YAAY,CAC1B,OAAmD,EACnD,GAAW,EACX,OAA+B,EAC/B,WAA4B,EAC5B,SAA6B,EAC7B,KAA+B,EAC/B,IAAgB,EAChB,MAA0C,EAC1C,aAAqB;IAErB,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IAE/B,IAAI,SAAS,EAAE;QACb,OAAO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AK,QAAQ,EAAE;QACrD,OAAO,6BAA6B,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;KACtD;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type * as http from 'http';\nimport type * as https from 'https';\nimport * as zlib from 'zlib';\nimport { Readable } from 'stream';\nimport { ExportResponse } from '../export-response';\nimport {\n isExportHTTPErrorRetryable,\n parseRetryAfterToMills,\n} from '../is-export-retryable';\nimport { OTLPExporterError } from '../types';\nimport { VERSION } from '../version';\n\nconst DEFAULT_USER_AGENT = `OTel-OTLP-Exporter-JavaScript/${VERSION}`;\n\n/**\n * Sends data using http\n * @param request\n * @param url\n * @param headers\n * @param compression\n * @param userAgent\n * @param agent\n * @param data\n * @param onDone\n * @param timeoutMillis\n */\nexport function sendWithHttp(\n request: typeof https.request | typeof http.request,\n url: string,\n headers: Record<string, string>,\n compression: 'gzip' | 'none',\n userAgent: string | undefined,\n agent: http.Agent | https.Agent,\n data: Uint8Array,\n onDone: (response: ExportResponse) => void,\n timeoutMillis: number\n): void {\n const parsedUrl = new URL(url);\n\n if (userAgent) {\n headers['User-Agent'] = `${userAgent} ${DEFAULT_USER_AGENT}`;\n } else {\n headers['User-Agent'] = DEFAULT_USER_AGENT;\n }\n\n const options: http.RequestOptions | https.RequestOptions = {\n hostname: parsedUrl.hostname,\n port: parsedUrl.port,\n path: parsedUrl.pathname,\n method: 'POST',\n headers,\n agent,\n };\n\n const req = request(options, (res: http.IncomingMessage) => {\n const responseData: Buffer[] = [];\n res.on('data', chunk => responseData.push(chunk));\n\n res.on('end', () => {\n if (res.statusCode && res.statusCode <= 299) {\n onDone({\n status: 'success',\n data: Buffer.concat(responseData),\n });\n } else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {\n onDone({\n status: 'retryable',\n retryInMillis: parseRetryAfterToMills(res.headers['retry-after']),\n });\n } else {\n const error = new OTLPExporterError(\n res.statusMessage,\n res.statusCode,\n Buffer.concat(responseData).toString()\n );\n onDone({\n status: 'failure',\n error,\n });\n }\n });\n\n res.on('error', (error: Error) => {\n // Note: 'end' may still be emitted after 'error' on the same response object.\n // However, since onDone maps to a Promise resolve/reject, only the first call takes effect.\n // This will be addressed in https://github.com/open-telemetry/opentelemetry-js/issues/5990\n if (res.statusCode && res.statusCode <= 299) {\n // If the response is successful but an error occurs while reading the response,\n // we consider it a success since the data has been sent successfully.\n onDone({\n status: 'success',\n });\n } else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {\n onDone({\n status: 'retryable',\n error: error,\n retryInMillis: parseRetryAfterToMills(res.headers['retry-after']),\n });\n } else {\n onDone({\n status: 'failure',\n error,\n });\n }\n });\n });\n\n req.setTimeout(timeoutMillis, () => {\n req.destroy();\n onDone({\n status: 'retryable',\n error: new Error('Request timed out'),\n });\n });\n\n req.on('error', (error: Error) => {\n if (isHttpTransportNetworkErrorRetryable(error)) {\n onDone({\n status: 'retryable',\n error,\n });\n } else {\n onDone({\n status: 'failure',\n error,\n });\n }\n });\n\n compressAndSend(req, compression, data, (error: Error) => {\n onDone({\n status: 'failure',\n error,\n });\n });\n}\n\nexport function compressAndSend(\n req: http.ClientRequest,\n compression: 'gzip' | 'none',\n data: Uint8Array,\n onError: (error: Error) => void\n) {\n let dataStream = readableFromUint8Array(data);\n\n if (compression === 'gzip') {\n req.setHeader('Content-Encoding', 'gzip');\n dataStream = dataStream\n .on('error', onError)\n .pipe(zlib.createGzip())\n .on('error', onError);\n }\n\n dataStream.pipe(req).on('error', onError);\n}\n\nfunction readableFromUint8Array(buff: string | Uint8Array): Readable {\n const readable = new Readable();\n readable.push(buff);\n readable.push(null);\n\n return readable;\n}\n\nfunction isHttpTransportNetworkErrorRetryable(error: Error): boolean {\n const RETRYABLE_NETWORK_ERROR_CODES = new Set([\n 'ECONNRESET',\n 'ECONNREFUSED',\n 'EPIPE',\n 'ETIMEDOUT',\n 'EAI_AGAIN',\n 'ENOTFOUND',\n 'ENETUNREACH',\n 'EHOSTUNREACH',\n ]);\n\n if ('code' in error && typeof error.code === 'string') {\n return RETRYABLE_NETWORK_ERROR_CODES.has(error.code);\n }\n\n return false;\n}\n"]}
1
+ {"version":3,"file":"http-transport-utils.js","sourceRoot":"","sources":["../../../src/transport/http-transport-utils.ts"],"names":[],"mappings":";;;AAMA,6BAA6B;AAC7B,mCAAkC;AAElC,gEAGgC;AAChC,oCAA6C;AAC7C,wCAAqC;AAErC,MAAM,kBAAkB,GAAG,iCAAiC,iBAAO,EAAE,CAAC;AAEtE;;;;GAIG;AACU,QAAA,sBAAsB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtD;;;;;;;;;;GAUG;AACH,SAAgB,YAAY,CAC1B,OAAmD,EACnD,GAAW,EACX,OAA+B,EAC/B,WAA4B,EAC5B,SAA6B,EAC7B,KAA+B,EAC/B,IAAgB,EAChB,aAAqB;IAErB,OAAO,IAAI,OAAO,CAAiB,OAAO,CAAC,EAAE;QAC3C,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAE/B,IAAI,SAAS,EAAE;YACb,OAAO,CAAC,YAAY,CAAC,GAAG,GAAG,SAAS,IAAI,kBAAkB,EAAE,CAAC;SAC9D;aAAM;YACL,OAAO,CAAC,YAAY,CAAC,GAAG,kBAAkB,CAAC;SAC5C;QAED,MAAM,OAAO,GAA+C;YAC1D,QAAQ,EAAE,SAAS,CAAC,QAAQ;YAC5B,IAAI,EAAE,SAAS,CAAC,IAAI;YACpB,IAAI,EAAE,SAAS,CAAC,QAAQ;YACxB,MAAM,EAAE,MAAM;YACd,OAAO;YACP,KAAK;SACN,CAAC;QAEF,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,GAAyB,EAAE,EAAE;YACzD,MAAM,YAAY,GAAa,EAAE,CAAC;YAClC,IAAI,YAAY,GAAG,CAAC,CAAC;YACrB,GAAG,CA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AK,QAAQ,EAAE;QACrD,OAAO,6BAA6B,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;KACtD;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type * as http from 'http';\nimport type * as https from 'https';\nimport * as zlib from 'zlib';\nimport { Readable } from 'stream';\nimport type { ExportResponse } from '../export-response';\nimport {\n isExportHTTPErrorRetryable,\n parseRetryAfterToMills,\n} from '../is-export-retryable';\nimport { OTLPExporterError } from '../types';\nimport { VERSION } from '../version';\n\nconst DEFAULT_USER_AGENT = `OTel-OTLP-Exporter-JavaScript/${VERSION}`;\n\n/**\n * Maximum response body size (4 MB) that the HTTP transport will read.\n * If the server sends more data the connection is destroyed and the export\n * is treated as a non-retryable error regardless of status code.\n */\nexport const MAX_RESPONSE_BODY_SIZE = 4 * 1024 * 1024;\n\n/**\n * Sends data using http\n * @param request\n * @param url\n * @param headers\n * @param compression\n * @param userAgent\n * @param agent\n * @param data\n * @param timeoutMillis\n */\nexport function sendWithHttp(\n request: typeof https.request | typeof http.request,\n url: string,\n headers: Record<string, string>,\n compression: 'gzip' | 'none',\n userAgent: string | undefined,\n agent: http.Agent | https.Agent,\n data: Uint8Array,\n timeoutMillis: number\n): Promise<ExportResponse> {\n return new Promise<ExportResponse>(resolve => {\n const parsedUrl = new URL(url);\n\n if (userAgent) {\n headers['User-Agent'] = `${userAgent} ${DEFAULT_USER_AGENT}`;\n } else {\n headers['User-Agent'] = DEFAULT_USER_AGENT;\n }\n\n const options: http.RequestOptions | https.RequestOptions = {\n hostname: parsedUrl.hostname,\n port: parsedUrl.port,\n path: parsedUrl.pathname,\n method: 'POST',\n headers,\n agent,\n };\n\n const req = request(options, (res: http.IncomingMessage) => {\n const responseData: Buffer[] = [];\n let responseSize = 0;\n res.on('data', (chunk: Buffer) => {\n responseSize += chunk.length;\n if (responseSize > MAX_RESPONSE_BODY_SIZE) {\n const sizeError = new Error(\n `OTLP export response body exceeded size limit of ${MAX_RESPONSE_BODY_SIZE} bytes`\n );\n // Oversized responses are treated as non-retryable errors\n // regardless of status code.\n // Resolve before destroying: res.destroy() tears down the socket which\n // triggers ECONNRESET on req.on('error'), so, resolving first makes that\n // a no-op. res.on('error') does not fire because destroy() is called\n // without an error argument.\n resolve({ status: 'failure', error: sizeError });\n res.destroy();\n return;\n }\n responseData.push(chunk);\n });\n\n res.on('end', () => {\n if (res.statusCode && res.statusCode <= 299) {\n resolve({\n status: 'success',\n data: Buffer.concat(responseData),\n });\n } else if (\n res.statusCode &&\n isExportHTTPErrorRetryable(res.statusCode)\n ) {\n resolve({\n status: 'retryable',\n retryInMillis: parseRetryAfterToMills(res.headers['retry-after']),\n });\n } else {\n const error = new OTLPExporterError(\n res.statusMessage,\n res.statusCode,\n Buffer.concat(responseData).toString()\n );\n resolve({\n status: 'failure',\n error,\n });\n }\n });\n\n res.on('error', (error: Error) => {\n // Note: 'end' may still be emitted after 'error' on the same response object, since we're resolving a promise,\n // the first call to resolve() will determine the final state.\n if (res.statusCode && res.statusCode <= 299) {\n // If the response is successful but an error occurs while reading the response,\n // we consider it a success since the data has been sent successfully.\n resolve({\n status: 'success',\n });\n } else if (\n res.statusCode &&\n isExportHTTPErrorRetryable(res.statusCode)\n ) {\n resolve({\n status: 'retryable',\n error: error,\n retryInMillis: parseRetryAfterToMills(res.headers['retry-after']),\n });\n } else {\n resolve({\n status: 'failure',\n error,\n });\n }\n });\n });\n\n req.setTimeout(timeoutMillis, () => {\n req.destroy();\n resolve({\n status: 'retryable',\n error: new Error('Request timed out'),\n });\n });\n\n req.on('error', (error: Error) => {\n if (isHttpTransportNetworkErrorRetryable(error)) {\n resolve({\n status: 'retryable',\n error,\n });\n } else {\n resolve({\n status: 'failure',\n error,\n });\n }\n });\n\n compressAndSend(req, compression, data, (error: Error) => {\n resolve({\n status: 'failure',\n error,\n });\n });\n });\n}\n\nexport function compressAndSend(\n req: http.ClientRequest,\n compression: 'gzip' | 'none',\n data: Uint8Array,\n onError: (error: Error) => void\n) {\n let dataStream = readableFromUint8Array(data);\n\n if (compression === 'gzip') {\n req.setHeader('Content-Encoding', 'gzip');\n dataStream = dataStream\n .on('error', onError)\n .pipe(zlib.createGzip())\n .on('error', onError);\n }\n\n dataStream.pipe(req).on('error', onError);\n}\n\nfunction readableFromUint8Array(buff: string | Uint8Array): Readable {\n const readable = new Readable();\n readable.push(buff);\n readable.push(null);\n\n return readable;\n}\n\nfunction isHttpTransportNetworkErrorRetryable(error: Error): boolean {\n const RETRYABLE_NETWORK_ERROR_CODES = new Set([\n 'ECONNRESET',\n 'ECONNREFUSED',\n 'EPIPE',\n 'ETIMEDOUT',\n 'EAI_AGAIN',\n 'ENOTFOUND',\n 'ENETUNREACH',\n 'EHOSTUNREACH',\n ]);\n\n if ('code' in error && typeof error.code === 'string') {\n return RETRYABLE_NETWORK_ERROR_CODES.has(error.code);\n }\n\n return false;\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { HttpAgentFactory } from '../configuration/otlp-node-http-configuration';
2
- import { HttpRequestParameters } from './http-transport-types';
1
+ import type { HttpAgentFactory } from '../configuration/otlp-node-http-configuration';
2
+ import type { HttpRequestParameters } from './http-transport-types';
3
3
  export interface NodeHttpRequestParameters extends HttpRequestParameters {
4
4
  agentFactory: HttpAgentFactory;
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"node-http-transport-types.js","sourceRoot":"","sources":["../../../src/transport/node-http-transport-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { HttpAgentFactory } from '../configuration/otlp-node-http-configuration';\nimport { HttpRequestParameters } from './http-transport-types';\n\nexport interface NodeHttpRequestParameters extends HttpRequestParameters {\n agentFactory: HttpAgentFactory;\n}\n"]}
1
+ {"version":3,"file":"node-http-transport-types.js","sourceRoot":"","sources":["../../../src/transport/node-http-transport-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { HttpAgentFactory } from '../configuration/otlp-node-http-configuration';\nimport type { HttpRequestParameters } from './http-transport-types';\n\nexport interface NodeHttpRequestParameters extends HttpRequestParameters {\n agentFactory: HttpAgentFactory;\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.213.0";
1
+ export declare const VERSION = "0.215.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,21 +1,10 @@
1
1
  "use strict";
2
2
  /*
3
3
  * Copyright The OpenTelemetry Authors
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * https://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
4
+ * SPDX-License-Identifier: Apache-2.0
16
5
  */
17
6
  Object.defineProperty(exports, "__esModule", { value: true });
18
7
  exports.VERSION = void 0;
19
8
  // this is autogenerated file, see scripts/version-update.js
20
- exports.VERSION = '0.213.0';
9
+ exports.VERSION = '0.215.0';
21
10
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,SAAS,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.213.0';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,SAAS,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.215.0';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentelemetry/otlp-exporter-base",
3
- "version": "0.213.0",
3
+ "version": "0.215.0",
4
4
  "description": "OpenTelemetry OTLP Exporter base (for internal use only)",
5
5
  "main": "build/src/index.js",
6
6
  "module": "build/esm/index.js",
@@ -74,13 +74,13 @@
74
74
  "access": "public"
75
75
  },
76
76
  "dependencies": {
77
- "@opentelemetry/core": "2.6.0",
78
- "@opentelemetry/otlp-transformer": "0.213.0"
77
+ "@opentelemetry/core": "2.7.0",
78
+ "@opentelemetry/otlp-transformer": "0.215.0"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@babel/core": "7.27.1",
82
82
  "@babel/preset-env": "7.27.2",
83
- "@opentelemetry/api": "1.9.0",
83
+ "@opentelemetry/api": "1.9.1",
84
84
  "@types/mocha": "10.0.10",
85
85
  "@types/node": "18.19.130",
86
86
  "@types/sinon": "17.0.4",
@@ -97,12 +97,12 @@
97
97
  "ts-loader": "9.5.4",
98
98
  "typescript": "5.0.4",
99
99
  "webpack": "5.104.1",
100
- "webpack-cli": "6.0.1"
100
+ "webpack-cli": "7.0.2"
101
101
  },
102
102
  "peerDependencies": {
103
103
  "@opentelemetry/api": "^1.3.0"
104
104
  },
105
105
  "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/otlp-exporter-base",
106
106
  "sideEffects": false,
107
- "gitHead": "541e1b4ad83ad2093459794a18283228fe58d199"
107
+ "gitHead": "a0476eef3cb973bfcc0c2e41f868dd7b484c2ed8"
108
108
  }