@opentelemetry/otlp-exporter-base 0.211.0 → 0.213.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.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.js +1 -12
- package/build/esm/configuration/convert-legacy-browser-http-options.js.map +1 -1
- 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.js.map +1 -1
- package/build/esm/configuration/create-legacy-browser-delegate.d.ts +0 -2
- 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.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.js +1 -12
- package/build/esm/configuration/otlp-http-configuration.js.map +1 -1
- package/build/esm/configuration/otlp-node-http-configuration.js +1 -12
- package/build/esm/configuration/otlp-node-http-configuration.js.map +1 -1
- package/build/esm/configuration/otlp-node-http-env-configuration.js +1 -12
- package/build/esm/configuration/otlp-node-http-env-configuration.js.map +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.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.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.js +1 -12
- package/build/esm/logging-response-handler.js.map +1 -1
- package/build/esm/otlp-browser-http-export-delegate.d.ts +3 -0
- 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.js +1 -12
- package/build/esm/otlp-export-delegate.js.map +1 -1
- package/build/esm/otlp-http-export-delegate.js +1 -12
- package/build/esm/otlp-http-export-delegate.js.map +1 -1
- package/build/esm/otlp-network-export-delegate.js +1 -12
- 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.js +1 -12
- package/build/esm/retrying-transport.js.map +1 -1
- package/build/esm/transport/fetch-transport.js +65 -19
- package/build/esm/transport/fetch-transport.js.map +1 -1
- package/build/esm/transport/http-exporter-transport.js +1 -12
- package/build/esm/transport/http-exporter-transport.js.map +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 +4 -1
- package/build/esm/transport/http-transport-utils.js +30 -2
- package/build/esm/transport/http-transport-utils.js.map +1 -1
- 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 +1 -1
- package/build/esm/version.js.map +1 -1
- 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.js +1 -12
- package/build/esnext/configuration/convert-legacy-browser-http-options.js.map +1 -1
- 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.js.map +1 -1
- package/build/esnext/configuration/create-legacy-browser-delegate.d.ts +0 -2
- 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.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.js +1 -12
- package/build/esnext/configuration/otlp-http-configuration.js.map +1 -1
- package/build/esnext/configuration/otlp-node-http-configuration.js +1 -12
- package/build/esnext/configuration/otlp-node-http-configuration.js.map +1 -1
- package/build/esnext/configuration/otlp-node-http-env-configuration.js +1 -12
- package/build/esnext/configuration/otlp-node-http-env-configuration.js.map +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.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.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.js +1 -12
- package/build/esnext/logging-response-handler.js.map +1 -1
- package/build/esnext/otlp-browser-http-export-delegate.d.ts +3 -0
- 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.js +1 -12
- package/build/esnext/otlp-export-delegate.js.map +1 -1
- package/build/esnext/otlp-http-export-delegate.js +1 -12
- package/build/esnext/otlp-http-export-delegate.js.map +1 -1
- package/build/esnext/otlp-network-export-delegate.js +1 -12
- 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.js +1 -12
- package/build/esnext/retrying-transport.js.map +1 -1
- package/build/esnext/transport/fetch-transport.js +65 -19
- package/build/esnext/transport/fetch-transport.js.map +1 -1
- package/build/esnext/transport/http-exporter-transport.js +1 -12
- package/build/esnext/transport/http-exporter-transport.js.map +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 +4 -1
- package/build/esnext/transport/http-transport-utils.js +30 -2
- package/build/esnext/transport/http-transport-utils.js.map +1 -1
- 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 +1 -1
- package/build/esnext/version.js.map +1 -1
- 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.js +1 -12
- package/build/src/configuration/convert-legacy-browser-http-options.js.map +1 -1
- 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.js.map +1 -1
- package/build/src/configuration/create-legacy-browser-delegate.d.ts +0 -2
- 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.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.js +1 -12
- package/build/src/configuration/otlp-http-configuration.js.map +1 -1
- package/build/src/configuration/otlp-node-http-configuration.js +1 -12
- package/build/src/configuration/otlp-node-http-configuration.js.map +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.js +1 -12
- package/build/src/configuration/shared-configuration.js.map +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.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.js +1 -12
- package/build/src/logging-response-handler.js.map +1 -1
- package/build/src/otlp-browser-http-export-delegate.d.ts +3 -0
- 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.js +1 -12
- package/build/src/otlp-export-delegate.js.map +1 -1
- package/build/src/otlp-http-export-delegate.js +1 -12
- package/build/src/otlp-http-export-delegate.js.map +1 -1
- 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.js +1 -12
- package/build/src/retrying-transport.js.map +1 -1
- package/build/src/transport/fetch-transport.js +65 -19
- package/build/src/transport/fetch-transport.js.map +1 -1
- package/build/src/transport/http-exporter-transport.js +1 -12
- package/build/src/transport/http-exporter-transport.js.map +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 +4 -1
- package/build/src/transport/http-transport-utils.js +30 -2
- package/build/src/transport/http-transport-utils.js.map +1 -1
- 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 +1 -1
- package/build/src/version.js.map +1 -1
- package/package.json +5 -5
- 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
|
@@ -10,7 +10,10 @@ const DEFAULT_USER_AGENT = `OTel-OTLP-Exporter-JavaScript/${version_1.VERSION}`;
|
|
|
10
10
|
/**
|
|
11
11
|
* Sends data using http
|
|
12
12
|
* @param request
|
|
13
|
-
* @param
|
|
13
|
+
* @param url
|
|
14
|
+
* @param headers
|
|
15
|
+
* @param compression
|
|
16
|
+
* @param userAgent
|
|
14
17
|
* @param agent
|
|
15
18
|
* @param data
|
|
16
19
|
* @param onDone
|
|
@@ -36,7 +39,7 @@ function sendWithHttp(request, url, headers, compression, userAgent, agent, data
|
|
|
36
39
|
const responseData = [];
|
|
37
40
|
res.on('data', chunk => responseData.push(chunk));
|
|
38
41
|
res.on('end', () => {
|
|
39
|
-
if (res.statusCode && res.statusCode
|
|
42
|
+
if (res.statusCode && res.statusCode <= 299) {
|
|
40
43
|
onDone({
|
|
41
44
|
status: 'success',
|
|
42
45
|
data: Buffer.concat(responseData),
|
|
@@ -56,6 +59,31 @@ function sendWithHttp(request, url, headers, compression, userAgent, agent, data
|
|
|
56
59
|
});
|
|
57
60
|
}
|
|
58
61
|
});
|
|
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({
|
|
75
|
+
status: 'retryable',
|
|
76
|
+
error: error,
|
|
77
|
+
retryInMillis: (0, is_export_retryable_1.parseRetryAfterToMills)(res.headers['retry-after']),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
onDone({
|
|
82
|
+
status: 'failure',
|
|
83
|
+
error,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
});
|
|
59
87
|
});
|
|
60
88
|
req.setTimeout(timeoutMillis, () => {
|
|
61
89
|
req.destroy();
|
|
@@ -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":"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","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,18 +1,7 @@
|
|
|
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
|
//# 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 { HttpAgentFactory } from '../configuration/otlp-node-http-configuration';\nimport { HttpRequestParameters } from './http-transport-types';\n\nexport interface NodeHttpRequestParameters extends HttpRequestParameters {\n agentFactory: HttpAgentFactory;\n}\n"]}
|
package/build/src/types.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
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.OTLPExporterError = void 0;
|
package/build/src/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,MAAa,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;AAVD,8CAUC","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/src/util.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
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.validateAndNormalizeHeaders = void 0;
|
package/build/src/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,4CAA0C;AAE1C;;;GAGG;AACH,SAAgB,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,UAAI,CAAC,IAAI,CACP,WAAW,GAAG,wBAAwB,KAAK,uBAAuB,CACnE,CAAC;SACH;IACH,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC;AAdD,kEAcC","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/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.213.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/build/src/version.js
CHANGED
package/build/src/version.js.map
CHANGED
|
@@ -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.
|
|
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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentelemetry/otlp-exporter-base",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.213.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,8 +74,8 @@
|
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@opentelemetry/core": "2.
|
|
78
|
-
"@opentelemetry/otlp-transformer": "0.
|
|
77
|
+
"@opentelemetry/core": "2.6.0",
|
|
78
|
+
"@opentelemetry/otlp-transformer": "0.213.0"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@babel/core": "7.27.1",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"sinon": "18.0.1",
|
|
97
97
|
"ts-loader": "9.5.4",
|
|
98
98
|
"typescript": "5.0.4",
|
|
99
|
-
"webpack": "5.
|
|
99
|
+
"webpack": "5.104.1",
|
|
100
100
|
"webpack-cli": "6.0.1"
|
|
101
101
|
},
|
|
102
102
|
"peerDependencies": {
|
|
@@ -104,5 +104,5 @@
|
|
|
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": "
|
|
107
|
+
"gitHead": "541e1b4ad83ad2093459794a18283228fe58d199"
|
|
108
108
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IExporterTransport } from '../exporter-transport';
|
|
2
|
-
import { HeadersFactory } from '../configuration/otlp-http-configuration';
|
|
3
|
-
export interface SendBeaconParameters {
|
|
4
|
-
url: string;
|
|
5
|
-
/**
|
|
6
|
-
* Only `Content-Type` will be used, sendBeacon does not support custom headers
|
|
7
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon
|
|
8
|
-
*/
|
|
9
|
-
headers: HeadersFactory;
|
|
10
|
-
}
|
|
11
|
-
export declare function createSendBeaconTransport(parameters: SendBeaconParameters): IExporterTransport;
|
|
12
|
-
//# sourceMappingURL=send-beacon-transport.d.ts.map
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright The OpenTelemetry Authors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { diag } from '@opentelemetry/api';
|
|
17
|
-
class SendBeaconTransport {
|
|
18
|
-
_params;
|
|
19
|
-
constructor(params) {
|
|
20
|
-
this._params = params;
|
|
21
|
-
}
|
|
22
|
-
async send(data) {
|
|
23
|
-
const blobType = (await this._params.headers())['Content-Type'];
|
|
24
|
-
return new Promise(resolve => {
|
|
25
|
-
if (navigator.sendBeacon(this._params.url, new Blob([data], { type: blobType }))) {
|
|
26
|
-
// no way to signal retry, treat everything as success
|
|
27
|
-
diag.debug('SendBeacon success');
|
|
28
|
-
resolve({
|
|
29
|
-
status: 'success',
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
resolve({
|
|
34
|
-
status: 'failure',
|
|
35
|
-
error: new Error('SendBeacon failed'),
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
shutdown() {
|
|
41
|
-
// Intentionally left empty, nothing to do.
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
export function createSendBeaconTransport(parameters) {
|
|
45
|
-
return new SendBeaconTransport(parameters);
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=send-beacon-transport.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"send-beacon-transport.js","sourceRoot":"","sources":["../../../src/transport/send-beacon-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAY1C,MAAM,mBAAmB;IACf,OAAO,CAAuB;IACtC,YAAY,MAA4B;QACtC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,IAAgB;QACzB,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC;QAChE,OAAO,IAAI,OAAO,CAAiB,OAAO,CAAC,EAAE;YAC3C,IACE,SAAS,CAAC,UAAU,CAClB,IAAI,CAAC,OAAO,CAAC,GAAG,EAChB,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CACrC,EACD;gBACA,sDAAsD;gBACtD,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;gBACjC,OAAO,CAAC;oBACN,MAAM,EAAE,SAAS;iBAClB,CAAC,CAAC;aACJ;iBAAM;gBACL,OAAO,CAAC;oBACN,MAAM,EAAE,SAAS;oBACjB,KAAK,EAAE,IAAI,KAAK,CAAC,mBAAmB,CAAC;iBACtC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,QAAQ;QACN,2CAA2C;IAC7C,CAAC;CACF;AAED,MAAM,UAAU,yBAAyB,CACvC,UAAgC;IAEhC,OAAO,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { IExporterTransport } from '../exporter-transport';\nimport { ExportResponse } from '../export-response';\nimport { diag } from '@opentelemetry/api';\nimport { HeadersFactory } from '../configuration/otlp-http-configuration';\n\nexport interface SendBeaconParameters {\n url: string;\n /**\n * Only `Content-Type` will be used, sendBeacon does not support custom headers\n * https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon\n */\n headers: HeadersFactory;\n}\n\nclass SendBeaconTransport implements IExporterTransport {\n private _params: SendBeaconParameters;\n constructor(params: SendBeaconParameters) {\n this._params = params;\n }\n\n async send(data: Uint8Array): Promise<ExportResponse> {\n const blobType = (await this._params.headers())['Content-Type'];\n return new Promise<ExportResponse>(resolve => {\n if (\n navigator.sendBeacon(\n this._params.url,\n new Blob([data], { type: blobType })\n )\n ) {\n // no way to signal retry, treat everything as success\n diag.debug('SendBeacon success');\n resolve({\n status: 'success',\n });\n } else {\n resolve({\n status: 'failure',\n error: new Error('SendBeacon failed'),\n });\n }\n });\n }\n\n shutdown(): void {\n // Intentionally left empty, nothing to do.\n }\n}\n\nexport function createSendBeaconTransport(\n parameters: SendBeaconParameters\n): IExporterTransport {\n return new SendBeaconTransport(parameters);\n}\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IExporterTransport } from '../exporter-transport';
|
|
2
|
-
import { HeadersFactory } from '../configuration/otlp-http-configuration';
|
|
3
|
-
export interface SendBeaconParameters {
|
|
4
|
-
url: string;
|
|
5
|
-
/**
|
|
6
|
-
* Only `Content-Type` will be used, sendBeacon does not support custom headers
|
|
7
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon
|
|
8
|
-
*/
|
|
9
|
-
headers: HeadersFactory;
|
|
10
|
-
}
|
|
11
|
-
export declare function createSendBeaconTransport(parameters: SendBeaconParameters): IExporterTransport;
|
|
12
|
-
//# sourceMappingURL=send-beacon-transport.d.ts.map
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright The OpenTelemetry Authors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { diag } from '@opentelemetry/api';
|
|
17
|
-
class SendBeaconTransport {
|
|
18
|
-
_params;
|
|
19
|
-
constructor(params) {
|
|
20
|
-
this._params = params;
|
|
21
|
-
}
|
|
22
|
-
async send(data) {
|
|
23
|
-
const blobType = (await this._params.headers())['Content-Type'];
|
|
24
|
-
return new Promise(resolve => {
|
|
25
|
-
if (navigator.sendBeacon(this._params.url, new Blob([data], { type: blobType }))) {
|
|
26
|
-
// no way to signal retry, treat everything as success
|
|
27
|
-
diag.debug('SendBeacon success');
|
|
28
|
-
resolve({
|
|
29
|
-
status: 'success',
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
resolve({
|
|
34
|
-
status: 'failure',
|
|
35
|
-
error: new Error('SendBeacon failed'),
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
shutdown() {
|
|
41
|
-
// Intentionally left empty, nothing to do.
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
export function createSendBeaconTransport(parameters) {
|
|
45
|
-
return new SendBeaconTransport(parameters);
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=send-beacon-transport.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"send-beacon-transport.js","sourceRoot":"","sources":["../../../src/transport/send-beacon-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAY1C,MAAM,mBAAmB;IACf,OAAO,CAAuB;IACtC,YAAY,MAA4B;QACtC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,IAAgB;QACzB,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC;QAChE,OAAO,IAAI,OAAO,CAAiB,OAAO,CAAC,EAAE;YAC3C,IACE,SAAS,CAAC,UAAU,CAClB,IAAI,CAAC,OAAO,CAAC,GAAG,EAChB,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CACrC,EACD;gBACA,sDAAsD;gBACtD,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;gBACjC,OAAO,CAAC;oBACN,MAAM,EAAE,SAAS;iBAClB,CAAC,CAAC;aACJ;iBAAM;gBACL,OAAO,CAAC;oBACN,MAAM,EAAE,SAAS;oBACjB,KAAK,EAAE,IAAI,KAAK,CAAC,mBAAmB,CAAC;iBACtC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,QAAQ;QACN,2CAA2C;IAC7C,CAAC;CACF;AAED,MAAM,UAAU,yBAAyB,CACvC,UAAgC;IAEhC,OAAO,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { IExporterTransport } from '../exporter-transport';\nimport { ExportResponse } from '../export-response';\nimport { diag } from '@opentelemetry/api';\nimport { HeadersFactory } from '../configuration/otlp-http-configuration';\n\nexport interface SendBeaconParameters {\n url: string;\n /**\n * Only `Content-Type` will be used, sendBeacon does not support custom headers\n * https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon\n */\n headers: HeadersFactory;\n}\n\nclass SendBeaconTransport implements IExporterTransport {\n private _params: SendBeaconParameters;\n constructor(params: SendBeaconParameters) {\n this._params = params;\n }\n\n async send(data: Uint8Array): Promise<ExportResponse> {\n const blobType = (await this._params.headers())['Content-Type'];\n return new Promise<ExportResponse>(resolve => {\n if (\n navigator.sendBeacon(\n this._params.url,\n new Blob([data], { type: blobType })\n )\n ) {\n // no way to signal retry, treat everything as success\n diag.debug('SendBeacon success');\n resolve({\n status: 'success',\n });\n } else {\n resolve({\n status: 'failure',\n error: new Error('SendBeacon failed'),\n });\n }\n });\n }\n\n shutdown(): void {\n // Intentionally left empty, nothing to do.\n }\n}\n\nexport function createSendBeaconTransport(\n parameters: SendBeaconParameters\n): IExporterTransport {\n return new SendBeaconTransport(parameters);\n}\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IExporterTransport } from '../exporter-transport';
|
|
2
|
-
import { HeadersFactory } from '../configuration/otlp-http-configuration';
|
|
3
|
-
export interface SendBeaconParameters {
|
|
4
|
-
url: string;
|
|
5
|
-
/**
|
|
6
|
-
* Only `Content-Type` will be used, sendBeacon does not support custom headers
|
|
7
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon
|
|
8
|
-
*/
|
|
9
|
-
headers: HeadersFactory;
|
|
10
|
-
}
|
|
11
|
-
export declare function createSendBeaconTransport(parameters: SendBeaconParameters): IExporterTransport;
|
|
12
|
-
//# sourceMappingURL=send-beacon-transport.d.ts.map
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright The OpenTelemetry Authors
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.createSendBeaconTransport = void 0;
|
|
19
|
-
const api_1 = require("@opentelemetry/api");
|
|
20
|
-
class SendBeaconTransport {
|
|
21
|
-
_params;
|
|
22
|
-
constructor(params) {
|
|
23
|
-
this._params = params;
|
|
24
|
-
}
|
|
25
|
-
async send(data) {
|
|
26
|
-
const blobType = (await this._params.headers())['Content-Type'];
|
|
27
|
-
return new Promise(resolve => {
|
|
28
|
-
if (navigator.sendBeacon(this._params.url, new Blob([data], { type: blobType }))) {
|
|
29
|
-
// no way to signal retry, treat everything as success
|
|
30
|
-
api_1.diag.debug('SendBeacon success');
|
|
31
|
-
resolve({
|
|
32
|
-
status: 'success',
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
resolve({
|
|
37
|
-
status: 'failure',
|
|
38
|
-
error: new Error('SendBeacon failed'),
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
shutdown() {
|
|
44
|
-
// Intentionally left empty, nothing to do.
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function createSendBeaconTransport(parameters) {
|
|
48
|
-
return new SendBeaconTransport(parameters);
|
|
49
|
-
}
|
|
50
|
-
exports.createSendBeaconTransport = createSendBeaconTransport;
|
|
51
|
-
//# sourceMappingURL=send-beacon-transport.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"send-beacon-transport.js","sourceRoot":"","sources":["../../../src/transport/send-beacon-transport.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,4CAA0C;AAY1C,MAAM,mBAAmB;IACf,OAAO,CAAuB;IACtC,YAAY,MAA4B;QACtC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,IAAgB;QACzB,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC;QAChE,OAAO,IAAI,OAAO,CAAiB,OAAO,CAAC,EAAE;YAC3C,IACE,SAAS,CAAC,UAAU,CAClB,IAAI,CAAC,OAAO,CAAC,GAAG,EAChB,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CACrC,EACD;gBACA,sDAAsD;gBACtD,UAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;gBACjC,OAAO,CAAC;oBACN,MAAM,EAAE,SAAS;iBAClB,CAAC,CAAC;aACJ;iBAAM;gBACL,OAAO,CAAC;oBACN,MAAM,EAAE,SAAS;oBACjB,KAAK,EAAE,IAAI,KAAK,CAAC,mBAAmB,CAAC;iBACtC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,QAAQ;QACN,2CAA2C;IAC7C,CAAC;CACF;AAED,SAAgB,yBAAyB,CACvC,UAAgC;IAEhC,OAAO,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC;AAC7C,CAAC;AAJD,8DAIC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { IExporterTransport } from '../exporter-transport';\nimport { ExportResponse } from '../export-response';\nimport { diag } from '@opentelemetry/api';\nimport { HeadersFactory } from '../configuration/otlp-http-configuration';\n\nexport interface SendBeaconParameters {\n url: string;\n /**\n * Only `Content-Type` will be used, sendBeacon does not support custom headers\n * https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon\n */\n headers: HeadersFactory;\n}\n\nclass SendBeaconTransport implements IExporterTransport {\n private _params: SendBeaconParameters;\n constructor(params: SendBeaconParameters) {\n this._params = params;\n }\n\n async send(data: Uint8Array): Promise<ExportResponse> {\n const blobType = (await this._params.headers())['Content-Type'];\n return new Promise<ExportResponse>(resolve => {\n if (\n navigator.sendBeacon(\n this._params.url,\n new Blob([data], { type: blobType })\n )\n ) {\n // no way to signal retry, treat everything as success\n diag.debug('SendBeacon success');\n resolve({\n status: 'success',\n });\n } else {\n resolve({\n status: 'failure',\n error: new Error('SendBeacon failed'),\n });\n }\n });\n }\n\n shutdown(): void {\n // Intentionally left empty, nothing to do.\n }\n}\n\nexport function createSendBeaconTransport(\n parameters: SendBeaconParameters\n): IExporterTransport {\n return new SendBeaconTransport(parameters);\n}\n"]}
|