@opentelemetry/otlp-exporter-base 0.212.0 → 0.214.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/esm/OTLPExporterBase.d.ts +2 -2
- package/build/esm/OTLPExporterBase.js +1 -12
- package/build/esm/OTLPExporterBase.js.map +1 -1
- package/build/esm/bounded-queue-export-promise-handler.js +1 -12
- package/build/esm/bounded-queue-export-promise-handler.js.map +1 -1
- package/build/esm/configuration/convert-legacy-browser-http-options.d.ts +2 -2
- package/build/esm/configuration/convert-legacy-browser-http-options.js +0 -15
- package/build/esm/configuration/convert-legacy-browser-http-options.js.map +1 -1
- package/build/esm/configuration/convert-legacy-http-options.d.ts +2 -2
- package/build/esm/configuration/convert-legacy-http-options.js +1 -12
- package/build/esm/configuration/convert-legacy-http-options.js.map +1 -1
- package/build/esm/configuration/convert-legacy-node-http-options.d.ts +2 -2
- package/build/esm/configuration/convert-legacy-node-http-options.js.map +1 -1
- package/build/esm/configuration/create-legacy-browser-delegate.d.ts +3 -5
- package/build/esm/configuration/create-legacy-browser-delegate.js +2 -9
- package/build/esm/configuration/create-legacy-browser-delegate.js.map +1 -1
- package/build/esm/configuration/legacy-base-configuration.d.ts +1 -1
- package/build/esm/configuration/legacy-base-configuration.js.map +1 -1
- package/build/esm/configuration/legacy-node-configuration.js +1 -12
- package/build/esm/configuration/legacy-node-configuration.js.map +1 -1
- package/build/esm/configuration/otlp-http-configuration.d.ts +1 -1
- package/build/esm/configuration/otlp-http-configuration.js +1 -12
- package/build/esm/configuration/otlp-http-configuration.js.map +1 -1
- package/build/esm/configuration/otlp-node-http-configuration.d.ts +1 -1
- package/build/esm/configuration/otlp-node-http-configuration.js +0 -15
- package/build/esm/configuration/otlp-node-http-configuration.js.map +1 -1
- package/build/esm/configuration/otlp-node-http-env-configuration.d.ts +1 -1
- package/build/esm/configuration/otlp-node-http-env-configuration.js +2 -13
- package/build/esm/configuration/otlp-node-http-env-configuration.js.map +1 -1
- package/build/esm/configuration/shared-configuration.d.ts +1 -1
- package/build/esm/configuration/shared-configuration.js +1 -12
- package/build/esm/configuration/shared-configuration.js.map +1 -1
- package/build/esm/configuration/shared-env-configuration.d.ts +1 -1
- package/build/esm/configuration/shared-env-configuration.js +1 -12
- package/build/esm/configuration/shared-env-configuration.js.map +1 -1
- package/build/esm/export-response.js +1 -12
- package/build/esm/export-response.js.map +1 -1
- package/build/esm/exporter-transport.d.ts +1 -1
- package/build/esm/exporter-transport.js +1 -12
- package/build/esm/exporter-transport.js.map +1 -1
- package/build/esm/index-browser-http.d.ts +3 -0
- package/build/esm/index-browser-http.js +4 -12
- package/build/esm/index-browser-http.js.map +1 -1
- package/build/esm/index-node-http.js +1 -12
- package/build/esm/index-node-http.js.map +1 -1
- package/build/esm/index.js +1 -12
- package/build/esm/index.js.map +1 -1
- package/build/esm/is-export-retryable.js +1 -12
- package/build/esm/is-export-retryable.js.map +1 -1
- package/build/esm/logging-response-handler.d.ts +1 -1
- package/build/esm/logging-response-handler.js +1 -12
- package/build/esm/logging-response-handler.js.map +1 -1
- package/build/esm/otlp-browser-http-export-delegate.d.ts +6 -3
- package/build/esm/otlp-browser-http-export-delegate.js +4 -7
- package/build/esm/otlp-browser-http-export-delegate.js.map +1 -1
- package/build/esm/otlp-export-delegate.d.ts +4 -4
- package/build/esm/otlp-export-delegate.js +1 -12
- package/build/esm/otlp-export-delegate.js.map +1 -1
- package/build/esm/otlp-http-export-delegate.d.ts +3 -3
- package/build/esm/otlp-http-export-delegate.js +1 -16
- package/build/esm/otlp-http-export-delegate.js.map +1 -1
- package/build/esm/otlp-network-export-delegate.d.ts +4 -4
- package/build/esm/otlp-network-export-delegate.js +2 -13
- package/build/esm/otlp-network-export-delegate.js.map +1 -1
- package/build/esm/response-handler.js +1 -12
- package/build/esm/response-handler.js.map +1 -1
- package/build/esm/retrying-transport.d.ts +1 -1
- package/build/esm/retrying-transport.js +1 -12
- package/build/esm/retrying-transport.js.map +1 -1
- package/build/esm/transport/fetch-transport.d.ts +2 -2
- package/build/esm/transport/fetch-transport.js +52 -18
- package/build/esm/transport/fetch-transport.js.map +1 -1
- package/build/esm/transport/http-exporter-transport.d.ts +2 -2
- package/build/esm/transport/http-exporter-transport.js +2 -17
- package/build/esm/transport/http-exporter-transport.js.map +1 -1
- package/build/esm/transport/http-transport-types.d.ts +1 -1
- package/build/esm/transport/http-transport-types.js +1 -12
- package/build/esm/transport/http-transport-types.js.map +1 -1
- package/build/esm/transport/http-transport-utils.d.ts +6 -4
- package/build/esm/transport/http-transport-utils.js +86 -56
- package/build/esm/transport/http-transport-utils.js.map +1 -1
- package/build/esm/transport/node-http-transport-types.d.ts +2 -2
- package/build/esm/transport/node-http-transport-types.js +1 -12
- package/build/esm/transport/node-http-transport-types.js.map +1 -1
- package/build/esm/types.js +1 -12
- package/build/esm/types.js.map +1 -1
- package/build/esm/util.js +1 -12
- package/build/esm/util.js.map +1 -1
- package/build/esm/version.d.ts +1 -1
- package/build/esm/version.js +2 -13
- package/build/esm/version.js.map +1 -1
- package/build/esnext/OTLPExporterBase.d.ts +2 -2
- package/build/esnext/OTLPExporterBase.js +1 -12
- package/build/esnext/OTLPExporterBase.js.map +1 -1
- package/build/esnext/bounded-queue-export-promise-handler.js +1 -12
- package/build/esnext/bounded-queue-export-promise-handler.js.map +1 -1
- package/build/esnext/configuration/convert-legacy-browser-http-options.d.ts +2 -2
- package/build/esnext/configuration/convert-legacy-browser-http-options.js +0 -15
- package/build/esnext/configuration/convert-legacy-browser-http-options.js.map +1 -1
- package/build/esnext/configuration/convert-legacy-http-options.d.ts +2 -2
- package/build/esnext/configuration/convert-legacy-http-options.js +1 -12
- package/build/esnext/configuration/convert-legacy-http-options.js.map +1 -1
- package/build/esnext/configuration/convert-legacy-node-http-options.d.ts +2 -2
- package/build/esnext/configuration/convert-legacy-node-http-options.js.map +1 -1
- package/build/esnext/configuration/create-legacy-browser-delegate.d.ts +3 -5
- package/build/esnext/configuration/create-legacy-browser-delegate.js +2 -9
- package/build/esnext/configuration/create-legacy-browser-delegate.js.map +1 -1
- package/build/esnext/configuration/legacy-base-configuration.d.ts +1 -1
- package/build/esnext/configuration/legacy-base-configuration.js.map +1 -1
- package/build/esnext/configuration/legacy-node-configuration.js +1 -12
- package/build/esnext/configuration/legacy-node-configuration.js.map +1 -1
- package/build/esnext/configuration/otlp-http-configuration.d.ts +1 -1
- package/build/esnext/configuration/otlp-http-configuration.js +1 -12
- package/build/esnext/configuration/otlp-http-configuration.js.map +1 -1
- package/build/esnext/configuration/otlp-node-http-configuration.d.ts +1 -1
- package/build/esnext/configuration/otlp-node-http-configuration.js +0 -15
- package/build/esnext/configuration/otlp-node-http-configuration.js.map +1 -1
- package/build/esnext/configuration/otlp-node-http-env-configuration.d.ts +1 -1
- package/build/esnext/configuration/otlp-node-http-env-configuration.js +2 -13
- package/build/esnext/configuration/otlp-node-http-env-configuration.js.map +1 -1
- package/build/esnext/configuration/shared-configuration.d.ts +1 -1
- package/build/esnext/configuration/shared-configuration.js +1 -12
- package/build/esnext/configuration/shared-configuration.js.map +1 -1
- package/build/esnext/configuration/shared-env-configuration.d.ts +1 -1
- package/build/esnext/configuration/shared-env-configuration.js +1 -12
- package/build/esnext/configuration/shared-env-configuration.js.map +1 -1
- package/build/esnext/export-response.js +1 -12
- package/build/esnext/export-response.js.map +1 -1
- package/build/esnext/exporter-transport.d.ts +1 -1
- package/build/esnext/exporter-transport.js +1 -12
- package/build/esnext/exporter-transport.js.map +1 -1
- package/build/esnext/index-browser-http.d.ts +3 -0
- package/build/esnext/index-browser-http.js +4 -12
- package/build/esnext/index-browser-http.js.map +1 -1
- package/build/esnext/index-node-http.js +1 -12
- package/build/esnext/index-node-http.js.map +1 -1
- package/build/esnext/index.js +1 -12
- package/build/esnext/index.js.map +1 -1
- package/build/esnext/is-export-retryable.js +1 -12
- package/build/esnext/is-export-retryable.js.map +1 -1
- package/build/esnext/logging-response-handler.d.ts +1 -1
- package/build/esnext/logging-response-handler.js +1 -12
- package/build/esnext/logging-response-handler.js.map +1 -1
- package/build/esnext/otlp-browser-http-export-delegate.d.ts +6 -3
- package/build/esnext/otlp-browser-http-export-delegate.js +4 -7
- package/build/esnext/otlp-browser-http-export-delegate.js.map +1 -1
- package/build/esnext/otlp-export-delegate.d.ts +4 -4
- package/build/esnext/otlp-export-delegate.js +1 -12
- package/build/esnext/otlp-export-delegate.js.map +1 -1
- package/build/esnext/otlp-http-export-delegate.d.ts +3 -3
- package/build/esnext/otlp-http-export-delegate.js +1 -16
- package/build/esnext/otlp-http-export-delegate.js.map +1 -1
- package/build/esnext/otlp-network-export-delegate.d.ts +4 -4
- package/build/esnext/otlp-network-export-delegate.js +2 -13
- package/build/esnext/otlp-network-export-delegate.js.map +1 -1
- package/build/esnext/response-handler.js +1 -12
- package/build/esnext/response-handler.js.map +1 -1
- package/build/esnext/retrying-transport.d.ts +1 -1
- package/build/esnext/retrying-transport.js +1 -12
- package/build/esnext/retrying-transport.js.map +1 -1
- package/build/esnext/transport/fetch-transport.d.ts +2 -2
- package/build/esnext/transport/fetch-transport.js +52 -18
- package/build/esnext/transport/fetch-transport.js.map +1 -1
- package/build/esnext/transport/http-exporter-transport.d.ts +2 -2
- package/build/esnext/transport/http-exporter-transport.js +2 -17
- package/build/esnext/transport/http-exporter-transport.js.map +1 -1
- package/build/esnext/transport/http-transport-types.d.ts +1 -1
- package/build/esnext/transport/http-transport-types.js +1 -12
- package/build/esnext/transport/http-transport-types.js.map +1 -1
- package/build/esnext/transport/http-transport-utils.d.ts +6 -4
- package/build/esnext/transport/http-transport-utils.js +86 -56
- package/build/esnext/transport/http-transport-utils.js.map +1 -1
- package/build/esnext/transport/node-http-transport-types.d.ts +2 -2
- package/build/esnext/transport/node-http-transport-types.js +1 -12
- package/build/esnext/transport/node-http-transport-types.js.map +1 -1
- package/build/esnext/types.js +1 -12
- package/build/esnext/types.js.map +1 -1
- package/build/esnext/util.js +1 -12
- package/build/esnext/util.js.map +1 -1
- package/build/esnext/version.d.ts +1 -1
- package/build/esnext/version.js +2 -13
- package/build/esnext/version.js.map +1 -1
- package/build/src/OTLPExporterBase.d.ts +2 -2
- package/build/src/OTLPExporterBase.js +1 -12
- package/build/src/OTLPExporterBase.js.map +1 -1
- package/build/src/bounded-queue-export-promise-handler.js +1 -12
- package/build/src/bounded-queue-export-promise-handler.js.map +1 -1
- package/build/src/configuration/convert-legacy-browser-http-options.d.ts +2 -2
- package/build/src/configuration/convert-legacy-browser-http-options.js +0 -15
- package/build/src/configuration/convert-legacy-browser-http-options.js.map +1 -1
- package/build/src/configuration/convert-legacy-http-options.d.ts +2 -2
- package/build/src/configuration/convert-legacy-http-options.js +1 -12
- package/build/src/configuration/convert-legacy-http-options.js.map +1 -1
- package/build/src/configuration/convert-legacy-node-http-options.d.ts +2 -2
- package/build/src/configuration/convert-legacy-node-http-options.js.map +1 -1
- package/build/src/configuration/create-legacy-browser-delegate.d.ts +3 -5
- package/build/src/configuration/create-legacy-browser-delegate.js +2 -10
- package/build/src/configuration/create-legacy-browser-delegate.js.map +1 -1
- package/build/src/configuration/legacy-base-configuration.d.ts +1 -1
- package/build/src/configuration/legacy-base-configuration.js.map +1 -1
- package/build/src/configuration/legacy-node-configuration.js +1 -12
- package/build/src/configuration/legacy-node-configuration.js.map +1 -1
- package/build/src/configuration/otlp-http-configuration.d.ts +1 -1
- package/build/src/configuration/otlp-http-configuration.js +1 -12
- package/build/src/configuration/otlp-http-configuration.js.map +1 -1
- package/build/src/configuration/otlp-node-http-configuration.d.ts +1 -1
- package/build/src/configuration/otlp-node-http-configuration.js +0 -15
- package/build/src/configuration/otlp-node-http-configuration.js.map +1 -1
- package/build/src/configuration/otlp-node-http-env-configuration.d.ts +1 -1
- package/build/src/configuration/otlp-node-http-env-configuration.js +1 -12
- package/build/src/configuration/otlp-node-http-env-configuration.js.map +1 -1
- package/build/src/configuration/shared-configuration.d.ts +1 -1
- package/build/src/configuration/shared-configuration.js +1 -12
- package/build/src/configuration/shared-configuration.js.map +1 -1
- package/build/src/configuration/shared-env-configuration.d.ts +1 -1
- package/build/src/configuration/shared-env-configuration.js +1 -12
- package/build/src/configuration/shared-env-configuration.js.map +1 -1
- package/build/src/export-response.js +1 -12
- package/build/src/export-response.js.map +1 -1
- package/build/src/exporter-transport.d.ts +1 -1
- package/build/src/exporter-transport.js +1 -12
- package/build/src/exporter-transport.js.map +1 -1
- package/build/src/index-browser-http.d.ts +3 -0
- package/build/src/index-browser-http.js +4 -12
- package/build/src/index-browser-http.js.map +1 -1
- package/build/src/index-node-http.js +1 -12
- package/build/src/index-node-http.js.map +1 -1
- package/build/src/index.js +1 -12
- package/build/src/index.js.map +1 -1
- package/build/src/is-export-retryable.js +1 -12
- package/build/src/is-export-retryable.js.map +1 -1
- package/build/src/logging-response-handler.d.ts +1 -1
- package/build/src/logging-response-handler.js +1 -12
- package/build/src/logging-response-handler.js.map +1 -1
- package/build/src/otlp-browser-http-export-delegate.d.ts +6 -3
- package/build/src/otlp-browser-http-export-delegate.js +4 -7
- package/build/src/otlp-browser-http-export-delegate.js.map +1 -1
- package/build/src/otlp-export-delegate.d.ts +4 -4
- package/build/src/otlp-export-delegate.js +1 -12
- package/build/src/otlp-export-delegate.js.map +1 -1
- package/build/src/otlp-http-export-delegate.d.ts +3 -3
- package/build/src/otlp-http-export-delegate.js +0 -15
- package/build/src/otlp-http-export-delegate.js.map +1 -1
- package/build/src/otlp-network-export-delegate.d.ts +4 -4
- package/build/src/otlp-network-export-delegate.js +1 -12
- package/build/src/otlp-network-export-delegate.js.map +1 -1
- package/build/src/response-handler.js +1 -12
- package/build/src/response-handler.js.map +1 -1
- package/build/src/retrying-transport.d.ts +1 -1
- package/build/src/retrying-transport.js +1 -12
- package/build/src/retrying-transport.js.map +1 -1
- package/build/src/transport/fetch-transport.d.ts +2 -2
- package/build/src/transport/fetch-transport.js +52 -18
- package/build/src/transport/fetch-transport.js.map +1 -1
- package/build/src/transport/http-exporter-transport.d.ts +2 -2
- package/build/src/transport/http-exporter-transport.js +2 -17
- package/build/src/transport/http-exporter-transport.js.map +1 -1
- package/build/src/transport/http-transport-types.d.ts +1 -1
- package/build/src/transport/http-transport-types.js +1 -12
- package/build/src/transport/http-transport-types.js.map +1 -1
- package/build/src/transport/http-transport-utils.d.ts +6 -4
- package/build/src/transport/http-transport-utils.js +86 -56
- package/build/src/transport/http-transport-utils.js.map +1 -1
- package/build/src/transport/node-http-transport-types.d.ts +2 -2
- package/build/src/transport/node-http-transport-types.js +1 -12
- package/build/src/transport/node-http-transport-types.js.map +1 -1
- package/build/src/types.js +1 -12
- package/build/src/types.js.map +1 -1
- package/build/src/util.js +1 -12
- package/build/src/util.js.map +1 -1
- package/build/src/version.d.ts +1 -1
- package/build/src/version.js +2 -13
- package/build/src/version.js.map +1 -1
- package/package.json +6 -6
- package/build/esm/transport/send-beacon-transport.d.ts +0 -12
- package/build/esm/transport/send-beacon-transport.js +0 -47
- package/build/esm/transport/send-beacon-transport.js.map +0 -1
- package/build/esnext/transport/send-beacon-transport.d.ts +0 -12
- package/build/esnext/transport/send-beacon-transport.js +0 -47
- package/build/esnext/transport/send-beacon-transport.js.map +0 -1
- package/build/src/transport/send-beacon-transport.d.ts +0 -12
- package/build/src/transport/send-beacon-transport.js +0 -51
- package/build/src/transport/send-beacon-transport.js.map +0 -1
|
@@ -1,20 +1,33 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright The OpenTelemetry Authors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
15
4
|
*/
|
|
16
5
|
import { diag } from '@opentelemetry/api';
|
|
17
6
|
import { isExportHTTPErrorRetryable, parseRetryAfterToMills, } from '../is-export-retryable';
|
|
7
|
+
/**
|
|
8
|
+
* Maximum total body size for concurrent keepalive requests.
|
|
9
|
+
* Browsers enforce a 64KiB cumulative limit across all pending keepalive requests.
|
|
10
|
+
* We use 60KB to leave headroom for headers.
|
|
11
|
+
* @see https://github.com/whatwg/fetch/issues/679
|
|
12
|
+
* @see https://blog.huli.tw/2025/01/06/en/navigator-sendbeacon-64kib-and-source-code/
|
|
13
|
+
*/
|
|
14
|
+
const MAX_KEEPALIVE_BODY_SIZE = 60 * 1024;
|
|
15
|
+
/**
|
|
16
|
+
* Maximum concurrent keepalive requests.
|
|
17
|
+
* Chrome enforces 9 concurrent keepalive fetch requests per renderer process.
|
|
18
|
+
* @see https://github.com/whatwg/fetch/issues/679
|
|
19
|
+
* Quote: "If the renderer process is processing more than 9 requests with keepalive set, we reject a new request"
|
|
20
|
+
*/
|
|
21
|
+
const MAX_KEEPALIVE_REQUESTS = 9;
|
|
22
|
+
/**
|
|
23
|
+
* Track cumulative pending body size across all in-flight keepalive requests.
|
|
24
|
+
* This is necessary because the 64KiB limit is cumulative, not per-request.
|
|
25
|
+
*/
|
|
26
|
+
let pendingBodySize = 0;
|
|
27
|
+
/**
|
|
28
|
+
* Track number of pending keepalive requests.
|
|
29
|
+
*/
|
|
30
|
+
let pendingKeepaliveCount = 0;
|
|
18
31
|
class FetchTransport {
|
|
19
32
|
_parameters;
|
|
20
33
|
constructor(parameters) {
|
|
@@ -35,37 +48,53 @@ class FetchTransport {
|
|
|
35
48
|
// @ts-expect-error -- fetch could be wrapped
|
|
36
49
|
fetchApi = fetchApi.__original;
|
|
37
50
|
}
|
|
51
|
+
const requestSize = data.byteLength;
|
|
52
|
+
// Determine if we can use keepalive based on cumulative browser limits.
|
|
53
|
+
// We must check BEFORE adding to pending totals to avoid exceeding limits.
|
|
54
|
+
const wouldExceedSize = pendingBodySize + requestSize > MAX_KEEPALIVE_BODY_SIZE;
|
|
55
|
+
const wouldExceedCount = pendingKeepaliveCount >= MAX_KEEPALIVE_REQUESTS;
|
|
56
|
+
const useKeepalive = !wouldExceedSize && !wouldExceedCount;
|
|
57
|
+
if (useKeepalive) {
|
|
58
|
+
pendingBodySize += requestSize;
|
|
59
|
+
pendingKeepaliveCount++;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const reason = wouldExceedSize ? 'size limit' : 'count limit';
|
|
63
|
+
diag.debug(`keepalive disabled: ${(requestSize / 1024).toFixed(1)}KB payload, ${pendingKeepaliveCount} pending (${reason})`);
|
|
64
|
+
}
|
|
38
65
|
try {
|
|
39
|
-
const isBrowserEnvironment = !!globalThis.location;
|
|
40
66
|
const url = new URL(this._parameters.url);
|
|
41
67
|
const response = await fetchApi(url.href, {
|
|
42
68
|
method: 'POST',
|
|
43
69
|
headers: await this._parameters.headers(),
|
|
44
70
|
body: data,
|
|
45
71
|
signal: abortController.signal,
|
|
46
|
-
keepalive:
|
|
47
|
-
mode:
|
|
48
|
-
? globalThis.location
|
|
72
|
+
keepalive: useKeepalive,
|
|
73
|
+
mode: globalThis.location
|
|
74
|
+
? globalThis.location.origin === url.origin
|
|
49
75
|
? 'same-origin'
|
|
50
76
|
: 'cors'
|
|
51
77
|
: 'no-cors',
|
|
52
78
|
});
|
|
53
79
|
if (response.status >= 200 && response.status <= 299) {
|
|
54
|
-
diag.debug(
|
|
80
|
+
diag.debug(`export response success (status: ${response.status})`);
|
|
55
81
|
return { status: 'success' };
|
|
56
82
|
}
|
|
57
83
|
else if (isExportHTTPErrorRetryable(response.status)) {
|
|
84
|
+
diag.warn(`export response retryable (status: ${response.status})`);
|
|
58
85
|
const retryAfter = response.headers.get('Retry-After');
|
|
59
86
|
const retryInMillis = parseRetryAfterToMills(retryAfter);
|
|
60
87
|
return { status: 'retryable', retryInMillis };
|
|
61
88
|
}
|
|
89
|
+
diag.error(`export response failure (status: ${response.status})`);
|
|
62
90
|
return {
|
|
63
91
|
status: 'failure',
|
|
64
|
-
error: new Error(
|
|
92
|
+
error: new Error(`Fetch request failed with non-retryable status ${response.status}`),
|
|
65
93
|
};
|
|
66
94
|
}
|
|
67
95
|
catch (error) {
|
|
68
96
|
if (isFetchNetworkErrorRetryable(error)) {
|
|
97
|
+
diag.warn(`export request retryable (network error: ${error})`);
|
|
69
98
|
return {
|
|
70
99
|
status: 'retryable',
|
|
71
100
|
error: new Error('Fetch request encountered a network error', {
|
|
@@ -73,6 +102,7 @@ class FetchTransport {
|
|
|
73
102
|
}),
|
|
74
103
|
};
|
|
75
104
|
}
|
|
105
|
+
diag.error(`export request failure (error: ${error})`);
|
|
76
106
|
return {
|
|
77
107
|
status: 'failure',
|
|
78
108
|
error: new Error('Fetch request errored', { cause: error }),
|
|
@@ -80,6 +110,10 @@ class FetchTransport {
|
|
|
80
110
|
}
|
|
81
111
|
finally {
|
|
82
112
|
clearTimeout(timeout);
|
|
113
|
+
if (useKeepalive) {
|
|
114
|
+
pendingBodySize -= requestSize;
|
|
115
|
+
pendingKeepaliveCount--;
|
|
116
|
+
}
|
|
83
117
|
}
|
|
84
118
|
}
|
|
85
119
|
shutdown() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-transport.js","sourceRoot":"","sources":["../../../src/transport/fetch-transport.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"fetch-transport.js","sourceRoot":"","sources":["../../../src/transport/fetch-transport.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAGhC;;;;;;GAMG;AACH,MAAM,uBAAuB,GAAG,EAAE,GAAG,IAAI,CAAC;AAE1C;;;;;GA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Q,CAAC,MAAM,GAAG,CAAC,CAAC;YACnE,OAAO;gBACL,MAAM,EAAE,SAAS;gBACjB,KAAK,EAAE,IAAI,KAAK,CACd,kDAAkD,QAAQ,CAAC,MAAM,EAAE,CACpE;aACF,CAAC;SACH;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,4BAA4B,CAAC,KAAK,CAAC,EAAE;gBACvC,IAAI,CAAC,IAAI,CAAC,4CAA4C,KAAK,GAAG,CAAC,CAAC;gBAChE,OAAO;oBACL,MAAM,EAAE,WAAW;oBACnB,KAAK,EAAE,IAAI,KAAK,CAAC,2CAA2C,EAAE;wBAC5D,KAAK,EAAE,KAAK;qBACb,CAAC;iBACH,CAAC;aACH;YACD,IAAI,CAAC,KAAK,CAAC,kCAAkC,KAAK,GAAG,CAAC,CAAC;YACvD,OAAO;gBACL,MAAM,EAAE,SAAS;gBACjB,KAAK,EAAE,IAAI,KAAK,CAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;aAC5D,CAAC;SACH;gBAAS;YACR,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,IAAI,YAAY,EAAE;gBAChB,eAAe,IAAI,WAAW,CAAC;gBAC/B,qBAAqB,EAAE,CAAC;aACzB;SACF;IACH,CAAC;IAED,QAAQ;QACN,2CAA2C;IAC7C,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAAoC;IAEpC,OAAO,IAAI,cAAc,CAAC,UAAU,CAAC,CAAC;AACxC,CAAC;AAED,SAAS,4BAA4B,CAAC,KAAc;IAClD,OAAO,KAAK,YAAY,SAAS,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;AACpD,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { IExporterTransport } from '../exporter-transport';\nimport type { ExportResponse } from '../export-response';\nimport { diag } from '@opentelemetry/api';\nimport {\n isExportHTTPErrorRetryable,\n parseRetryAfterToMills,\n} from '../is-export-retryable';\nimport type { HeadersFactory } from '../configuration/otlp-http-configuration';\n\n/**\n * Maximum total body size for concurrent keepalive requests.\n * Browsers enforce a 64KiB cumulative limit across all pending keepalive requests.\n * We use 60KB to leave headroom for headers.\n * @see https://github.com/whatwg/fetch/issues/679\n * @see https://blog.huli.tw/2025/01/06/en/navigator-sendbeacon-64kib-and-source-code/\n */\nconst MAX_KEEPALIVE_BODY_SIZE = 60 * 1024;\n\n/**\n * Maximum concurrent keepalive requests.\n * Chrome enforces 9 concurrent keepalive fetch requests per renderer process.\n * @see https://github.com/whatwg/fetch/issues/679\n * Quote: \"If the renderer process is processing more than 9 requests with keepalive set, we reject a new request\"\n */\nconst MAX_KEEPALIVE_REQUESTS = 9;\n\n/**\n * Track cumulative pending body size across all in-flight keepalive requests.\n * This is necessary because the 64KiB limit is cumulative, not per-request.\n */\nlet pendingBodySize = 0;\n\n/**\n * Track number of pending keepalive requests.\n */\nlet pendingKeepaliveCount = 0;\n\nexport interface FetchTransportParameters {\n url: string;\n headers: HeadersFactory;\n}\n\nclass FetchTransport implements IExporterTransport {\n private _parameters: FetchTransportParameters;\n\n constructor(parameters: FetchTransportParameters) {\n this._parameters = parameters;\n }\n\n async send(data: Uint8Array, timeoutMillis: number): Promise<ExportResponse> {\n const abortController = new AbortController();\n const timeout = setTimeout(() => abortController.abort(), timeoutMillis);\n // Fetch API may be wrapped by an instrumentation like `@opentelemetry/instrumentation-fetch`.\n // In that case the instrumentation would create a new Span for this request\n // because the context manager cannot keep the context after `await` calls.\n // This creates an indirect endless loop Export -> Span -> Export\n // By using the `__original` function the instrumentation can't intercept the call\n // and no Span will be created breaking the vicious cycle\n let fetchApi = globalThis.fetch;\n // @ts-expect-error -- fetch could be wrapped\n if (typeof fetchApi.__original === 'function') {\n // @ts-expect-error -- fetch could be wrapped\n fetchApi = fetchApi.__original;\n }\n\n const requestSize = data.byteLength;\n\n // Determine if we can use keepalive based on cumulative browser limits.\n // We must check BEFORE adding to pending totals to avoid exceeding limits.\n const wouldExceedSize =\n pendingBodySize + requestSize > MAX_KEEPALIVE_BODY_SIZE;\n const wouldExceedCount = pendingKeepaliveCount >= MAX_KEEPALIVE_REQUESTS;\n const useKeepalive = !wouldExceedSize && !wouldExceedCount;\n\n if (useKeepalive) {\n pendingBodySize += requestSize;\n pendingKeepaliveCount++;\n } else {\n const reason = wouldExceedSize ? 'size limit' : 'count limit';\n diag.debug(\n `keepalive disabled: ${(requestSize / 1024).toFixed(1)}KB payload, ${pendingKeepaliveCount} pending (${reason})`\n );\n }\n\n try {\n const url = new URL(this._parameters.url);\n const response = await fetchApi(url.href, {\n method: 'POST',\n headers: await this._parameters.headers(),\n body: data,\n signal: abortController.signal,\n keepalive: useKeepalive,\n mode: globalThis.location\n ? globalThis.location.origin === url.origin\n ? 'same-origin'\n : 'cors'\n : 'no-cors',\n });\n\n if (response.status >= 200 && response.status <= 299) {\n diag.debug(`export response success (status: ${response.status})`);\n return { status: 'success' };\n } else if (isExportHTTPErrorRetryable(response.status)) {\n diag.warn(`export response retryable (status: ${response.status})`);\n const retryAfter = response.headers.get('Retry-After');\n const retryInMillis = parseRetryAfterToMills(retryAfter);\n return { status: 'retryable', retryInMillis };\n }\n diag.error(`export response failure (status: ${response.status})`);\n return {\n status: 'failure',\n error: new Error(\n `Fetch request failed with non-retryable status ${response.status}`\n ),\n };\n } catch (error) {\n if (isFetchNetworkErrorRetryable(error)) {\n diag.warn(`export request retryable (network error: ${error})`);\n return {\n status: 'retryable',\n error: new Error('Fetch request encountered a network error', {\n cause: error,\n }),\n };\n }\n diag.error(`export request failure (error: ${error})`);\n return {\n status: 'failure',\n error: new Error('Fetch request errored', { cause: error }),\n };\n } finally {\n clearTimeout(timeout);\n if (useKeepalive) {\n pendingBodySize -= requestSize;\n pendingKeepaliveCount--;\n }\n }\n }\n\n shutdown() {\n // Intentionally left empty, nothing to do.\n }\n}\n\n/**\n * Creates an exporter transport that uses `fetch` to send the data\n * @param parameters applied to each request made by transport\n */\nexport function createFetchTransport(\n parameters: FetchTransportParameters\n): IExporterTransport {\n return new FetchTransport(parameters);\n}\n\nfunction isFetchNetworkErrorRetryable(error: unknown): boolean {\n return error instanceof TypeError && !error.cause;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IExporterTransport } from '../exporter-transport';
|
|
2
|
-
import { NodeHttpRequestParameters } from './node-http-transport-types';
|
|
1
|
+
import type { IExporterTransport } from '../exporter-transport';
|
|
2
|
+
import type { NodeHttpRequestParameters } from './node-http-transport-types';
|
|
3
3
|
export declare function createHttpExporterTransport(parameters: NodeHttpRequestParameters): IExporterTransport;
|
|
4
4
|
//# sourceMappingURL=http-exporter-transport.d.ts.map
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright The OpenTelemetry Authors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
15
4
|
*/
|
|
16
5
|
import { sendWithHttp } from './http-transport-utils';
|
|
17
6
|
class HttpExporterTransport {
|
|
@@ -23,11 +12,7 @@ class HttpExporterTransport {
|
|
|
23
12
|
async send(data, timeoutMillis) {
|
|
24
13
|
const { agent, request } = await this._loadUtils();
|
|
25
14
|
const headers = await this._parameters.headers();
|
|
26
|
-
return
|
|
27
|
-
sendWithHttp(request, this._parameters.url, headers, this._parameters.compression, this._parameters.userAgent, agent, data, result => {
|
|
28
|
-
resolve(result);
|
|
29
|
-
}, timeoutMillis);
|
|
30
|
-
});
|
|
15
|
+
return sendWithHttp(request, this._parameters.url, headers, this._parameters.compression, this._parameters.userAgent, agent, data, timeoutMillis);
|
|
31
16
|
}
|
|
32
17
|
shutdown() {
|
|
33
18
|
// intentionally left empty, nothing to do.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-exporter-transport.js","sourceRoot":"","sources":["../../../src/transport/http-exporter-transport.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"http-exporter-transport.js","sourceRoot":"","sources":["../../../src/transport/http-exporter-transport.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAQtD,MAAM,qBAAqB;IACjB,MAAM,GAAiB,IAAI,CAAC;IAC5B,WAAW,CAA4B;IAE/C,YAAY,UAAqC;QAC/C,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,IAAgB,EAAE,aAAqB;QAChD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QACnD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QAEjD,OAAO,YAAY,CACjB,OAAO,EACP,IAAI,CAAC,WAAW,CAAC,GAAG,EACpB,OAAO,EACP,IAAI,CAAC,WAAW,CAAC,WAAW,EAC5B,IAAI,CAAC,WAAW,CAAC,SAAS,EAC1B,KAAK,EACL,IAAI,EACJ,aAAa,CACd,CAAC;IACJ,CAAC;IAED,QAAQ;QACN,2CAA2C;IAC7C,CAAC;IAEO,KAAK,CAAC,UAAU;QACtB,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QAExB,IAAI,KAAK,KAAK,IAAI,EAAE;YAClB,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;YACxD,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;gBACzC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC;gBACvC,sBAAsB,CAAC,QAAQ,CAAC;aACjC,CAAC,CAAC;YACH,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;SAC1C;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED,KAAK,UAAU,sBAAsB,CACnC,QAAgB;IAEhB,MAAM,MAAM,GAAG,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC;IACjC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,UAAqC;IAErC,OAAO,IAAI,qBAAqB,CAAC,UAAU,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// NOTE: do not change these type imports to actual imports. Doing so WILL break `@opentelemetry/instrumentation-http`,\n// as they'd be imported before the http/https modules can be wrapped.\nimport type * as https from 'https';\nimport type * as http from 'http';\nimport type { ExportResponse } from '../export-response';\nimport type { IExporterTransport } from '../exporter-transport';\nimport { sendWithHttp } from './http-transport-utils';\nimport type { NodeHttpRequestParameters } from './node-http-transport-types';\n\ninterface Utils {\n agent: http.Agent | https.Agent;\n request: typeof http.request | typeof https.request;\n}\n\nclass HttpExporterTransport implements IExporterTransport {\n private _utils: Utils | null = null;\n private _parameters: NodeHttpRequestParameters;\n\n constructor(parameters: NodeHttpRequestParameters) {\n this._parameters = parameters;\n }\n\n async send(data: Uint8Array, timeoutMillis: number): Promise<ExportResponse> {\n const { agent, request } = await this._loadUtils();\n const headers = await this._parameters.headers();\n\n return sendWithHttp(\n request,\n this._parameters.url,\n headers,\n this._parameters.compression,\n this._parameters.userAgent,\n agent,\n data,\n timeoutMillis\n );\n }\n\n shutdown() {\n // intentionally left empty, nothing to do.\n }\n\n private async _loadUtils(): Promise<Utils> {\n let utils = this._utils;\n\n if (utils === null) {\n const protocol = new URL(this._parameters.url).protocol;\n const [agent, request] = await Promise.all([\n this._parameters.agentFactory(protocol),\n requestFunctionFactory(protocol),\n ]);\n utils = this._utils = { agent, request };\n }\n\n return utils;\n }\n}\n\nasync function requestFunctionFactory(\n protocol: string\n): Promise<typeof http.request | typeof https.request> {\n const module = protocol === 'http:' ? import('http') : import('https');\n const { request } = await module;\n return request;\n}\n\nexport function createHttpExporterTransport(\n parameters: NodeHttpRequestParameters\n): IExporterTransport {\n return new HttpExporterTransport(parameters);\n}\n"]}
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright The OpenTelemetry Authors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
15
4
|
*/
|
|
16
5
|
export {};
|
|
17
6
|
//# sourceMappingURL=http-transport-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-transport-types.js","sourceRoot":"","sources":["../../../src/transport/http-transport-types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"http-transport-types.js","sourceRoot":"","sources":["../../../src/transport/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 { HeadersFactory } from '../configuration/otlp-http-configuration';\n\nexport interface HttpRequestParameters {\n url: string;\n headers: HeadersFactory;\n compression: 'gzip' | 'none';\n userAgent?: string;\n}\n"]}
|
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import type * as http from 'http';
|
|
4
4
|
import type * as https from 'https';
|
|
5
|
-
import { ExportResponse } from '../export-response';
|
|
5
|
+
import type { ExportResponse } from '../export-response';
|
|
6
6
|
/**
|
|
7
7
|
* Sends data using http
|
|
8
8
|
* @param request
|
|
9
|
-
* @param
|
|
9
|
+
* @param url
|
|
10
|
+
* @param headers
|
|
11
|
+
* @param compression
|
|
12
|
+
* @param userAgent
|
|
10
13
|
* @param agent
|
|
11
14
|
* @param data
|
|
12
|
-
* @param onDone
|
|
13
15
|
* @param timeoutMillis
|
|
14
16
|
*/
|
|
15
|
-
export declare function sendWithHttp(request: typeof https.request | typeof http.request, url: string, headers: Record<string, string>, compression: 'gzip' | 'none', userAgent: string | undefined, agent: http.Agent | https.Agent, data: Uint8Array,
|
|
17
|
+
export declare function sendWithHttp(request: typeof https.request | typeof http.request, url: string, headers: Record<string, string>, compression: 'gzip' | 'none', userAgent: string | undefined, agent: http.Agent | https.Agent, data: Uint8Array, timeoutMillis: number): Promise<ExportResponse>;
|
|
16
18
|
export declare function compressAndSend(req: http.ClientRequest, compression: 'gzip' | 'none', data: Uint8Array, onError: (error: Error) => void): void;
|
|
17
19
|
//# sourceMappingURL=http-transport-utils.d.ts.map
|
|
@@ -7,78 +7,108 @@ const DEFAULT_USER_AGENT = `OTel-OTLP-Exporter-JavaScript/${VERSION}`;
|
|
|
7
7
|
/**
|
|
8
8
|
* Sends data using http
|
|
9
9
|
* @param request
|
|
10
|
-
* @param
|
|
10
|
+
* @param url
|
|
11
|
+
* @param headers
|
|
12
|
+
* @param compression
|
|
13
|
+
* @param userAgent
|
|
11
14
|
* @param agent
|
|
12
15
|
* @param data
|
|
13
|
-
* @param onDone
|
|
14
16
|
* @param timeoutMillis
|
|
15
17
|
*/
|
|
16
|
-
export function sendWithHttp(request, url, headers, compression, userAgent, agent, data,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
18
|
+
export function sendWithHttp(request, url, headers, compression, userAgent, agent, data, timeoutMillis) {
|
|
19
|
+
return new Promise(resolve => {
|
|
20
|
+
const parsedUrl = new URL(url);
|
|
21
|
+
if (userAgent) {
|
|
22
|
+
headers['User-Agent'] = `${userAgent} ${DEFAULT_USER_AGENT}`;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
headers['User-Agent'] = DEFAULT_USER_AGENT;
|
|
26
|
+
}
|
|
27
|
+
const options = {
|
|
28
|
+
hostname: parsedUrl.hostname,
|
|
29
|
+
port: parsedUrl.port,
|
|
30
|
+
path: parsedUrl.pathname,
|
|
31
|
+
method: 'POST',
|
|
32
|
+
headers,
|
|
33
|
+
agent,
|
|
34
|
+
};
|
|
35
|
+
const req = request(options, (res) => {
|
|
36
|
+
const responseData = [];
|
|
37
|
+
res.on('data', chunk => responseData.push(chunk));
|
|
38
|
+
res.on('end', () => {
|
|
39
|
+
if (res.statusCode && res.statusCode <= 299) {
|
|
40
|
+
resolve({
|
|
41
|
+
status: 'success',
|
|
42
|
+
data: Buffer.concat(responseData),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
else if (res.statusCode &&
|
|
46
|
+
isExportHTTPErrorRetryable(res.statusCode)) {
|
|
47
|
+
resolve({
|
|
48
|
+
status: 'retryable',
|
|
49
|
+
retryInMillis: parseRetryAfterToMills(res.headers['retry-after']),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
const error = new OTLPExporterError(res.statusMessage, res.statusCode, Buffer.concat(responseData).toString());
|
|
54
|
+
resolve({
|
|
55
|
+
status: 'failure',
|
|
56
|
+
error,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
res.on('error', (error) => {
|
|
61
|
+
// Note: 'end' may still be emitted after 'error' on the same response object, since we're resolving a promise,
|
|
62
|
+
// the first call to resolve() will determine the final state.
|
|
63
|
+
if (res.statusCode && res.statusCode <= 299) {
|
|
64
|
+
// If the response is successful but an error occurs while reading the response,
|
|
65
|
+
// we consider it a success since the data has been sent successfully.
|
|
66
|
+
resolve({
|
|
67
|
+
status: 'success',
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
else if (res.statusCode &&
|
|
71
|
+
isExportHTTPErrorRetryable(res.statusCode)) {
|
|
72
|
+
resolve({
|
|
73
|
+
status: 'retryable',
|
|
74
|
+
error: error,
|
|
75
|
+
retryInMillis: parseRetryAfterToMills(res.headers['retry-after']),
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
resolve({
|
|
80
|
+
status: 'failure',
|
|
81
|
+
error,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
req.setTimeout(timeoutMillis, () => {
|
|
87
|
+
req.destroy();
|
|
88
|
+
resolve({
|
|
89
|
+
status: 'retryable',
|
|
90
|
+
error: new Error('Request timed out'),
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
req.on('error', (error) => {
|
|
94
|
+
if (isHttpTransportNetworkErrorRetryable(error)) {
|
|
95
|
+
resolve({
|
|
44
96
|
status: 'retryable',
|
|
45
|
-
|
|
97
|
+
error,
|
|
46
98
|
});
|
|
47
99
|
}
|
|
48
100
|
else {
|
|
49
|
-
|
|
50
|
-
onDone({
|
|
101
|
+
resolve({
|
|
51
102
|
status: 'failure',
|
|
52
103
|
error,
|
|
53
104
|
});
|
|
54
105
|
}
|
|
55
106
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
req.destroy();
|
|
59
|
-
onDone({
|
|
60
|
-
status: 'retryable',
|
|
61
|
-
error: new Error('Request timed out'),
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
req.on('error', (error) => {
|
|
65
|
-
if (isHttpTransportNetworkErrorRetryable(error)) {
|
|
66
|
-
onDone({
|
|
67
|
-
status: 'retryable',
|
|
68
|
-
error,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
onDone({
|
|
107
|
+
compressAndSend(req, compression, data, (error) => {
|
|
108
|
+
resolve({
|
|
73
109
|
status: 'failure',
|
|
74
110
|
error,
|
|
75
111
|
});
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
compressAndSend(req, compression, data, (error) => {
|
|
79
|
-
onDone({
|
|
80
|
-
status: 'failure',
|
|
81
|
-
error,
|
|
82
112
|
});
|
|
83
113
|
});
|
|
84
114
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-transport-utils.js","sourceRoot":"","sources":["../../../src/transport/http-transport-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http-transport-utils.js","sourceRoot":"","sources":["../../../src/transport/http-transport-utils.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAA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AE,OAAO,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,sBAAsB,CAAC,IAAyB;IACvD,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;IAChC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEpB,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,oCAAoC,CAAC,KAAY;IACxD,MAAM,6BAA6B,GAAG,IAAI,GAAG,CAAC;QAC5C,YAAY;QACZ,cAAc;QACd,OAAO;QACP,WAAW;QACX,WAAW;QACX,WAAW;QACX,aAAa;QACb,cAAc;KACf,CAAC,CAAC;IAEH,IAAI,MAAM,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,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 * 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 res.on('data', chunk => responseData.push(chunk));\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,17 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright The OpenTelemetry Authors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
15
4
|
*/
|
|
16
5
|
export {};
|
|
17
6
|
//# sourceMappingURL=node-http-transport-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-http-transport-types.js","sourceRoot":"","sources":["../../../src/transport/node-http-transport-types.ts"],"names":[],"mappings":"AAAA
|
|
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"]}
|
package/build/esm/types.js
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright The OpenTelemetry Authors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
15
4
|
*/
|
|
16
5
|
/**
|
|
17
6
|
* Interface for handling error
|
package/build/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACjC,IAAI,CAAU;IACL,IAAI,GAAW,mBAAmB,CAAC;IAC5C,IAAI,CAAU;IAEvB,YAAY,OAAgB,EAAE,IAAa,EAAE,IAAa;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\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"]}
|
package/build/esm/util.js
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright The OpenTelemetry Authors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
15
4
|
*/
|
|
16
5
|
import { diag } from '@opentelemetry/api';
|
|
17
6
|
/**
|
package/build/esm/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CACzC,cAAkD;IAElD,MAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,MAAM,CAAC,OAAO,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAC5D,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;YAChC,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;SAC9B;aAAM;YACL,IAAI,CAAC,IAAI,CACP,WAAW,GAAG,wBAAwB,KAAK,uBAAuB,CACnE,CAAC;SACH;IACH,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { diag } from '@opentelemetry/api';\n\n/**\n * Parses headers from config leaving only those that have defined values\n * @param partialHeaders\n */\nexport function validateAndNormalizeHeaders(\n partialHeaders: Record<string, string> | undefined\n): Record<string, string> {\n const headers: Record<string, string> = {};\n Object.entries(partialHeaders ?? {}).forEach(([key, value]) => {\n if (typeof value !== 'undefined') {\n headers[key] = String(value);\n } else {\n diag.warn(\n `Header \"${key}\" has invalid value (${value}) and will be ignored`\n );\n }\n });\n return headers;\n}\n"]}
|
package/build/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.214.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|