@opentelemetry/otlp-exporter-base 0.222.0 → 0.300.0-development.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/dist/ExporterMetrics.cjs +80 -0
- package/dist/ExporterMetrics.cjs.map +1 -0
- package/dist/ExporterMetrics.d.cts +27 -0
- package/dist/ExporterMetrics.d.cts.map +1 -0
- package/dist/ExporterMetrics.d.mts +27 -0
- package/dist/ExporterMetrics.d.mts.map +1 -0
- package/dist/ExporterMetrics.mjs +80 -0
- package/dist/ExporterMetrics.mjs.map +1 -0
- package/dist/OTLPExporterBase.cjs +28 -0
- package/dist/OTLPExporterBase.cjs.map +1 -0
- package/dist/OTLPExporterBase.d.cts +20 -0
- package/dist/OTLPExporterBase.d.cts.map +1 -0
- package/dist/OTLPExporterBase.d.mts +20 -0
- package/dist/OTLPExporterBase.d.mts.map +1 -0
- package/dist/OTLPExporterBase.mjs +28 -0
- package/dist/OTLPExporterBase.mjs.map +1 -0
- package/dist/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/bounded-queue-export-promise-handler.cjs +37 -0
- package/dist/bounded-queue-export-promise-handler.cjs.map +1 -0
- package/dist/bounded-queue-export-promise-handler.mjs +37 -0
- package/dist/bounded-queue-export-promise-handler.mjs.map +1 -0
- package/dist/configuration/convert-legacy-browser-http-options.cjs +22 -0
- package/dist/configuration/convert-legacy-browser-http-options.cjs.map +1 -0
- package/dist/configuration/convert-legacy-browser-http-options.d.cts +14 -0
- package/dist/configuration/convert-legacy-browser-http-options.d.cts.map +1 -0
- package/dist/configuration/convert-legacy-browser-http-options.d.mts +14 -0
- package/dist/configuration/convert-legacy-browser-http-options.d.mts.map +1 -0
- package/dist/configuration/convert-legacy-browser-http-options.mjs +22 -0
- package/dist/configuration/convert-legacy-browser-http-options.mjs.map +1 -0
- package/dist/configuration/convert-legacy-http-options.cjs +10 -0
- package/dist/configuration/convert-legacy-http-options.cjs.map +1 -0
- package/dist/configuration/convert-legacy-http-options.mjs +10 -0
- package/dist/configuration/convert-legacy-http-options.mjs.map +1 -0
- package/dist/configuration/convert-legacy-node-http-options.cjs +38 -0
- package/{build/src/configuration/convert-legacy-node-http-options.js.map → dist/configuration/convert-legacy-node-http-options.cjs.map} +1 -1
- package/dist/configuration/convert-legacy-node-http-options.d.cts +14 -0
- package/dist/configuration/convert-legacy-node-http-options.d.cts.map +1 -0
- package/dist/configuration/convert-legacy-node-http-options.d.mts +14 -0
- package/dist/configuration/convert-legacy-node-http-options.d.mts.map +1 -0
- package/dist/configuration/convert-legacy-node-http-options.mjs +38 -0
- package/dist/configuration/convert-legacy-node-http-options.mjs.map +1 -0
- package/dist/configuration/create-legacy-browser-delegate.cjs +41 -0
- package/{build/esm/configuration/create-legacy-browser-delegate.js.map → dist/configuration/create-legacy-browser-delegate.cjs.map} +1 -1
- package/dist/configuration/create-legacy-browser-delegate.d.cts +21 -0
- package/dist/configuration/create-legacy-browser-delegate.d.cts.map +1 -0
- package/dist/configuration/create-legacy-browser-delegate.d.mts +21 -0
- package/dist/configuration/create-legacy-browser-delegate.d.mts.map +1 -0
- package/dist/configuration/create-legacy-browser-delegate.mjs +40 -0
- package/dist/configuration/create-legacy-browser-delegate.mjs.map +1 -0
- package/dist/configuration/legacy-base-configuration.d.cts +55 -0
- package/dist/configuration/legacy-base-configuration.d.cts.map +1 -0
- package/dist/configuration/legacy-base-configuration.d.mts +55 -0
- package/dist/configuration/legacy-base-configuration.d.mts.map +1 -0
- package/dist/configuration/legacy-node-configuration.cjs +10 -0
- package/dist/configuration/legacy-node-configuration.cjs.map +1 -0
- package/dist/configuration/legacy-node-configuration.d.cts +63 -0
- package/dist/configuration/legacy-node-configuration.d.cts.map +1 -0
- package/dist/configuration/legacy-node-configuration.d.mts +63 -0
- package/dist/configuration/legacy-node-configuration.d.mts.map +1 -0
- package/dist/configuration/legacy-node-configuration.mjs +10 -0
- package/dist/configuration/legacy-node-configuration.mjs.map +1 -0
- package/dist/configuration/otlp-http-configuration.cjs +45 -0
- package/dist/configuration/otlp-http-configuration.cjs.map +1 -0
- package/dist/configuration/otlp-http-configuration.d.cts +10 -0
- package/dist/configuration/otlp-http-configuration.d.cts.map +1 -0
- package/dist/configuration/otlp-http-configuration.d.mts +10 -0
- package/dist/configuration/otlp-http-configuration.d.mts.map +1 -0
- package/dist/configuration/otlp-http-configuration.mjs +44 -0
- package/dist/configuration/otlp-http-configuration.mjs.map +1 -0
- package/dist/configuration/otlp-node-http-configuration.cjs +37 -0
- package/dist/configuration/otlp-node-http-configuration.cjs.map +1 -0
- package/dist/configuration/otlp-node-http-configuration.d.cts +29 -0
- package/dist/configuration/otlp-node-http-configuration.d.cts.map +1 -0
- package/dist/configuration/otlp-node-http-configuration.d.mts +29 -0
- package/dist/configuration/otlp-node-http-configuration.d.mts.map +1 -0
- package/dist/configuration/otlp-node-http-configuration.mjs +35 -0
- package/dist/configuration/otlp-node-http-configuration.mjs.map +1 -0
- package/dist/configuration/otlp-node-http-env-configuration.cjs +98 -0
- package/dist/configuration/otlp-node-http-env-configuration.cjs.map +1 -0
- package/dist/configuration/otlp-node-http-env-configuration.mjs +95 -0
- package/dist/configuration/otlp-node-http-env-configuration.mjs.map +1 -0
- package/dist/configuration/shared-configuration.cjs +35 -0
- package/dist/configuration/shared-configuration.cjs.map +1 -0
- package/dist/configuration/shared-configuration.d.cts +24 -0
- package/dist/configuration/shared-configuration.d.cts.map +1 -0
- package/dist/configuration/shared-configuration.d.mts +24 -0
- package/dist/configuration/shared-configuration.d.mts.map +1 -0
- package/dist/configuration/shared-configuration.mjs +32 -0
- package/dist/configuration/shared-configuration.mjs.map +1 -0
- package/dist/configuration/shared-env-configuration.cjs +35 -0
- package/dist/configuration/shared-env-configuration.cjs.map +1 -0
- package/dist/configuration/shared-env-configuration.d.cts +6 -0
- package/dist/configuration/shared-env-configuration.d.cts.map +1 -0
- package/dist/configuration/shared-env-configuration.d.mts +6 -0
- package/dist/configuration/shared-env-configuration.d.mts.map +1 -0
- package/dist/configuration/shared-env-configuration.mjs +35 -0
- package/dist/configuration/shared-env-configuration.mjs.map +1 -0
- package/dist/export-response.d.cts +18 -0
- package/dist/export-response.d.cts.map +1 -0
- package/dist/export-response.d.mts +18 -0
- package/dist/export-response.d.mts.map +1 -0
- package/dist/exporter-transport.d.cts +9 -0
- package/dist/exporter-transport.d.cts.map +1 -0
- package/dist/exporter-transport.d.mts +9 -0
- package/dist/exporter-transport.d.mts.map +1 -0
- package/dist/index-browser-http.cjs +8 -0
- package/dist/index-browser-http.d.cts +4 -0
- package/dist/index-browser-http.d.mts +4 -0
- package/dist/index-browser-http.mjs +4 -0
- package/dist/index-node-http.cjs +10 -0
- package/dist/index-node-http.d.cts +5 -0
- package/dist/index-node-http.d.mts +5 -0
- package/dist/index-node-http.mjs +5 -0
- package/dist/index.cjs +14 -0
- package/dist/index.d.cts +11 -0
- package/dist/index.d.mts +11 -0
- package/dist/index.mjs +7 -0
- package/dist/is-export-retryable.cjs +17 -0
- package/dist/is-export-retryable.cjs.map +1 -0
- package/dist/is-export-retryable.mjs +16 -0
- package/dist/is-export-retryable.mjs.map +1 -0
- package/dist/logging-response-handler.cjs +18 -0
- package/{build/src/logging-response-handler.js.map → dist/logging-response-handler.cjs.map} +1 -1
- package/dist/logging-response-handler.mjs +18 -0
- package/dist/logging-response-handler.mjs.map +1 -0
- package/dist/otlp-browser-http-export-delegate.cjs +18 -0
- package/dist/otlp-browser-http-export-delegate.cjs.map +1 -0
- package/dist/otlp-browser-http-export-delegate.d.cts +12 -0
- package/dist/otlp-browser-http-export-delegate.d.cts.map +1 -0
- package/dist/otlp-browser-http-export-delegate.d.mts +12 -0
- package/dist/otlp-browser-http-export-delegate.d.mts.map +1 -0
- package/dist/otlp-browser-http-export-delegate.mjs +17 -0
- package/dist/otlp-browser-http-export-delegate.mjs.map +1 -0
- package/dist/otlp-export-delegate.cjs +101 -0
- package/dist/otlp-export-delegate.cjs.map +1 -0
- package/dist/otlp-export-delegate.d.cts +16 -0
- package/dist/otlp-export-delegate.d.cts.map +1 -0
- package/dist/otlp-export-delegate.d.mts +16 -0
- package/dist/otlp-export-delegate.d.mts.map +1 -0
- package/dist/otlp-export-delegate.mjs +101 -0
- package/dist/otlp-export-delegate.mjs.map +1 -0
- package/dist/otlp-http-export-delegate.cjs +34 -0
- package/dist/otlp-http-export-delegate.cjs.map +1 -0
- package/dist/otlp-http-export-delegate.d.cts +11 -0
- package/dist/otlp-http-export-delegate.d.cts.map +1 -0
- package/dist/otlp-http-export-delegate.d.mts +11 -0
- package/dist/otlp-http-export-delegate.d.mts.map +1 -0
- package/dist/otlp-http-export-delegate.mjs +33 -0
- package/dist/otlp-http-export-delegate.mjs.map +1 -0
- package/dist/otlp-network-export-delegate.cjs +15 -0
- package/dist/otlp-network-export-delegate.cjs.map +1 -0
- package/dist/otlp-network-export-delegate.d.cts +10 -0
- package/dist/otlp-network-export-delegate.d.cts.map +1 -0
- package/dist/otlp-network-export-delegate.d.mts +10 -0
- package/dist/otlp-network-export-delegate.d.mts.map +1 -0
- package/dist/otlp-network-export-delegate.mjs +15 -0
- package/dist/otlp-network-export-delegate.mjs.map +1 -0
- package/dist/retrying-transport.cjs +62 -0
- package/dist/retrying-transport.cjs.map +1 -0
- package/dist/retrying-transport.mjs +62 -0
- package/dist/retrying-transport.mjs.map +1 -0
- package/dist/semconv.cjs +100 -0
- package/dist/semconv.cjs.map +1 -0
- package/dist/semconv.mjs +95 -0
- package/dist/semconv.mjs.map +1 -0
- package/dist/transport/fetch-transport.cjs +143 -0
- package/dist/transport/fetch-transport.cjs.map +1 -0
- package/dist/transport/fetch-transport.mjs +143 -0
- package/dist/transport/fetch-transport.mjs.map +1 -0
- package/dist/transport/http-exporter-transport.cjs +38 -0
- package/dist/transport/http-exporter-transport.cjs.map +1 -0
- package/dist/transport/http-exporter-transport.mjs +38 -0
- package/dist/transport/http-exporter-transport.mjs.map +1 -0
- package/dist/transport/http-transport-utils.cjs +136 -0
- package/dist/transport/http-transport-utils.cjs.map +1 -0
- package/dist/transport/http-transport-utils.mjs +132 -0
- package/dist/transport/http-transport-utils.mjs.map +1 -0
- package/dist/types.cjs +18 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +13 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +13 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +18 -0
- package/dist/types.mjs.map +1 -0
- package/dist/util.cjs +18 -0
- package/dist/util.cjs.map +1 -0
- package/dist/util.mjs +18 -0
- package/dist/util.mjs.map +1 -0
- package/dist/version.cjs +6 -0
- package/dist/version.cjs.map +1 -0
- package/dist/version.mjs +6 -0
- package/dist/version.mjs.map +1 -0
- package/package.json +41 -38
- package/build/esm/ExporterMetrics.d.ts +0 -24
- package/build/esm/ExporterMetrics.js +0 -104
- package/build/esm/ExporterMetrics.js.map +0 -1
- package/build/esm/OTLPExporterBase.d.ts +0 -17
- package/build/esm/OTLPExporterBase.js +0 -28
- package/build/esm/OTLPExporterBase.js.map +0 -1
- package/build/esm/bounded-queue-export-promise-handler.d.ts +0 -13
- package/build/esm/bounded-queue-export-promise-handler.js +0 -39
- package/build/esm/bounded-queue-export-promise-handler.js.map +0 -1
- package/build/esm/configuration/convert-legacy-browser-http-options.d.ts +0 -11
- package/build/esm/configuration/convert-legacy-browser-http-options.js +0 -19
- package/build/esm/configuration/convert-legacy-browser-http-options.js.map +0 -1
- package/build/esm/configuration/convert-legacy-http-options.d.ts +0 -4
- package/build/esm/configuration/convert-legacy-http-options.js +0 -12
- package/build/esm/configuration/convert-legacy-http-options.js.map +0 -1
- package/build/esm/configuration/convert-legacy-node-http-options.d.ts +0 -11
- package/build/esm/configuration/convert-legacy-node-http-options.js +0 -43
- package/build/esm/configuration/convert-legacy-node-http-options.js.map +0 -1
- package/build/esm/configuration/create-legacy-browser-delegate.d.ts +0 -18
- package/build/esm/configuration/create-legacy-browser-delegate.js +0 -48
- package/build/esm/configuration/legacy-base-configuration.d.ts +0 -52
- package/build/esm/configuration/legacy-base-configuration.js +0 -2
- package/build/esm/configuration/legacy-base-configuration.js.map +0 -1
- package/build/esm/configuration/legacy-node-configuration.d.ts +0 -61
- package/build/esm/configuration/legacy-node-configuration.js +0 -10
- package/build/esm/configuration/legacy-node-configuration.js.map +0 -1
- package/build/esm/configuration/otlp-http-configuration.d.ts +0 -14
- package/build/esm/configuration/otlp-http-configuration.js +0 -59
- package/build/esm/configuration/otlp-http-configuration.js.map +0 -1
- package/build/esm/configuration/otlp-node-http-configuration.d.ts +0 -34
- package/build/esm/configuration/otlp-node-http-configuration.js +0 -35
- package/build/esm/configuration/otlp-node-http-configuration.js.map +0 -1
- package/build/esm/configuration/otlp-node-http-env-configuration.d.ts +0 -9
- package/build/esm/configuration/otlp-node-http-env-configuration.js +0 -119
- package/build/esm/configuration/otlp-node-http-env-configuration.js.map +0 -1
- package/build/esm/configuration/shared-configuration.d.ts +0 -24
- package/build/esm/configuration/shared-configuration.js +0 -42
- package/build/esm/configuration/shared-configuration.js.map +0 -1
- package/build/esm/configuration/shared-env-configuration.d.ts +0 -3
- package/build/esm/configuration/shared-env-configuration.js +0 -41
- package/build/esm/configuration/shared-env-configuration.js.map +0 -1
- package/build/esm/export-response.d.ts +0 -15
- package/build/esm/export-response.js +0 -6
- package/build/esm/export-response.js.map +0 -1
- package/build/esm/exporter-transport.d.ts +0 -6
- package/build/esm/exporter-transport.js +0 -6
- package/build/esm/exporter-transport.js.map +0 -1
- package/build/esm/index-browser-http.d.ts +0 -7
- package/build/esm/index-browser-http.js +0 -11
- package/build/esm/index-browser-http.js.map +0 -1
- package/build/esm/index-node-http.d.ts +0 -5
- package/build/esm/index-node-http.js +0 -9
- package/build/esm/index-node-http.js.map +0 -1
- package/build/esm/index.d.ts +0 -13
- package/build/esm/index.js +0 -11
- package/build/esm/index.js.map +0 -1
- package/build/esm/is-export-retryable.d.ts +0 -3
- package/build/esm/is-export-retryable.js +0 -26
- package/build/esm/is-export-retryable.js.map +0 -1
- package/build/esm/logging-response-handler.d.ts +0 -6
- package/build/esm/logging-response-handler.js +0 -27
- package/build/esm/logging-response-handler.js.map +0 -1
- package/build/esm/otlp-browser-http-export-delegate.d.ts +0 -10
- package/build/esm/otlp-browser-http-export-delegate.js +0 -19
- package/build/esm/otlp-browser-http-export-delegate.js.map +0 -1
- package/build/esm/otlp-export-delegate.d.ts +0 -27
- package/build/esm/otlp-export-delegate.js +0 -114
- package/build/esm/otlp-export-delegate.js.map +0 -1
- package/build/esm/otlp-http-export-delegate.d.ts +0 -8
- package/build/esm/otlp-http-export-delegate.js +0 -43
- package/build/esm/otlp-http-export-delegate.js.map +0 -1
- package/build/esm/otlp-network-export-delegate.d.ts +0 -7
- package/build/esm/otlp-network-export-delegate.js +0 -15
- package/build/esm/otlp-network-export-delegate.js.map +0 -1
- package/build/esm/response-handler.d.ts +0 -12
- package/build/esm/response-handler.js +0 -6
- package/build/esm/response-handler.js.map +0 -1
- package/build/esm/retrying-transport.d.ts +0 -8
- package/build/esm/retrying-transport.js +0 -70
- package/build/esm/retrying-transport.js.map +0 -1
- package/build/esm/semconv.d.ts +0 -91
- package/build/esm/semconv.js +0 -100
- package/build/esm/semconv.js.map +0 -1
- package/build/esm/transport/fetch-transport.d.ts +0 -12
- package/build/esm/transport/fetch-transport.js +0 -133
- package/build/esm/transport/fetch-transport.js.map +0 -1
- package/build/esm/transport/http-exporter-transport.d.ts +0 -4
- package/build/esm/transport/http-exporter-transport.js +0 -41
- package/build/esm/transport/http-exporter-transport.js.map +0 -1
- package/build/esm/transport/http-transport-types.d.ts +0 -8
- package/build/esm/transport/http-transport-types.js +0 -6
- package/build/esm/transport/http-transport-types.js.map +0 -1
- package/build/esm/transport/http-transport-utils.d.ts +0 -25
- package/build/esm/transport/http-transport-utils.js +0 -167
- package/build/esm/transport/http-transport-utils.js.map +0 -1
- package/build/esm/transport/node-http-transport-types.d.ts +0 -6
- package/build/esm/transport/node-http-transport-types.js +0 -6
- package/build/esm/transport/node-http-transport-types.js.map +0 -1
- package/build/esm/types.d.ts +0 -23
- package/build/esm/types.js +0 -18
- package/build/esm/types.js.map +0 -1
- package/build/esm/util.d.ts +0 -6
- package/build/esm/util.js +0 -22
- package/build/esm/util.js.map +0 -1
- package/build/esm/version.d.ts +0 -2
- package/build/esm/version.js +0 -7
- package/build/esm/version.js.map +0 -1
- package/build/esnext/ExporterMetrics.d.ts +0 -24
- package/build/esnext/ExporterMetrics.js +0 -104
- package/build/esnext/ExporterMetrics.js.map +0 -1
- package/build/esnext/OTLPExporterBase.d.ts +0 -17
- package/build/esnext/OTLPExporterBase.js +0 -28
- package/build/esnext/OTLPExporterBase.js.map +0 -1
- package/build/esnext/bounded-queue-export-promise-handler.d.ts +0 -13
- package/build/esnext/bounded-queue-export-promise-handler.js +0 -39
- package/build/esnext/bounded-queue-export-promise-handler.js.map +0 -1
- package/build/esnext/configuration/convert-legacy-browser-http-options.d.ts +0 -11
- package/build/esnext/configuration/convert-legacy-browser-http-options.js +0 -19
- package/build/esnext/configuration/convert-legacy-browser-http-options.js.map +0 -1
- package/build/esnext/configuration/convert-legacy-http-options.d.ts +0 -4
- package/build/esnext/configuration/convert-legacy-http-options.js +0 -12
- package/build/esnext/configuration/convert-legacy-http-options.js.map +0 -1
- package/build/esnext/configuration/convert-legacy-node-http-options.d.ts +0 -11
- package/build/esnext/configuration/convert-legacy-node-http-options.js +0 -43
- package/build/esnext/configuration/convert-legacy-node-http-options.js.map +0 -1
- package/build/esnext/configuration/create-legacy-browser-delegate.d.ts +0 -18
- package/build/esnext/configuration/create-legacy-browser-delegate.js +0 -48
- package/build/esnext/configuration/create-legacy-browser-delegate.js.map +0 -1
- package/build/esnext/configuration/legacy-base-configuration.d.ts +0 -52
- package/build/esnext/configuration/legacy-base-configuration.js +0 -2
- package/build/esnext/configuration/legacy-base-configuration.js.map +0 -1
- package/build/esnext/configuration/legacy-node-configuration.d.ts +0 -61
- package/build/esnext/configuration/legacy-node-configuration.js +0 -10
- package/build/esnext/configuration/legacy-node-configuration.js.map +0 -1
- package/build/esnext/configuration/otlp-http-configuration.d.ts +0 -14
- package/build/esnext/configuration/otlp-http-configuration.js +0 -59
- package/build/esnext/configuration/otlp-http-configuration.js.map +0 -1
- package/build/esnext/configuration/otlp-node-http-configuration.d.ts +0 -34
- package/build/esnext/configuration/otlp-node-http-configuration.js +0 -35
- package/build/esnext/configuration/otlp-node-http-configuration.js.map +0 -1
- package/build/esnext/configuration/otlp-node-http-env-configuration.d.ts +0 -9
- package/build/esnext/configuration/otlp-node-http-env-configuration.js +0 -119
- package/build/esnext/configuration/otlp-node-http-env-configuration.js.map +0 -1
- package/build/esnext/configuration/shared-configuration.d.ts +0 -24
- package/build/esnext/configuration/shared-configuration.js +0 -42
- package/build/esnext/configuration/shared-configuration.js.map +0 -1
- package/build/esnext/configuration/shared-env-configuration.d.ts +0 -3
- package/build/esnext/configuration/shared-env-configuration.js +0 -41
- package/build/esnext/configuration/shared-env-configuration.js.map +0 -1
- package/build/esnext/export-response.d.ts +0 -15
- package/build/esnext/export-response.js +0 -6
- package/build/esnext/export-response.js.map +0 -1
- package/build/esnext/exporter-transport.d.ts +0 -6
- package/build/esnext/exporter-transport.js +0 -6
- package/build/esnext/exporter-transport.js.map +0 -1
- package/build/esnext/index-browser-http.d.ts +0 -7
- package/build/esnext/index-browser-http.js +0 -11
- package/build/esnext/index-browser-http.js.map +0 -1
- package/build/esnext/index-node-http.d.ts +0 -5
- package/build/esnext/index-node-http.js +0 -9
- package/build/esnext/index-node-http.js.map +0 -1
- package/build/esnext/index.d.ts +0 -13
- package/build/esnext/index.js +0 -11
- package/build/esnext/index.js.map +0 -1
- package/build/esnext/is-export-retryable.d.ts +0 -3
- package/build/esnext/is-export-retryable.js +0 -26
- package/build/esnext/is-export-retryable.js.map +0 -1
- package/build/esnext/logging-response-handler.d.ts +0 -6
- package/build/esnext/logging-response-handler.js +0 -27
- package/build/esnext/logging-response-handler.js.map +0 -1
- package/build/esnext/otlp-browser-http-export-delegate.d.ts +0 -10
- package/build/esnext/otlp-browser-http-export-delegate.js +0 -19
- package/build/esnext/otlp-browser-http-export-delegate.js.map +0 -1
- package/build/esnext/otlp-export-delegate.d.ts +0 -27
- package/build/esnext/otlp-export-delegate.js +0 -114
- package/build/esnext/otlp-export-delegate.js.map +0 -1
- package/build/esnext/otlp-http-export-delegate.d.ts +0 -8
- package/build/esnext/otlp-http-export-delegate.js +0 -43
- package/build/esnext/otlp-http-export-delegate.js.map +0 -1
- package/build/esnext/otlp-network-export-delegate.d.ts +0 -7
- package/build/esnext/otlp-network-export-delegate.js +0 -15
- package/build/esnext/otlp-network-export-delegate.js.map +0 -1
- package/build/esnext/response-handler.d.ts +0 -12
- package/build/esnext/response-handler.js +0 -6
- package/build/esnext/response-handler.js.map +0 -1
- package/build/esnext/retrying-transport.d.ts +0 -8
- package/build/esnext/retrying-transport.js +0 -70
- package/build/esnext/retrying-transport.js.map +0 -1
- package/build/esnext/semconv.d.ts +0 -91
- package/build/esnext/semconv.js +0 -100
- package/build/esnext/semconv.js.map +0 -1
- package/build/esnext/transport/fetch-transport.d.ts +0 -12
- package/build/esnext/transport/fetch-transport.js +0 -133
- package/build/esnext/transport/fetch-transport.js.map +0 -1
- package/build/esnext/transport/http-exporter-transport.d.ts +0 -4
- package/build/esnext/transport/http-exporter-transport.js +0 -41
- package/build/esnext/transport/http-exporter-transport.js.map +0 -1
- package/build/esnext/transport/http-transport-types.d.ts +0 -8
- package/build/esnext/transport/http-transport-types.js +0 -6
- package/build/esnext/transport/http-transport-types.js.map +0 -1
- package/build/esnext/transport/http-transport-utils.d.ts +0 -25
- package/build/esnext/transport/http-transport-utils.js +0 -167
- package/build/esnext/transport/http-transport-utils.js.map +0 -1
- package/build/esnext/transport/node-http-transport-types.d.ts +0 -6
- package/build/esnext/transport/node-http-transport-types.js +0 -6
- package/build/esnext/transport/node-http-transport-types.js.map +0 -1
- package/build/esnext/types.d.ts +0 -23
- package/build/esnext/types.js +0 -18
- package/build/esnext/types.js.map +0 -1
- package/build/esnext/util.d.ts +0 -6
- package/build/esnext/util.js +0 -22
- package/build/esnext/util.js.map +0 -1
- package/build/esnext/version.d.ts +0 -2
- package/build/esnext/version.js +0 -7
- package/build/esnext/version.js.map +0 -1
- package/build/src/ExporterMetrics.d.ts +0 -24
- package/build/src/ExporterMetrics.js +0 -108
- package/build/src/ExporterMetrics.js.map +0 -1
- package/build/src/OTLPExporterBase.d.ts +0 -17
- package/build/src/OTLPExporterBase.js +0 -32
- package/build/src/OTLPExporterBase.js.map +0 -1
- package/build/src/bounded-queue-export-promise-handler.d.ts +0 -13
- package/build/src/bounded-queue-export-promise-handler.js +0 -43
- package/build/src/bounded-queue-export-promise-handler.js.map +0 -1
- package/build/src/configuration/convert-legacy-browser-http-options.d.ts +0 -11
- package/build/src/configuration/convert-legacy-browser-http-options.js +0 -23
- package/build/src/configuration/convert-legacy-browser-http-options.js.map +0 -1
- package/build/src/configuration/convert-legacy-http-options.d.ts +0 -4
- package/build/src/configuration/convert-legacy-http-options.js +0 -16
- package/build/src/configuration/convert-legacy-http-options.js.map +0 -1
- package/build/src/configuration/convert-legacy-node-http-options.d.ts +0 -11
- package/build/src/configuration/convert-legacy-node-http-options.js +0 -47
- package/build/src/configuration/create-legacy-browser-delegate.d.ts +0 -18
- package/build/src/configuration/create-legacy-browser-delegate.js +0 -53
- package/build/src/configuration/create-legacy-browser-delegate.js.map +0 -1
- package/build/src/configuration/legacy-base-configuration.d.ts +0 -52
- package/build/src/configuration/legacy-base-configuration.js +0 -3
- package/build/src/configuration/legacy-base-configuration.js.map +0 -1
- package/build/src/configuration/legacy-node-configuration.d.ts +0 -61
- package/build/src/configuration/legacy-node-configuration.js +0 -13
- package/build/src/configuration/legacy-node-configuration.js.map +0 -1
- package/build/src/configuration/otlp-http-configuration.d.ts +0 -14
- package/build/src/configuration/otlp-http-configuration.js +0 -64
- package/build/src/configuration/otlp-http-configuration.js.map +0 -1
- package/build/src/configuration/otlp-node-http-configuration.d.ts +0 -34
- package/build/src/configuration/otlp-node-http-configuration.js +0 -41
- package/build/src/configuration/otlp-node-http-configuration.js.map +0 -1
- package/build/src/configuration/otlp-node-http-env-configuration.d.ts +0 -9
- package/build/src/configuration/otlp-node-http-env-configuration.js +0 -123
- package/build/src/configuration/otlp-node-http-env-configuration.js.map +0 -1
- package/build/src/configuration/shared-configuration.d.ts +0 -24
- package/build/src/configuration/shared-configuration.js +0 -49
- package/build/src/configuration/shared-configuration.js.map +0 -1
- package/build/src/configuration/shared-env-configuration.d.ts +0 -3
- package/build/src/configuration/shared-env-configuration.js +0 -45
- package/build/src/configuration/shared-env-configuration.js.map +0 -1
- package/build/src/export-response.d.ts +0 -15
- package/build/src/export-response.js +0 -7
- package/build/src/export-response.js.map +0 -1
- package/build/src/exporter-transport.d.ts +0 -6
- package/build/src/exporter-transport.js +0 -7
- package/build/src/exporter-transport.js.map +0 -1
- package/build/src/index-browser-http.d.ts +0 -7
- package/build/src/index-browser-http.js +0 -18
- package/build/src/index-browser-http.js.map +0 -1
- package/build/src/index-node-http.d.ts +0 -5
- package/build/src/index-node-http.js +0 -17
- package/build/src/index-node-http.js.map +0 -1
- package/build/src/index.d.ts +0 -13
- package/build/src/index.js +0 -21
- package/build/src/index.js.map +0 -1
- package/build/src/is-export-retryable.d.ts +0 -3
- package/build/src/is-export-retryable.js +0 -31
- package/build/src/is-export-retryable.js.map +0 -1
- package/build/src/logging-response-handler.d.ts +0 -6
- package/build/src/logging-response-handler.js +0 -31
- package/build/src/otlp-browser-http-export-delegate.d.ts +0 -10
- package/build/src/otlp-browser-http-export-delegate.js +0 -24
- package/build/src/otlp-browser-http-export-delegate.js.map +0 -1
- package/build/src/otlp-export-delegate.d.ts +0 -27
- package/build/src/otlp-export-delegate.js +0 -118
- package/build/src/otlp-export-delegate.js.map +0 -1
- package/build/src/otlp-http-export-delegate.d.ts +0 -8
- package/build/src/otlp-http-export-delegate.js +0 -48
- package/build/src/otlp-http-export-delegate.js.map +0 -1
- package/build/src/otlp-network-export-delegate.d.ts +0 -7
- package/build/src/otlp-network-export-delegate.js +0 -19
- package/build/src/otlp-network-export-delegate.js.map +0 -1
- package/build/src/response-handler.d.ts +0 -12
- package/build/src/response-handler.js +0 -7
- package/build/src/response-handler.js.map +0 -1
- package/build/src/retrying-transport.d.ts +0 -8
- package/build/src/retrying-transport.js +0 -74
- package/build/src/retrying-transport.js.map +0 -1
- package/build/src/semconv.d.ts +0 -91
- package/build/src/semconv.js +0 -103
- package/build/src/semconv.js.map +0 -1
- package/build/src/transport/fetch-transport.d.ts +0 -12
- package/build/src/transport/fetch-transport.js +0 -137
- package/build/src/transport/fetch-transport.js.map +0 -1
- package/build/src/transport/http-exporter-transport.d.ts +0 -4
- package/build/src/transport/http-exporter-transport.js +0 -45
- package/build/src/transport/http-exporter-transport.js.map +0 -1
- package/build/src/transport/http-transport-types.d.ts +0 -8
- package/build/src/transport/http-transport-types.js +0 -7
- package/build/src/transport/http-transport-types.js.map +0 -1
- package/build/src/transport/http-transport-utils.d.ts +0 -25
- package/build/src/transport/http-transport-utils.js +0 -172
- package/build/src/transport/http-transport-utils.js.map +0 -1
- package/build/src/transport/node-http-transport-types.d.ts +0 -6
- package/build/src/transport/node-http-transport-types.js +0 -7
- package/build/src/transport/node-http-transport-types.js.map +0 -1
- package/build/src/types.d.ts +0 -23
- package/build/src/types.js +0 -22
- package/build/src/types.js.map +0 -1
- package/build/src/util.d.ts +0 -6
- package/build/src/util.js +0 -26
- package/build/src/util.js.map +0 -1
- package/build/src/version.d.ts +0 -2
- package/build/src/version.js +0 -10
- package/build/src/version.js.map +0 -1
package/dist/semconv.cjs
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
//#region src/semconv.ts
|
|
2
|
+
/**
|
|
3
|
+
* [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).
|
|
4
|
+
*
|
|
5
|
+
* @example 200
|
|
6
|
+
*/
|
|
7
|
+
const ATTR_HTTP_RESPONSE_STATUS_CODE = "http.response.status_code";
|
|
8
|
+
/**
|
|
9
|
+
* A name uniquely identifying the instance of the OpenTelemetry component within its containing SDK instance.
|
|
10
|
+
*
|
|
11
|
+
* @example otlp_grpc_span_exporter/0
|
|
12
|
+
* @example custom-name
|
|
13
|
+
*
|
|
14
|
+
* @note Implementations **SHOULD** ensure a low cardinality for this attribute, even across application or SDK restarts.
|
|
15
|
+
* E.g. implementations **MUST NOT** use UUIDs as values for this attribute.
|
|
16
|
+
*
|
|
17
|
+
* Implementations **MAY** achieve these goals by following a `<otel.component.type>/<instance-counter>` pattern, e.g. `batching_span_processor/0`.
|
|
18
|
+
* Hereby `otel.component.type` refers to the corresponding attribute value of the component.
|
|
19
|
+
*
|
|
20
|
+
* The value of `instance-counter` **MAY** be automatically assigned by the component and uniqueness within the enclosing SDK instance **MUST** be guaranteed.
|
|
21
|
+
* For example, `<instance-counter>` **MAY** be implemented by using a monotonically increasing counter (starting with `0`), which is incremented every time an
|
|
22
|
+
* instance of the given component type is started.
|
|
23
|
+
*
|
|
24
|
+
* With this implementation, for example the first Batching Span Processor would have `batching_span_processor/0`
|
|
25
|
+
* as `otel.component.name`, the second one `batching_span_processor/1` and so on.
|
|
26
|
+
* These values will therefore be reused in the case of an application restart.
|
|
27
|
+
*
|
|
28
|
+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
29
|
+
*/
|
|
30
|
+
const ATTR_OTEL_COMPONENT_NAME = "otel.component.name";
|
|
31
|
+
/**
|
|
32
|
+
* A name identifying the type of the OpenTelemetry component.
|
|
33
|
+
*
|
|
34
|
+
* @example batching_span_processor
|
|
35
|
+
* @example com.example.MySpanExporter
|
|
36
|
+
*
|
|
37
|
+
* @note If none of the standardized values apply, implementations **SHOULD** use the language-defined name of the type.
|
|
38
|
+
* E.g. for Java the fully qualified classname **SHOULD** be used in this case.
|
|
39
|
+
*
|
|
40
|
+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
41
|
+
*/
|
|
42
|
+
const ATTR_OTEL_COMPONENT_TYPE = "otel.component.type";
|
|
43
|
+
/**
|
|
44
|
+
* Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.
|
|
45
|
+
*
|
|
46
|
+
* @example example.com
|
|
47
|
+
* @example 10.1.2.80
|
|
48
|
+
* @example /tmp/my.sock
|
|
49
|
+
*
|
|
50
|
+
* @note When observed from the client side, and when communicating through an intermediary, `server.address` **SHOULD** represent the server address behind any intermediaries, for example proxies, if it's available.
|
|
51
|
+
*/
|
|
52
|
+
const ATTR_SERVER_ADDRESS = "server.address";
|
|
53
|
+
/**
|
|
54
|
+
* Server port number.
|
|
55
|
+
*
|
|
56
|
+
* @example 80
|
|
57
|
+
* @example 8080
|
|
58
|
+
* @example 443
|
|
59
|
+
*
|
|
60
|
+
* @note When observed from the client side, and when communicating through an intermediary, `server.port` **SHOULD** represent the server port behind any intermediaries, for example proxies, if it's available.
|
|
61
|
+
*/
|
|
62
|
+
const ATTR_SERVER_PORT = "server.port";
|
|
63
|
+
/**
|
|
64
|
+
* Describes a class of error the operation ended with.
|
|
65
|
+
*
|
|
66
|
+
* @example timeout
|
|
67
|
+
* @example java.net.UnknownHostException
|
|
68
|
+
* @example server_certificate_invalid
|
|
69
|
+
* @example 500
|
|
70
|
+
*
|
|
71
|
+
* @note The `error.type` **SHOULD** be predictable, and **SHOULD** have low cardinality.
|
|
72
|
+
*
|
|
73
|
+
* When `error.type` is set to a type (e.g., an exception type), its
|
|
74
|
+
* canonical class name identifying the type within the artifact **SHOULD** be used.
|
|
75
|
+
*
|
|
76
|
+
* Instrumentations **SHOULD** document the list of errors they report.
|
|
77
|
+
*
|
|
78
|
+
* The cardinality of `error.type` within one instrumentation library **SHOULD** be low.
|
|
79
|
+
* Telemetry consumers that aggregate data from multiple instrumentation libraries and applications
|
|
80
|
+
* should be prepared for `error.type` to have high cardinality at query time when no
|
|
81
|
+
* additional filters are applied.
|
|
82
|
+
*
|
|
83
|
+
* If the operation has completed successfully, instrumentations **SHOULD NOT** set `error.type`.
|
|
84
|
+
*
|
|
85
|
+
* If a specific domain defines its own set of error identifiers (such as HTTP or RPC status codes),
|
|
86
|
+
* it's **RECOMMENDED** to:
|
|
87
|
+
*
|
|
88
|
+
* - Use a domain-specific attribute
|
|
89
|
+
* - Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.
|
|
90
|
+
*/
|
|
91
|
+
const ATTR_ERROR_TYPE = "error.type";
|
|
92
|
+
//#endregion
|
|
93
|
+
exports.ATTR_ERROR_TYPE = ATTR_ERROR_TYPE;
|
|
94
|
+
exports.ATTR_HTTP_RESPONSE_STATUS_CODE = ATTR_HTTP_RESPONSE_STATUS_CODE;
|
|
95
|
+
exports.ATTR_OTEL_COMPONENT_NAME = ATTR_OTEL_COMPONENT_NAME;
|
|
96
|
+
exports.ATTR_OTEL_COMPONENT_TYPE = ATTR_OTEL_COMPONENT_TYPE;
|
|
97
|
+
exports.ATTR_SERVER_ADDRESS = ATTR_SERVER_ADDRESS;
|
|
98
|
+
exports.ATTR_SERVER_PORT = ATTR_SERVER_PORT;
|
|
99
|
+
|
|
100
|
+
//# sourceMappingURL=semconv.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semconv.cjs","names":[],"sources":["../src/semconv.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n\n/**\n * [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).\n *\n * @example 200\n */\nexport const ATTR_HTTP_RESPONSE_STATUS_CODE =\n 'http.response.status_code' as const;\n\n/**\n * A name uniquely identifying the instance of the OpenTelemetry component within its containing SDK instance.\n *\n * @example otlp_grpc_span_exporter/0\n * @example custom-name\n *\n * @note Implementations **SHOULD** ensure a low cardinality for this attribute, even across application or SDK restarts.\n * E.g. implementations **MUST NOT** use UUIDs as values for this attribute.\n *\n * Implementations **MAY** achieve these goals by following a `<otel.component.type>/<instance-counter>` pattern, e.g. `batching_span_processor/0`.\n * Hereby `otel.component.type` refers to the corresponding attribute value of the component.\n *\n * The value of `instance-counter` **MAY** be automatically assigned by the component and uniqueness within the enclosing SDK instance **MUST** be guaranteed.\n * For example, `<instance-counter>` **MAY** be implemented by using a monotonically increasing counter (starting with `0`), which is incremented every time an\n * instance of the given component type is started.\n *\n * With this implementation, for example the first Batching Span Processor would have `batching_span_processor/0`\n * as `otel.component.name`, the second one `batching_span_processor/1` and so on.\n * These values will therefore be reused in the case of an application restart.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_OTEL_COMPONENT_NAME = 'otel.component.name' as const;\n\n/**\n * A name identifying the type of the OpenTelemetry component.\n *\n * @example batching_span_processor\n * @example com.example.MySpanExporter\n *\n * @note If none of the standardized values apply, implementations **SHOULD** use the language-defined name of the type.\n * E.g. for Java the fully qualified classname **SHOULD** be used in this case.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_OTEL_COMPONENT_TYPE = 'otel.component.type' as const;\n\n/**\n * Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.\n *\n * @example example.com\n * @example 10.1.2.80\n * @example /tmp/my.sock\n *\n * @note When observed from the client side, and when communicating through an intermediary, `server.address` **SHOULD** represent the server address behind any intermediaries, for example proxies, if it's available.\n */\nexport const ATTR_SERVER_ADDRESS = 'server.address' as const;\n\n/**\n * Server port number.\n *\n * @example 80\n * @example 8080\n * @example 443\n *\n * @note When observed from the client side, and when communicating through an intermediary, `server.port` **SHOULD** represent the server port behind any intermediaries, for example proxies, if it's available.\n */\nexport const ATTR_SERVER_PORT = 'server.port' as const;\n\n/**\n * Describes a class of error the operation ended with.\n *\n * @example timeout\n * @example java.net.UnknownHostException\n * @example server_certificate_invalid\n * @example 500\n *\n * @note The `error.type` **SHOULD** be predictable, and **SHOULD** have low cardinality.\n *\n * When `error.type` is set to a type (e.g., an exception type), its\n * canonical class name identifying the type within the artifact **SHOULD** be used.\n *\n * Instrumentations **SHOULD** document the list of errors they report.\n *\n * The cardinality of `error.type` within one instrumentation library **SHOULD** be low.\n * Telemetry consumers that aggregate data from multiple instrumentation libraries and applications\n * should be prepared for `error.type` to have high cardinality at query time when no\n * additional filters are applied.\n *\n * If the operation has completed successfully, instrumentations **SHOULD NOT** set `error.type`.\n *\n * If a specific domain defines its own set of error identifiers (such as HTTP or RPC status codes),\n * it's **RECOMMENDED** to:\n *\n * - Use a domain-specific attribute\n * - Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.\n */\nexport const ATTR_ERROR_TYPE = 'error.type' as const;\n"],"mappings":";;;;;;AAgBA,MAAa,iCACX;;;;;;;;;;;;;;;;;;;;;;;AAwBF,MAAa,2BAA2B;;;;;;;;;;;;AAaxC,MAAa,2BAA2B;;;;;;;;;;AAWxC,MAAa,sBAAsB;;;;;;;;;;AAWnC,MAAa,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BhC,MAAa,kBAAkB"}
|
package/dist/semconv.mjs
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
//#region src/semconv.ts
|
|
2
|
+
/**
|
|
3
|
+
* [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).
|
|
4
|
+
*
|
|
5
|
+
* @example 200
|
|
6
|
+
*/
|
|
7
|
+
const ATTR_HTTP_RESPONSE_STATUS_CODE = "http.response.status_code";
|
|
8
|
+
/**
|
|
9
|
+
* A name uniquely identifying the instance of the OpenTelemetry component within its containing SDK instance.
|
|
10
|
+
*
|
|
11
|
+
* @example otlp_grpc_span_exporter/0
|
|
12
|
+
* @example custom-name
|
|
13
|
+
*
|
|
14
|
+
* @note Implementations **SHOULD** ensure a low cardinality for this attribute, even across application or SDK restarts.
|
|
15
|
+
* E.g. implementations **MUST NOT** use UUIDs as values for this attribute.
|
|
16
|
+
*
|
|
17
|
+
* Implementations **MAY** achieve these goals by following a `<otel.component.type>/<instance-counter>` pattern, e.g. `batching_span_processor/0`.
|
|
18
|
+
* Hereby `otel.component.type` refers to the corresponding attribute value of the component.
|
|
19
|
+
*
|
|
20
|
+
* The value of `instance-counter` **MAY** be automatically assigned by the component and uniqueness within the enclosing SDK instance **MUST** be guaranteed.
|
|
21
|
+
* For example, `<instance-counter>` **MAY** be implemented by using a monotonically increasing counter (starting with `0`), which is incremented every time an
|
|
22
|
+
* instance of the given component type is started.
|
|
23
|
+
*
|
|
24
|
+
* With this implementation, for example the first Batching Span Processor would have `batching_span_processor/0`
|
|
25
|
+
* as `otel.component.name`, the second one `batching_span_processor/1` and so on.
|
|
26
|
+
* These values will therefore be reused in the case of an application restart.
|
|
27
|
+
*
|
|
28
|
+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
29
|
+
*/
|
|
30
|
+
const ATTR_OTEL_COMPONENT_NAME = "otel.component.name";
|
|
31
|
+
/**
|
|
32
|
+
* A name identifying the type of the OpenTelemetry component.
|
|
33
|
+
*
|
|
34
|
+
* @example batching_span_processor
|
|
35
|
+
* @example com.example.MySpanExporter
|
|
36
|
+
*
|
|
37
|
+
* @note If none of the standardized values apply, implementations **SHOULD** use the language-defined name of the type.
|
|
38
|
+
* E.g. for Java the fully qualified classname **SHOULD** be used in this case.
|
|
39
|
+
*
|
|
40
|
+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
41
|
+
*/
|
|
42
|
+
const ATTR_OTEL_COMPONENT_TYPE = "otel.component.type";
|
|
43
|
+
/**
|
|
44
|
+
* Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.
|
|
45
|
+
*
|
|
46
|
+
* @example example.com
|
|
47
|
+
* @example 10.1.2.80
|
|
48
|
+
* @example /tmp/my.sock
|
|
49
|
+
*
|
|
50
|
+
* @note When observed from the client side, and when communicating through an intermediary, `server.address` **SHOULD** represent the server address behind any intermediaries, for example proxies, if it's available.
|
|
51
|
+
*/
|
|
52
|
+
const ATTR_SERVER_ADDRESS = "server.address";
|
|
53
|
+
/**
|
|
54
|
+
* Server port number.
|
|
55
|
+
*
|
|
56
|
+
* @example 80
|
|
57
|
+
* @example 8080
|
|
58
|
+
* @example 443
|
|
59
|
+
*
|
|
60
|
+
* @note When observed from the client side, and when communicating through an intermediary, `server.port` **SHOULD** represent the server port behind any intermediaries, for example proxies, if it's available.
|
|
61
|
+
*/
|
|
62
|
+
const ATTR_SERVER_PORT = "server.port";
|
|
63
|
+
/**
|
|
64
|
+
* Describes a class of error the operation ended with.
|
|
65
|
+
*
|
|
66
|
+
* @example timeout
|
|
67
|
+
* @example java.net.UnknownHostException
|
|
68
|
+
* @example server_certificate_invalid
|
|
69
|
+
* @example 500
|
|
70
|
+
*
|
|
71
|
+
* @note The `error.type` **SHOULD** be predictable, and **SHOULD** have low cardinality.
|
|
72
|
+
*
|
|
73
|
+
* When `error.type` is set to a type (e.g., an exception type), its
|
|
74
|
+
* canonical class name identifying the type within the artifact **SHOULD** be used.
|
|
75
|
+
*
|
|
76
|
+
* Instrumentations **SHOULD** document the list of errors they report.
|
|
77
|
+
*
|
|
78
|
+
* The cardinality of `error.type` within one instrumentation library **SHOULD** be low.
|
|
79
|
+
* Telemetry consumers that aggregate data from multiple instrumentation libraries and applications
|
|
80
|
+
* should be prepared for `error.type` to have high cardinality at query time when no
|
|
81
|
+
* additional filters are applied.
|
|
82
|
+
*
|
|
83
|
+
* If the operation has completed successfully, instrumentations **SHOULD NOT** set `error.type`.
|
|
84
|
+
*
|
|
85
|
+
* If a specific domain defines its own set of error identifiers (such as HTTP or RPC status codes),
|
|
86
|
+
* it's **RECOMMENDED** to:
|
|
87
|
+
*
|
|
88
|
+
* - Use a domain-specific attribute
|
|
89
|
+
* - Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.
|
|
90
|
+
*/
|
|
91
|
+
const ATTR_ERROR_TYPE = "error.type";
|
|
92
|
+
//#endregion
|
|
93
|
+
export { ATTR_ERROR_TYPE, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_OTEL_COMPONENT_NAME, ATTR_OTEL_COMPONENT_TYPE, ATTR_SERVER_ADDRESS, ATTR_SERVER_PORT };
|
|
94
|
+
|
|
95
|
+
//# sourceMappingURL=semconv.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semconv.mjs","names":[],"sources":["../src/semconv.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n\n/**\n * [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).\n *\n * @example 200\n */\nexport const ATTR_HTTP_RESPONSE_STATUS_CODE =\n 'http.response.status_code' as const;\n\n/**\n * A name uniquely identifying the instance of the OpenTelemetry component within its containing SDK instance.\n *\n * @example otlp_grpc_span_exporter/0\n * @example custom-name\n *\n * @note Implementations **SHOULD** ensure a low cardinality for this attribute, even across application or SDK restarts.\n * E.g. implementations **MUST NOT** use UUIDs as values for this attribute.\n *\n * Implementations **MAY** achieve these goals by following a `<otel.component.type>/<instance-counter>` pattern, e.g. `batching_span_processor/0`.\n * Hereby `otel.component.type` refers to the corresponding attribute value of the component.\n *\n * The value of `instance-counter` **MAY** be automatically assigned by the component and uniqueness within the enclosing SDK instance **MUST** be guaranteed.\n * For example, `<instance-counter>` **MAY** be implemented by using a monotonically increasing counter (starting with `0`), which is incremented every time an\n * instance of the given component type is started.\n *\n * With this implementation, for example the first Batching Span Processor would have `batching_span_processor/0`\n * as `otel.component.name`, the second one `batching_span_processor/1` and so on.\n * These values will therefore be reused in the case of an application restart.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_OTEL_COMPONENT_NAME = 'otel.component.name' as const;\n\n/**\n * A name identifying the type of the OpenTelemetry component.\n *\n * @example batching_span_processor\n * @example com.example.MySpanExporter\n *\n * @note If none of the standardized values apply, implementations **SHOULD** use the language-defined name of the type.\n * E.g. for Java the fully qualified classname **SHOULD** be used in this case.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_OTEL_COMPONENT_TYPE = 'otel.component.type' as const;\n\n/**\n * Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.\n *\n * @example example.com\n * @example 10.1.2.80\n * @example /tmp/my.sock\n *\n * @note When observed from the client side, and when communicating through an intermediary, `server.address` **SHOULD** represent the server address behind any intermediaries, for example proxies, if it's available.\n */\nexport const ATTR_SERVER_ADDRESS = 'server.address' as const;\n\n/**\n * Server port number.\n *\n * @example 80\n * @example 8080\n * @example 443\n *\n * @note When observed from the client side, and when communicating through an intermediary, `server.port` **SHOULD** represent the server port behind any intermediaries, for example proxies, if it's available.\n */\nexport const ATTR_SERVER_PORT = 'server.port' as const;\n\n/**\n * Describes a class of error the operation ended with.\n *\n * @example timeout\n * @example java.net.UnknownHostException\n * @example server_certificate_invalid\n * @example 500\n *\n * @note The `error.type` **SHOULD** be predictable, and **SHOULD** have low cardinality.\n *\n * When `error.type` is set to a type (e.g., an exception type), its\n * canonical class name identifying the type within the artifact **SHOULD** be used.\n *\n * Instrumentations **SHOULD** document the list of errors they report.\n *\n * The cardinality of `error.type` within one instrumentation library **SHOULD** be low.\n * Telemetry consumers that aggregate data from multiple instrumentation libraries and applications\n * should be prepared for `error.type` to have high cardinality at query time when no\n * additional filters are applied.\n *\n * If the operation has completed successfully, instrumentations **SHOULD NOT** set `error.type`.\n *\n * If a specific domain defines its own set of error identifiers (such as HTTP or RPC status codes),\n * it's **RECOMMENDED** to:\n *\n * - Use a domain-specific attribute\n * - Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.\n */\nexport const ATTR_ERROR_TYPE = 'error.type' as const;\n"],"mappings":";;;;;;AAgBA,MAAa,iCACX;;;;;;;;;;;;;;;;;;;;;;;AAwBF,MAAa,2BAA2B;;;;;;;;;;;;AAaxC,MAAa,2BAA2B;;;;;;;;;;AAWxC,MAAa,sBAAsB;;;;;;;;;;AAWnC,MAAa,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BhC,MAAa,kBAAkB"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
const require_is_export_retryable = require("../is-export-retryable.cjs");
|
|
2
|
+
let _opentelemetry_core = require("@opentelemetry/core");
|
|
3
|
+
let _opentelemetry_api = require("@opentelemetry/api");
|
|
4
|
+
//#region src/transport/fetch-transport.ts
|
|
5
|
+
/**
|
|
6
|
+
* Maximum total body size for concurrent keepalive requests.
|
|
7
|
+
* Browsers enforce a 64KiB cumulative limit across all pending keepalive requests.
|
|
8
|
+
* We use 60KB to leave headroom for headers.
|
|
9
|
+
* @see https://github.com/whatwg/fetch/issues/679
|
|
10
|
+
* @see https://blog.huli.tw/2025/01/06/en/navigator-sendbeacon-64kib-and-source-code/
|
|
11
|
+
*/
|
|
12
|
+
const MAX_KEEPALIVE_BODY_SIZE = 61440;
|
|
13
|
+
/**
|
|
14
|
+
* Maximum concurrent keepalive requests.
|
|
15
|
+
* Chrome enforces 9 concurrent keepalive fetch requests per renderer process.
|
|
16
|
+
* @see https://github.com/whatwg/fetch/issues/679
|
|
17
|
+
* Quote: "If the renderer process is processing more than 9 requests with keepalive set, we reject a new request"
|
|
18
|
+
*/
|
|
19
|
+
const MAX_KEEPALIVE_REQUESTS = 9;
|
|
20
|
+
/**
|
|
21
|
+
* Track cumulative pending body size across all in-flight keepalive requests.
|
|
22
|
+
* This is necessary because the 64KiB limit is cumulative, not per-request.
|
|
23
|
+
*/
|
|
24
|
+
let pendingBodySize = 0;
|
|
25
|
+
/**
|
|
26
|
+
* Track number of pending keepalive requests.
|
|
27
|
+
*/
|
|
28
|
+
let pendingKeepaliveCount = 0;
|
|
29
|
+
var FetchTransport = class {
|
|
30
|
+
_parameters;
|
|
31
|
+
constructor(parameters) {
|
|
32
|
+
this._parameters = parameters;
|
|
33
|
+
}
|
|
34
|
+
async send(data, timeoutMillis) {
|
|
35
|
+
const abortController = new AbortController();
|
|
36
|
+
const timeout = setTimeout(() => abortController.abort(), timeoutMillis);
|
|
37
|
+
let fetchApi = globalThis.fetch;
|
|
38
|
+
if (typeof fetchApi.__original === "function") fetchApi = fetchApi.__original;
|
|
39
|
+
const requestSize = data.byteLength;
|
|
40
|
+
const wouldExceedSize = pendingBodySize + requestSize > MAX_KEEPALIVE_BODY_SIZE;
|
|
41
|
+
const useKeepalive = !wouldExceedSize && !(pendingKeepaliveCount >= MAX_KEEPALIVE_REQUESTS);
|
|
42
|
+
if (useKeepalive) {
|
|
43
|
+
pendingBodySize += requestSize;
|
|
44
|
+
pendingKeepaliveCount++;
|
|
45
|
+
} else {
|
|
46
|
+
const reason = wouldExceedSize ? "size limit" : "count limit";
|
|
47
|
+
_opentelemetry_api.diag.debug(`keepalive disabled: ${(requestSize / 1024).toFixed(1)}KB payload, ${pendingKeepaliveCount} pending (${reason})`);
|
|
48
|
+
}
|
|
49
|
+
const suppressedContext = (0, _opentelemetry_core.suppressTracing)(_opentelemetry_api.context.active());
|
|
50
|
+
try {
|
|
51
|
+
const url = new URL(this._parameters.url);
|
|
52
|
+
const headers = await this._parameters.headers();
|
|
53
|
+
const response = await _opentelemetry_api.context.with(suppressedContext, () => fetchApi(url.href, {
|
|
54
|
+
method: "POST",
|
|
55
|
+
headers,
|
|
56
|
+
body: data,
|
|
57
|
+
signal: abortController.signal,
|
|
58
|
+
keepalive: useKeepalive,
|
|
59
|
+
mode: globalThis.location ? globalThis.location.origin === url.origin ? "same-origin" : "cors" : "no-cors"
|
|
60
|
+
}));
|
|
61
|
+
await drainResponseBody(response);
|
|
62
|
+
if (response.status >= 200 && response.status <= 299) {
|
|
63
|
+
_opentelemetry_api.diag.debug(`export response success (status: ${response.status})`);
|
|
64
|
+
return { status: "success" };
|
|
65
|
+
} else if (require_is_export_retryable.isExportHTTPErrorRetryable(response.status)) {
|
|
66
|
+
_opentelemetry_api.diag.warn(`export response retryable (status: ${response.status})`);
|
|
67
|
+
const retryAfter = response.headers.get("Retry-After");
|
|
68
|
+
return {
|
|
69
|
+
status: "retryable",
|
|
70
|
+
retryInMillis: require_is_export_retryable.parseRetryAfterToMills(retryAfter)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
_opentelemetry_api.diag.error(`export response failure (status: ${response.status})`);
|
|
74
|
+
return {
|
|
75
|
+
status: "failure",
|
|
76
|
+
error: /* @__PURE__ */ new Error(`Fetch request failed with non-retryable status ${response.status}`)
|
|
77
|
+
};
|
|
78
|
+
} catch (error) {
|
|
79
|
+
if (isFetchNetworkErrorRetryable(error)) {
|
|
80
|
+
_opentelemetry_api.diag.warn(`export request retryable (network error: ${error})`);
|
|
81
|
+
return {
|
|
82
|
+
status: "retryable",
|
|
83
|
+
error: new Error("Fetch request encountered a network error", { cause: error })
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
_opentelemetry_api.diag.error(`export request failure (error: ${error})`);
|
|
87
|
+
return {
|
|
88
|
+
status: "failure",
|
|
89
|
+
error: new Error("Fetch request errored", { cause: error })
|
|
90
|
+
};
|
|
91
|
+
} finally {
|
|
92
|
+
clearTimeout(timeout);
|
|
93
|
+
if (useKeepalive) {
|
|
94
|
+
pendingBodySize -= requestSize;
|
|
95
|
+
pendingKeepaliveCount--;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
shutdown() {}
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Creates an exporter transport that uses `fetch` to send the data
|
|
103
|
+
* @param parameters applied to each request made by transport
|
|
104
|
+
*/
|
|
105
|
+
function createFetchTransport(parameters) {
|
|
106
|
+
return new FetchTransport(parameters);
|
|
107
|
+
}
|
|
108
|
+
function isFetchNetworkErrorRetryable(error) {
|
|
109
|
+
return error instanceof TypeError && !error.cause;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Reads the response body to its end and discards it.
|
|
113
|
+
*
|
|
114
|
+
* Chromium gives the request's share of the keepalive quota back only once the
|
|
115
|
+
* response body has been read to the end, and it skips the buffering consumer
|
|
116
|
+
* that would otherwise drain the body on its own when the response carries a
|
|
117
|
+
* `Cache-Control: no-store` header, which collectors commonly send. Leaving the
|
|
118
|
+
* body unread then leaks the quota until the document goes away and every
|
|
119
|
+
* following keepalive export stays pending forever. Cancelling the body is the
|
|
120
|
+
* client-abort path and releases the quota far more slowly than reading it to
|
|
121
|
+
* the end, so the body is read rather than cancelled.
|
|
122
|
+
*
|
|
123
|
+
* @see https://fetch.spec.whatwg.org/#fetch-processresponseendofbody
|
|
124
|
+
*/
|
|
125
|
+
async function drainResponseBody(response) {
|
|
126
|
+
try {
|
|
127
|
+
const body = response.body;
|
|
128
|
+
if (body == null) return;
|
|
129
|
+
const reader = body.getReader();
|
|
130
|
+
try {
|
|
131
|
+
let chunk = await reader.read();
|
|
132
|
+
while (!chunk.done) chunk = await reader.read();
|
|
133
|
+
} finally {
|
|
134
|
+
reader.releaseLock();
|
|
135
|
+
}
|
|
136
|
+
} catch (error) {
|
|
137
|
+
_opentelemetry_api.diag.debug(`error reading export response body: ${error}`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
//#endregion
|
|
141
|
+
exports.createFetchTransport = createFetchTransport;
|
|
142
|
+
|
|
143
|
+
//# sourceMappingURL=fetch-transport.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-transport.cjs","names":["suppressTracing","context","isExportHTTPErrorRetryable","parseRetryAfterToMills"],"sources":["../../src/transport/fetch-transport.ts"],"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 { context, diag } from '@opentelemetry/api';\nimport { suppressTracing } from '@opentelemetry/core';\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 // creating an indirect endless loop Export -> Span -> Export.\n // `__original` lets the call bypass one wrapper; the suppressed context\n // below covers a `fetch` that was wrapped more than once.\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 // Captured before the first `await`, which a synchronous context manager\n // would not survive.\n const suppressedContext = suppressTracing(context.active());\n\n try {\n const url = new URL(this._parameters.url);\n // Resolve headers before entering the suppressed fetch context.\n const headers = await this._parameters.headers();\n const response = await context.with(suppressedContext, () =>\n fetchApi(url.href, {\n method: 'POST',\n 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\n await drainResponseBody(response);\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\n/**\n * Reads the response body to its end and discards it.\n *\n * Chromium gives the request's share of the keepalive quota back only once the\n * response body has been read to the end, and it skips the buffering consumer\n * that would otherwise drain the body on its own when the response carries a\n * `Cache-Control: no-store` header, which collectors commonly send. Leaving the\n * body unread then leaks the quota until the document goes away and every\n * following keepalive export stays pending forever. Cancelling the body is the\n * client-abort path and releases the quota far more slowly than reading it to\n * the end, so the body is read rather than cancelled.\n *\n * @see https://fetch.spec.whatwg.org/#fetch-processresponseendofbody\n */\nasync function drainResponseBody(response: Response): Promise<void> {\n try {\n // Empty and opaque responses have no body to read.\n const body = response.body;\n if (body == null) {\n return;\n }\n\n // Throws when the body is already locked to another reader, which happens\n // when the same response is handed to more than one export.\n const reader = body.getReader();\n try {\n // Chunks are dropped as they arrive: the payload is not used, and\n // buffering it - with `response.arrayBuffer()` for instance - would keep\n // a response of arbitrary size in memory.\n let chunk = await reader.read();\n while (!chunk.done) {\n chunk = await reader.read();\n }\n } finally {\n // The reader keeps the body locked until it is released, which would\n // make a later export handed the same response fail to acquire a reader\n // and skip the drain.\n reader.releaseLock();\n }\n } catch (error) {\n // The export outcome is decided by the response status, a body that cannot\n // be read must not change it.\n diag.debug(`error reading export response body: ${error}`);\n }\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { isExportHTTPErrorRetryable, parseRetryAfterToMills } from "../is-export-retryable.mjs";
|
|
2
|
+
import { suppressTracing } from "@opentelemetry/core";
|
|
3
|
+
import { context, diag } from "@opentelemetry/api";
|
|
4
|
+
//#region src/transport/fetch-transport.ts
|
|
5
|
+
/**
|
|
6
|
+
* Maximum total body size for concurrent keepalive requests.
|
|
7
|
+
* Browsers enforce a 64KiB cumulative limit across all pending keepalive requests.
|
|
8
|
+
* We use 60KB to leave headroom for headers.
|
|
9
|
+
* @see https://github.com/whatwg/fetch/issues/679
|
|
10
|
+
* @see https://blog.huli.tw/2025/01/06/en/navigator-sendbeacon-64kib-and-source-code/
|
|
11
|
+
*/
|
|
12
|
+
const MAX_KEEPALIVE_BODY_SIZE = 61440;
|
|
13
|
+
/**
|
|
14
|
+
* Maximum concurrent keepalive requests.
|
|
15
|
+
* Chrome enforces 9 concurrent keepalive fetch requests per renderer process.
|
|
16
|
+
* @see https://github.com/whatwg/fetch/issues/679
|
|
17
|
+
* Quote: "If the renderer process is processing more than 9 requests with keepalive set, we reject a new request"
|
|
18
|
+
*/
|
|
19
|
+
const MAX_KEEPALIVE_REQUESTS = 9;
|
|
20
|
+
/**
|
|
21
|
+
* Track cumulative pending body size across all in-flight keepalive requests.
|
|
22
|
+
* This is necessary because the 64KiB limit is cumulative, not per-request.
|
|
23
|
+
*/
|
|
24
|
+
let pendingBodySize = 0;
|
|
25
|
+
/**
|
|
26
|
+
* Track number of pending keepalive requests.
|
|
27
|
+
*/
|
|
28
|
+
let pendingKeepaliveCount = 0;
|
|
29
|
+
var FetchTransport = class {
|
|
30
|
+
_parameters;
|
|
31
|
+
constructor(parameters) {
|
|
32
|
+
this._parameters = parameters;
|
|
33
|
+
}
|
|
34
|
+
async send(data, timeoutMillis) {
|
|
35
|
+
const abortController = new AbortController();
|
|
36
|
+
const timeout = setTimeout(() => abortController.abort(), timeoutMillis);
|
|
37
|
+
let fetchApi = globalThis.fetch;
|
|
38
|
+
if (typeof fetchApi.__original === "function") fetchApi = fetchApi.__original;
|
|
39
|
+
const requestSize = data.byteLength;
|
|
40
|
+
const wouldExceedSize = pendingBodySize + requestSize > MAX_KEEPALIVE_BODY_SIZE;
|
|
41
|
+
const useKeepalive = !wouldExceedSize && !(pendingKeepaliveCount >= MAX_KEEPALIVE_REQUESTS);
|
|
42
|
+
if (useKeepalive) {
|
|
43
|
+
pendingBodySize += requestSize;
|
|
44
|
+
pendingKeepaliveCount++;
|
|
45
|
+
} else {
|
|
46
|
+
const reason = wouldExceedSize ? "size limit" : "count limit";
|
|
47
|
+
diag.debug(`keepalive disabled: ${(requestSize / 1024).toFixed(1)}KB payload, ${pendingKeepaliveCount} pending (${reason})`);
|
|
48
|
+
}
|
|
49
|
+
const suppressedContext = suppressTracing(context.active());
|
|
50
|
+
try {
|
|
51
|
+
const url = new URL(this._parameters.url);
|
|
52
|
+
const headers = await this._parameters.headers();
|
|
53
|
+
const response = await context.with(suppressedContext, () => fetchApi(url.href, {
|
|
54
|
+
method: "POST",
|
|
55
|
+
headers,
|
|
56
|
+
body: data,
|
|
57
|
+
signal: abortController.signal,
|
|
58
|
+
keepalive: useKeepalive,
|
|
59
|
+
mode: globalThis.location ? globalThis.location.origin === url.origin ? "same-origin" : "cors" : "no-cors"
|
|
60
|
+
}));
|
|
61
|
+
await drainResponseBody(response);
|
|
62
|
+
if (response.status >= 200 && response.status <= 299) {
|
|
63
|
+
diag.debug(`export response success (status: ${response.status})`);
|
|
64
|
+
return { status: "success" };
|
|
65
|
+
} else if (isExportHTTPErrorRetryable(response.status)) {
|
|
66
|
+
diag.warn(`export response retryable (status: ${response.status})`);
|
|
67
|
+
const retryAfter = response.headers.get("Retry-After");
|
|
68
|
+
return {
|
|
69
|
+
status: "retryable",
|
|
70
|
+
retryInMillis: parseRetryAfterToMills(retryAfter)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
diag.error(`export response failure (status: ${response.status})`);
|
|
74
|
+
return {
|
|
75
|
+
status: "failure",
|
|
76
|
+
error: /* @__PURE__ */ new Error(`Fetch request failed with non-retryable status ${response.status}`)
|
|
77
|
+
};
|
|
78
|
+
} catch (error) {
|
|
79
|
+
if (isFetchNetworkErrorRetryable(error)) {
|
|
80
|
+
diag.warn(`export request retryable (network error: ${error})`);
|
|
81
|
+
return {
|
|
82
|
+
status: "retryable",
|
|
83
|
+
error: new Error("Fetch request encountered a network error", { cause: error })
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
diag.error(`export request failure (error: ${error})`);
|
|
87
|
+
return {
|
|
88
|
+
status: "failure",
|
|
89
|
+
error: new Error("Fetch request errored", { cause: error })
|
|
90
|
+
};
|
|
91
|
+
} finally {
|
|
92
|
+
clearTimeout(timeout);
|
|
93
|
+
if (useKeepalive) {
|
|
94
|
+
pendingBodySize -= requestSize;
|
|
95
|
+
pendingKeepaliveCount--;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
shutdown() {}
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Creates an exporter transport that uses `fetch` to send the data
|
|
103
|
+
* @param parameters applied to each request made by transport
|
|
104
|
+
*/
|
|
105
|
+
function createFetchTransport(parameters) {
|
|
106
|
+
return new FetchTransport(parameters);
|
|
107
|
+
}
|
|
108
|
+
function isFetchNetworkErrorRetryable(error) {
|
|
109
|
+
return error instanceof TypeError && !error.cause;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Reads the response body to its end and discards it.
|
|
113
|
+
*
|
|
114
|
+
* Chromium gives the request's share of the keepalive quota back only once the
|
|
115
|
+
* response body has been read to the end, and it skips the buffering consumer
|
|
116
|
+
* that would otherwise drain the body on its own when the response carries a
|
|
117
|
+
* `Cache-Control: no-store` header, which collectors commonly send. Leaving the
|
|
118
|
+
* body unread then leaks the quota until the document goes away and every
|
|
119
|
+
* following keepalive export stays pending forever. Cancelling the body is the
|
|
120
|
+
* client-abort path and releases the quota far more slowly than reading it to
|
|
121
|
+
* the end, so the body is read rather than cancelled.
|
|
122
|
+
*
|
|
123
|
+
* @see https://fetch.spec.whatwg.org/#fetch-processresponseendofbody
|
|
124
|
+
*/
|
|
125
|
+
async function drainResponseBody(response) {
|
|
126
|
+
try {
|
|
127
|
+
const body = response.body;
|
|
128
|
+
if (body == null) return;
|
|
129
|
+
const reader = body.getReader();
|
|
130
|
+
try {
|
|
131
|
+
let chunk = await reader.read();
|
|
132
|
+
while (!chunk.done) chunk = await reader.read();
|
|
133
|
+
} finally {
|
|
134
|
+
reader.releaseLock();
|
|
135
|
+
}
|
|
136
|
+
} catch (error) {
|
|
137
|
+
diag.debug(`error reading export response body: ${error}`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
//#endregion
|
|
141
|
+
export { createFetchTransport };
|
|
142
|
+
|
|
143
|
+
//# sourceMappingURL=fetch-transport.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-transport.mjs","names":[],"sources":["../../src/transport/fetch-transport.ts"],"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 { context, diag } from '@opentelemetry/api';\nimport { suppressTracing } from '@opentelemetry/core';\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 // creating an indirect endless loop Export -> Span -> Export.\n // `__original` lets the call bypass one wrapper; the suppressed context\n // below covers a `fetch` that was wrapped more than once.\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 // Captured before the first `await`, which a synchronous context manager\n // would not survive.\n const suppressedContext = suppressTracing(context.active());\n\n try {\n const url = new URL(this._parameters.url);\n // Resolve headers before entering the suppressed fetch context.\n const headers = await this._parameters.headers();\n const response = await context.with(suppressedContext, () =>\n fetchApi(url.href, {\n method: 'POST',\n 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\n await drainResponseBody(response);\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\n/**\n * Reads the response body to its end and discards it.\n *\n * Chromium gives the request's share of the keepalive quota back only once the\n * response body has been read to the end, and it skips the buffering consumer\n * that would otherwise drain the body on its own when the response carries a\n * `Cache-Control: no-store` header, which collectors commonly send. Leaving the\n * body unread then leaks the quota until the document goes away and every\n * following keepalive export stays pending forever. Cancelling the body is the\n * client-abort path and releases the quota far more slowly than reading it to\n * the end, so the body is read rather than cancelled.\n *\n * @see https://fetch.spec.whatwg.org/#fetch-processresponseendofbody\n */\nasync function drainResponseBody(response: Response): Promise<void> {\n try {\n // Empty and opaque responses have no body to read.\n const body = response.body;\n if (body == null) {\n return;\n }\n\n // Throws when the body is already locked to another reader, which happens\n // when the same response is handed to more than one export.\n const reader = body.getReader();\n try {\n // Chunks are dropped as they arrive: the payload is not used, and\n // buffering it - with `response.arrayBuffer()` for instance - would keep\n // a response of arbitrary size in memory.\n let chunk = await reader.read();\n while (!chunk.done) {\n chunk = await reader.read();\n }\n } finally {\n // The reader keeps the body locked until it is released, which would\n // make a later export handed the same response fail to acquire a reader\n // and skip the drain.\n reader.releaseLock();\n }\n } catch (error) {\n // The export outcome is decided by the response status, a body that cannot\n // be read must not change it.\n diag.debug(`error reading export response body: ${error}`);\n }\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const require_http_transport_utils = require("./http-transport-utils.cjs");
|
|
2
|
+
//#region src/transport/http-exporter-transport.ts
|
|
3
|
+
var HttpExporterTransport = class {
|
|
4
|
+
_utils = null;
|
|
5
|
+
_parameters;
|
|
6
|
+
constructor(parameters) {
|
|
7
|
+
this._parameters = parameters;
|
|
8
|
+
}
|
|
9
|
+
async send(data, timeoutMillis) {
|
|
10
|
+
const { agent, request } = await this._loadUtils();
|
|
11
|
+
const headers = await this._parameters.headers();
|
|
12
|
+
return require_http_transport_utils.sendWithHttp(request, this._parameters.url, headers, this._parameters.compression, this._parameters.userAgent, agent, data, timeoutMillis);
|
|
13
|
+
}
|
|
14
|
+
shutdown() {}
|
|
15
|
+
async _loadUtils() {
|
|
16
|
+
let utils = this._utils;
|
|
17
|
+
if (utils === null) {
|
|
18
|
+
const protocol = new URL(this._parameters.url).protocol;
|
|
19
|
+
const [agent, request] = await Promise.all([this._parameters.agentFactory(protocol), requestFunctionFactory(protocol)]);
|
|
20
|
+
utils = this._utils = {
|
|
21
|
+
agent,
|
|
22
|
+
request
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return utils;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
async function requestFunctionFactory(protocol) {
|
|
29
|
+
const { request } = await (protocol === "http:" ? import("http") : import("https"));
|
|
30
|
+
return request;
|
|
31
|
+
}
|
|
32
|
+
function createHttpExporterTransport(parameters) {
|
|
33
|
+
return new HttpExporterTransport(parameters);
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
exports.createHttpExporterTransport = createHttpExporterTransport;
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=http-exporter-transport.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-exporter-transport.cjs","names":["sendWithHttp"],"sources":["../../src/transport/http-exporter-transport.ts"],"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"],"mappings":";;AAmBA,IAAM,wBAAN,MAA0D;CACxD,SAA+B;CAC/B;CAEA,YAAY,YAAuC;EACjD,KAAK,cAAc;CACrB;CAEA,MAAM,KAAK,MAAkB,eAAgD;EAC3E,MAAM,EAAE,OAAO,YAAY,MAAM,KAAK,WAAW;EACjD,MAAM,UAAU,MAAM,KAAK,YAAY,QAAQ;EAE/C,OAAOA,6BAAAA,aACL,SACA,KAAK,YAAY,KACjB,SACA,KAAK,YAAY,aACjB,KAAK,YAAY,WACjB,OACA,MACA,aACF;CACF;CAEA,WAAW,CAEX;CAEA,MAAc,aAA6B;EACzC,IAAI,QAAQ,KAAK;EAEjB,IAAI,UAAU,MAAM;GAClB,MAAM,WAAW,IAAI,IAAI,KAAK,YAAY,GAAG,CAAC,CAAC;GAC/C,MAAM,CAAC,OAAO,WAAW,MAAM,QAAQ,IAAI,CACzC,KAAK,YAAY,aAAa,QAAQ,GACtC,uBAAuB,QAAQ,CACjC,CAAC;GACD,QAAQ,KAAK,SAAS;IAAE;IAAO;GAAQ;EACzC;EAEA,OAAO;CACT;AACF;AAEA,eAAe,uBACb,UACqD;CAErD,MAAM,EAAE,YAAY,OADL,aAAa,UAAU,OAAO,UAAU,OAAO;CAE9D,OAAO;AACT;AAEA,SAAgB,4BACd,YACoB;CACpB,OAAO,IAAI,sBAAsB,UAAU;AAC7C"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { sendWithHttp } from "./http-transport-utils.mjs";
|
|
2
|
+
//#region src/transport/http-exporter-transport.ts
|
|
3
|
+
var HttpExporterTransport = class {
|
|
4
|
+
_utils = null;
|
|
5
|
+
_parameters;
|
|
6
|
+
constructor(parameters) {
|
|
7
|
+
this._parameters = parameters;
|
|
8
|
+
}
|
|
9
|
+
async send(data, timeoutMillis) {
|
|
10
|
+
const { agent, request } = await this._loadUtils();
|
|
11
|
+
const headers = await this._parameters.headers();
|
|
12
|
+
return sendWithHttp(request, this._parameters.url, headers, this._parameters.compression, this._parameters.userAgent, agent, data, timeoutMillis);
|
|
13
|
+
}
|
|
14
|
+
shutdown() {}
|
|
15
|
+
async _loadUtils() {
|
|
16
|
+
let utils = this._utils;
|
|
17
|
+
if (utils === null) {
|
|
18
|
+
const protocol = new URL(this._parameters.url).protocol;
|
|
19
|
+
const [agent, request] = await Promise.all([this._parameters.agentFactory(protocol), requestFunctionFactory(protocol)]);
|
|
20
|
+
utils = this._utils = {
|
|
21
|
+
agent,
|
|
22
|
+
request
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return utils;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
async function requestFunctionFactory(protocol) {
|
|
29
|
+
const { request } = await (protocol === "http:" ? import("http") : import("https"));
|
|
30
|
+
return request;
|
|
31
|
+
}
|
|
32
|
+
function createHttpExporterTransport(parameters) {
|
|
33
|
+
return new HttpExporterTransport(parameters);
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { createHttpExporterTransport };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=http-exporter-transport.mjs.map
|