@vercel/otel 1.10.4 → 1.11.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/README.md +1 -1
- package/dist/edge/index.js +1 -1
- package/dist/edge/index.js.map +3 -3
- package/dist/node/index.js +7 -7
- package/dist/node/index.js.map +3 -3
- package/dist/types/types.d.ts +2 -2
- package/package.json +3 -3
package/dist/edge/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["external:@opentelemetry/api", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/trace/suppress-tracing.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/baggage/constants.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/baggage/utils.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/baggage/propagation/W3CBaggagePropagator.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/common/anchored-clock.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/common/attributes.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/common/logging-error-handler.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/common/global-error-handler.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/utils/sampling.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/platform/browser/globalThis.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/utils/environment.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/platform/browser/environment.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/platform/browser/hex-to-base64.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/platform/browser/RandomIdGenerator.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/platform/browser/performance.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/version.ts", "../../../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.19.0/node_modules/@opentelemetry/semantic-conventions/src/trace/SemanticAttributes.ts", "../../../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.19.0/node_modules/@opentelemetry/semantic-conventions/src/trace/index.ts", "../../../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.19.0/node_modules/@opentelemetry/semantic-conventions/src/resource/SemanticResourceAttributes.ts", "../../../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.19.0/node_modules/@opentelemetry/semantic-conventions/src/resource/index.ts", "../../../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.19.0/node_modules/@opentelemetry/semantic-conventions/src/index.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/platform/browser/sdk-info.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/platform/browser/timer-util.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/platform/browser/index.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/common/time.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/ExportResult.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/propagation/composite.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/internal/validators.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/trace/TraceState.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/trace/W3CTraceContextPropagator.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/trace/rpc-metadata.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/trace/sampler/AlwaysOffSampler.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/trace/sampler/AlwaysOnSampler.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/trace/sampler/ParentBasedSampler.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/trace/sampler/TraceIdRatioBasedSampler.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/utils/lodash.merge.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/utils/merge.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/utils/timeout.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/utils/url.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/utils/wrap.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/utils/promise.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/utils/callback.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/internal/exporter.ts", "../../../../node_modules/.pnpm/@opentelemetry+core@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/core/src/index.ts", "../../../../node_modules/.pnpm/@opentelemetry+instrumentation@0.46.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/instrumentation/src/autoLoaderUtils.ts", "../../../../node_modules/.pnpm/@opentelemetry+instrumentation@0.46.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/instrumentation/src/autoLoader.ts", "external:async_hooks", "external:events", "../../../../node_modules/.pnpm/@opentelemetry+context-async-hooks@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/context-async-hooks/src/AbstractAsyncHooksContextManager.ts", "../../../../node_modules/.pnpm/@opentelemetry+context-async-hooks@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/context-async-hooks/src/AsyncLocalStorageContextManager.ts", "../../../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.46.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/otlp-transformer/src/common/internal.ts", "../../../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.46.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/otlp-transformer/src/trace/internal.ts", "../../../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.46.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/otlp-transformer/src/common/index.ts", "../../../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.46.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/otlp-transformer/src/trace/index.ts", "../../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.46.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/otlp-exporter-base/src/util.ts", "../../../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.46.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/otlp-exporter-base/src/OTLPExporterBase.ts", "../../../../node_modules/.pnpm/@protobufjs+aspromise@1.1.2/node_modules/@protobufjs/aspromise/index.js", "../../../../node_modules/.pnpm/@protobufjs+base64@1.1.2/node_modules/@protobufjs/base64/index.js", "../../../../node_modules/.pnpm/@protobufjs+eventemitter@1.1.0/node_modules/@protobufjs/eventemitter/index.js", "../../../../node_modules/.pnpm/@protobufjs+float@1.0.2/node_modules/@protobufjs/float/index.js", "../../../../node_modules/.pnpm/@protobufjs+inquire@1.1.0/node_modules/@protobufjs/inquire/index.js", "../../../../node_modules/.pnpm/@protobufjs+utf8@1.1.0/node_modules/@protobufjs/utf8/index.js", "../../../../node_modules/.pnpm/@protobufjs+pool@1.1.0/node_modules/@protobufjs/pool/index.js", "../../../../node_modules/.pnpm/protobufjs@7.2.6/node_modules/protobufjs/src/util/longbits.js", "../../../../node_modules/.pnpm/protobufjs@7.2.6/node_modules/protobufjs/src/util/minimal.js", "../../../../node_modules/.pnpm/protobufjs@7.2.6/node_modules/protobufjs/src/writer.js", "../../../../node_modules/.pnpm/protobufjs@7.2.6/node_modules/protobufjs/src/writer_buffer.js", "../../../../node_modules/.pnpm/protobufjs@7.2.6/node_modules/protobufjs/src/reader.js", "../../../../node_modules/.pnpm/protobufjs@7.2.6/node_modules/protobufjs/src/reader_buffer.js", "../../../../node_modules/.pnpm/protobufjs@7.2.6/node_modules/protobufjs/src/rpc/service.js", "../../../../node_modules/.pnpm/protobufjs@7.2.6/node_modules/protobufjs/src/rpc.js", "../../../../node_modules/.pnpm/protobufjs@7.2.6/node_modules/protobufjs/src/roots.js", "../../../../node_modules/.pnpm/protobufjs@7.2.6/node_modules/protobufjs/src/index-minimal.js", "../../../../node_modules/.pnpm/protobufjs@7.2.6/node_modules/protobufjs/minimal.js", "../../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-trace-base/src/Tracer.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-trace-base/src/Span.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-trace-base/src/enums.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-trace-base/src/config.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-trace-base/src/Sampler.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-trace-base/src/sampler/AlwaysOffSampler.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-trace-base/src/sampler/AlwaysOnSampler.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-trace-base/src/sampler/ParentBasedSampler.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-trace-base/src/sampler/TraceIdRatioBasedSampler.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-trace-base/src/utility.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-trace-base/src/export/BatchSpanProcessorBase.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-trace-base/src/platform/browser/export/BatchSpanProcessor.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-trace-base/src/platform/browser/RandomIdGenerator.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-trace-base/src/BasicTracerProvider.ts", "../../../../node_modules/.pnpm/@opentelemetry+resources@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/resources/src/Resource.ts", "../../../../node_modules/.pnpm/@opentelemetry+resources@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/resources/src/platform/browser/default-service-name.ts", "../../../../node_modules/.pnpm/@opentelemetry+resources@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/resources/src/detectors/EnvDetectorSync.ts", "../../../../node_modules/.pnpm/@opentelemetry+resources@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/resources/src/detect-resources.ts", "../../../../node_modules/.pnpm/@opentelemetry+resources@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/resources/src/utils.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-trace-base/src/MultiSpanProcessor.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-trace-base/src/export/NoopSpanProcessor.ts", "../../src/sdk.ts", "external:@opentelemetry/api-logs", "../../../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.46.0_@opentelemetry+api-logs@0.46.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-logs/src/LoggerProvider.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.46.0_@opentelemetry+api-logs@0.46.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-logs/src/Logger.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.46.0_@opentelemetry+api-logs@0.46.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-logs/src/LogRecord.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.46.0_@opentelemetry+api-logs@0.46.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-logs/src/config.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.46.0_@opentelemetry+api-logs@0.46.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-logs/src/MultiLogRecordProcessor.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.46.0_@opentelemetry+api-logs@0.46.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-logs/src/export/NoopLogRecordProcessor.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.46.0_@opentelemetry+api-logs@0.46.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-logs/src/internal/LoggerProviderSharedState.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/export/AggregationTemporality.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/utils.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/InstrumentDescriptor.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/MeterProvider.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/view/ViewRegistry.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/Instruments.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/Meter.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/state/MetricStorage.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/state/HashMap.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/state/DeltaMetricProcessor.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/state/TemporalMetricProcessor.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/state/AsyncMetricStorage.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/state/MetricStorageRegistry.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/view/RegistrationConflicts.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/state/MultiWritableMetricStorage.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/state/ObservableRegistry.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/ObservableResult.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/state/SyncMetricStorage.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/view/AttributesProcessor.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/state/MeterSharedState.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/state/MeterProviderSharedState.ts", "../../../../node_modules/.pnpm/@opentelemetry+sdk-metrics@1.19.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/sdk-metrics/src/state/MetricCollector.ts", "../../src/processor/composite-span-processor.ts", "../../src/vercel-request-context/api.ts", "../../src/vercel-request-context/attributes.ts", "../../src/util/attributes.ts", "../../src/util/request-id.ts", "../../src/util/sampled.ts", "../../src/exporters/exporter-trace-otlp-http-fetch.ts", "../../src/exporters/otlp-exporter-base.ts", "../../src/exporters/trace-config.ts", "../../src/exporters/exporter-trace-otlp-proto-fetch.ts", "../../src/exporters/proto.ts", "../../src/instrumentations/fetch.ts", "../../src/util/template.ts", "../../src/propagators/w3c-tracecontext-propagator.ts", "../../src/vercel-request-context/propagator.ts", "../../src/vercel-request-context/exporter.ts", "../../../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.46.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/otlp-transformer/src/common/index.ts", "../../../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.46.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/otlp-transformer/src/common/internal.ts", "../../../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.46.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/otlp-transformer/src/trace/internal.ts", "../../../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.46.0_@opentelemetry+api@1.7.0/node_modules/@opentelemetry/otlp-transformer/src/trace/index.ts", "../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from \"@opentelemetry/api\"", "/*\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 { Context, createContextKey } from '@opentelemetry/api';\n\nconst SUPPRESS_TRACING_KEY = createContextKey(\n 'OpenTelemetry SDK Context Key SUPPRESS_TRACING'\n);\n\nexport function suppressTracing(context: Context): Context {\n return context.setValue(SUPPRESS_TRACING_KEY, true);\n}\n\nexport function unsuppressTracing(context: Context): Context {\n return context.deleteValue(SUPPRESS_TRACING_KEY);\n}\n\nexport function isTracingSuppressed(context: Context): boolean {\n return context.getValue(SUPPRESS_TRACING_KEY) === true;\n}\n", "/*\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\nexport const BAGGAGE_KEY_PAIR_SEPARATOR = '=';\nexport const BAGGAGE_PROPERTIES_SEPARATOR = ';';\nexport const BAGGAGE_ITEMS_SEPARATOR = ',';\n\n// Name of the http header used to propagate the baggage\nexport const BAGGAGE_HEADER = 'baggage';\n// Maximum number of name-value pairs allowed by w3c spec\nexport const BAGGAGE_MAX_NAME_VALUE_PAIRS = 180;\n// Maximum number of bytes per a single name-value pair allowed by w3c spec\nexport const BAGGAGE_MAX_PER_NAME_VALUE_PAIRS = 4096;\n// Maximum total length of all name-value pairs allowed by w3c spec\nexport const BAGGAGE_MAX_TOTAL_LENGTH = 8192;\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Baggage,\n BaggageEntryMetadata,\n baggageEntryMetadataFromString,\n} from '@opentelemetry/api';\nimport {\n BAGGAGE_ITEMS_SEPARATOR,\n BAGGAGE_PROPERTIES_SEPARATOR,\n BAGGAGE_KEY_PAIR_SEPARATOR,\n BAGGAGE_MAX_TOTAL_LENGTH,\n} from './constants';\n\ntype ParsedBaggageKeyValue = {\n key: string;\n value: string;\n metadata: BaggageEntryMetadata | undefined;\n};\n\nexport function serializeKeyPairs(keyPairs: string[]): string {\n return keyPairs.reduce((hValue: string, current: string) => {\n const value = `${hValue}${\n hValue !== '' ? BAGGAGE_ITEMS_SEPARATOR : ''\n }${current}`;\n return value.length > BAGGAGE_MAX_TOTAL_LENGTH ? hValue : value;\n }, '');\n}\n\nexport function getKeyPairs(baggage: Baggage): string[] {\n return baggage.getAllEntries().map(([key, value]) => {\n let entry = `${encodeURIComponent(key)}=${encodeURIComponent(value.value)}`;\n\n // include opaque metadata if provided\n // NOTE: we intentionally don't URI-encode the metadata - that responsibility falls on the metadata implementation\n if (value.metadata !== undefined) {\n entry += BAGGAGE_PROPERTIES_SEPARATOR + value.metadata.toString();\n }\n\n return entry;\n });\n}\n\nexport function parsePairKeyValue(\n entry: string\n): ParsedBaggageKeyValue | undefined {\n const valueProps = entry.split(BAGGAGE_PROPERTIES_SEPARATOR);\n if (valueProps.length <= 0) return;\n const keyPairPart = valueProps.shift();\n if (!keyPairPart) return;\n const separatorIndex = keyPairPart.indexOf(BAGGAGE_KEY_PAIR_SEPARATOR);\n if (separatorIndex <= 0) return;\n const key = decodeURIComponent(\n keyPairPart.substring(0, separatorIndex).trim()\n );\n const value = decodeURIComponent(\n keyPairPart.substring(separatorIndex + 1).trim()\n );\n let metadata;\n if (valueProps.length > 0) {\n metadata = baggageEntryMetadataFromString(\n valueProps.join(BAGGAGE_PROPERTIES_SEPARATOR)\n );\n }\n return { key, value, metadata };\n}\n\n/**\n * Parse a string serialized in the baggage HTTP Format (without metadata):\n * https://github.com/w3c/baggage/blob/master/baggage/HTTP_HEADER_FORMAT.md\n */\nexport function parseKeyPairsIntoRecord(\n value?: string\n): Record<string, string> {\n if (typeof value !== 'string' || value.length === 0) return {};\n return value\n .split(BAGGAGE_ITEMS_SEPARATOR)\n .map(entry => {\n return parsePairKeyValue(entry);\n })\n .filter(keyPair => keyPair !== undefined && keyPair.value.length > 0)\n .reduce<Record<string, string>>((headers, keyPair) => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n headers[keyPair!.key] = keyPair!.value;\n return headers;\n }, {});\n}\n", "/*\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 {\n BaggageEntry,\n Context,\n propagation,\n TextMapGetter,\n TextMapPropagator,\n TextMapSetter,\n} from '@opentelemetry/api';\n\nimport { isTracingSuppressed } from '../../trace/suppress-tracing';\nimport {\n BAGGAGE_HEADER,\n BAGGAGE_ITEMS_SEPARATOR,\n BAGGAGE_MAX_NAME_VALUE_PAIRS,\n BAGGAGE_MAX_PER_NAME_VALUE_PAIRS,\n} from '../constants';\nimport { getKeyPairs, parsePairKeyValue, serializeKeyPairs } from '../utils';\n\n/**\n * Propagates {@link Baggage} through Context format propagation.\n *\n * Based on the Baggage specification:\n * https://w3c.github.io/baggage/\n */\nexport class W3CBaggagePropagator implements TextMapPropagator {\n inject(context: Context, carrier: unknown, setter: TextMapSetter): void {\n const baggage = propagation.getBaggage(context);\n if (!baggage || isTracingSuppressed(context)) return;\n const keyPairs = getKeyPairs(baggage)\n .filter((pair: string) => {\n return pair.length <= BAGGAGE_MAX_PER_NAME_VALUE_PAIRS;\n })\n .slice(0, BAGGAGE_MAX_NAME_VALUE_PAIRS);\n const headerValue = serializeKeyPairs(keyPairs);\n if (headerValue.length > 0) {\n setter.set(carrier, BAGGAGE_HEADER, headerValue);\n }\n }\n\n extract(context: Context, carrier: unknown, getter: TextMapGetter): Context {\n const headerValue = getter.get(carrier, BAGGAGE_HEADER);\n const baggageString = Array.isArray(headerValue)\n ? headerValue.join(BAGGAGE_ITEMS_SEPARATOR)\n : headerValue;\n if (!baggageString) return context;\n const baggage: Record<string, BaggageEntry> = {};\n if (baggageString.length === 0) {\n return context;\n }\n const pairs = baggageString.split(BAGGAGE_ITEMS_SEPARATOR);\n pairs.forEach(entry => {\n const keyPair = parsePairKeyValue(entry);\n if (keyPair) {\n const baggageEntry: BaggageEntry = { value: keyPair.value };\n if (keyPair.metadata) {\n baggageEntry.metadata = keyPair.metadata;\n }\n baggage[keyPair.key] = baggageEntry;\n }\n });\n if (Object.entries(baggage).length === 0) {\n return context;\n }\n return propagation.setBaggage(context, propagation.createBaggage(baggage));\n }\n\n fields(): string[] {\n return [BAGGAGE_HEADER];\n }\n}\n", "/*\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\nexport interface Clock {\n /**\n * Return the current time in milliseconds from some epoch such as the Unix epoch or process start\n */\n now(): number;\n}\n\n/**\n * A utility for returning wall times anchored to a given point in time. Wall time measurements will\n * not be taken from the system, but instead are computed by adding a monotonic clock time\n * to the anchor point.\n *\n * This is needed because the system time can change and result in unexpected situations like\n * spans ending before they are started. Creating an anchored clock for each local root span\n * ensures that span timings and durations are accurate while preventing span times from drifting\n * too far from the system clock.\n *\n * Only creating an anchored clock once per local trace ensures span times are correct relative\n * to each other. For example, a child span will never have a start time before its parent even\n * if the system clock is corrected during the local trace.\n *\n * Heavily inspired by the OTel Java anchored clock\n * https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk/trace/src/main/java/io/opentelemetry/sdk/trace/AnchoredClock.java\n */\nexport class AnchoredClock implements Clock {\n private _monotonicClock: Clock;\n private _epochMillis: number;\n private _performanceMillis: number;\n\n /**\n * Create a new AnchoredClock anchored to the current time returned by systemClock.\n *\n * @param systemClock should be a clock that returns the number of milliseconds since January 1 1970 such as Date\n * @param monotonicClock should be a clock that counts milliseconds monotonically such as window.performance or perf_hooks.performance\n */\n public constructor(systemClock: Clock, monotonicClock: Clock) {\n this._monotonicClock = monotonicClock;\n this._epochMillis = systemClock.now();\n this._performanceMillis = monotonicClock.now();\n }\n\n /**\n * Returns the current time by adding the number of milliseconds since the\n * AnchoredClock was created to the creation epoch time\n */\n public now(): number {\n const delta = this._monotonicClock.now() - this._performanceMillis;\n return this._epochMillis + delta;\n }\n}\n", "/*\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 { diag, SpanAttributeValue, SpanAttributes } from '@opentelemetry/api';\n\nexport function sanitizeAttributes(attributes: unknown): SpanAttributes {\n const out: SpanAttributes = {};\n\n if (typeof attributes !== 'object' || attributes == null) {\n return out;\n }\n\n for (const [key, val] of Object.entries(attributes)) {\n if (!isAttributeKey(key)) {\n diag.warn(`Invalid attribute key: ${key}`);\n continue;\n }\n if (!isAttributeValue(val)) {\n diag.warn(`Invalid attribute value set for key: ${key}`);\n continue;\n }\n if (Array.isArray(val)) {\n out[key] = val.slice();\n } else {\n out[key] = val;\n }\n }\n\n return out;\n}\n\nexport function isAttributeKey(key: unknown): key is string {\n return typeof key === 'string' && key.length > 0;\n}\n\nexport function isAttributeValue(val: unknown): val is SpanAttributeValue {\n if (val == null) {\n return true;\n }\n\n if (Array.isArray(val)) {\n return isHomogeneousAttributeValueArray(val);\n }\n\n return isValidPrimitiveAttributeValue(val);\n}\n\nfunction isHomogeneousAttributeValueArray(arr: unknown[]): boolean {\n let type: string | undefined;\n\n for (const element of arr) {\n // null/undefined elements are allowed\n if (element == null) continue;\n\n if (!type) {\n if (isValidPrimitiveAttributeValue(element)) {\n type = typeof element;\n continue;\n }\n // encountered an invalid primitive\n return false;\n }\n\n if (typeof element === type) {\n continue;\n }\n\n return false;\n }\n\n return true;\n}\n\nfunction isValidPrimitiveAttributeValue(val: unknown): boolean {\n switch (typeof val) {\n case 'number':\n case 'boolean':\n case 'string':\n return true;\n }\n\n return false;\n}\n", "/*\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 { diag, Exception } from '@opentelemetry/api';\nimport { ErrorHandler } from './types';\n\n/**\n * Returns a function that logs an error using the provided logger, or a\n * console logger if one was not provided.\n */\nexport function loggingErrorHandler(): ErrorHandler {\n return (ex: Exception) => {\n diag.error(stringifyException(ex));\n };\n}\n\n/**\n * Converts an exception into a string representation\n * @param {Exception} ex\n */\nfunction stringifyException(ex: Exception | string): string {\n if (typeof ex === 'string') {\n return ex;\n } else {\n return JSON.stringify(flattenException(ex));\n }\n}\n\n/**\n * Flattens an exception into key-value pairs by traversing the prototype chain\n * and coercing values to strings. Duplicate properties will not be overwritten;\n * the first insert wins.\n */\nfunction flattenException(ex: Exception): Record<string, string> {\n const result = {} as Record<string, string>;\n let current = ex;\n\n while (current !== null) {\n Object.getOwnPropertyNames(current).forEach(propertyName => {\n if (result[propertyName]) return;\n const value = current[propertyName as keyof typeof current];\n if (value) {\n result[propertyName] = String(value);\n }\n });\n current = Object.getPrototypeOf(current);\n }\n\n return result;\n}\n", "/*\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 { Exception } from '@opentelemetry/api';\nimport { loggingErrorHandler } from './logging-error-handler';\nimport { ErrorHandler } from './types';\n\n/** The global error handler delegate */\nlet delegateHandler = loggingErrorHandler();\n\n/**\n * Set the global error handler\n * @param {ErrorHandler} handler\n */\nexport function setGlobalErrorHandler(handler: ErrorHandler): void {\n delegateHandler = handler;\n}\n\n/**\n * Return the global error handler\n * @param {Exception} ex\n */\nexport function globalErrorHandler(ex: Exception): void {\n try {\n delegateHandler(ex);\n } catch {} // eslint-disable-line no-empty\n}\n", "/*\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\nexport enum TracesSamplerValues {\n AlwaysOff = 'always_off',\n AlwaysOn = 'always_on',\n ParentBasedAlwaysOff = 'parentbased_always_off',\n ParentBasedAlwaysOn = 'parentbased_always_on',\n ParentBasedTraceIdRatio = 'parentbased_traceidratio',\n TraceIdRatio = 'traceidratio',\n}\n", "/*\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// Updates to this file should also be replicated to @opentelemetry/api too.\n\n/**\n * - globalThis (New standard)\n * - self (Will return the current window instance for supported browsers)\n * - window (fallback for older browser implementations)\n * - global (NodeJS implementation)\n * - <object> (When all else fails)\n */\n\n/** only globals that common to node and browsers are allowed */\n// eslint-disable-next-line node/no-unsupported-features/es-builtins, no-undef\nexport const _globalThis: typeof globalThis =\n typeof globalThis === 'object'\n ? globalThis\n : typeof self === 'object'\n ? self\n : typeof window === 'object'\n ? window\n : typeof global === 'object'\n ? global\n : ({} as typeof globalThis);\n", "/*\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 { DiagLogLevel } from '@opentelemetry/api';\nimport { TracesSamplerValues } from './sampling';\nimport { _globalThis } from '../platform/browser/globalThis';\n\nconst DEFAULT_LIST_SEPARATOR = ',';\n\n/**\n * Environment interface to define all names\n */\n\nconst ENVIRONMENT_BOOLEAN_KEYS = ['OTEL_SDK_DISABLED'] as const;\n\ntype ENVIRONMENT_BOOLEANS = {\n [K in (typeof ENVIRONMENT_BOOLEAN_KEYS)[number]]?: boolean;\n};\n\nfunction isEnvVarABoolean(key: unknown): key is keyof ENVIRONMENT_BOOLEANS {\n return (\n ENVIRONMENT_BOOLEAN_KEYS.indexOf(key as keyof ENVIRONMENT_BOOLEANS) > -1\n );\n}\n\nconst ENVIRONMENT_NUMBERS_KEYS = [\n 'OTEL_BSP_EXPORT_TIMEOUT',\n 'OTEL_BSP_MAX_EXPORT_BATCH_SIZE',\n 'OTEL_BSP_MAX_QUEUE_SIZE',\n 'OTEL_BSP_SCHEDULE_DELAY',\n 'OTEL_BLRP_EXPORT_TIMEOUT',\n 'OTEL_BLRP_MAX_EXPORT_BATCH_SIZE',\n 'OTEL_BLRP_MAX_QUEUE_SIZE',\n 'OTEL_BLRP_SCHEDULE_DELAY',\n 'OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT',\n 'OTEL_ATTRIBUTE_COUNT_LIMIT',\n 'OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT',\n 'OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT',\n 'OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT',\n 'OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT',\n 'OTEL_SPAN_EVENT_COUNT_LIMIT',\n 'OTEL_SPAN_LINK_COUNT_LIMIT',\n 'OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT',\n 'OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT',\n 'OTEL_EXPORTER_OTLP_TIMEOUT',\n 'OTEL_EXPORTER_OTLP_TRACES_TIMEOUT',\n 'OTEL_EXPORTER_OTLP_METRICS_TIMEOUT',\n 'OTEL_EXPORTER_OTLP_LOGS_TIMEOUT',\n 'OTEL_EXPORTER_JAEGER_AGENT_PORT',\n] as const;\n\ntype ENVIRONMENT_NUMBERS = {\n [K in (typeof ENVIRONMENT_NUMBERS_KEYS)[number]]?: number;\n};\n\nfunction isEnvVarANumber(key: unknown): key is keyof ENVIRONMENT_NUMBERS {\n return (\n ENVIRONMENT_NUMBERS_KEYS.indexOf(key as keyof ENVIRONMENT_NUMBERS) > -1\n );\n}\n\nconst ENVIRONMENT_LISTS_KEYS = [\n 'OTEL_NO_PATCH_MODULES',\n 'OTEL_PROPAGATORS',\n] as const;\n\ntype ENVIRONMENT_LISTS = {\n [K in (typeof ENVIRONMENT_LISTS_KEYS)[number]]?: string[];\n};\n\nfunction isEnvVarAList(key: unknown): key is keyof ENVIRONMENT_LISTS {\n return ENVIRONMENT_LISTS_KEYS.indexOf(key as keyof ENVIRONMENT_LISTS) > -1;\n}\n\nexport type ENVIRONMENT = {\n CONTAINER_NAME?: string;\n ECS_CONTAINER_METADATA_URI_V4?: string;\n ECS_CONTAINER_METADATA_URI?: string;\n HOSTNAME?: string;\n KUBERNETES_SERVICE_HOST?: string;\n NAMESPACE?: string;\n OTEL_EXPORTER_JAEGER_AGENT_HOST?: string;\n OTEL_EXPORTER_JAEGER_ENDPOINT?: string;\n OTEL_EXPORTER_JAEGER_PASSWORD?: string;\n OTEL_EXPORTER_JAEGER_USER?: string;\n OTEL_EXPORTER_OTLP_ENDPOINT?: string;\n OTEL_EXPORTER_OTLP_TRACES_ENDPOINT?: string;\n OTEL_EXPORTER_OTLP_METRICS_ENDPOINT?: string;\n OTEL_EXPORTER_OTLP_LOGS_ENDPOINT?: string;\n OTEL_EXPORTER_OTLP_HEADERS?: string;\n OTEL_EXPORTER_OTLP_TRACES_HEADERS?: string;\n OTEL_EXPORTER_OTLP_METRICS_HEADERS?: string;\n OTEL_EXPORTER_OTLP_LOGS_HEADERS?: string;\n OTEL_EXPORTER_ZIPKIN_ENDPOINT?: string;\n OTEL_LOG_LEVEL?: DiagLogLevel;\n OTEL_RESOURCE_ATTRIBUTES?: string;\n OTEL_SERVICE_NAME?: string;\n OTEL_TRACES_EXPORTER?: string;\n OTEL_TRACES_SAMPLER_ARG?: string;\n OTEL_TRACES_SAMPLER?: string;\n OTEL_LOGS_EXPORTER?: string;\n OTEL_EXPORTER_OTLP_INSECURE?: string;\n OTEL_EXPORTER_OTLP_TRACES_INSECURE?: string;\n OTEL_EXPORTER_OTLP_METRICS_INSECURE?: string;\n OTEL_EXPORTER_OTLP_LOGS_INSECURE?: string;\n OTEL_EXPORTER_OTLP_CERTIFICATE?: string;\n OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE?: string;\n OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE?: string;\n OTEL_EXPORTER_OTLP_LOGS_CERTIFICATE?: string;\n OTEL_EXPORTER_OTLP_COMPRESSION?: string;\n OTEL_EXPORTER_OTLP_TRACES_COMPRESSION?: string;\n OTEL_EXPORTER_OTLP_METRICS_COMPRESSION?: string;\n OTEL_EXPORTER_OTLP_LOGS_COMPRESSION?: string;\n OTEL_EXPORTER_OTLP_CLIENT_KEY?: string;\n OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY?: string;\n OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY?: string;\n OTEL_EXPORTER_OTLP_LOGS_CLIENT_KEY?: string;\n OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE?: string;\n OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE?: string;\n OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE?: string;\n OTEL_EXPORTER_OTLP_LOGS_CLIENT_CERTIFICATE?: string;\n OTEL_EXPORTER_OTLP_PROTOCOL?: string;\n OTEL_EXPORTER_OTLP_TRACES_PROTOCOL?: string;\n OTEL_EXPORTER_OTLP_METRICS_PROTOCOL?: string;\n OTEL_EXPORTER_OTLP_LOGS_PROTOCOL?: string;\n OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE?: string;\n} & ENVIRONMENT_BOOLEANS &\n ENVIRONMENT_NUMBERS &\n ENVIRONMENT_LISTS;\n\nexport type RAW_ENVIRONMENT = {\n [key: string]: string | number | undefined | string[];\n};\n\nexport const DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT = Infinity;\n\nexport const DEFAULT_ATTRIBUTE_COUNT_LIMIT = 128;\n\nexport const DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT = 128;\nexport const DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT = 128;\n\n/**\n * Default environment variables\n */\nexport const DEFAULT_ENVIRONMENT: Required<ENVIRONMENT> = {\n OTEL_SDK_DISABLED: false,\n CONTAINER_NAME: '',\n ECS_CONTAINER_METADATA_URI_V4: '',\n ECS_CONTAINER_METADATA_URI: '',\n HOSTNAME: '',\n KUBERNETES_SERVICE_HOST: '',\n NAMESPACE: '',\n OTEL_BSP_EXPORT_TIMEOUT: 30000,\n OTEL_BSP_MAX_EXPORT_BATCH_SIZE: 512,\n OTEL_BSP_MAX_QUEUE_SIZE: 2048,\n OTEL_BSP_SCHEDULE_DELAY: 5000,\n OTEL_BLRP_EXPORT_TIMEOUT: 30000,\n OTEL_BLRP_MAX_EXPORT_BATCH_SIZE: 512,\n OTEL_BLRP_MAX_QUEUE_SIZE: 2048,\n OTEL_BLRP_SCHEDULE_DELAY: 5000,\n OTEL_EXPORTER_JAEGER_AGENT_HOST: '',\n OTEL_EXPORTER_JAEGER_AGENT_PORT: 6832,\n OTEL_EXPORTER_JAEGER_ENDPOINT: '',\n OTEL_EXPORTER_JAEGER_PASSWORD: '',\n OTEL_EXPORTER_JAEGER_USER: '',\n OTEL_EXPORTER_OTLP_ENDPOINT: '',\n OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: '',\n OTEL_EXPORTER_OTLP_METRICS_ENDPOINT: '',\n OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: '',\n OTEL_EXPORTER_OTLP_HEADERS: '',\n OTEL_EXPORTER_OTLP_TRACES_HEADERS: '',\n OTEL_EXPORTER_OTLP_METRICS_HEADERS: '',\n OTEL_EXPORTER_OTLP_LOGS_HEADERS: '',\n OTEL_EXPORTER_OTLP_TIMEOUT: 10000,\n OTEL_EXPORTER_OTLP_TRACES_TIMEOUT: 10000,\n OTEL_EXPORTER_OTLP_METRICS_TIMEOUT: 10000,\n OTEL_EXPORTER_OTLP_LOGS_TIMEOUT: 10000,\n OTEL_EXPORTER_ZIPKIN_ENDPOINT: 'http://localhost:9411/api/v2/spans',\n OTEL_LOG_LEVEL: DiagLogLevel.INFO,\n OTEL_NO_PATCH_MODULES: [],\n OTEL_PROPAGATORS: ['tracecontext', 'baggage'],\n OTEL_RESOURCE_ATTRIBUTES: '',\n OTEL_SERVICE_NAME: '',\n OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT: DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,\n OTEL_ATTRIBUTE_COUNT_LIMIT: DEFAULT_ATTRIBUTE_COUNT_LIMIT,\n OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT: DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,\n OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT: DEFAULT_ATTRIBUTE_COUNT_LIMIT,\n OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT:\n DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,\n OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT: DEFAULT_ATTRIBUTE_COUNT_LIMIT,\n OTEL_SPAN_EVENT_COUNT_LIMIT: 128,\n OTEL_SPAN_LINK_COUNT_LIMIT: 128,\n OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT:\n DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT,\n OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT:\n DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT,\n OTEL_TRACES_EXPORTER: '',\n OTEL_TRACES_SAMPLER: TracesSamplerValues.ParentBasedAlwaysOn,\n OTEL_TRACES_SAMPLER_ARG: '',\n OTEL_LOGS_EXPORTER: '',\n OTEL_EXPORTER_OTLP_INSECURE: '',\n OTEL_EXPORTER_OTLP_TRACES_INSECURE: '',\n OTEL_EXPORTER_OTLP_METRICS_INSECURE: '',\n OTEL_EXPORTER_OTLP_LOGS_INSECURE: '',\n OTEL_EXPORTER_OTLP_CERTIFICATE: '',\n OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE: '',\n OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE: '',\n OTEL_EXPORTER_OTLP_LOGS_CERTIFICATE: '',\n OTEL_EXPORTER_OTLP_COMPRESSION: '',\n OTEL_EXPORTER_OTLP_TRACES_COMPRESSION: '',\n OTEL_EXPORTER_OTLP_METRICS_COMPRESSION: '',\n OTEL_EXPORTER_OTLP_LOGS_COMPRESSION: '',\n OTEL_EXPORTER_OTLP_CLIENT_KEY: '',\n OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY: '',\n OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY: '',\n OTEL_EXPORTER_OTLP_LOGS_CLIENT_KEY: '',\n OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE: '',\n OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE: '',\n OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE: '',\n OTEL_EXPORTER_OTLP_LOGS_CLIENT_CERTIFICATE: '',\n OTEL_EXPORTER_OTLP_PROTOCOL: 'http/protobuf',\n OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: 'http/protobuf',\n OTEL_EXPORTER_OTLP_METRICS_PROTOCOL: 'http/protobuf',\n OTEL_EXPORTER_OTLP_LOGS_PROTOCOL: 'http/protobuf',\n OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE: 'cumulative',\n};\n\n/**\n * @param key\n * @param environment\n * @param values\n */\nfunction parseBoolean(\n key: keyof ENVIRONMENT_BOOLEANS,\n environment: ENVIRONMENT,\n values: RAW_ENVIRONMENT\n) {\n if (typeof values[key] === 'undefined') {\n return;\n }\n\n const value = String(values[key]);\n // support case-insensitive \"true\"\n environment[key] = value.toLowerCase() === 'true';\n}\n\n/**\n * Parses a variable as number with number validation\n * @param name\n * @param environment\n * @param values\n * @param min\n * @param max\n */\nfunction parseNumber(\n name: keyof ENVIRONMENT_NUMBERS,\n environment: ENVIRONMENT,\n values: RAW_ENVIRONMENT,\n min = -Infinity,\n max = Infinity\n) {\n if (typeof values[name] !== 'undefined') {\n const value = Number(values[name] as string);\n if (!isNaN(value)) {\n if (value < min) {\n environment[name] = min;\n } else if (value > max) {\n environment[name] = max;\n } else {\n environment[name] = value;\n }\n }\n }\n}\n\n/**\n * Parses list-like strings from input into output.\n * @param name\n * @param environment\n * @param values\n * @param separator\n */\nfunction parseStringList(\n name: keyof ENVIRONMENT_LISTS,\n output: ENVIRONMENT,\n input: RAW_ENVIRONMENT,\n separator = DEFAULT_LIST_SEPARATOR\n) {\n const givenValue = input[name];\n if (typeof givenValue === 'string') {\n output[name] = givenValue.split(separator).map(v => v.trim());\n }\n}\n\n// The support string -> DiagLogLevel mappings\nconst logLevelMap: { [key: string]: DiagLogLevel } = {\n ALL: DiagLogLevel.ALL,\n VERBOSE: DiagLogLevel.VERBOSE,\n DEBUG: DiagLogLevel.DEBUG,\n INFO: DiagLogLevel.INFO,\n WARN: DiagLogLevel.WARN,\n ERROR: DiagLogLevel.ERROR,\n NONE: DiagLogLevel.NONE,\n};\n\n/**\n * Environmentally sets log level if valid log level string is provided\n * @param key\n * @param environment\n * @param values\n */\nfunction setLogLevelFromEnv(\n key: keyof ENVIRONMENT,\n environment: RAW_ENVIRONMENT | ENVIRONMENT,\n values: RAW_ENVIRONMENT\n) {\n const value = values[key];\n if (typeof value === 'string') {\n const theLevel = logLevelMap[value.toUpperCase()];\n if (theLevel != null) {\n environment[key] = theLevel;\n }\n }\n}\n\n/**\n * Parses environment values\n * @param values\n */\nexport function parseEnvironment(values: RAW_ENVIRONMENT): ENVIRONMENT {\n const environment: ENVIRONMENT = {};\n\n for (const env in DEFAULT_ENVIRONMENT) {\n const key = env as keyof ENVIRONMENT;\n\n switch (key) {\n case 'OTEL_LOG_LEVEL':\n setLogLevelFromEnv(key, environment, values);\n break;\n\n default:\n if (isEnvVarABoolean(key)) {\n parseBoolean(key, environment, values);\n } else if (isEnvVarANumber(key)) {\n parseNumber(key, environment, values);\n } else if (isEnvVarAList(key)) {\n parseStringList(key, environment, values);\n } else {\n const value = values[key];\n if (typeof value !== 'undefined' && value !== null) {\n environment[key] = String(value);\n }\n }\n }\n }\n\n return environment;\n}\n\n/**\n * Get environment in node or browser without\n * populating default values.\n */\nexport function getEnvWithoutDefaults(): ENVIRONMENT {\n return typeof process !== 'undefined' && process && process.env\n ? parseEnvironment(process.env as RAW_ENVIRONMENT)\n : parseEnvironment(_globalThis as typeof globalThis & RAW_ENVIRONMENT);\n}\n", "/*\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 {\n DEFAULT_ENVIRONMENT,\n ENVIRONMENT,\n RAW_ENVIRONMENT,\n parseEnvironment,\n} from '../../utils/environment';\nimport { _globalThis } from './globalThis';\n\n/**\n * Gets the environment variables\n */\nexport function getEnv(): Required<ENVIRONMENT> {\n const globalEnv = parseEnvironment(\n _globalThis as typeof globalThis & RAW_ENVIRONMENT\n );\n return Object.assign({}, DEFAULT_ENVIRONMENT, globalEnv);\n}\n", "/*\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 */\nexport function hexToBase64(hexStr: string): string {\n const hexStrLen = hexStr.length;\n let hexAsciiCharsStr = '';\n for (let i = 0; i < hexStrLen; i += 2) {\n const hexPair = hexStr.substring(i, i + 2);\n const hexVal = parseInt(hexPair, 16);\n hexAsciiCharsStr += String.fromCharCode(hexVal);\n }\n return btoa(hexAsciiCharsStr);\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { IdGenerator } from '../../trace/IdGenerator';\n\nconst SPAN_ID_BYTES = 8;\nconst TRACE_ID_BYTES = 16;\n\n/**\n * @deprecated Use the one defined in @opentelemetry/sdk-trace-base instead.\n */\nexport class RandomIdGenerator implements IdGenerator {\n /**\n * Returns a random 16-byte trace ID formatted/encoded as a 32 lowercase hex\n * characters corresponding to 128 bits.\n */\n generateTraceId = getIdGenerator(TRACE_ID_BYTES);\n\n /**\n * Returns a random 8-byte span ID formatted/encoded as a 16 lowercase hex\n * characters corresponding to 64 bits.\n */\n generateSpanId = getIdGenerator(SPAN_ID_BYTES);\n}\n\nconst SHARED_CHAR_CODES_ARRAY = Array(32);\nfunction getIdGenerator(bytes: number): () => string {\n return function generateId() {\n for (let i = 0; i < bytes * 2; i++) {\n SHARED_CHAR_CODES_ARRAY[i] = Math.floor(Math.random() * 16) + 48;\n // valid hex characters in the range 48-57 and 97-102\n if (SHARED_CHAR_CODES_ARRAY[i] >= 58) {\n SHARED_CHAR_CODES_ARRAY[i] += 39;\n }\n }\n return String.fromCharCode.apply(\n null,\n SHARED_CHAR_CODES_ARRAY.slice(0, bytes * 2)\n );\n };\n}\n", "/*\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\nexport const otperformance = performance;\n", "/*\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 = '1.19.0';\n", "/*\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// DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates//templates/SemanticAttributes.ts.j2\nexport const SemanticAttributes = {\n /**\n * The full invoked ARN as provided on the `Context` passed to the function (`Lambda-Runtime-Invoked-Function-Arn` header on the `/runtime/invocation/next` applicable).\n *\n * Note: This may be different from `faas.id` if an alias is involved.\n */\n AWS_LAMBDA_INVOKED_ARN: 'aws.lambda.invoked_arn',\n\n /**\n * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers.\n */\n DB_SYSTEM: 'db.system',\n\n /**\n * The connection string used to connect to the database. It is recommended to remove embedded credentials.\n */\n DB_CONNECTION_STRING: 'db.connection_string',\n\n /**\n * Username for accessing the database.\n */\n DB_USER: 'db.user',\n\n /**\n * The fully-qualified class name of the [Java Database Connectivity (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver used to connect.\n */\n DB_JDBC_DRIVER_CLASSNAME: 'db.jdbc.driver_classname',\n\n /**\n * If no [tech-specific attribute](#call-level-attributes-for-specific-technologies) is defined, this attribute is used to report the name of the database being accessed. For commands that switch the database, this should be set to the target database (even if the command fails).\n *\n * Note: In some SQL databases, the database name to be used is called "schema name".\n */\n DB_NAME: 'db.name',\n\n /**\n * The database statement being executed.\n *\n * Note: The value may be sanitized to exclude sensitive information.\n */\n DB_STATEMENT: 'db.statement',\n\n /**\n * The name of the operation being executed, e.g. the [MongoDB command name](https://docs.mongodb.com/manual/reference/command/#database-operations) such as `findAndModify`, or the SQL keyword.\n *\n * Note: When setting this to an SQL keyword, it is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if the operation name is provided by the library being instrumented. If the SQL statement has an ambiguous operation, or performs more than one operation, this value may be omitted.\n */\n DB_OPERATION: 'db.operation',\n\n /**\n * The Microsoft SQL Server [instance name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) connecting to. This name is used to determine the port of a named instance.\n *\n * Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no longer required (but still recommended if non-standard).\n */\n DB_MSSQL_INSTANCE_NAME: 'db.mssql.instance_name',\n\n /**\n * The name of the keyspace being accessed. To be used instead of the generic `db.name` attribute.\n */\n DB_CASSANDRA_KEYSPACE: 'db.cassandra.keyspace',\n\n /**\n * The fetch size used for paging, i.e. how many rows will be returned at once.\n */\n DB_CASSANDRA_PAGE_SIZE: 'db.cassandra.page_size',\n\n /**\n * The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html).\n */\n DB_CASSANDRA_CONSISTENCY_LEVEL: 'db.cassandra.consistency_level',\n\n /**\n * The name of the primary table that the operation is acting upon, including the schema name (if applicable).\n *\n * Note: This mirrors the db.sql.table attribute but references cassandra rather than sql. It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set.\n */\n DB_CASSANDRA_TABLE: 'db.cassandra.table',\n\n /**\n * Whether or not the query is idempotent.\n */\n DB_CASSANDRA_IDEMPOTENCE: 'db.cassandra.idempotence',\n\n /**\n * The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively.\n */\n DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT:\n 'db.cassandra.speculative_execution_count',\n\n /**\n * The ID of the coordinating node for a query.\n */\n DB_CASSANDRA_COORDINATOR_ID: 'db.cassandra.coordinator.id',\n\n /**\n * The data center of the coordinating node for a query.\n */\n DB_CASSANDRA_COORDINATOR_DC: 'db.cassandra.coordinator.dc',\n\n /**\n * The [HBase namespace](https://hbase.apache.org/book.html#_namespace) being accessed. To be used instead of the generic `db.name` attribute.\n */\n DB_HBASE_NAMESPACE: 'db.hbase.namespace',\n\n /**\n * The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select), provided as an integer. To be used instead of the generic `db.name` attribute.\n */\n DB_REDIS_DATABASE_INDEX: 'db.redis.database_index',\n\n /**\n * The collection being accessed within the database stated in `db.name`.\n */\n DB_MONGODB_COLLECTION: 'db.mongodb.collection',\n\n /**\n * The name of the primary table that the operation is acting upon, including the schema name (if applicable).\n *\n * Note: It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set.\n */\n DB_SQL_TABLE: 'db.sql.table',\n\n /**\n * The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it.\n */\n EXCEPTION_TYPE: 'exception.type',\n\n /**\n * The exception message.\n */\n EXCEPTION_MESSAGE: 'exception.message',\n\n /**\n * A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG.\n */\n EXCEPTION_STACKTRACE: 'exception.stacktrace',\n\n /**\n * SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span.\n *\n * Note: An exception is considered to have escaped (or left) the scope of a span,\nif that span is ended while the exception is still logically "in flight".\nThis may be actually "in flight" in some languages (e.g. if the exception\nis passed to a Context manager's `__exit__` method in Python) but will\nusually be caught at the point of recording the exception in most languages.\n\nIt is usually not possible to determine at the point where an exception is thrown\nwhether it will escape the scope of a span.\nHowever, it is trivial to know that an exception\nwill escape, if one checks for an active exception just before ending the span,\nas done in the [example above](#exception-end-example).\n\nIt follows that an exception may still escape the scope of the span\neven if the `exception.escaped` attribute was not set or set to false,\nsince the event might have been recorded at a time where it was not\nclear whether the exception will escape.\n */\n EXCEPTION_ESCAPED: 'exception.escaped',\n\n /**\n * Type of the trigger on which the function is executed.\n */\n FAAS_TRIGGER: 'faas.trigger',\n\n /**\n * The execution ID of the current function execution.\n */\n FAAS_EXECUTION: 'faas.execution',\n\n /**\n * The name of the source on which the triggering operation was performed. For example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the database name.\n */\n FAAS_DOCUMENT_COLLECTION: 'faas.document.collection',\n\n /**\n * Describes the type of the operation that was performed on the data.\n */\n FAAS_DOCUMENT_OPERATION: 'faas.document.operation',\n\n /**\n * A string containing the time when the data was accessed in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime).\n */\n FAAS_DOCUMENT_TIME: 'faas.document.time',\n\n /**\n * The document name/table subjected to the operation. For example, in Cloud Storage or S3 is the name of the file, and in Cosmos DB the table name.\n */\n FAAS_DOCUMENT_NAME: 'faas.document.name',\n\n /**\n * A string containing the function invocation time in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime).\n */\n FAAS_TIME: 'faas.time',\n\n /**\n * A string containing the schedule period as [Cron Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm).\n */\n FAAS_CRON: 'faas.cron',\n\n /**\n * A boolean that is true if the serverless function is executed for the first time (aka cold-start).\n */\n FAAS_COLDSTART: 'faas.coldstart',\n\n /**\n * The name of the invoked function.\n *\n * Note: SHOULD be equal to the `faas.name` resource attribute of the invoked function.\n */\n FAAS_INVOKED_NAME: 'faas.invoked_name',\n\n /**\n * The cloud provider of the invoked function.\n *\n * Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked function.\n */\n FAAS_INVOKED_PROVIDER: 'faas.invoked_provider',\n\n /**\n * The cloud region of the invoked function.\n *\n * Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked function.\n */\n FAAS_INVOKED_REGION: 'faas.invoked_region',\n\n /**\n * Transport protocol used. See note below.\n */\n NET_TRANSPORT: 'net.transport',\n\n /**\n * Remote address of the peer (dotted decimal for IPv4 or [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6).\n */\n NET_PEER_IP: 'net.peer.ip',\n\n /**\n * Remote port number.\n */\n NET_PEER_PORT: 'net.peer.port',\n\n /**\n * Remote hostname or similar, see note below.\n */\n NET_PEER_NAME: 'net.peer.name',\n\n /**\n * Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host.\n */\n NET_HOST_IP: 'net.host.ip',\n\n /**\n * Like `net.peer.port` but for the host port.\n */\n NET_HOST_PORT: 'net.host.port',\n\n /**\n * Local hostname or similar, see note below.\n */\n NET_HOST_NAME: 'net.host.name',\n\n /**\n * The internet connection type currently being used by the host.\n */\n NET_HOST_CONNECTION_TYPE: 'net.host.connection.type',\n\n /**\n * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection.\n */\n NET_HOST_CONNECTION_SUBTYPE: 'net.host.connection.subtype',\n\n /**\n * The name of the mobile carrier.\n */\n NET_HOST_CARRIER_NAME: 'net.host.carrier.name',\n\n /**\n * The mobile carrier country code.\n */\n NET_HOST_CARRIER_MCC: 'net.host.carrier.mcc',\n\n /**\n * The mobile carrier network code.\n */\n NET_HOST_CARRIER_MNC: 'net.host.carrier.mnc',\n\n /**\n * The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network.\n */\n NET_HOST_CARRIER_ICC: 'net.host.carrier.icc',\n\n /**\n * The [`service.name`](../../resource/semantic_conventions/README.md#service) of the remote service. SHOULD be equal to the actual `service.name` resource attribute of the remote service if any.\n */\n PEER_SERVICE: 'peer.service',\n\n /**\n * Username or client_id extracted from the access token or [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in the inbound request from outside the system.\n */\n ENDUSER_ID: 'enduser.id',\n\n /**\n * Actual/assumed role the client is making the request under extracted from token or application security context.\n */\n ENDUSER_ROLE: 'enduser.role',\n\n /**\n * Scopes or granted authorities the client currently possesses extracted from token or application security context. The value would come from the scope associated with an [OAuth 2.0 Access Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute value in a [SAML 2.0 Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html).\n */\n ENDUSER_SCOPE: 'enduser.scope',\n\n /**\n * Current "managed" thread ID (as opposed to OS thread ID).\n */\n THREAD_ID: 'thread.id',\n\n /**\n * Current thread name.\n */\n THREAD_NAME: 'thread.name',\n\n /**\n * The method or function name, or equivalent (usually rightmost part of the code unit's name).\n */\n CODE_FUNCTION: 'code.function',\n\n /**\n * The "namespace" within which `code.function` is defined. Usually the qualified class or module name, such that `code.namespace` + some separator + `code.function` form a unique identifier for the code unit.\n */\n CODE_NAMESPACE: 'code.namespace',\n\n /**\n * The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path).\n */\n CODE_FILEPATH: 'code.filepath',\n\n /**\n * The line number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`.\n */\n CODE_LINENO: 'code.lineno',\n\n /**\n * HTTP request method.\n */\n HTTP_METHOD: 'http.method',\n\n /**\n * Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is not transmitted over HTTP, but if it is known, it should be included nevertheless.\n *\n * Note: `http.url` MUST NOT contain credentials passed via URL in form of `https://username:password@www.example.com/`. In such case the attribute's value should be `https://www.example.com/`.\n */\n HTTP_URL: 'http.url',\n\n /**\n * The full request target as passed in a HTTP request line or equivalent.\n */\n HTTP_TARGET: 'http.target',\n\n /**\n * The value of the [HTTP host header](https://tools.ietf.org/html/rfc7230#section-5.4). An empty Host header should also be reported, see note.\n *\n * Note: When the header is present but empty the attribute SHOULD be set to the empty string. Note that this is a valid situation that is expected in certain cases, according the aforementioned [section of RFC 7230](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is not set the attribute MUST NOT be set.\n */\n HTTP_HOST: 'http.host',\n\n /**\n * The URI scheme identifying the used protocol.\n */\n HTTP_SCHEME: 'http.scheme',\n\n /**\n * [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).\n */\n HTTP_STATUS_CODE: 'http.status_code',\n\n /**\n * Kind of HTTP protocol used.\n *\n * Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed.\n */\n HTTP_FLAVOR: 'http.flavor',\n\n /**\n * Value of the [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the client.\n */\n HTTP_USER_AGENT: 'http.user_agent',\n\n /**\n * The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For requests using transport encoding, this should be the compressed size.\n */\n HTTP_REQUEST_CONTENT_LENGTH: 'http.request_content_length',\n\n /**\n * The size of the uncompressed request payload body after transport decoding. Not set if transport encoding not used.\n */\n HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED:\n 'http.request_content_length_uncompressed',\n\n /**\n * The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For requests using transport encoding, this should be the compressed size.\n */\n HTTP_RESPONSE_CONTENT_LENGTH: 'http.response_content_length',\n\n /**\n * The size of the uncompressed response payload body after transport decoding. Not set if transport encoding not used.\n */\n HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED:\n 'http.response_content_length_uncompressed',\n\n /**\n * The primary server name of the matched virtual host. This should be obtained via configuration. If no such configuration can be obtained, this attribute MUST NOT be set ( `net.host.name` should be used instead).\n *\n * Note: `http.url` is usually not readily available on the server side but would have to be assembled in a cumbersome and sometimes lossy process from other information (see e.g. open-telemetry/opentelemetry-python/pull/148). It is thus preferred to supply the raw data that is available.\n */\n HTTP_SERVER_NAME: 'http.server_name',\n\n /**\n * The matched route (path template).\n */\n HTTP_ROUTE: 'http.route',\n\n /**\n * The IP address of the original client behind all proxies, if known (e.g. from [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)).\n *\n * Note: This is not necessarily the same as `net.peer.ip`, which would\nidentify the network-level peer, which may be a proxy.\n\nThis attribute should be set when a source of information different\nfrom the one used for `net.peer.ip`, is available even if that other\nsource just confirms the same value as `net.peer.ip`.\nRationale: For `net.peer.ip`, one typically does not know if it\ncomes from a proxy, reverse proxy, or the actual client. Setting\n`http.client_ip` when it's the same as `net.peer.ip` means that\none is at least somewhat confident that the address is not that of\nthe closest proxy.\n */\n HTTP_CLIENT_IP: 'http.client_ip',\n\n /**\n * The keys in the `RequestItems` object field.\n */\n AWS_DYNAMODB_TABLE_NAMES: 'aws.dynamodb.table_names',\n\n /**\n * The JSON-serialized value of each item in the `ConsumedCapacity` response field.\n */\n AWS_DYNAMODB_CONSUMED_CAPACITY: 'aws.dynamodb.consumed_capacity',\n\n /**\n * The JSON-serialized value of the `ItemCollectionMetrics` response field.\n */\n AWS_DYNAMODB_ITEM_COLLECTION_METRICS: 'aws.dynamodb.item_collection_metrics',\n\n /**\n * The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter.\n */\n AWS_DYNAMODB_PROVISIONED_READ_CAPACITY:\n 'aws.dynamodb.provisioned_read_capacity',\n\n /**\n * The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter.\n */\n AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY:\n 'aws.dynamodb.provisioned_write_capacity',\n\n /**\n * The value of the `ConsistentRead` request parameter.\n */\n AWS_DYNAMODB_CONSISTENT_READ: 'aws.dynamodb.consistent_read',\n\n /**\n * The value of the `ProjectionExpression` request parameter.\n */\n AWS_DYNAMODB_PROJECTION: 'aws.dynamodb.projection',\n\n /**\n * The value of the `Limit` request parameter.\n */\n AWS_DYNAMODB_LIMIT: 'aws.dynamodb.limit',\n\n /**\n * The value of the `AttributesToGet` request parameter.\n */\n AWS_DYNAMODB_ATTRIBUTES_TO_GET: 'aws.dynamodb.attributes_to_get',\n\n /**\n * The value of the `IndexName` request parameter.\n */\n AWS_DYNAMODB_INDEX_NAME: 'aws.dynamodb.index_name',\n\n /**\n * The value of the `Select` request parameter.\n */\n AWS_DYNAMODB_SELECT: 'aws.dynamodb.select',\n\n /**\n * The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field.\n */\n AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES:\n 'aws.dynamodb.global_secondary_indexes',\n\n /**\n * The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field.\n */\n AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES: 'aws.dynamodb.local_secondary_indexes',\n\n /**\n * The value of the `ExclusiveStartTableName` request parameter.\n */\n AWS_DYNAMODB_EXCLUSIVE_START_TABLE: 'aws.dynamodb.exclusive_start_table',\n\n /**\n * The the number of items in the `TableNames` response parameter.\n */\n AWS_DYNAMODB_TABLE_COUNT: 'aws.dynamodb.table_count',\n\n /**\n * The value of the `ScanIndexForward` request parameter.\n */\n AWS_DYNAMODB_SCAN_FORWARD: 'aws.dynamodb.scan_forward',\n\n /**\n * The value of the `Segment` request parameter.\n */\n AWS_DYNAMODB_SEGMENT: 'aws.dynamodb.segment',\n\n /**\n * The value of the `TotalSegments` request parameter.\n */\n AWS_DYNAMODB_TOTAL_SEGMENTS: 'aws.dynamodb.total_segments',\n\n /**\n * The value of the `Count` response parameter.\n */\n AWS_DYNAMODB_COUNT: 'aws.dynamodb.count',\n\n /**\n * The value of the `ScannedCount` response parameter.\n */\n AWS_DYNAMODB_SCANNED_COUNT: 'aws.dynamodb.scanned_count',\n\n /**\n * The JSON-serialized value of each item in the `AttributeDefinitions` request field.\n */\n AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS: 'aws.dynamodb.attribute_definitions',\n\n /**\n * The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` request field.\n */\n AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES:\n 'aws.dynamodb.global_secondary_index_updates',\n\n /**\n * A string identifying the messaging system.\n */\n MESSAGING_SYSTEM: 'messaging.system',\n\n /**\n * The message destination name. This might be equal to the span name but is required nevertheless.\n */\n MESSAGING_DESTINATION: 'messaging.destination',\n\n /**\n * The kind of message destination.\n */\n MESSAGING_DESTINATION_KIND: 'messaging.destination_kind',\n\n /**\n * A boolean that is true if the message destination is temporary.\n */\n MESSAGING_TEMP_DESTINATION: 'messaging.temp_destination',\n\n /**\n * The name of the transport protocol.\n */\n MESSAGING_PROTOCOL: 'messaging.protocol',\n\n /**\n * The version of the transport protocol.\n */\n MESSAGING_PROTOCOL_VERSION: 'messaging.protocol_version',\n\n /**\n * Connection string.\n */\n MESSAGING_URL: 'messaging.url',\n\n /**\n * A value used by the messaging system as an identifier for the message, represented as a string.\n */\n MESSAGING_MESSAGE_ID: 'messaging.message_id',\n\n /**\n * The [conversation ID](#conversations) identifying the conversation to which the message belongs, represented as a string. Sometimes called "Correlation ID".\n */\n MESSAGING_CONVERSATION_ID: 'messaging.conversation_id',\n\n /**\n * The (uncompressed) size of the message payload in bytes. Also use this attribute if it is unknown whether the compressed or uncompressed payload size is reported.\n */\n MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES: 'messaging.message_payload_size_bytes',\n\n /**\n * The compressed size of the message payload in bytes.\n */\n MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES:\n 'messaging.message_payload_compressed_size_bytes',\n\n /**\n * A string identifying the kind of message consumption as defined in the [Operation names](#operation-names) section above. If the operation is "send", this attribute MUST NOT be set, since the operation can be inferred from the span kind in that case.\n */\n MESSAGING_OPERATION: 'messaging.operation',\n\n /**\n * The identifier for the consumer receiving a message. For Kafka, set it to `{messaging.kafka.consumer_group} - {messaging.kafka.client_id}`, if both are present, or only `messaging.kafka.consumer_group`. For brokers, such as RabbitMQ and Artemis, set it to the `client_id` of the client consuming the message.\n */\n MESSAGING_CONSUMER_ID: 'messaging.consumer_id',\n\n /**\n * RabbitMQ message routing key.\n */\n MESSAGING_RABBITMQ_ROUTING_KEY: 'messaging.rabbitmq.routing_key',\n\n /**\n * Message keys in Kafka are used for grouping alike messages to ensure they're processed on the same partition. They differ from `messaging.message_id` in that they're not unique. If the key is `null`, the attribute MUST NOT be set.\n *\n * Note: If the key type is not string, it's string representation has to be supplied for the attribute. If the key has no unambiguous, canonical string form, don't include its value.\n */\n MESSAGING_KAFKA_MESSAGE_KEY: 'messaging.kafka.message_key',\n\n /**\n * Name of the Kafka Consumer Group that is handling the message. Only applies to consumers, not producers.\n */\n MESSAGING_KAFKA_CONSUMER_GROUP: 'messaging.kafka.consumer_group',\n\n /**\n * Client Id for the Consumer or Producer that is handling the message.\n */\n MESSAGING_KAFKA_CLIENT_ID: 'messaging.kafka.client_id',\n\n /**\n * Partition the message is sent to.\n */\n MESSAGING_KAFKA_PARTITION: 'messaging.kafka.partition',\n\n /**\n * A boolean that is true if the message is a tombstone.\n */\n MESSAGING_KAFKA_TOMBSTONE: 'messaging.kafka.tombstone',\n\n /**\n * A string identifying the remoting system.\n */\n RPC_SYSTEM: 'rpc.system',\n\n /**\n * The full (logical) name of the service being called, including its package name, if applicable.\n *\n * Note: This is the logical name of the service from the RPC interface perspective, which can be different from the name of any implementing class. The `code.namespace` attribute may be used to store the latter (despite the attribute name, it may include a class name; e.g., class with method actually executing the call on the server side, RPC client stub class on the client side).\n */\n RPC_SERVICE: 'rpc.service',\n\n /**\n * The name of the (logical) method being called, must be equal to the $method part in the span name.\n *\n * Note: This is the logical name of the method from the RPC interface perspective, which can be different from the name of any implementing method/function. The `code.function` attribute may be used to store the latter (e.g., method actually executing the call on the server side, RPC client stub method on the client side).\n */\n RPC_METHOD: 'rpc.method',\n\n /**\n * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request.\n */\n RPC_GRPC_STATUS_CODE: 'rpc.grpc.status_code',\n\n /**\n * Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 does not specify this, the value can be omitted.\n */\n RPC_JSONRPC_VERSION: 'rpc.jsonrpc.version',\n\n /**\n * `id` property of request or response. Since protocol allows id to be int, string, `null` or missing (for notifications), value is expected to be cast to string for simplicity. Use empty string in case of `null` value. Omit entirely if this is a notification.\n */\n RPC_JSONRPC_REQUEST_ID: 'rpc.jsonrpc.request_id',\n\n /**\n * `error.code` property of response if it is an error response.\n */\n RPC_JSONRPC_ERROR_CODE: 'rpc.jsonrpc.error_code',\n\n /**\n * `error.message` property of response if it is an error response.\n */\n RPC_JSONRPC_ERROR_MESSAGE: 'rpc.jsonrpc.error_message',\n\n /**\n * Whether this is a received or sent message.\n */\n MESSAGE_TYPE: 'message.type',\n\n /**\n * MUST be calculated as two different counters starting from `1` one for sent messages and one for received message.\n *\n * Note: This way we guarantee that the values will be consistent between different implementations.\n */\n MESSAGE_ID: 'message.id',\n\n /**\n * Compressed size of the message in bytes.\n */\n MESSAGE_COMPRESSED_SIZE: 'message.compressed_size',\n\n /**\n * Uncompressed size of the message in bytes.\n */\n MESSAGE_UNCOMPRESSED_SIZE: 'message.uncompressed_size',\n};\n\nexport const DbSystemValues = {\n /** Some other SQL database. Fallback only. See notes. */\n OTHER_SQL: 'other_sql',\n /** Microsoft SQL Server. */\n MSSQL: 'mssql',\n /** MySQL. */\n MYSQL: 'mysql',\n /** Oracle Database. */\n ORACLE: 'oracle',\n /** IBM Db2. */\n DB2: 'db2',\n /** PostgreSQL. */\n POSTGRESQL: 'postgresql',\n /** Amazon Redshift. */\n REDSHIFT: 'redshift',\n /** Apache Hive. */\n HIVE: 'hive',\n /** Cloudscape. */\n CLOUDSCAPE: 'cloudscape',\n /** HyperSQL DataBase. */\n HSQLDB: 'hsqldb',\n /** Progress Database. */\n PROGRESS: 'progress',\n /** SAP MaxDB. */\n MAXDB: 'maxdb',\n /** SAP HANA. */\n HANADB: 'hanadb',\n /** Ingres. */\n INGRES: 'ingres',\n /** FirstSQL. */\n FIRSTSQL: 'firstsql',\n /** EnterpriseDB. */\n EDB: 'edb',\n /** InterSystems Caché. */\n CACHE: 'cache',\n /** Adabas (Adaptable Database System). */\n ADABAS: 'adabas',\n /** Firebird. */\n FIREBIRD: 'firebird',\n /** Apache Derby. */\n DERBY: 'derby',\n /** FileMaker. */\n FILEMAKER: 'filemaker',\n /** Informix. */\n INFORMIX: 'informix',\n /** InstantDB. */\n INSTANTDB: 'instantdb',\n /** InterBase. */\n INTERBASE: 'interbase',\n /** MariaDB. */\n MARIADB: 'mariadb',\n /** Netezza. */\n NETEZZA: 'netezza',\n /** Pervasive PSQL. */\n PERVASIVE: 'pervasive',\n /** PointBase. */\n POINTBASE: 'pointbase',\n /** SQLite. */\n SQLITE: 'sqlite',\n /** Sybase. */\n SYBASE: 'sybase',\n /** Teradata. */\n TERADATA: 'teradata',\n /** Vertica. */\n VERTICA: 'vertica',\n /** H2. */\n H2: 'h2',\n /** ColdFusion IMQ. */\n COLDFUSION: 'coldfusion',\n /** Apache Cassandra. */\n CASSANDRA: 'cassandra',\n /** Apache HBase. */\n HBASE: 'hbase',\n /** MongoDB. */\n MONGODB: 'mongodb',\n /** Redis. */\n REDIS: 'redis',\n /** Couchbase. */\n COUCHBASE: 'couchbase',\n /** CouchDB. */\n COUCHDB: 'couchdb',\n /** Microsoft Azure Cosmos DB. */\n COSMOSDB: 'cosmosdb',\n /** Amazon DynamoDB. */\n DYNAMODB: 'dynamodb',\n /** Neo4j. */\n NEO4J: 'neo4j',\n /** Apache Geode. */\n GEODE: 'geode',\n /** Elasticsearch. */\n ELASTICSEARCH: 'elasticsearch',\n /** Memcached. */\n MEMCACHED: 'memcached',\n /** CockroachDB. */\n COCKROACHDB: 'cockroachdb',\n} as const;\nexport type DbSystemValues =\n (typeof DbSystemValues)[keyof typeof DbSystemValues];\n\nexport const DbCassandraConsistencyLevelValues = {\n /** all. */\n ALL: 'all',\n /** each_quorum. */\n EACH_QUORUM: 'each_quorum',\n /** quorum. */\n QUORUM: 'quorum',\n /** local_quorum. */\n LOCAL_QUORUM: 'local_quorum',\n /** one. */\n ONE: 'one',\n /** two. */\n TWO: 'two',\n /** three. */\n THREE: 'three',\n /** local_one. */\n LOCAL_ONE: 'local_one',\n /** any. */\n ANY: 'any',\n /** serial. */\n SERIAL: 'serial',\n /** local_serial. */\n LOCAL_SERIAL: 'local_serial',\n} as const;\nexport type DbCassandraConsistencyLevelValues =\n (typeof DbCassandraConsistencyLevelValues)[keyof typeof DbCassandraConsistencyLevelValues];\n\nexport const FaasTriggerValues = {\n /** A response to some data source operation such as a database or filesystem read/write. */\n DATASOURCE: 'datasource',\n /** To provide an answer to an inbound HTTP request. */\n HTTP: 'http',\n /** A function is set to be executed when messages are sent to a messaging system. */\n PUBSUB: 'pubsub',\n /** A function is scheduled to be executed regularly. */\n TIMER: 'timer',\n /** If none of the others apply. */\n OTHER: 'other',\n} as const;\nexport type FaasTriggerValues =\n (typeof FaasTriggerValues)[keyof typeof FaasTriggerValues];\n\nexport const FaasDocumentOperationValues = {\n /** When a new object is created. */\n INSERT: 'insert',\n /** When an object is modified. */\n EDIT: 'edit',\n /** When an object is deleted. */\n DELETE: 'delete',\n} as const;\nexport type FaasDocumentOperationValues =\n (typeof FaasDocumentOperationValues)[keyof typeof FaasDocumentOperationValues];\n\nexport const FaasInvokedProviderValues = {\n /** Alibaba Cloud. */\n ALIBABA_CLOUD: 'alibaba_cloud',\n /** Amazon Web Services. */\n AWS: 'aws',\n /** Microsoft Azure. */\n AZURE: 'azure',\n /** Google Cloud Platform. */\n GCP: 'gcp',\n} as const;\nexport type FaasInvokedProviderValues =\n (typeof FaasInvokedProviderValues)[keyof typeof FaasInvokedProviderValues];\n\nexport const NetTransportValues = {\n /** ip_tcp. */\n IP_TCP: 'ip_tcp',\n /** ip_udp. */\n IP_UDP: 'ip_udp',\n /** Another IP-based protocol. */\n IP: 'ip',\n /** Unix Domain socket. See below. */\n UNIX: 'unix',\n /** Named or anonymous pipe. See note below. */\n PIPE: 'pipe',\n /** In-process communication. */\n INPROC: 'inproc',\n /** Something else (non IP-based). */\n OTHER: 'other',\n} as const;\nexport type NetTransportValues =\n (typeof NetTransportValues)[keyof typeof NetTransportValues];\n\nexport const NetHostConnectionTypeValues = {\n /** wifi. */\n WIFI: 'wifi',\n /** wired. */\n WIRED: 'wired',\n /** cell. */\n CELL: 'cell',\n /** unavailable. */\n UNAVAILABLE: 'unavailable',\n /** unknown. */\n UNKNOWN: 'unknown',\n} as const;\nexport type NetHostConnectionTypeValues =\n (typeof NetHostConnectionTypeValues)[keyof typeof NetHostConnectionTypeValues];\n\nexport const NetHostConnectionSubtypeValues = {\n /** GPRS. */\n GPRS: 'gprs',\n /** EDGE. */\n EDGE: 'edge',\n /** UMTS. */\n UMTS: 'umts',\n /** CDMA. */\n CDMA: 'cdma',\n /** EVDO Rel. 0. */\n EVDO_0: 'evdo_0',\n /** EVDO Rev. A. */\n EVDO_A: 'evdo_a',\n /** CDMA2000 1XRTT. */\n CDMA2000_1XRTT: 'cdma2000_1xrtt',\n /** HSDPA. */\n HSDPA: 'hsdpa',\n /** HSUPA. */\n HSUPA: 'hsupa',\n /** HSPA. */\n HSPA: 'hspa',\n /** IDEN. */\n IDEN: 'iden',\n /** EVDO Rev. B. */\n EVDO_B: 'evdo_b',\n /** LTE. */\n LTE: 'lte',\n /** EHRPD. */\n EHRPD: 'ehrpd',\n /** HSPAP. */\n HSPAP: 'hspap',\n /** GSM. */\n GSM: 'gsm',\n /** TD-SCDMA. */\n TD_SCDMA: 'td_scdma',\n /** IWLAN. */\n IWLAN: 'iwlan',\n /** 5G NR (New Radio). */\n NR: 'nr',\n /** 5G NRNSA (New Radio Non-Standalone). */\n NRNSA: 'nrnsa',\n /** LTE CA. */\n LTE_CA: 'lte_ca',\n} as const;\nexport type NetHostConnectionSubtypeValues =\n (typeof NetHostConnectionSubtypeValues)[keyof typeof NetHostConnectionSubtypeValues];\n\nexport const HttpFlavorValues = {\n /** HTTP 1.0. */\n HTTP_1_0: '1.0',\n /** HTTP 1.1. */\n HTTP_1_1: '1.1',\n /** HTTP 2. */\n HTTP_2_0: '2.0',\n /** SPDY protocol. */\n SPDY: 'SPDY',\n /** QUIC protocol. */\n QUIC: 'QUIC',\n} as const;\nexport type HttpFlavorValues =\n (typeof HttpFlavorValues)[keyof typeof HttpFlavorValues];\n\nexport const MessagingDestinationKindValues = {\n /** A message sent to a queue. */\n QUEUE: 'queue',\n /** A message sent to a topic. */\n TOPIC: 'topic',\n} as const;\nexport type MessagingDestinationKindValues =\n (typeof MessagingDestinationKindValues)[keyof typeof MessagingDestinationKindValues];\n\nexport const MessagingOperationValues = {\n /** receive. */\n RECEIVE: 'receive',\n /** process. */\n PROCESS: 'process',\n} as const;\nexport type MessagingOperationValues =\n (typeof MessagingOperationValues)[keyof typeof MessagingOperationValues];\n\nexport const RpcGrpcStatusCodeValues = {\n /** OK. */\n OK: 0,\n /** CANCELLED. */\n CANCELLED: 1,\n /** UNKNOWN. */\n UNKNOWN: 2,\n /** INVALID_ARGUMENT. */\n INVALID_ARGUMENT: 3,\n /** DEADLINE_EXCEEDED. */\n DEADLINE_EXCEEDED: 4,\n /** NOT_FOUND. */\n NOT_FOUND: 5,\n /** ALREADY_EXISTS. */\n ALREADY_EXISTS: 6,\n /** PERMISSION_DENIED. */\n PERMISSION_DENIED: 7,\n /** RESOURCE_EXHAUSTED. */\n RESOURCE_EXHAUSTED: 8,\n /** FAILED_PRECONDITION. */\n FAILED_PRECONDITION: 9,\n /** ABORTED. */\n ABORTED: 10,\n /** OUT_OF_RANGE. */\n OUT_OF_RANGE: 11,\n /** UNIMPLEMENTED. */\n UNIMPLEMENTED: 12,\n /** INTERNAL. */\n INTERNAL: 13,\n /** UNAVAILABLE. */\n UNAVAILABLE: 14,\n /** DATA_LOSS. */\n DATA_LOSS: 15,\n /** UNAUTHENTICATED. */\n UNAUTHENTICATED: 16,\n} as const;\nexport type RpcGrpcStatusCodeValues =\n (typeof RpcGrpcStatusCodeValues)[keyof typeof RpcGrpcStatusCodeValues];\n\nexport const MessageTypeValues = {\n /** sent. */\n SENT: 'SENT',\n /** received. */\n RECEIVED: 'RECEIVED',\n} as const;\nexport type MessageTypeValues =\n (typeof MessageTypeValues)[keyof typeof MessageTypeValues];\n", "/*\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 */\nexport * from './SemanticAttributes';\n", "/*\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// DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates//templates/SemanticAttributes.ts.j2\nexport const SemanticResourceAttributes = {\n /**\n * Name of the cloud provider.\n */\n CLOUD_PROVIDER: 'cloud.provider',\n\n /**\n * The cloud account ID the resource is assigned to.\n */\n CLOUD_ACCOUNT_ID: 'cloud.account.id',\n\n /**\n * The geographical region the resource is running. Refer to your provider's docs to see the available regions, for example [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), or [Google Cloud regions](https://cloud.google.com/about/locations).\n */\n CLOUD_REGION: 'cloud.region',\n\n /**\n * Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running.\n *\n * Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud.\n */\n CLOUD_AVAILABILITY_ZONE: 'cloud.availability_zone',\n\n /**\n * The cloud platform in use.\n *\n * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`.\n */\n CLOUD_PLATFORM: 'cloud.platform',\n\n /**\n * The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html).\n */\n AWS_ECS_CONTAINER_ARN: 'aws.ecs.container.arn',\n\n /**\n * The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html).\n */\n AWS_ECS_CLUSTER_ARN: 'aws.ecs.cluster.arn',\n\n /**\n * The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) for an ECS task.\n */\n AWS_ECS_LAUNCHTYPE: 'aws.ecs.launchtype',\n\n /**\n * The ARN of an [ECS task definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html).\n */\n AWS_ECS_TASK_ARN: 'aws.ecs.task.arn',\n\n /**\n * The task definition family this task definition is a member of.\n */\n AWS_ECS_TASK_FAMILY: 'aws.ecs.task.family',\n\n /**\n * The revision for this task definition.\n */\n AWS_ECS_TASK_REVISION: 'aws.ecs.task.revision',\n\n /**\n * The ARN of an EKS cluster.\n */\n AWS_EKS_CLUSTER_ARN: 'aws.eks.cluster.arn',\n\n /**\n * The name(s) of the AWS log group(s) an application is writing to.\n *\n * Note: Multiple log groups must be supported for cases like multi-container applications, where a single application has sidecar containers, and each write to their own log group.\n */\n AWS_LOG_GROUP_NAMES: 'aws.log.group.names',\n\n /**\n * The Amazon Resource Name(s) (ARN) of the AWS log group(s).\n *\n * Note: See the [log group ARN format documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format).\n */\n AWS_LOG_GROUP_ARNS: 'aws.log.group.arns',\n\n /**\n * The name(s) of the AWS log stream(s) an application is writing to.\n */\n AWS_LOG_STREAM_NAMES: 'aws.log.stream.names',\n\n /**\n * The ARN(s) of the AWS log stream(s).\n *\n * Note: See the [log stream ARN format documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain several log streams, so these ARNs necessarily identify both a log group and a log stream.\n */\n AWS_LOG_STREAM_ARNS: 'aws.log.stream.arns',\n\n /**\n * Container name.\n */\n CONTAINER_NAME: 'container.name',\n\n /**\n * Container ID. Usually a UUID, as for example used to [identify Docker containers](https://docs.docker.com/engine/reference/run/#container-identification). The UUID might be abbreviated.\n */\n CONTAINER_ID: 'container.id',\n\n /**\n * The container runtime managing this container.\n */\n CONTAINER_RUNTIME: 'container.runtime',\n\n /**\n * Name of the image the container was built on.\n */\n CONTAINER_IMAGE_NAME: 'container.image.name',\n\n /**\n * Container image tag.\n */\n CONTAINER_IMAGE_TAG: 'container.image.tag',\n\n /**\n * Name of the [deployment environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka deployment tier).\n */\n DEPLOYMENT_ENVIRONMENT: 'deployment.environment',\n\n /**\n * A unique identifier representing the device.\n *\n * Note: The device identifier MUST only be defined using the values outlined below. This value is not an advertising identifier and MUST NOT be used as such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the Firebase Installation ID or a globally unique UUID which is persisted across sessions in your application. More information can be found [here](https://developer.android.com/training/articles/user-data-ids) on best practices and exact implementation details. Caution should be taken when storing personal data or anything which can identify a user. GDPR and data protection laws may apply, ensure you do your own due diligence.\n */\n DEVICE_ID: 'device.id',\n\n /**\n * The model identifier for the device.\n *\n * Note: It's recommended this value represents a machine readable version of the model identifier rather than the market or consumer-friendly name of the device.\n */\n DEVICE_MODEL_IDENTIFIER: 'device.model.identifier',\n\n /**\n * The marketing name for the device model.\n *\n * Note: It's recommended this value represents a human readable version of the device model rather than a machine readable alternative.\n */\n DEVICE_MODEL_NAME: 'device.model.name',\n\n /**\n * The name of the single function that this runtime instance executes.\n *\n * Note: This is the name of the function as configured/deployed on the FaaS platform and is usually different from the name of the callback function (which may be stored in the [`code.namespace`/`code.function`](../../trace/semantic_conventions/span-general.md#source-code-attributes) span attributes).\n */\n FAAS_NAME: 'faas.name',\n\n /**\n * The unique ID of the single function that this runtime instance executes.\n *\n * Note: Depending on the cloud provider, use:\n\n* **AWS Lambda:** The function [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html).\nTake care not to use the "invoked ARN" directly but replace any\n[alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) with the resolved function version, as the same runtime instance may be invokable with multiple\ndifferent aliases.\n* **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full-resource-names)\n* **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id).\n\nOn some providers, it may not be possible to determine the full ID at startup,\nwhich is why this field cannot be made required. For example, on AWS the account ID\npart of the ARN is not available without calling another AWS API\nwhich may be deemed too slow for a short-running lambda function.\nAs an alternative, consider setting `faas.id` as a span attribute instead.\n */\n FAAS_ID: 'faas.id',\n\n /**\n * The immutable version of the function being executed.\n *\n * Note: Depending on the cloud provider and platform, use:\n\n* **AWS Lambda:** The [function version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html)\n (an integer represented as a decimal string).\n* **Google Cloud Run:** The [revision](https://cloud.google.com/run/docs/managing/revisions)\n (i.e., the function name plus the revision suffix).\n* **Google Cloud Functions:** The value of the\n [`K_REVISION` environment variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically).\n* **Azure Functions:** Not applicable. Do not set this attribute.\n */\n FAAS_VERSION: 'faas.version',\n\n /**\n * The execution environment ID as a string, that will be potentially reused for other invocations to the same function/function version.\n *\n * Note: * **AWS Lambda:** Use the (full) log stream name.\n */\n FAAS_INSTANCE: 'faas.instance',\n\n /**\n * The amount of memory available to the serverless function in MiB.\n *\n * Note: It's recommended to set this attribute since e.g. too little memory can easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information.\n */\n FAAS_MAX_MEMORY: 'faas.max_memory',\n\n /**\n * Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider.\n */\n HOST_ID: 'host.id',\n\n /**\n * Name of the host. On Unix systems, it may contain what the hostname command returns, or the fully qualified hostname, or another name specified by the user.\n */\n HOST_NAME: 'host.name',\n\n /**\n * Type of host. For Cloud, this must be the machine type.\n */\n HOST_TYPE: 'host.type',\n\n /**\n * The CPU architecture the host system is running on.\n */\n HOST_ARCH: 'host.arch',\n\n /**\n * Name of the VM image or OS install the host was instantiated from.\n */\n HOST_IMAGE_NAME: 'host.image.name',\n\n /**\n * VM image ID. For Cloud, this value is from the provider.\n */\n HOST_IMAGE_ID: 'host.image.id',\n\n /**\n * The version string of the VM image as defined in [Version SpanAttributes](README.md#version-attributes).\n */\n HOST_IMAGE_VERSION: 'host.image.version',\n\n /**\n * The name of the cluster.\n */\n K8S_CLUSTER_NAME: 'k8s.cluster.name',\n\n /**\n * The name of the Node.\n */\n K8S_NODE_NAME: 'k8s.node.name',\n\n /**\n * The UID of the Node.\n */\n K8S_NODE_UID: 'k8s.node.uid',\n\n /**\n * The name of the namespace that the pod is running in.\n */\n K8S_NAMESPACE_NAME: 'k8s.namespace.name',\n\n /**\n * The UID of the Pod.\n */\n K8S_POD_UID: 'k8s.pod.uid',\n\n /**\n * The name of the Pod.\n */\n K8S_POD_NAME: 'k8s.pod.name',\n\n /**\n * The name of the Container in a Pod template.\n */\n K8S_CONTAINER_NAME: 'k8s.container.name',\n\n /**\n * The UID of the ReplicaSet.\n */\n K8S_REPLICASET_UID: 'k8s.replicaset.uid',\n\n /**\n * The name of the ReplicaSet.\n */\n K8S_REPLICASET_NAME: 'k8s.replicaset.name',\n\n /**\n * The UID of the Deployment.\n */\n K8S_DEPLOYMENT_UID: 'k8s.deployment.uid',\n\n /**\n * The name of the Deployment.\n */\n K8S_DEPLOYMENT_NAME: 'k8s.deployment.name',\n\n /**\n * The UID of the StatefulSet.\n */\n K8S_STATEFULSET_UID: 'k8s.statefulset.uid',\n\n /**\n * The name of the StatefulSet.\n */\n K8S_STATEFULSET_NAME: 'k8s.statefulset.name',\n\n /**\n * The UID of the DaemonSet.\n */\n K8S_DAEMONSET_UID: 'k8s.daemonset.uid',\n\n /**\n * The name of the DaemonSet.\n */\n K8S_DAEMONSET_NAME: 'k8s.daemonset.name',\n\n /**\n * The UID of the Job.\n */\n K8S_JOB_UID: 'k8s.job.uid',\n\n /**\n * The name of the Job.\n */\n K8S_JOB_NAME: 'k8s.job.name',\n\n /**\n * The UID of the CronJob.\n */\n K8S_CRONJOB_UID: 'k8s.cronjob.uid',\n\n /**\n * The name of the CronJob.\n */\n K8S_CRONJOB_NAME: 'k8s.cronjob.name',\n\n /**\n * The operating system type.\n */\n OS_TYPE: 'os.type',\n\n /**\n * Human readable (not intended to be parsed) OS version information, like e.g. reported by `ver` or `lsb_release -a` commands.\n */\n OS_DESCRIPTION: 'os.description',\n\n /**\n * Human readable operating system name.\n */\n OS_NAME: 'os.name',\n\n /**\n * The version string of the operating system as defined in [Version SpanAttributes](../../resource/semantic_conventions/README.md#version-attributes).\n */\n OS_VERSION: 'os.version',\n\n /**\n * Process identifier (PID).\n */\n PROCESS_PID: 'process.pid',\n\n /**\n * The name of the process executable. On Linux based systems, can be set to the `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of `GetProcessImageFileNameW`.\n */\n PROCESS_EXECUTABLE_NAME: 'process.executable.name',\n\n /**\n * The full path to the process executable. On Linux based systems, can be set to the target of `proc/[pid]/exe`. On Windows, can be set to the result of `GetProcessImageFileNameW`.\n */\n PROCESS_EXECUTABLE_PATH: 'process.executable.path',\n\n /**\n * The command used to launch the process (i.e. the command name). On Linux based systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to the first parameter extracted from `GetCommandLineW`.\n */\n PROCESS_COMMAND: 'process.command',\n\n /**\n * The full command used to launch the process as a single string representing the full command. On Windows, can be set to the result of `GetCommandLineW`. Do not set this if you have to assemble it just for monitoring; use `process.command_args` instead.\n */\n PROCESS_COMMAND_LINE: 'process.command_line',\n\n /**\n * All the command arguments (including the command/executable itself) as received by the process. On Linux-based systems (and some other Unixoid systems supporting procfs), can be set according to the list of null-delimited strings extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be the full argv vector passed to `main`.\n */\n PROCESS_COMMAND_ARGS: 'process.command_args',\n\n /**\n * The username of the user that owns the process.\n */\n PROCESS_OWNER: 'process.owner',\n\n /**\n * The name of the runtime of this process. For compiled native binaries, this SHOULD be the name of the compiler.\n */\n PROCESS_RUNTIME_NAME: 'process.runtime.name',\n\n /**\n * The version of the runtime of this process, as returned by the runtime without modification.\n */\n PROCESS_RUNTIME_VERSION: 'process.runtime.version',\n\n /**\n * An additional description about the runtime of the process, for example a specific vendor customization of the runtime environment.\n */\n PROCESS_RUNTIME_DESCRIPTION: 'process.runtime.description',\n\n /**\n * Logical name of the service.\n *\n * Note: MUST be the same for all instances of horizontally scaled services. If the value was not specified, SDKs MUST fallback to `unknown_service:` concatenated with [`process.executable.name`](process.md#process), e.g. `unknown_service:bash`. If `process.executable.name` is not available, the value MUST be set to `unknown_service`.\n */\n SERVICE_NAME: 'service.name',\n\n /**\n * A namespace for `service.name`.\n *\n * Note: A string value having a meaning that helps to distinguish a group of services, for example the team name that owns a group of services. `service.name` is expected to be unique within the same namespace. If `service.namespace` is not specified in the Resource then `service.name` is expected to be unique for all services that have no explicit namespace defined (so the empty/unspecified namespace is simply one more valid namespace). Zero-length namespace string is assumed equal to unspecified namespace.\n */\n SERVICE_NAMESPACE: 'service.namespace',\n\n /**\n * The string ID of the service instance.\n *\n * Note: MUST be unique for each instance of the same `service.namespace,service.name` pair (in other words `service.namespace,service.name,service.instance.id` triplet MUST be globally unique). The ID helps to distinguish instances of the same service that exist at the same time (e.g. instances of a horizontally scaled service). It is preferable for the ID to be persistent and stay the same for the lifetime of the service instance, however it is acceptable that the ID is ephemeral and changes during important lifetime events for the service (e.g. service restarts). If the service has no inherent unique ID that can be used as the value of this attribute it is recommended to generate a random Version 1 or Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use Version 5, see RFC 4122 for more recommendations).\n */\n SERVICE_INSTANCE_ID: 'service.instance.id',\n\n /**\n * The version string of the service API or implementation.\n */\n SERVICE_VERSION: 'service.version',\n\n /**\n * The name of the telemetry SDK as defined above.\n */\n TELEMETRY_SDK_NAME: 'telemetry.sdk.name',\n\n /**\n * The language of the telemetry SDK.\n */\n TELEMETRY_SDK_LANGUAGE: 'telemetry.sdk.language',\n\n /**\n * The version string of the telemetry SDK.\n */\n TELEMETRY_SDK_VERSION: 'telemetry.sdk.version',\n\n /**\n * The version string of the auto instrumentation agent, if used.\n */\n TELEMETRY_AUTO_VERSION: 'telemetry.auto.version',\n\n /**\n * The name of the web engine.\n */\n WEBENGINE_NAME: 'webengine.name',\n\n /**\n * The version of the web engine.\n */\n WEBENGINE_VERSION: 'webengine.version',\n\n /**\n * Additional description of the web engine (e.g. detailed version and edition information).\n */\n WEBENGINE_DESCRIPTION: 'webengine.description',\n};\n\nexport const CloudProviderValues = {\n /** Alibaba Cloud. */\n ALIBABA_CLOUD: 'alibaba_cloud',\n /** Amazon Web Services. */\n AWS: 'aws',\n /** Microsoft Azure. */\n AZURE: 'azure',\n /** Google Cloud Platform. */\n GCP: 'gcp',\n} as const;\nexport type CloudProviderValues =\n (typeof CloudProviderValues)[keyof typeof CloudProviderValues];\n\nexport const CloudPlatformValues = {\n /** Alibaba Cloud Elastic Compute Service. */\n ALIBABA_CLOUD_ECS: 'alibaba_cloud_ecs',\n /** Alibaba Cloud Function Compute. */\n ALIBABA_CLOUD_FC: 'alibaba_cloud_fc',\n /** AWS Elastic Compute Cloud. */\n AWS_EC2: 'aws_ec2',\n /** AWS Elastic Container Service. */\n AWS_ECS: 'aws_ecs',\n /** AWS Elastic Kubernetes Service. */\n AWS_EKS: 'aws_eks',\n /** AWS Lambda. */\n AWS_LAMBDA: 'aws_lambda',\n /** AWS Elastic Beanstalk. */\n AWS_ELASTIC_BEANSTALK: 'aws_elastic_beanstalk',\n /** Azure Virtual Machines. */\n AZURE_VM: 'azure_vm',\n /** Azure Container Instances. */\n AZURE_CONTAINER_INSTANCES: 'azure_container_instances',\n /** Azure Kubernetes Service. */\n AZURE_AKS: 'azure_aks',\n /** Azure Functions. */\n AZURE_FUNCTIONS: 'azure_functions',\n /** Azure App Service. */\n AZURE_APP_SERVICE: 'azure_app_service',\n /** Google Cloud Compute Engine (GCE). */\n GCP_COMPUTE_ENGINE: 'gcp_compute_engine',\n /** Google Cloud Run. */\n GCP_CLOUD_RUN: 'gcp_cloud_run',\n /** Google Cloud Kubernetes Engine (GKE). */\n GCP_KUBERNETES_ENGINE: 'gcp_kubernetes_engine',\n /** Google Cloud Functions (GCF). */\n GCP_CLOUD_FUNCTIONS: 'gcp_cloud_functions',\n /** Google Cloud App Engine (GAE). */\n GCP_APP_ENGINE: 'gcp_app_engine',\n} as const;\nexport type CloudPlatformValues =\n (typeof CloudPlatformValues)[keyof typeof CloudPlatformValues];\n\nexport const AwsEcsLaunchtypeValues = {\n /** ec2. */\n EC2: 'ec2',\n /** fargate. */\n FARGATE: 'fargate',\n} as const;\nexport type AwsEcsLaunchtypeValues =\n (typeof AwsEcsLaunchtypeValues)[keyof typeof AwsEcsLaunchtypeValues];\n\nexport const HostArchValues = {\n /** AMD64. */\n AMD64: 'amd64',\n /** ARM32. */\n ARM32: 'arm32',\n /** ARM64. */\n ARM64: 'arm64',\n /** Itanium. */\n IA64: 'ia64',\n /** 32-bit PowerPC. */\n PPC32: 'ppc32',\n /** 64-bit PowerPC. */\n PPC64: 'ppc64',\n /** 32-bit x86. */\n X86: 'x86',\n} as const;\nexport type HostArchValues =\n (typeof HostArchValues)[keyof typeof HostArchValues];\n\nexport const OsTypeValues = {\n /** Microsoft Windows. */\n WINDOWS: 'windows',\n /** Linux. */\n LINUX: 'linux',\n /** Apple Darwin. */\n DARWIN: 'darwin',\n /** FreeBSD. */\n FREEBSD: 'freebsd',\n /** NetBSD. */\n NETBSD: 'netbsd',\n /** OpenBSD. */\n OPENBSD: 'openbsd',\n /** DragonFly BSD. */\n DRAGONFLYBSD: 'dragonflybsd',\n /** HP-UX (Hewlett Packard Unix). */\n HPUX: 'hpux',\n /** AIX (Advanced Interactive eXecutive). */\n AIX: 'aix',\n /** Oracle Solaris. */\n SOLARIS: 'solaris',\n /** IBM z/OS. */\n Z_OS: 'z_os',\n} as const;\nexport type OsTypeValues = (typeof OsTypeValues)[keyof typeof OsTypeValues];\n\nexport const TelemetrySdkLanguageValues = {\n /** cpp. */\n CPP: 'cpp',\n /** dotnet. */\n DOTNET: 'dotnet',\n /** erlang. */\n ERLANG: 'erlang',\n /** go. */\n GO: 'go',\n /** java. */\n JAVA: 'java',\n /** nodejs. */\n NODEJS: 'nodejs',\n /** php. */\n PHP: 'php',\n /** python. */\n PYTHON: 'python',\n /** ruby. */\n RUBY: 'ruby',\n /** webjs. */\n WEBJS: 'webjs',\n} as const;\nexport type TelemetrySdkLanguageValues =\n (typeof TelemetrySdkLanguageValues)[keyof typeof TelemetrySdkLanguageValues];\n", "/*\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 */\nexport * from './SemanticResourceAttributes';\n", "/*\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\nexport * from './trace';\nexport * from './resource';\n", "/*\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 { VERSION } from '../../version';\nimport {\n TelemetrySdkLanguageValues,\n SemanticResourceAttributes,\n} from '@opentelemetry/semantic-conventions';\n\n/** Constants describing the SDK in use */\nexport const SDK_INFO = {\n [SemanticResourceAttributes.TELEMETRY_SDK_NAME]: 'opentelemetry',\n [SemanticResourceAttributes.PROCESS_RUNTIME_NAME]: 'browser',\n [SemanticResourceAttributes.TELEMETRY_SDK_LANGUAGE]:\n TelemetrySdkLanguageValues.WEBJS,\n [SemanticResourceAttributes.TELEMETRY_SDK_VERSION]: VERSION,\n};\n", "/*\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 */\nexport function unrefTimer(_timer: number): void {}\n", "/*\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\nexport * from './environment';\nexport * from './globalThis';\nexport * from './hex-to-base64';\nexport * from './RandomIdGenerator';\nexport * from './performance';\nexport * from './sdk-info';\nexport * from './timer-util';\n", "/*\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 * as api from '@opentelemetry/api';\nimport { otperformance as performance } from '../platform';\nimport { TimeOriginLegacy } from './types';\n\nconst NANOSECOND_DIGITS = 9;\nconst NANOSECOND_DIGITS_IN_MILLIS = 6;\nconst MILLISECONDS_TO_NANOSECONDS = Math.pow(10, NANOSECOND_DIGITS_IN_MILLIS);\nconst SECOND_TO_NANOSECONDS = Math.pow(10, NANOSECOND_DIGITS);\n\n/**\n * Converts a number of milliseconds from epoch to HrTime([seconds, remainder in nanoseconds]).\n * @param epochMillis\n */\nexport function millisToHrTime(epochMillis: number): api.HrTime {\n const epochSeconds = epochMillis / 1000;\n // Decimals only.\n const seconds = Math.trunc(epochSeconds);\n // Round sub-nanosecond accuracy to nanosecond.\n const nanos = Math.round((epochMillis % 1000) * MILLISECONDS_TO_NANOSECONDS);\n return [seconds, nanos];\n}\n\nexport function getTimeOrigin(): number {\n let timeOrigin = performance.timeOrigin;\n if (typeof timeOrigin !== 'number') {\n const perf: TimeOriginLegacy = performance as unknown as TimeOriginLegacy;\n timeOrigin = perf.timing && perf.timing.fetchStart;\n }\n return timeOrigin;\n}\n\n/**\n * Returns an hrtime calculated via performance component.\n * @param performanceNow\n */\nexport function hrTime(performanceNow?: number): api.HrTime {\n const timeOrigin = millisToHrTime(getTimeOrigin());\n const now = millisToHrTime(\n typeof performanceNow === 'number' ? performanceNow : performance.now()\n );\n\n return addHrTimes(timeOrigin, now);\n}\n\n/**\n *\n * Converts a TimeInput to an HrTime, defaults to _hrtime().\n * @param time\n */\nexport function timeInputToHrTime(time: api.TimeInput): api.HrTime {\n // process.hrtime\n if (isTimeInputHrTime(time)) {\n return time as api.HrTime;\n } else if (typeof time === 'number') {\n // Must be a performance.now() if it's smaller than process start time.\n if (time < getTimeOrigin()) {\n return hrTime(time);\n } else {\n // epoch milliseconds or performance.timeOrigin\n return millisToHrTime(time);\n }\n } else if (time instanceof Date) {\n return millisToHrTime(time.getTime());\n } else {\n throw TypeError('Invalid input type');\n }\n}\n\n/**\n * Returns a duration of two hrTime.\n * @param startTime\n * @param endTime\n */\nexport function hrTimeDuration(\n startTime: api.HrTime,\n endTime: api.HrTime\n): api.HrTime {\n let seconds = endTime[0] - startTime[0];\n let nanos = endTime[1] - startTime[1];\n\n // overflow\n if (nanos < 0) {\n seconds -= 1;\n // negate\n nanos += SECOND_TO_NANOSECONDS;\n }\n\n return [seconds, nanos];\n}\n\n/**\n * Convert hrTime to timestamp, for example \"2019-05-14T17:00:00.000123456Z\"\n * @param time\n */\nexport function hrTimeToTimeStamp(time: api.HrTime): string {\n const precision = NANOSECOND_DIGITS;\n const tmp = `${'0'.repeat(precision)}${time[1]}Z`;\n const nanoString = tmp.substr(tmp.length - precision - 1);\n const date = new Date(time[0] * 1000).toISOString();\n return date.replace('000Z', nanoString);\n}\n\n/**\n * Convert hrTime to nanoseconds.\n * @param time\n */\nexport function hrTimeToNanoseconds(time: api.HrTime): number {\n return time[0] * SECOND_TO_NANOSECONDS + time[1];\n}\n\n/**\n * Convert hrTime to milliseconds.\n * @param time\n */\nexport function hrTimeToMilliseconds(time: api.HrTime): number {\n return time[0] * 1e3 + time[1] / 1e6;\n}\n\n/**\n * Convert hrTime to microseconds.\n * @param time\n */\nexport function hrTimeToMicroseconds(time: api.HrTime): number {\n return time[0] * 1e6 + time[1] / 1e3;\n}\n\n/**\n * check if time is HrTime\n * @param value\n */\nexport function isTimeInputHrTime(value: unknown): value is api.HrTime {\n return (\n Array.isArray(value) &&\n value.length === 2 &&\n typeof value[0] === 'number' &&\n typeof value[1] === 'number'\n );\n}\n\n/**\n * check if input value is a correct types.TimeInput\n * @param value\n */\nexport function isTimeInput(\n value: unknown\n): value is api.HrTime | number | Date {\n return (\n isTimeInputHrTime(value) ||\n typeof value === 'number' ||\n value instanceof Date\n );\n}\n\n/**\n * Given 2 HrTime formatted times, return their sum as an HrTime.\n */\nexport function addHrTimes(time1: api.HrTime, time2: api.HrTime): api.HrTime {\n const out = [time1[0] + time2[0], time1[1] + time2[1]] as api.HrTime;\n\n // Nanoseconds\n if (out[1] >= SECOND_TO_NANOSECONDS) {\n out[1] -= SECOND_TO_NANOSECONDS;\n out[0] += 1;\n }\n\n return out;\n}\n", "/*\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\nexport interface ExportResult {\n code: ExportResultCode;\n error?: Error;\n}\n\nexport enum ExportResultCode {\n SUCCESS,\n FAILED,\n}\n", "/*\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 {\n Context,\n TextMapGetter,\n TextMapPropagator,\n diag,\n TextMapSetter,\n} from '@opentelemetry/api';\n\n/** Configuration object for composite propagator */\nexport interface CompositePropagatorConfig {\n /**\n * List of propagators to run. Propagators run in the\n * list order. If a propagator later in the list writes the same context\n * key as a propagator earlier in the list, the later on will \"win\".\n */\n propagators?: TextMapPropagator[];\n}\n\n/** Combines multiple propagators into a single propagator. */\nexport class CompositePropagator implements TextMapPropagator {\n private readonly _propagators: TextMapPropagator[];\n private readonly _fields: string[];\n\n /**\n * Construct a composite propagator from a list of propagators.\n *\n * @param [config] Configuration object for composite propagator\n */\n constructor(config: CompositePropagatorConfig = {}) {\n this._propagators = config.propagators ?? [];\n\n this._fields = Array.from(\n new Set(\n this._propagators\n // older propagators may not have fields function, null check to be sure\n .map(p => (typeof p.fields === 'function' ? p.fields() : []))\n .reduce((x, y) => x.concat(y), [])\n )\n );\n }\n\n /**\n * Run each of the configured propagators with the given context and carrier.\n * Propagators are run in the order they are configured, so if multiple\n * propagators write the same carrier key, the propagator later in the list\n * will \"win\".\n *\n * @param context Context to inject\n * @param carrier Carrier into which context will be injected\n */\n inject(context: Context, carrier: unknown, setter: TextMapSetter): void {\n for (const propagator of this._propagators) {\n try {\n propagator.inject(context, carrier, setter);\n } catch (err) {\n diag.warn(\n `Failed to inject with ${propagator.constructor.name}. Err: ${err.message}`\n );\n }\n }\n }\n\n /**\n * Run each of the configured propagators with the given context and carrier.\n * Propagators are run in the order they are configured, so if multiple\n * propagators write the same context key, the propagator later in the list\n * will \"win\".\n *\n * @param context Context to add values to\n * @param carrier Carrier from which to extract context\n */\n extract(context: Context, carrier: unknown, getter: TextMapGetter): Context {\n return this._propagators.reduce((ctx, propagator) => {\n try {\n return propagator.extract(ctx, carrier, getter);\n } catch (err) {\n diag.warn(\n `Failed to inject with ${propagator.constructor.name}. Err: ${err.message}`\n );\n }\n return ctx;\n }, context);\n }\n\n fields(): string[] {\n // return a new array so our fields cannot be modified\n return this._fields.slice();\n }\n}\n", "/*\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\nconst VALID_KEY_CHAR_RANGE = '[_0-9a-z-*/]';\nconst VALID_KEY = `[a-z]${VALID_KEY_CHAR_RANGE}{0,255}`;\nconst VALID_VENDOR_KEY = `[a-z0-9]${VALID_KEY_CHAR_RANGE}{0,240}@[a-z]${VALID_KEY_CHAR_RANGE}{0,13}`;\nconst VALID_KEY_REGEX = new RegExp(`^(?:${VALID_KEY}|${VALID_VENDOR_KEY})$`);\nconst VALID_VALUE_BASE_REGEX = /^[ -~]{0,255}[!-~]$/;\nconst INVALID_VALUE_COMMA_EQUAL_REGEX = /,|=/;\n\n/**\n * Key is opaque string up to 256 characters printable. It MUST begin with a\n * lowercase letter, and can only contain lowercase letters a-z, digits 0-9,\n * underscores _, dashes -, asterisks *, and forward slashes /.\n * For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the\n * vendor name. Vendors SHOULD set the tenant ID at the beginning of the key.\n * see https://www.w3.org/TR/trace-context/#key\n */\nexport function validateKey(key: string): boolean {\n return VALID_KEY_REGEX.test(key);\n}\n\n/**\n * Value is opaque string up to 256 characters printable ASCII RFC0020\n * characters (i.e., the range 0x20 to 0x7E) except comma , and =.\n */\nexport function validateValue(value: string): boolean {\n return (\n VALID_VALUE_BASE_REGEX.test(value) &&\n !INVALID_VALUE_COMMA_EQUAL_REGEX.test(value)\n );\n}\n", "/*\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 * as api from '@opentelemetry/api';\nimport { validateKey, validateValue } from '../internal/validators';\n\nconst MAX_TRACE_STATE_ITEMS = 32;\nconst MAX_TRACE_STATE_LEN = 512;\nconst LIST_MEMBERS_SEPARATOR = ',';\nconst LIST_MEMBER_KEY_VALUE_SPLITTER = '=';\n\n/**\n * TraceState must be a class and not a simple object type because of the spec\n * requirement (https://www.w3.org/TR/trace-context/#tracestate-field).\n *\n * Here is the list of allowed mutations:\n * - New key-value pair should be added into the beginning of the list\n * - The value of any key can be updated. Modified keys MUST be moved to the\n * beginning of the list.\n */\nexport class TraceState implements api.TraceState {\n private _internalState: Map<string, string> = new Map();\n\n constructor(rawTraceState?: string) {\n if (rawTraceState) this._parse(rawTraceState);\n }\n\n set(key: string, value: string): TraceState {\n // TODO: Benchmark the different approaches(map vs list) and\n // use the faster one.\n const traceState = this._clone();\n if (traceState._internalState.has(key)) {\n traceState._internalState.delete(key);\n }\n traceState._internalState.set(key, value);\n return traceState;\n }\n\n unset(key: string): TraceState {\n const traceState = this._clone();\n traceState._internalState.delete(key);\n return traceState;\n }\n\n get(key: string): string | undefined {\n return this._internalState.get(key);\n }\n\n serialize(): string {\n return this._keys()\n .reduce((agg: string[], key) => {\n agg.push(key + LIST_MEMBER_KEY_VALUE_SPLITTER + this.get(key));\n return agg;\n }, [])\n .join(LIST_MEMBERS_SEPARATOR);\n }\n\n private _parse(rawTraceState: string) {\n if (rawTraceState.length > MAX_TRACE_STATE_LEN) return;\n this._internalState = rawTraceState\n .split(LIST_MEMBERS_SEPARATOR)\n .reverse() // Store in reverse so new keys (.set(...)) will be placed at the beginning\n .reduce((agg: Map<string, string>, part: string) => {\n const listMember = part.trim(); // Optional Whitespace (OWS) handling\n const i = listMember.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER);\n if (i !== -1) {\n const key = listMember.slice(0, i);\n const value = listMember.slice(i + 1, part.length);\n if (validateKey(key) && validateValue(value)) {\n agg.set(key, value);\n } else {\n // TODO: Consider to add warning log\n }\n }\n return agg;\n }, new Map());\n\n // Because of the reverse() requirement, trunc must be done after map is created\n if (this._internalState.size > MAX_TRACE_STATE_ITEMS) {\n this._internalState = new Map(\n Array.from(this._internalState.entries())\n .reverse() // Use reverse same as original tracestate parse chain\n .slice(0, MAX_TRACE_STATE_ITEMS)\n );\n }\n }\n\n private _keys(): string[] {\n return Array.from(this._internalState.keys()).reverse();\n }\n\n private _clone(): TraceState {\n const traceState = new TraceState();\n traceState._internalState = new Map(this._internalState);\n return traceState;\n }\n}\n", "/*\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 {\n Context,\n isSpanContextValid,\n SpanContext,\n TextMapGetter,\n TextMapPropagator,\n TextMapSetter,\n trace,\n TraceFlags,\n} from '@opentelemetry/api';\nimport { isTracingSuppressed } from './suppress-tracing';\nimport { TraceState } from './TraceState';\n\nexport const TRACE_PARENT_HEADER = 'traceparent';\nexport const TRACE_STATE_HEADER = 'tracestate';\n\nconst VERSION = '00';\nconst VERSION_PART = '(?!ff)[\\\\da-f]{2}';\nconst TRACE_ID_PART = '(?![0]{32})[\\\\da-f]{32}';\nconst PARENT_ID_PART = '(?![0]{16})[\\\\da-f]{16}';\nconst FLAGS_PART = '[\\\\da-f]{2}';\nconst TRACE_PARENT_REGEX = new RegExp(\n `^\\\\s?(${VERSION_PART})-(${TRACE_ID_PART})-(${PARENT_ID_PART})-(${FLAGS_PART})(-.*)?\\\\s?$`\n);\n\n/**\n * Parses information from the [traceparent] span tag and converts it into {@link SpanContext}\n * @param traceParent - A meta property that comes from server.\n * It should be dynamically generated server side to have the server's request trace Id,\n * a parent span Id that was set on the server's request span,\n * and the trace flags to indicate the server's sampling decision\n * (01 = sampled, 00 = not sampled).\n * for example: '{version}-{traceId}-{spanId}-{sampleDecision}'\n * For more information see {@link https://www.w3.org/TR/trace-context/}\n */\nexport function parseTraceParent(traceParent: string): SpanContext | null {\n const match = TRACE_PARENT_REGEX.exec(traceParent);\n if (!match) return null;\n\n // According to the specification the implementation should be compatible\n // with future versions. If there are more parts, we only reject it if it's using version 00\n // See https://www.w3.org/TR/trace-context/#versioning-of-traceparent\n if (match[1] === '00' && match[5]) return null;\n\n return {\n traceId: match[2],\n spanId: match[3],\n traceFlags: parseInt(match[4], 16),\n };\n}\n\n/**\n * Propagates {@link SpanContext} through Trace Context format propagation.\n *\n * Based on the Trace Context specification:\n * https://www.w3.org/TR/trace-context/\n */\nexport class W3CTraceContextPropagator implements TextMapPropagator {\n inject(context: Context, carrier: unknown, setter: TextMapSetter): void {\n const spanContext = trace.getSpanContext(context);\n if (\n !spanContext ||\n isTracingSuppressed(context) ||\n !isSpanContextValid(spanContext)\n )\n return;\n\n const traceParent = `${VERSION}-${spanContext.traceId}-${\n spanContext.spanId\n }-0${Number(spanContext.traceFlags || TraceFlags.NONE).toString(16)}`;\n\n setter.set(carrier, TRACE_PARENT_HEADER, traceParent);\n if (spanContext.traceState) {\n setter.set(\n carrier,\n TRACE_STATE_HEADER,\n spanContext.traceState.serialize()\n );\n }\n }\n\n extract(context: Context, carrier: unknown, getter: TextMapGetter): Context {\n const traceParentHeader = getter.get(carrier, TRACE_PARENT_HEADER);\n if (!traceParentHeader) return context;\n const traceParent = Array.isArray(traceParentHeader)\n ? traceParentHeader[0]\n : traceParentHeader;\n if (typeof traceParent !== 'string') return context;\n const spanContext = parseTraceParent(traceParent);\n if (!spanContext) return context;\n\n spanContext.isRemote = true;\n\n const traceStateHeader = getter.get(carrier, TRACE_STATE_HEADER);\n if (traceStateHeader) {\n // If more than one `tracestate` header is found, we merge them into a\n // single header.\n const state = Array.isArray(traceStateHeader)\n ? traceStateHeader.join(',')\n : traceStateHeader;\n spanContext.traceState = new TraceState(\n typeof state === 'string' ? state : undefined\n );\n }\n return trace.setSpanContext(context, spanContext);\n }\n\n fields(): string[] {\n return [TRACE_PARENT_HEADER, TRACE_STATE_HEADER];\n }\n}\n", "/*\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 { Context, createContextKey, Span } from '@opentelemetry/api';\n\nconst RPC_METADATA_KEY = createContextKey(\n 'OpenTelemetry SDK Context Key RPC_METADATA'\n);\n\nexport enum RPCType {\n HTTP = 'http',\n}\n\ntype HTTPMetadata = {\n type: RPCType.HTTP;\n route?: string;\n span: Span;\n};\n\n/**\n * Allows for future rpc metadata to be used with this mechanism\n */\nexport type RPCMetadata = HTTPMetadata;\n\nexport function setRPCMetadata(context: Context, meta: RPCMetadata): Context {\n return context.setValue(RPC_METADATA_KEY, meta);\n}\n\nexport function deleteRPCMetadata(context: Context): Context {\n return context.deleteValue(RPC_METADATA_KEY);\n}\n\nexport function getRPCMetadata(context: Context): RPCMetadata | undefined {\n return context.getValue(RPC_METADATA_KEY) as RPCMetadata | undefined;\n}\n", "/*\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 { Sampler, SamplingDecision, SamplingResult } from '@opentelemetry/api';\n\n/**\n * @deprecated Use the one defined in @opentelemetry/sdk-trace-base instead.\n * Sampler that samples no traces.\n */\nexport class AlwaysOffSampler implements Sampler {\n shouldSample(): SamplingResult {\n return {\n decision: SamplingDecision.NOT_RECORD,\n };\n }\n\n toString(): string {\n return 'AlwaysOffSampler';\n }\n}\n", "/*\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 { Sampler, SamplingDecision, SamplingResult } from '@opentelemetry/api';\n\n/**\n * @deprecated Use the one defined in @opentelemetry/sdk-trace-base instead.\n * Sampler that samples all traces.\n */\nexport class AlwaysOnSampler implements Sampler {\n shouldSample(): SamplingResult {\n return {\n decision: SamplingDecision.RECORD_AND_SAMPLED,\n };\n }\n\n toString(): string {\n return 'AlwaysOnSampler';\n }\n}\n", "/*\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 {\n Context,\n isSpanContextValid,\n Link,\n Sampler,\n SamplingResult,\n SpanAttributes,\n SpanKind,\n TraceFlags,\n trace,\n} from '@opentelemetry/api';\nimport { globalErrorHandler } from '../../common/global-error-handler';\nimport { AlwaysOffSampler } from './AlwaysOffSampler';\nimport { AlwaysOnSampler } from './AlwaysOnSampler';\n\n/**\n * @deprecated Use the one defined in @opentelemetry/sdk-trace-base instead.\n * A composite sampler that either respects the parent span's sampling decision\n * or delegates to `delegateSampler` for root spans.\n */\nexport class ParentBasedSampler implements Sampler {\n private _root: Sampler;\n private _remoteParentSampled: Sampler;\n private _remoteParentNotSampled: Sampler;\n private _localParentSampled: Sampler;\n private _localParentNotSampled: Sampler;\n\n constructor(config: ParentBasedSamplerConfig) {\n this._root = config.root;\n\n if (!this._root) {\n globalErrorHandler(\n new Error('ParentBasedSampler must have a root sampler configured')\n );\n this._root = new AlwaysOnSampler();\n }\n\n this._remoteParentSampled =\n config.remoteParentSampled ?? new AlwaysOnSampler();\n this._remoteParentNotSampled =\n config.remoteParentNotSampled ?? new AlwaysOffSampler();\n this._localParentSampled =\n config.localParentSampled ?? new AlwaysOnSampler();\n this._localParentNotSampled =\n config.localParentNotSampled ?? new AlwaysOffSampler();\n }\n\n shouldSample(\n context: Context,\n traceId: string,\n spanName: string,\n spanKind: SpanKind,\n attributes: SpanAttributes,\n links: Link[]\n ): SamplingResult {\n const parentContext = trace.getSpanContext(context);\n\n if (!parentContext || !isSpanContextValid(parentContext)) {\n return this._root.shouldSample(\n context,\n traceId,\n spanName,\n spanKind,\n attributes,\n links\n );\n }\n\n if (parentContext.isRemote) {\n if (parentContext.traceFlags & TraceFlags.SAMPLED) {\n return this._remoteParentSampled.shouldSample(\n context,\n traceId,\n spanName,\n spanKind,\n attributes,\n links\n );\n }\n return this._remoteParentNotSampled.shouldSample(\n context,\n traceId,\n spanName,\n spanKind,\n attributes,\n links\n );\n }\n\n if (parentContext.traceFlags & TraceFlags.SAMPLED) {\n return this._localParentSampled.shouldSample(\n context,\n traceId,\n spanName,\n spanKind,\n attributes,\n links\n );\n }\n\n return this._localParentNotSampled.shouldSample(\n context,\n traceId,\n spanName,\n spanKind,\n attributes,\n links\n );\n }\n\n toString(): string {\n return `ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`;\n }\n}\n\ninterface ParentBasedSamplerConfig {\n /** Sampler called for spans with no parent */\n root: Sampler;\n /** Sampler called for spans with a remote parent which was sampled. Default AlwaysOn */\n remoteParentSampled?: Sampler;\n /** Sampler called for spans with a remote parent which was not sampled. Default AlwaysOff */\n remoteParentNotSampled?: Sampler;\n /** Sampler called for spans with a local parent which was sampled. Default AlwaysOn */\n localParentSampled?: Sampler;\n /** Sampler called for spans with a local parent which was not sampled. Default AlwaysOff */\n localParentNotSampled?: Sampler;\n}\n", "/*\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 {\n Sampler,\n SamplingDecision,\n SamplingResult,\n isValidTraceId,\n} from '@opentelemetry/api';\n\n/**\n * @deprecated Use the one defined in @opentelemetry/sdk-trace-base instead.\n * Sampler that samples a given fraction of traces based of trace id deterministically.\n */\nexport class TraceIdRatioBasedSampler implements Sampler {\n private _upperBound: number;\n\n constructor(private readonly _ratio: number = 0) {\n this._ratio = this._normalize(_ratio);\n this._upperBound = Math.floor(this._ratio * 0xffffffff);\n }\n\n shouldSample(context: unknown, traceId: string): SamplingResult {\n return {\n decision:\n isValidTraceId(traceId) && this._accumulate(traceId) < this._upperBound\n ? SamplingDecision.RECORD_AND_SAMPLED\n : SamplingDecision.NOT_RECORD,\n };\n }\n\n toString(): string {\n return `TraceIdRatioBased{${this._ratio}}`;\n }\n\n private _normalize(ratio: number): number {\n if (typeof ratio !== 'number' || isNaN(ratio)) return 0;\n return ratio >= 1 ? 1 : ratio <= 0 ? 0 : ratio;\n }\n\n private _accumulate(traceId: string): number {\n let accumulation = 0;\n for (let i = 0; i < traceId.length / 8; i++) {\n const pos = i * 8;\n const part = parseInt(traceId.slice(pos, pos + 8), 16);\n accumulation = (accumulation ^ part) >>> 0;\n }\n return accumulation;\n }\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * based on lodash in order to support esm builds without esModuleInterop.\n * lodash is using MIT License.\n **/\n\nconst objectTag = '[object Object]';\nconst nullTag = '[object Null]';\nconst undefinedTag = '[object Undefined]';\nconst funcProto = Function.prototype;\nconst funcToString = funcProto.toString;\nconst objectCtorString = funcToString.call(Object);\nconst getPrototype = overArg(Object.getPrototypeOf, Object);\nconst objectProto = Object.prototype;\nconst hasOwnProperty = objectProto.hasOwnProperty;\nconst symToStringTag = Symbol ? Symbol.toStringTag : undefined;\nconst nativeObjectToString = objectProto.toString;\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func: Function, transform: any): any {\n return function (arg: any) {\n return func(transform(arg));\n };\n}\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nexport function isPlainObject(value: any) {\n if (!isObjectLike(value) || baseGetTag(value) !== objectTag) {\n return false;\n }\n const proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n const Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return (\n typeof Ctor == 'function' &&\n Ctor instanceof Ctor &&\n funcToString.call(Ctor) === objectCtorString\n );\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value: any) {\n return value != null && typeof value == 'object';\n}\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value: any) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return symToStringTag && symToStringTag in Object(value)\n ? getRawTag(value)\n : objectToString(value);\n}\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value: any) {\n const isOwn = hasOwnProperty.call(value, symToStringTag as any),\n tag = value[symToStringTag as any];\n let unmasked = false;\n\n try {\n value[symToStringTag as any] = undefined;\n unmasked = true;\n } catch (e) {\n // silence\n }\n\n const result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag as any] = tag;\n } else {\n delete value[symToStringTag as any];\n }\n }\n return result;\n}\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value: any) {\n return nativeObjectToString.call(value);\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { isPlainObject } from './lodash.merge';\n\nconst MAX_LEVEL = 20;\n\ninterface ObjectInto {\n obj: any;\n key: string;\n}\n\n/**\n * Merges objects together\n * @param args - objects / values to be merged\n */\nexport function merge(...args: any[]): any {\n let result: any = args.shift();\n const objects: WeakMap<any, ObjectInto[]> | undefined = new WeakMap<\n any,\n ObjectInto[]\n >();\n while (args.length > 0) {\n result = mergeTwoObjects(result, args.shift(), 0, objects);\n }\n\n return result;\n}\n\nfunction takeValue(value: any): any {\n if (isArray(value)) {\n return value.slice();\n }\n return value;\n}\n\n/**\n * Merges two objects\n * @param one - first object\n * @param two - second object\n * @param level - current deep level\n * @param objects - objects holder that has been already referenced - to prevent\n * cyclic dependency\n */\nfunction mergeTwoObjects(\n one: any,\n two: any,\n level = 0,\n objects: WeakMap<any, ObjectInto[]>\n): any {\n let result: any;\n if (level > MAX_LEVEL) {\n return undefined;\n }\n level++;\n if (isPrimitive(one) || isPrimitive(two) || isFunction(two)) {\n result = takeValue(two);\n } else if (isArray(one)) {\n result = one.slice();\n if (isArray(two)) {\n for (let i = 0, j = two.length; i < j; i++) {\n result.push(takeValue(two[i]));\n }\n } else if (isObject(two)) {\n const keys = Object.keys(two);\n for (let i = 0, j = keys.length; i < j; i++) {\n const key = keys[i];\n result[key] = takeValue(two[key]);\n }\n }\n } else if (isObject(one)) {\n if (isObject(two)) {\n if (!shouldMerge(one, two)) {\n return two;\n }\n result = Object.assign({}, one);\n const keys = Object.keys(two);\n\n for (let i = 0, j = keys.length; i < j; i++) {\n const key = keys[i];\n const twoValue = two[key];\n\n if (isPrimitive(twoValue)) {\n if (typeof twoValue === 'undefined') {\n delete result[key];\n } else {\n // result[key] = takeValue(twoValue);\n result[key] = twoValue;\n }\n } else {\n const obj1 = result[key];\n const obj2 = twoValue;\n\n if (\n wasObjectReferenced(one, key, objects) ||\n wasObjectReferenced(two, key, objects)\n ) {\n delete result[key];\n } else {\n if (isObject(obj1) && isObject(obj2)) {\n const arr1 = objects.get(obj1) || [];\n const arr2 = objects.get(obj2) || [];\n arr1.push({ obj: one, key });\n arr2.push({ obj: two, key });\n objects.set(obj1, arr1);\n objects.set(obj2, arr2);\n }\n\n result[key] = mergeTwoObjects(\n result[key],\n twoValue,\n level,\n objects\n );\n }\n }\n }\n } else {\n result = two;\n }\n }\n\n return result;\n}\n\n/**\n * Function to check if object has been already reference\n * @param obj\n * @param key\n * @param objects\n */\nfunction wasObjectReferenced(\n obj: any,\n key: string,\n objects: WeakMap<any, ObjectInto[]>\n): boolean {\n const arr = objects.get(obj[key]) || [];\n for (let i = 0, j = arr.length; i < j; i++) {\n const info = arr[i];\n if (info.key === key && info.obj === obj) {\n return true;\n }\n }\n return false;\n}\n\nfunction isArray(value: any): boolean {\n return Array.isArray(value);\n}\n\nfunction isFunction(value: any): boolean {\n return typeof value === 'function';\n}\n\nfunction isObject(value: any): boolean {\n return (\n !isPrimitive(value) &&\n !isArray(value) &&\n !isFunction(value) &&\n typeof value === 'object'\n );\n}\n\nfunction isPrimitive(value: any): boolean {\n return (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n typeof value === 'undefined' ||\n value instanceof Date ||\n value instanceof RegExp ||\n value === null\n );\n}\n\nfunction shouldMerge(one: any, two: any): boolean {\n if (!isPlainObject(one) || !isPlainObject(two)) {\n return false;\n }\n\n return true;\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Error that is thrown on timeouts.\n */\nexport class TimeoutError extends Error {\n constructor(message?: string) {\n super(message);\n\n // manually adjust prototype to retain `instanceof` functionality when targeting ES5, see:\n // https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(this, TimeoutError.prototype);\n }\n}\n\n/**\n * Adds a timeout to a promise and rejects if the specified timeout has elapsed. Also rejects if the specified promise\n * rejects, and resolves if the specified promise resolves.\n *\n * <p> NOTE: this operation will continue even after it throws a {@link TimeoutError}.\n *\n * @param promise promise to use with timeout.\n * @param timeout the timeout in milliseconds until the returned promise is rejected.\n */\nexport function callWithTimeout<T>(\n promise: Promise<T>,\n timeout: number\n): Promise<T> {\n let timeoutHandle: ReturnType<typeof setTimeout>;\n\n const timeoutPromise = new Promise<never>(function timeoutFunction(\n _resolve,\n reject\n ) {\n timeoutHandle = setTimeout(function timeoutHandler() {\n reject(new TimeoutError('Operation timed out.'));\n }, timeout);\n });\n\n return Promise.race([promise, timeoutPromise]).then(\n result => {\n clearTimeout(timeoutHandle);\n return result;\n },\n reason => {\n clearTimeout(timeoutHandle);\n throw reason;\n }\n );\n}\n", "/*\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 */\nexport function urlMatches(url: string, urlToMatch: string | RegExp): boolean {\n if (typeof urlToMatch === 'string') {\n return url === urlToMatch;\n } else {\n return !!url.match(urlToMatch);\n }\n}\n/**\n * Check if {@param url} should be ignored when comparing against {@param ignoredUrls}\n * @param url\n * @param ignoredUrls\n */\nexport function isUrlIgnored(\n url: string,\n ignoredUrls?: Array<string | RegExp>\n): boolean {\n if (!ignoredUrls) {\n return false;\n }\n\n for (const ignoreUrl of ignoredUrls) {\n if (urlMatches(url, ignoreUrl)) {\n return true;\n }\n }\n return false;\n}\n", "/*\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 { ShimWrapped } from '../common/types';\n\n/**\n * Checks if certain function has been already wrapped\n * @param func\n */\nexport function isWrapped(func: unknown): func is ShimWrapped {\n return (\n typeof func === 'function' &&\n typeof (func as ShimWrapped).__original === 'function' &&\n typeof (func as ShimWrapped).__unwrap === 'function' &&\n (func as ShimWrapped).__wrapped === true\n );\n}\n", "/*\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\nexport class Deferred<T> {\n private _promise: Promise<T>;\n private _resolve!: (val: T) => void;\n private _reject!: (error: unknown) => void;\n constructor() {\n this._promise = new Promise((resolve, reject) => {\n this._resolve = resolve;\n this._reject = reject;\n });\n }\n\n get promise() {\n return this._promise;\n }\n\n resolve(val: T) {\n this._resolve(val);\n }\n\n reject(err: unknown) {\n this._reject(err);\n }\n}\n", "/*\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 { Deferred } from './promise';\n\n/**\n * Bind the callback and only invoke the callback once regardless how many times `BindOnceFuture.call` is invoked.\n */\nexport class BindOnceFuture<\n R,\n This = unknown,\n T extends (this: This, ...args: unknown[]) => R = () => R,\n> {\n private _isCalled = false;\n private _deferred = new Deferred<R>();\n constructor(\n private _callback: T,\n private _that: This\n ) {}\n\n get isCalled() {\n return this._isCalled;\n }\n\n get promise() {\n return this._deferred.promise;\n }\n\n call(...args: Parameters<T>): Promise<R> {\n if (!this._isCalled) {\n this._isCalled = true;\n try {\n Promise.resolve(this._callback.call(this._that, ...args)).then(\n val => this._deferred.resolve(val),\n err => this._deferred.reject(err)\n );\n } catch (err) {\n this._deferred.reject(err);\n }\n }\n return this._deferred.promise;\n }\n}\n", "/*\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 { context } from '@opentelemetry/api';\nimport { ExportResult } from '../ExportResult';\nimport { suppressTracing } from '../trace/suppress-tracing';\n\nexport interface Exporter<T> {\n export(arg: T, resultCallback: (result: ExportResult) => void): void;\n}\n\n/**\n * @internal\n * Shared functionality used by Exporters while exporting data, including suppresion of Traces.\n */\nexport function _export<T>(\n exporter: Exporter<T>,\n arg: T\n): Promise<ExportResult> {\n return new Promise(resolve => {\n // prevent downstream exporter calls from generating spans\n context.with(suppressTracing(context.active()), () => {\n exporter.export(arg, (result: ExportResult) => {\n resolve(result);\n });\n });\n });\n}\n", "/*\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\nexport * from './baggage/propagation/W3CBaggagePropagator';\nexport * from './common/anchored-clock';\nexport * from './common/attributes';\nexport * from './common/global-error-handler';\nexport * from './common/logging-error-handler';\nexport * from './common/time';\nexport * from './common/types';\nexport * from './ExportResult';\nexport * as baggageUtils from './baggage/utils';\nexport * from './platform';\nexport * from './propagation/composite';\nexport * from './trace/W3CTraceContextPropagator';\nexport * from './trace/IdGenerator';\nexport * from './trace/rpc-metadata';\nexport * from './trace/sampler/AlwaysOffSampler';\nexport * from './trace/sampler/AlwaysOnSampler';\nexport * from './trace/sampler/ParentBasedSampler';\nexport * from './trace/sampler/TraceIdRatioBasedSampler';\nexport * from './trace/suppress-tracing';\nexport * from './trace/TraceState';\nexport * from './utils/environment';\nexport * from './utils/merge';\nexport * from './utils/sampling';\nexport * from './utils/timeout';\nexport * from './utils/url';\nexport * from './utils/wrap';\nexport * from './utils/callback';\nexport * from './version';\nimport { _export } from './internal/exporter';\nexport const internal = {\n _export,\n};\n", "/*\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 { TracerProvider, MeterProvider } from '@opentelemetry/api';\nimport { Instrumentation } from './types';\nimport { AutoLoaderResult, InstrumentationOption } from './types_internal';\n\n/**\n * Parses the options and returns instrumentations, node plugins and\n * web plugins\n * @param options\n */\nexport function parseInstrumentationOptions(\n options: InstrumentationOption[] = []\n): AutoLoaderResult {\n let instrumentations: Instrumentation[] = [];\n for (let i = 0, j = options.length; i < j; i++) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const option = options[i] as any;\n if (Array.isArray(option)) {\n const results = parseInstrumentationOptions(option);\n instrumentations = instrumentations.concat(results.instrumentations);\n } else if (typeof option === 'function') {\n instrumentations.push(new option());\n } else if ((option as Instrumentation).instrumentationName) {\n instrumentations.push(option);\n }\n }\n\n return { instrumentations };\n}\n\n/**\n * Enable instrumentations\n * @param instrumentations\n * @param tracerProvider\n * @param meterProvider\n */\nexport function enableInstrumentations(\n instrumentations: Instrumentation[],\n tracerProvider?: TracerProvider,\n meterProvider?: MeterProvider\n): void {\n for (let i = 0, j = instrumentations.length; i < j; i++) {\n const instrumentation = instrumentations[i];\n if (tracerProvider) {\n instrumentation.setTracerProvider(tracerProvider);\n }\n if (meterProvider) {\n instrumentation.setMeterProvider(meterProvider);\n }\n // instrumentations have been already enabled during creation\n // so enable only if user prevented that by setting enabled to false\n // this is to prevent double enabling but when calling register all\n // instrumentations should be now enabled\n if (!instrumentation.getConfig().enabled) {\n instrumentation.enable();\n }\n }\n}\n\n/**\n * Disable instrumentations\n * @param instrumentations\n */\nexport function disableInstrumentations(\n instrumentations: Instrumentation[]\n): void {\n instrumentations.forEach(instrumentation => instrumentation.disable());\n}\n", "/*\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 { trace, metrics } from '@opentelemetry/api';\nimport {\n disableInstrumentations,\n enableInstrumentations,\n parseInstrumentationOptions,\n} from './autoLoaderUtils';\nimport { AutoLoaderOptions } from './types_internal';\n\n/**\n * It will register instrumentations and plugins\n * @param options\n * @return returns function to unload instrumentation and plugins that were\n * registered\n */\nexport function registerInstrumentations(\n options: AutoLoaderOptions\n): () => void {\n const { instrumentations } = parseInstrumentationOptions(\n options.instrumentations\n );\n const tracerProvider = options.tracerProvider || trace.getTracerProvider();\n const meterProvider = options.meterProvider || metrics.getMeterProvider();\n\n enableInstrumentations(instrumentations, tracerProvider, meterProvider);\n\n return () => {\n disableInstrumentations(instrumentations);\n };\n}\n", "export * from \"async_hooks\"", "export * from \"events\"", "/*\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 { ContextManager, Context } from '@opentelemetry/api';\nimport { EventEmitter } from 'events';\n\ntype Func<T> = (...args: unknown[]) => T;\n\n/**\n * Store a map for each event of all original listeners and their \"patched\"\n * version. So when a listener is removed by the user, the corresponding\n * patched function will be also removed.\n */\ninterface PatchMap {\n [name: string]: WeakMap<Func<void>, Func<void>>;\n}\n\nconst ADD_LISTENER_METHODS = [\n 'addListener' as const,\n 'on' as const,\n 'once' as const,\n 'prependListener' as const,\n 'prependOnceListener' as const,\n];\n\nexport abstract class AbstractAsyncHooksContextManager\n implements ContextManager\n{\n abstract active(): Context;\n\n abstract with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(\n context: Context,\n fn: F,\n thisArg?: ThisParameterType<F>,\n ...args: A\n ): ReturnType<F>;\n\n abstract enable(): this;\n\n abstract disable(): this;\n\n /**\n * Binds a the certain context or the active one to the target function and then returns the target\n * @param context A context (span) to be bind to target\n * @param target a function or event emitter. When target or one of its callbacks is called,\n * the provided context will be used as the active context for the duration of the call.\n */\n bind<T>(context: Context, target: T): T {\n if (target instanceof EventEmitter) {\n return this._bindEventEmitter(context, target);\n }\n\n if (typeof target === 'function') {\n return this._bindFunction(context, target);\n }\n return target;\n }\n\n private _bindFunction<T extends Function>(context: Context, target: T): T {\n const manager = this;\n const contextWrapper = function (this: never, ...args: unknown[]) {\n return manager.with(context, () => target.apply(this, args));\n };\n Object.defineProperty(contextWrapper, 'length', {\n enumerable: false,\n configurable: true,\n writable: false,\n value: target.length,\n });\n /**\n * It isn't possible to tell Typescript that contextWrapper is the same as T\n * so we forced to cast as any here.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return contextWrapper as any;\n }\n\n /**\n * By default, EventEmitter call their callback with their context, which we do\n * not want, instead we will bind a specific context to all callbacks that\n * go through it.\n * @param context the context we want to bind\n * @param ee EventEmitter an instance of EventEmitter to patch\n */\n private _bindEventEmitter<T extends EventEmitter>(\n context: Context,\n ee: T\n ): T {\n const map = this._getPatchMap(ee);\n if (map !== undefined) return ee;\n this._createPatchMap(ee);\n\n // patch methods that add a listener to propagate context\n ADD_LISTENER_METHODS.forEach(methodName => {\n if (ee[methodName] === undefined) return;\n ee[methodName] = this._patchAddListener(ee, ee[methodName], context);\n });\n // patch methods that remove a listener\n if (typeof ee.removeListener === 'function') {\n ee.removeListener = this._patchRemoveListener(ee, ee.removeListener);\n }\n if (typeof ee.off === 'function') {\n ee.off = this._patchRemoveListener(ee, ee.off);\n }\n // patch method that remove all listeners\n if (typeof ee.removeAllListeners === 'function') {\n ee.removeAllListeners = this._patchRemoveAllListeners(\n ee,\n ee.removeAllListeners\n );\n }\n return ee;\n }\n\n /**\n * Patch methods that remove a given listener so that we match the \"patched\"\n * version of that listener (the one that propagate context).\n * @param ee EventEmitter instance\n * @param original reference to the patched method\n */\n private _patchRemoveListener(ee: EventEmitter, original: Function) {\n const contextManager = this;\n return function (this: never, event: string, listener: Func<void>) {\n const events = contextManager._getPatchMap(ee)?.[event];\n if (events === undefined) {\n return original.call(this, event, listener);\n }\n const patchedListener = events.get(listener);\n return original.call(this, event, patchedListener || listener);\n };\n }\n\n /**\n * Patch methods that remove all listeners so we remove our\n * internal references for a given event.\n * @param ee EventEmitter instance\n * @param original reference to the patched method\n */\n private _patchRemoveAllListeners(ee: EventEmitter, original: Function) {\n const contextManager = this;\n return function (this: never, event: string) {\n const map = contextManager._getPatchMap(ee);\n if (map !== undefined) {\n if (arguments.length === 0) {\n contextManager._createPatchMap(ee);\n } else if (map[event] !== undefined) {\n delete map[event];\n }\n }\n return original.apply(this, arguments);\n };\n }\n\n /**\n * Patch methods on an event emitter instance that can add listeners so we\n * can force them to propagate a given context.\n * @param ee EventEmitter instance\n * @param original reference to the patched method\n * @param [context] context to propagate when calling listeners\n */\n private _patchAddListener(\n ee: EventEmitter,\n original: Function,\n context: Context\n ) {\n const contextManager = this;\n return function (this: never, event: string, listener: Func<void>) {\n /**\n * This check is required to prevent double-wrapping the listener.\n * The implementation for ee.once wraps the listener and calls ee.on.\n * Without this check, we would wrap that wrapped listener.\n * This causes an issue because ee.removeListener depends on the onceWrapper\n * to properly remove the listener. If we wrap their wrapper, we break\n * that detection.\n */\n if (contextManager._wrapped) {\n return original.call(this, event, listener);\n }\n let map = contextManager._getPatchMap(ee);\n if (map === undefined) {\n map = contextManager._createPatchMap(ee);\n }\n let listeners = map[event];\n if (listeners === undefined) {\n listeners = new WeakMap();\n map[event] = listeners;\n }\n const patchedListener = contextManager.bind(context, listener);\n // store a weak reference of the user listener to ours\n listeners.set(listener, patchedListener);\n\n /**\n * See comment at the start of this function for the explanation of this property.\n */\n contextManager._wrapped = true;\n try {\n return original.call(this, event, patchedListener);\n } finally {\n contextManager._wrapped = false;\n }\n };\n }\n\n private _createPatchMap(ee: EventEmitter): PatchMap {\n const map = Object.create(null);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (ee as any)[this._kOtListeners] = map;\n return map;\n }\n private _getPatchMap(ee: EventEmitter): PatchMap | undefined {\n return (ee as never)[this._kOtListeners];\n }\n\n private readonly _kOtListeners = Symbol('OtListeners');\n private _wrapped = false;\n}\n", "/*\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 { Context, ROOT_CONTEXT } from '@opentelemetry/api';\nimport { AsyncLocalStorage } from 'async_hooks';\nimport { AbstractAsyncHooksContextManager } from './AbstractAsyncHooksContextManager';\n\nexport class AsyncLocalStorageContextManager extends AbstractAsyncHooksContextManager {\n private _asyncLocalStorage: AsyncLocalStorage<Context>;\n\n constructor() {\n super();\n this._asyncLocalStorage = new AsyncLocalStorage();\n }\n\n active(): Context {\n return this._asyncLocalStorage.getStore() ?? ROOT_CONTEXT;\n }\n\n with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(\n context: Context,\n fn: F,\n thisArg?: ThisParameterType<F>,\n ...args: A\n ): ReturnType<F> {\n const cb = thisArg == null ? fn : fn.bind(thisArg);\n return this._asyncLocalStorage.run(context, cb as never, ...args);\n }\n\n enable(): this {\n return this;\n }\n\n disable(): this {\n this._asyncLocalStorage.disable();\n return this;\n }\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport type { IAnyValue, IKeyValue } from './types';\nimport { Attributes } from '@opentelemetry/api';\n\nexport function toAttributes(attributes: Attributes): IKeyValue[] {\n return Object.keys(attributes).map(key => toKeyValue(key, attributes[key]));\n}\n\nexport function toKeyValue(key: string, value: unknown): IKeyValue {\n return {\n key: key,\n value: toAnyValue(value),\n };\n}\n\nexport function toAnyValue(value: unknown): IAnyValue {\n const t = typeof value;\n if (t === 'string') return { stringValue: value as string };\n if (t === 'number') {\n if (!Number.isInteger(value)) return { doubleValue: value as number };\n return { intValue: value as number };\n }\n if (t === 'boolean') return { boolValue: value as boolean };\n if (value instanceof Uint8Array) return { bytesValue: value };\n if (Array.isArray(value))\n return { arrayValue: { values: value.map(toAnyValue) } };\n if (t === 'object' && value != null)\n return {\n kvlistValue: {\n values: Object.entries(value as object).map(([k, v]) =>\n toKeyValue(k, v)\n ),\n },\n };\n\n return {};\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport type { Link } from '@opentelemetry/api';\nimport type { ReadableSpan, TimedEvent } from '@opentelemetry/sdk-trace-base';\nimport type { Encoder } from '../common';\nimport { toAttributes } from '../common/internal';\nimport { EStatusCode, IEvent, ILink, ISpan } from './types';\n\nexport function sdkSpanToOtlpSpan(span: ReadableSpan, encoder: Encoder): ISpan {\n const ctx = span.spanContext();\n const status = span.status;\n return {\n traceId: encoder.encodeSpanContext(ctx.traceId),\n spanId: encoder.encodeSpanContext(ctx.spanId),\n parentSpanId: encoder.encodeOptionalSpanContext(span.parentSpanId),\n traceState: ctx.traceState?.serialize(),\n name: span.name,\n // Span kind is offset by 1 because the API does not define a value for unset\n kind: span.kind == null ? 0 : span.kind + 1,\n startTimeUnixNano: encoder.encodeHrTime(span.startTime),\n endTimeUnixNano: encoder.encodeHrTime(span.endTime),\n attributes: toAttributes(span.attributes),\n droppedAttributesCount: span.droppedAttributesCount,\n events: span.events.map(event => toOtlpSpanEvent(event, encoder)),\n droppedEventsCount: span.droppedEventsCount,\n status: {\n // API and proto enums share the same values\n code: status.code as unknown as EStatusCode,\n message: status.message,\n },\n links: span.links.map(link => toOtlpLink(link, encoder)),\n droppedLinksCount: span.droppedLinksCount,\n };\n}\n\nexport function toOtlpLink(link: Link, encoder: Encoder): ILink {\n return {\n attributes: link.attributes ? toAttributes(link.attributes) : [],\n spanId: encoder.encodeSpanContext(link.context.spanId),\n traceId: encoder.encodeSpanContext(link.context.traceId),\n traceState: link.context.traceState?.serialize(),\n droppedAttributesCount: link.droppedAttributesCount || 0,\n };\n}\n\nexport function toOtlpSpanEvent(\n timedEvent: TimedEvent,\n encoder: Encoder\n): IEvent {\n return {\n attributes: timedEvent.attributes\n ? toAttributes(timedEvent.attributes)\n : [],\n name: timedEvent.name,\n timeUnixNano: encoder.encodeHrTime(timedEvent.time),\n droppedAttributesCount: timedEvent.droppedAttributesCount || 0,\n };\n}\n", "/*\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 type { OtlpEncodingOptions, Fixed64, LongBits } from './types';\nimport { HrTime } from '@opentelemetry/api';\nimport { hexToBase64, hrTimeToNanoseconds } from '@opentelemetry/core';\n\nconst NANOSECONDS = BigInt(1_000_000_000);\n\nexport function hrTimeToNanos(hrTime: HrTime): bigint {\n return BigInt(hrTime[0]) * NANOSECONDS + BigInt(hrTime[1]);\n}\n\nexport function toLongBits(value: bigint): LongBits {\n const low = Number(BigInt.asUintN(32, value));\n const high = Number(BigInt.asUintN(32, value >> BigInt(32)));\n return { low, high };\n}\n\nexport function encodeAsLongBits(hrTime: HrTime): LongBits {\n const nanos = hrTimeToNanos(hrTime);\n return toLongBits(nanos);\n}\n\nexport function encodeAsString(hrTime: HrTime): string {\n const nanos = hrTimeToNanos(hrTime);\n return nanos.toString();\n}\n\nconst encodeTimestamp =\n typeof BigInt !== 'undefined' ? encodeAsString : hrTimeToNanoseconds;\n\nexport type HrTimeEncodeFunction = (hrTime: HrTime) => Fixed64;\nexport type SpanContextEncodeFunction = (spanContext: string) => string;\nexport type OptionalSpanContextEncodeFunction = (\n spanContext: string | undefined\n) => string | undefined;\n\nexport interface Encoder {\n encodeHrTime: HrTimeEncodeFunction;\n encodeSpanContext: SpanContextEncodeFunction;\n encodeOptionalSpanContext: OptionalSpanContextEncodeFunction;\n}\n\nfunction identity<T>(value: T): T {\n return value;\n}\n\nfunction optionalHexToBase64(str: string | undefined): string | undefined {\n if (str === undefined) return undefined;\n return hexToBase64(str);\n}\n\nconst DEFAULT_ENCODER: Encoder = {\n encodeHrTime: encodeAsLongBits,\n encodeSpanContext: hexToBase64,\n encodeOptionalSpanContext: optionalHexToBase64,\n};\n\nexport function getOtlpEncoder(options?: OtlpEncodingOptions): Encoder {\n if (options === undefined) {\n return DEFAULT_ENCODER;\n }\n\n const useLongBits = options.useLongBits ?? true;\n const useHex = options.useHex ?? false;\n return {\n encodeHrTime: useLongBits ? encodeAsLongBits : encodeTimestamp,\n encodeSpanContext: useHex ? identity : hexToBase64,\n encodeOptionalSpanContext: useHex ? identity : optionalHexToBase64,\n };\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport type { IResource } from '@opentelemetry/resources';\nimport type { ReadableSpan } from '@opentelemetry/sdk-trace-base';\nimport type { OtlpEncodingOptions } from '../common/types';\nimport { toAttributes } from '../common/internal';\nimport { sdkSpanToOtlpSpan } from './internal';\nimport {\n IExportTraceServiceRequest,\n IResourceSpans,\n IScopeSpans,\n} from './types';\nimport { Encoder, getOtlpEncoder } from '../common';\n\nexport function createExportTraceServiceRequest(\n spans: ReadableSpan[],\n options?: OtlpEncodingOptions\n): IExportTraceServiceRequest {\n const encoder = getOtlpEncoder(options);\n return {\n resourceSpans: spanRecordsToResourceSpans(spans, encoder),\n };\n}\n\nfunction createResourceMap(readableSpans: ReadableSpan[]) {\n const resourceMap: Map<IResource, Map<string, ReadableSpan[]>> = new Map();\n for (const record of readableSpans) {\n let ilmMap = resourceMap.get(record.resource);\n\n if (!ilmMap) {\n ilmMap = new Map();\n resourceMap.set(record.resource, ilmMap);\n }\n\n // TODO this is duplicated in basic tracer. Consolidate on a common helper in core\n const instrumentationLibraryKey = `${record.instrumentationLibrary.name}@${\n record.instrumentationLibrary.version || ''\n }:${record.instrumentationLibrary.schemaUrl || ''}`;\n let records = ilmMap.get(instrumentationLibraryKey);\n\n if (!records) {\n records = [];\n ilmMap.set(instrumentationLibraryKey, records);\n }\n\n records.push(record);\n }\n\n return resourceMap;\n}\n\nfunction spanRecordsToResourceSpans(\n readableSpans: ReadableSpan[],\n encoder: Encoder\n): IResourceSpans[] {\n const resourceMap = createResourceMap(readableSpans);\n const out: IResourceSpans[] = [];\n\n const entryIterator = resourceMap.entries();\n let entry = entryIterator.next();\n while (!entry.done) {\n const [resource, ilmMap] = entry.value;\n const scopeResourceSpans: IScopeSpans[] = [];\n const ilmIterator = ilmMap.values();\n let ilmEntry = ilmIterator.next();\n while (!ilmEntry.done) {\n const scopeSpans = ilmEntry.value;\n if (scopeSpans.length > 0) {\n const { name, version, schemaUrl } =\n scopeSpans[0].instrumentationLibrary;\n const spans = scopeSpans.map(readableSpan =>\n sdkSpanToOtlpSpan(readableSpan, encoder)\n );\n\n scopeResourceSpans.push({\n scope: { name, version },\n spans: spans,\n schemaUrl: schemaUrl,\n });\n }\n ilmEntry = ilmIterator.next();\n }\n // TODO SDK types don't provide resource schema URL at this time\n const transformedSpans: IResourceSpans = {\n resource: {\n attributes: toAttributes(resource.attributes),\n droppedAttributesCount: 0,\n },\n scopeSpans: scopeResourceSpans,\n schemaUrl: undefined,\n };\n\n out.push(transformedSpans);\n entry = entryIterator.next();\n }\n\n return out;\n}\n", "/*\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 { diag } from '@opentelemetry/api';\nimport { getEnv } from '@opentelemetry/core';\n\nconst DEFAULT_TRACE_TIMEOUT = 10000;\nexport const DEFAULT_EXPORT_MAX_ATTEMPTS = 5;\nexport const DEFAULT_EXPORT_INITIAL_BACKOFF = 1000;\nexport const DEFAULT_EXPORT_MAX_BACKOFF = 5000;\nexport const DEFAULT_EXPORT_BACKOFF_MULTIPLIER = 1.5;\n\n/**\n * Parses headers from config leaving only those that have defined values\n * @param partialHeaders\n */\nexport function parseHeaders(\n partialHeaders: Partial<Record<string, unknown>> = {}\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(`Header \"${key}\" has wrong value and will be ignored`);\n }\n });\n return headers;\n}\n\n/**\n * Adds path (version + signal) to a no per-signal endpoint\n * @param url\n * @param path\n * @returns url + path\n */\nexport function appendResourcePathToUrl(url: string, path: string): string {\n if (!url.endsWith('/')) {\n url = url + '/';\n }\n return url + path;\n}\n\n/**\n * Adds root path to signal specific endpoint when endpoint contains no path part and no root path\n * @param url\n * @returns url\n */\nexport function appendRootPathToUrlIfNeeded(url: string): string {\n try {\n const parsedUrl = new URL(url);\n if (parsedUrl.pathname === '') {\n parsedUrl.pathname = parsedUrl.pathname + '/';\n }\n return parsedUrl.toString();\n } catch {\n diag.warn(`Could not parse export URL: '${url}'`);\n return url;\n }\n}\n\n/**\n * Configure exporter trace timeout value from passed in value or environment variables\n * @param timeoutMillis\n * @returns timeout value in milliseconds\n */\nexport function configureExporterTimeout(\n timeoutMillis: number | undefined\n): number {\n if (typeof timeoutMillis === 'number') {\n if (timeoutMillis <= 0) {\n // OTLP exporter configured timeout - using default value of 10000ms\n return invalidTimeout(timeoutMillis, DEFAULT_TRACE_TIMEOUT);\n }\n return timeoutMillis;\n } else {\n return getExporterTimeoutFromEnv();\n }\n}\n\nfunction getExporterTimeoutFromEnv(): number {\n const definedTimeout = Number(\n getEnv().OTEL_EXPORTER_OTLP_TRACES_TIMEOUT ??\n getEnv().OTEL_EXPORTER_OTLP_TIMEOUT\n );\n\n if (definedTimeout <= 0) {\n // OTLP exporter configured timeout - using default value of 10000ms\n return invalidTimeout(definedTimeout, DEFAULT_TRACE_TIMEOUT);\n } else {\n return definedTimeout;\n }\n}\n\n// OTLP exporter configured timeout - using default value of 10000ms\nexport function invalidTimeout(\n timeout: number,\n defaultTimeout: number\n): number {\n diag.warn('Timeout must be greater than 0', timeout);\n\n return defaultTimeout;\n}\n\nexport function isExportRetryable(statusCode: number): boolean {\n const retryCodes = [429, 502, 503, 504];\n\n return retryCodes.includes(statusCode);\n}\n\nexport function parseRetryAfterToMills(retryAfter?: string | null): number {\n if (retryAfter == null) {\n return -1;\n }\n const seconds = Number.parseInt(retryAfter, 10);\n if (Number.isInteger(seconds)) {\n return seconds > 0 ? seconds * 1000 : -1;\n }\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After#directives\n const delay = new Date(retryAfter).getTime() - Date.now();\n\n if (delay >= 0) {\n return delay;\n }\n return 0;\n}\n", "/*\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 { diag } from '@opentelemetry/api';\nimport {\n ExportResult,\n ExportResultCode,\n BindOnceFuture,\n} from '@opentelemetry/core';\nimport {\n OTLPExporterError,\n OTLPExporterConfigBase,\n ExportServiceError,\n} from './types';\nimport { configureExporterTimeout } from './util';\n\n/**\n * Collector Exporter abstract base class\n */\nexport abstract class OTLPExporterBase<\n T extends OTLPExporterConfigBase,\n ExportItem,\n ServiceRequest,\n> {\n public readonly url: string;\n public readonly hostname: string | undefined;\n public readonly timeoutMillis: number;\n protected _concurrencyLimit: number;\n protected _sendingPromises: Promise<unknown>[] = [];\n protected _shutdownOnce: BindOnceFuture<void>;\n\n /**\n * @param config\n */\n constructor(config: T = {} as T) {\n this.url = this.getDefaultUrl(config);\n if (typeof config.hostname === 'string') {\n this.hostname = config.hostname;\n }\n\n this.shutdown = this.shutdown.bind(this);\n this._shutdownOnce = new BindOnceFuture(this._shutdown, this);\n\n this._concurrencyLimit =\n typeof config.concurrencyLimit === 'number'\n ? config.concurrencyLimit\n : 30;\n\n this.timeoutMillis = configureExporterTimeout(config.timeoutMillis);\n\n // platform dependent\n this.onInit(config);\n }\n\n /**\n * Export items.\n * @param items\n * @param resultCallback\n */\n export(\n items: ExportItem[],\n resultCallback: (result: ExportResult) => void\n ): void {\n if (this._shutdownOnce.isCalled) {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Exporter has been shutdown'),\n });\n return;\n }\n\n if (this._sendingPromises.length >= this._concurrencyLimit) {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Concurrent export limit reached'),\n });\n return;\n }\n\n this._export(items)\n .then(() => {\n resultCallback({ code: ExportResultCode.SUCCESS });\n })\n .catch((error: ExportServiceError) => {\n resultCallback({ code: ExportResultCode.FAILED, error });\n });\n }\n\n private _export(items: ExportItem[]): Promise<unknown> {\n return new Promise<void>((resolve, reject) => {\n try {\n diag.debug('items to be sent', items);\n this.send(items, resolve, reject);\n } catch (e) {\n reject(e);\n }\n });\n }\n\n /**\n * Shutdown the exporter.\n */\n shutdown(): Promise<void> {\n return this._shutdownOnce.call();\n }\n\n /**\n * Exports any pending spans in the exporter\n */\n forceFlush(): Promise<void> {\n return Promise.all(this._sendingPromises).then(() => {\n /** ignore resolved values */\n });\n }\n\n /**\n * Called by _shutdownOnce with BindOnceFuture\n */\n private _shutdown(): Promise<void> {\n diag.debug('shutdown started');\n this.onShutdown();\n return this.forceFlush();\n }\n\n abstract onShutdown(): void;\n abstract onInit(config: T): void;\n abstract send(\n items: ExportItem[],\n onSuccess: () => void,\n onError: (error: OTLPExporterError) => void\n ): void;\n abstract getDefaultUrl(config: T): string;\n abstract convert(objects: ExportItem[]): ServiceRequest;\n}\n", "\"use strict\";\r\nmodule.exports = asPromise;\r\n\r\n/**\r\n * Callback as used by {@link util.asPromise}.\r\n * @typedef asPromiseCallback\r\n * @type {function}\r\n * @param {Error|null} error Error, if any\r\n * @param {...*} params Additional arguments\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Returns a promise from a node-style callback function.\r\n * @memberof util\r\n * @param {asPromiseCallback} fn Function to call\r\n * @param {*} ctx Function context\r\n * @param {...*} params Function arguments\r\n * @returns {Promise<*>} Promisified function\r\n */\r\nfunction asPromise(fn, ctx/*, varargs */) {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0,\r\n index = 2,\r\n pending = true;\r\n while (index < arguments.length)\r\n params[offset++] = arguments[index++];\r\n return new Promise(function executor(resolve, reject) {\r\n params[offset] = function callback(err/*, varargs */) {\r\n if (pending) {\r\n pending = false;\r\n if (err)\r\n reject(err);\r\n else {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0;\r\n while (offset < params.length)\r\n params[offset++] = arguments[offset];\r\n resolve.apply(null, params);\r\n }\r\n }\r\n };\r\n try {\r\n fn.apply(ctx || null, params);\r\n } catch (err) {\r\n if (pending) {\r\n pending = false;\r\n reject(err);\r\n }\r\n }\r\n });\r\n}\r\n", "\"use strict\";\r\n\r\n/**\r\n * A minimal base64 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar base64 = exports;\r\n\r\n/**\r\n * Calculates the byte length of a base64 encoded string.\r\n * @param {string} string Base64 encoded string\r\n * @returns {number} Byte length\r\n */\r\nbase64.length = function length(string) {\r\n var p = string.length;\r\n if (!p)\r\n return 0;\r\n var n = 0;\r\n while (--p % 4 > 1 && string.charAt(p) === \"=\")\r\n ++n;\r\n return Math.ceil(string.length * 3) / 4 - n;\r\n};\r\n\r\n// Base64 encoding table\r\nvar b64 = new Array(64);\r\n\r\n// Base64 decoding table\r\nvar s64 = new Array(123);\r\n\r\n// 65..90, 97..122, 48..57, 43, 47\r\nfor (var i = 0; i < 64;)\r\n s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;\r\n\r\n/**\r\n * Encodes a buffer to a base64 encoded string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} Base64 encoded string\r\n */\r\nbase64.encode = function encode(buffer, start, end) {\r\n var parts = null,\r\n chunk = [];\r\n var i = 0, // output index\r\n j = 0, // goto index\r\n t; // temporary\r\n while (start < end) {\r\n var b = buffer[start++];\r\n switch (j) {\r\n case 0:\r\n chunk[i++] = b64[b >> 2];\r\n t = (b & 3) << 4;\r\n j = 1;\r\n break;\r\n case 1:\r\n chunk[i++] = b64[t | b >> 4];\r\n t = (b & 15) << 2;\r\n j = 2;\r\n break;\r\n case 2:\r\n chunk[i++] = b64[t | b >> 6];\r\n chunk[i++] = b64[b & 63];\r\n j = 0;\r\n break;\r\n }\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (j) {\r\n chunk[i++] = b64[t];\r\n chunk[i++] = 61;\r\n if (j === 1)\r\n chunk[i++] = 61;\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\nvar invalidEncoding = \"invalid encoding\";\r\n\r\n/**\r\n * Decodes a base64 encoded string to a buffer.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Number of bytes written\r\n * @throws {Error} If encoding is invalid\r\n */\r\nbase64.decode = function decode(string, buffer, offset) {\r\n var start = offset;\r\n var j = 0, // goto index\r\n t; // temporary\r\n for (var i = 0; i < string.length;) {\r\n var c = string.charCodeAt(i++);\r\n if (c === 61 && j > 1)\r\n break;\r\n if ((c = s64[c]) === undefined)\r\n throw Error(invalidEncoding);\r\n switch (j) {\r\n case 0:\r\n t = c;\r\n j = 1;\r\n break;\r\n case 1:\r\n buffer[offset++] = t << 2 | (c & 48) >> 4;\r\n t = c;\r\n j = 2;\r\n break;\r\n case 2:\r\n buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;\r\n t = c;\r\n j = 3;\r\n break;\r\n case 3:\r\n buffer[offset++] = (t & 3) << 6 | c;\r\n j = 0;\r\n break;\r\n }\r\n }\r\n if (j === 1)\r\n throw Error(invalidEncoding);\r\n return offset - start;\r\n};\r\n\r\n/**\r\n * Tests if the specified string appears to be base64 encoded.\r\n * @param {string} string String to test\r\n * @returns {boolean} `true` if probably base64 encoded, otherwise false\r\n */\r\nbase64.test = function test(string) {\r\n return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);\r\n};\r\n", "\"use strict\";\r\nmodule.exports = EventEmitter;\r\n\r\n/**\r\n * Constructs a new event emitter instance.\r\n * @classdesc A minimal event emitter.\r\n * @memberof util\r\n * @constructor\r\n */\r\nfunction EventEmitter() {\r\n\r\n /**\r\n * Registered listeners.\r\n * @type {Object.<string,*>}\r\n * @private\r\n */\r\n this._listeners = {};\r\n}\r\n\r\n/**\r\n * Registers an event listener.\r\n * @param {string} evt Event name\r\n * @param {function} fn Listener\r\n * @param {*} [ctx] Listener context\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.on = function on(evt, fn, ctx) {\r\n (this._listeners[evt] || (this._listeners[evt] = [])).push({\r\n fn : fn,\r\n ctx : ctx || this\r\n });\r\n return this;\r\n};\r\n\r\n/**\r\n * Removes an event listener or any matching listeners if arguments are omitted.\r\n * @param {string} [evt] Event name. Removes all listeners if omitted.\r\n * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.off = function off(evt, fn) {\r\n if (evt === undefined)\r\n this._listeners = {};\r\n else {\r\n if (fn === undefined)\r\n this._listeners[evt] = [];\r\n else {\r\n var listeners = this._listeners[evt];\r\n for (var i = 0; i < listeners.length;)\r\n if (listeners[i].fn === fn)\r\n listeners.splice(i, 1);\r\n else\r\n ++i;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emits an event by calling its listeners with the specified arguments.\r\n * @param {string} evt Event name\r\n * @param {...*} args Arguments\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.emit = function emit(evt) {\r\n var listeners = this._listeners[evt];\r\n if (listeners) {\r\n var args = [],\r\n i = 1;\r\n for (; i < arguments.length;)\r\n args.push(arguments[i++]);\r\n for (i = 0; i < listeners.length;)\r\n listeners[i].fn.apply(listeners[i++].ctx, args);\r\n }\r\n return this;\r\n};\r\n", "\"use strict\";\r\n\r\nmodule.exports = factory(factory);\r\n\r\n/**\r\n * Reads / writes floats / doubles from / to buffers.\r\n * @name util.float\r\n * @namespace\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using little endian byte order.\r\n * @name util.float.writeFloatLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using big endian byte order.\r\n * @name util.float.writeFloatBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using little endian byte order.\r\n * @name util.float.readFloatLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using big endian byte order.\r\n * @name util.float.readFloatBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using little endian byte order.\r\n * @name util.float.writeDoubleLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using big endian byte order.\r\n * @name util.float.writeDoubleBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using little endian byte order.\r\n * @name util.float.readDoubleLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using big endian byte order.\r\n * @name util.float.readDoubleBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n// Factory function for the purpose of node-based testing in modified global environments\r\nfunction factory(exports) {\r\n\r\n // float: typed array\r\n if (typeof Float32Array !== \"undefined\") (function() {\r\n\r\n var f32 = new Float32Array([ -0 ]),\r\n f8b = new Uint8Array(f32.buffer),\r\n le = f8b[3] === 128;\r\n\r\n function writeFloat_f32_cpy(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n }\r\n\r\n function writeFloat_f32_rev(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[3];\r\n buf[pos + 1] = f8b[2];\r\n buf[pos + 2] = f8b[1];\r\n buf[pos + 3] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;\r\n\r\n function readFloat_f32_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n function readFloat_f32_rev(buf, pos) {\r\n f8b[3] = buf[pos ];\r\n f8b[2] = buf[pos + 1];\r\n f8b[1] = buf[pos + 2];\r\n f8b[0] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;\r\n\r\n // float: ieee754\r\n })(); else (function() {\r\n\r\n function writeFloat_ieee754(writeUint, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0)\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos);\r\n else if (isNaN(val))\r\n writeUint(2143289344, buf, pos);\r\n else if (val > 3.4028234663852886e+38) // +-Infinity\r\n writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);\r\n else if (val < 1.1754943508222875e-38) // denormal\r\n writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);\r\n else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2),\r\n mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;\r\n writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);\r\n }\r\n }\r\n\r\n exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);\r\n exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);\r\n\r\n function readFloat_ieee754(readUint, buf, pos) {\r\n var uint = readUint(buf, pos),\r\n sign = (uint >> 31) * 2 + 1,\r\n exponent = uint >>> 23 & 255,\r\n mantissa = uint & 8388607;\r\n return exponent === 255\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 1.401298464324817e-45 * mantissa\r\n : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);\r\n }\r\n\r\n exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE);\r\n exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE);\r\n\r\n })();\r\n\r\n // double: typed array\r\n if (typeof Float64Array !== \"undefined\") (function() {\r\n\r\n var f64 = new Float64Array([-0]),\r\n f8b = new Uint8Array(f64.buffer),\r\n le = f8b[7] === 128;\r\n\r\n function writeDouble_f64_cpy(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n buf[pos + 4] = f8b[4];\r\n buf[pos + 5] = f8b[5];\r\n buf[pos + 6] = f8b[6];\r\n buf[pos + 7] = f8b[7];\r\n }\r\n\r\n function writeDouble_f64_rev(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[7];\r\n buf[pos + 1] = f8b[6];\r\n buf[pos + 2] = f8b[5];\r\n buf[pos + 3] = f8b[4];\r\n buf[pos + 4] = f8b[3];\r\n buf[pos + 5] = f8b[2];\r\n buf[pos + 6] = f8b[1];\r\n buf[pos + 7] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;\r\n\r\n function readDouble_f64_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n f8b[4] = buf[pos + 4];\r\n f8b[5] = buf[pos + 5];\r\n f8b[6] = buf[pos + 6];\r\n f8b[7] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n function readDouble_f64_rev(buf, pos) {\r\n f8b[7] = buf[pos ];\r\n f8b[6] = buf[pos + 1];\r\n f8b[5] = buf[pos + 2];\r\n f8b[4] = buf[pos + 3];\r\n f8b[3] = buf[pos + 4];\r\n f8b[2] = buf[pos + 5];\r\n f8b[1] = buf[pos + 6];\r\n f8b[0] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;\r\n\r\n // double: ieee754\r\n })(); else (function() {\r\n\r\n function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1);\r\n } else if (isNaN(val)) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(2146959360, buf, pos + off1);\r\n } else if (val > 1.7976931348623157e+308) { // +-Infinity\r\n writeUint(0, buf, pos + off0);\r\n writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);\r\n } else {\r\n var mantissa;\r\n if (val < 2.2250738585072014e-308) { // denormal\r\n mantissa = val / 5e-324;\r\n writeUint(mantissa >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);\r\n } else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2);\r\n if (exponent === 1024)\r\n exponent = 1023;\r\n mantissa = val * Math.pow(2, -exponent);\r\n writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);\r\n }\r\n }\r\n }\r\n\r\n exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);\r\n exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);\r\n\r\n function readDouble_ieee754(readUint, off0, off1, buf, pos) {\r\n var lo = readUint(buf, pos + off0),\r\n hi = readUint(buf, pos + off1);\r\n var sign = (hi >> 31) * 2 + 1,\r\n exponent = hi >>> 20 & 2047,\r\n mantissa = 4294967296 * (hi & 1048575) + lo;\r\n return exponent === 2047\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 5e-324 * mantissa\r\n : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);\r\n }\r\n\r\n exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);\r\n exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);\r\n\r\n })();\r\n\r\n return exports;\r\n}\r\n\r\n// uint helpers\r\n\r\nfunction writeUintLE(val, buf, pos) {\r\n buf[pos ] = val & 255;\r\n buf[pos + 1] = val >>> 8 & 255;\r\n buf[pos + 2] = val >>> 16 & 255;\r\n buf[pos + 3] = val >>> 24;\r\n}\r\n\r\nfunction writeUintBE(val, buf, pos) {\r\n buf[pos ] = val >>> 24;\r\n buf[pos + 1] = val >>> 16 & 255;\r\n buf[pos + 2] = val >>> 8 & 255;\r\n buf[pos + 3] = val & 255;\r\n}\r\n\r\nfunction readUintLE(buf, pos) {\r\n return (buf[pos ]\r\n | buf[pos + 1] << 8\r\n | buf[pos + 2] << 16\r\n | buf[pos + 3] << 24) >>> 0;\r\n}\r\n\r\nfunction readUintBE(buf, pos) {\r\n return (buf[pos ] << 24\r\n | buf[pos + 1] << 16\r\n | buf[pos + 2] << 8\r\n | buf[pos + 3]) >>> 0;\r\n}\r\n", "\n \"use strict\";\n module.exports = inquire;\n function inquire(moduleName) {\n return null;\n }\n ", "\"use strict\";\r\n\r\n/**\r\n * A minimal UTF8 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar utf8 = exports;\r\n\r\n/**\r\n * Calculates the UTF8 byte length of a string.\r\n * @param {string} string String\r\n * @returns {number} Byte length\r\n */\r\nutf8.length = function utf8_length(string) {\r\n var len = 0,\r\n c = 0;\r\n for (var i = 0; i < string.length; ++i) {\r\n c = string.charCodeAt(i);\r\n if (c < 128)\r\n len += 1;\r\n else if (c < 2048)\r\n len += 2;\r\n else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {\r\n ++i;\r\n len += 4;\r\n } else\r\n len += 3;\r\n }\r\n return len;\r\n};\r\n\r\n/**\r\n * Reads UTF8 bytes as a string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} String read\r\n */\r\nutf8.read = function utf8_read(buffer, start, end) {\r\n var len = end - start;\r\n if (len < 1)\r\n return \"\";\r\n var parts = null,\r\n chunk = [],\r\n i = 0, // char offset\r\n t; // temporary\r\n while (start < end) {\r\n t = buffer[start++];\r\n if (t < 128)\r\n chunk[i++] = t;\r\n else if (t > 191 && t < 224)\r\n chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\r\n else if (t > 239 && t < 365) {\r\n t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\r\n chunk[i++] = 0xD800 + (t >> 10);\r\n chunk[i++] = 0xDC00 + (t & 1023);\r\n } else\r\n chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\n/**\r\n * Writes a string as UTF8 bytes.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Bytes written\r\n */\r\nutf8.write = function utf8_write(string, buffer, offset) {\r\n var start = offset,\r\n c1, // character 1\r\n c2; // character 2\r\n for (var i = 0; i < string.length; ++i) {\r\n c1 = string.charCodeAt(i);\r\n if (c1 < 128) {\r\n buffer[offset++] = c1;\r\n } else if (c1 < 2048) {\r\n buffer[offset++] = c1 >> 6 | 192;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {\r\n c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);\r\n ++i;\r\n buffer[offset++] = c1 >> 18 | 240;\r\n buffer[offset++] = c1 >> 12 & 63 | 128;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else {\r\n buffer[offset++] = c1 >> 12 | 224;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n }\r\n }\r\n return offset - start;\r\n};\r\n", "\"use strict\";\r\nmodule.exports = pool;\r\n\r\n/**\r\n * An allocator as used by {@link util.pool}.\r\n * @typedef PoolAllocator\r\n * @type {function}\r\n * @param {number} size Buffer size\r\n * @returns {Uint8Array} Buffer\r\n */\r\n\r\n/**\r\n * A slicer as used by {@link util.pool}.\r\n * @typedef PoolSlicer\r\n * @type {function}\r\n * @param {number} start Start offset\r\n * @param {number} end End offset\r\n * @returns {Uint8Array} Buffer slice\r\n * @this {Uint8Array}\r\n */\r\n\r\n/**\r\n * A general purpose buffer pool.\r\n * @memberof util\r\n * @function\r\n * @param {PoolAllocator} alloc Allocator\r\n * @param {PoolSlicer} slice Slicer\r\n * @param {number} [size=8192] Slab size\r\n * @returns {PoolAllocator} Pooled allocator\r\n */\r\nfunction pool(alloc, slice, size) {\r\n var SIZE = size || 8192;\r\n var MAX = SIZE >>> 1;\r\n var slab = null;\r\n var offset = SIZE;\r\n return function pool_alloc(size) {\r\n if (size < 1 || size > MAX)\r\n return alloc(size);\r\n if (offset + size > SIZE) {\r\n slab = alloc(SIZE);\r\n offset = 0;\r\n }\r\n var buf = slice.call(slab, offset, offset += size);\r\n if (offset & 7) // align to 32 bit\r\n offset = (offset | 7) + 1;\r\n return buf;\r\n };\r\n}\r\n", "\"use strict\";\nmodule.exports = LongBits;\n\nvar util = require(\"../util/minimal\");\n\n/**\n * Constructs new long bits.\n * @classdesc Helper class for working with the low and high bits of a 64 bit value.\n * @memberof util\n * @constructor\n * @param {number} lo Low 32 bits, unsigned\n * @param {number} hi High 32 bits, unsigned\n */\nfunction LongBits(lo, hi) {\n\n // note that the casts below are theoretically unnecessary as of today, but older statically\n // generated converter code might still call the ctor with signed 32bits. kept for compat.\n\n /**\n * Low bits.\n * @type {number}\n */\n this.lo = lo >>> 0;\n\n /**\n * High bits.\n * @type {number}\n */\n this.hi = hi >>> 0;\n}\n\n/**\n * Zero bits.\n * @memberof util.LongBits\n * @type {util.LongBits}\n */\nvar zero = LongBits.zero = new LongBits(0, 0);\n\nzero.toNumber = function() { return 0; };\nzero.zzEncode = zero.zzDecode = function() { return this; };\nzero.length = function() { return 1; };\n\n/**\n * Zero hash.\n * @memberof util.LongBits\n * @type {string}\n */\nvar zeroHash = LongBits.zeroHash = \"\\0\\0\\0\\0\\0\\0\\0\\0\";\n\n/**\n * Constructs new long bits from the specified number.\n * @param {number} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.fromNumber = function fromNumber(value) {\n if (value === 0)\n return zero;\n var sign = value < 0;\n if (sign)\n value = -value;\n var lo = value >>> 0,\n hi = (value - lo) / 4294967296 >>> 0;\n if (sign) {\n hi = ~hi >>> 0;\n lo = ~lo >>> 0;\n if (++lo > 4294967295) {\n lo = 0;\n if (++hi > 4294967295)\n hi = 0;\n }\n }\n return new LongBits(lo, hi);\n};\n\n/**\n * Constructs new long bits from a number, long or string.\n * @param {Long|number|string} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.from = function from(value) {\n if (typeof value === \"number\")\n return LongBits.fromNumber(value);\n if (util.isString(value)) {\n /* istanbul ignore else */\n if (util.Long)\n value = util.Long.fromString(value);\n else\n return LongBits.fromNumber(parseInt(value, 10));\n }\n return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;\n};\n\n/**\n * Converts this long bits to a possibly unsafe JavaScript number.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {number} Possibly unsafe number\n */\nLongBits.prototype.toNumber = function toNumber(unsigned) {\n if (!unsigned && this.hi >>> 31) {\n var lo = ~this.lo + 1 >>> 0,\n hi = ~this.hi >>> 0;\n if (!lo)\n hi = hi + 1 >>> 0;\n return -(lo + hi * 4294967296);\n }\n return this.lo + this.hi * 4294967296;\n};\n\n/**\n * Converts this long bits to a long.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long} Long\n */\nLongBits.prototype.toLong = function toLong(unsigned) {\n return util.Long\n ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))\n /* istanbul ignore next */\n : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };\n};\n\nvar charCodeAt = String.prototype.charCodeAt;\n\n/**\n * Constructs new long bits from the specified 8 characters long hash.\n * @param {string} hash Hash\n * @returns {util.LongBits} Bits\n */\nLongBits.fromHash = function fromHash(hash) {\n if (hash === zeroHash)\n return zero;\n return new LongBits(\n ( charCodeAt.call(hash, 0)\n | charCodeAt.call(hash, 1) << 8\n | charCodeAt.call(hash, 2) << 16\n | charCodeAt.call(hash, 3) << 24) >>> 0\n ,\n ( charCodeAt.call(hash, 4)\n | charCodeAt.call(hash, 5) << 8\n | charCodeAt.call(hash, 6) << 16\n | charCodeAt.call(hash, 7) << 24) >>> 0\n );\n};\n\n/**\n * Converts this long bits to a 8 characters long hash.\n * @returns {string} Hash\n */\nLongBits.prototype.toHash = function toHash() {\n return String.fromCharCode(\n this.lo & 255,\n this.lo >>> 8 & 255,\n this.lo >>> 16 & 255,\n this.lo >>> 24 ,\n this.hi & 255,\n this.hi >>> 8 & 255,\n this.hi >>> 16 & 255,\n this.hi >>> 24\n );\n};\n\n/**\n * Zig-zag encodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzEncode = function zzEncode() {\n var mask = this.hi >> 31;\n this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;\n this.lo = ( this.lo << 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Zig-zag decodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzDecode = function zzDecode() {\n var mask = -(this.lo & 1);\n this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;\n this.hi = ( this.hi >>> 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Calculates the length of this longbits when encoded as a varint.\n * @returns {number} Length\n */\nLongBits.prototype.length = function length() {\n var part0 = this.lo,\n part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,\n part2 = this.hi >>> 24;\n return part2 === 0\n ? part1 === 0\n ? part0 < 16384\n ? part0 < 128 ? 1 : 2\n : part0 < 2097152 ? 3 : 4\n : part1 < 16384\n ? part1 < 128 ? 5 : 6\n : part1 < 2097152 ? 7 : 8\n : part2 < 128 ? 9 : 10;\n};\n", "\"use strict\";\nvar util = exports;\n\n// used to return a Promise where callback is omitted\nutil.asPromise = require(\"@protobufjs/aspromise\");\n\n// converts to / from base64 encoded strings\nutil.base64 = require(\"@protobufjs/base64\");\n\n// base class of rpc.Service\nutil.EventEmitter = require(\"@protobufjs/eventemitter\");\n\n// float handling accross browsers\nutil.float = require(\"@protobufjs/float\");\n\n// requires modules optionally and hides the call from bundlers\nutil.inquire = require(\"@protobufjs/inquire\");\n\n// converts to / from utf8 encoded strings\nutil.utf8 = require(\"@protobufjs/utf8\");\n\n// provides a node-like buffer pool in the browser\nutil.pool = require(\"@protobufjs/pool\");\n\n// utility to work with the low and high bits of a 64 bit value\nutil.LongBits = require(\"./longbits\");\n\n/**\n * Whether running within node or not.\n * @memberof util\n * @type {boolean}\n */\nutil.isNode = Boolean(typeof global !== \"undefined\"\n && global\n && global.process\n && global.process.versions\n && global.process.versions.node);\n\n/**\n * Global object reference.\n * @memberof util\n * @type {Object}\n */\nutil.global = util.isNode && global\n || typeof window !== \"undefined\" && window\n || typeof self !== \"undefined\" && self\n || this; // eslint-disable-line no-invalid-this\n\n/**\n * An immuable empty array.\n * @memberof util\n * @type {Array.<*>}\n * @const\n */\nutil.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes\n\n/**\n * An immutable empty object.\n * @type {Object}\n * @const\n */\nutil.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes\n\n/**\n * Tests if the specified value is an integer.\n * @function\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is an integer\n */\nutil.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) {\n return typeof value === \"number\" && isFinite(value) && Math.floor(value) === value;\n};\n\n/**\n * Tests if the specified value is a string.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a string\n */\nutil.isString = function isString(value) {\n return typeof value === \"string\" || value instanceof String;\n};\n\n/**\n * Tests if the specified value is a non-null object.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a non-null object\n */\nutil.isObject = function isObject(value) {\n return value && typeof value === \"object\";\n};\n\n/**\n * Checks if a property on a message is considered to be present.\n * This is an alias of {@link util.isSet}.\n * @function\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isset =\n\n/**\n * Checks if a property on a message is considered to be present.\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isSet = function isSet(obj, prop) {\n var value = obj[prop];\n if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins\n return typeof value !== \"object\" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;\n return false;\n};\n\n/**\n * Any compatible Buffer instance.\n * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.\n * @interface Buffer\n * @extends Uint8Array\n */\n\n/**\n * Node's Buffer class if available.\n * @type {Constructor<Buffer>}\n */\nutil.Buffer = (function() {\n try {\n var Buffer = util.inquire(\"buffer\").Buffer;\n // refuse to use non-node buffers if not explicitly assigned (perf reasons):\n return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null;\n } catch (e) {\n /* istanbul ignore next */\n return null;\n }\n})();\n\n// Internal alias of or polyfull for Buffer.from.\nutil._Buffer_from = null;\n\n// Internal alias of or polyfill for Buffer.allocUnsafe.\nutil._Buffer_allocUnsafe = null;\n\n/**\n * Creates a new buffer of whatever type supported by the environment.\n * @param {number|number[]} [sizeOrArray=0] Buffer size or number array\n * @returns {Uint8Array|Buffer} Buffer\n */\nutil.newBuffer = function newBuffer(sizeOrArray) {\n /* istanbul ignore next */\n return typeof sizeOrArray === \"number\"\n ? util.Buffer\n ? util._Buffer_allocUnsafe(sizeOrArray)\n : new util.Array(sizeOrArray)\n : util.Buffer\n ? util._Buffer_from(sizeOrArray)\n : typeof Uint8Array === \"undefined\"\n ? sizeOrArray\n : new Uint8Array(sizeOrArray);\n};\n\n/**\n * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.\n * @type {Constructor<Uint8Array>}\n */\nutil.Array = typeof Uint8Array !== \"undefined\" ? Uint8Array /* istanbul ignore next */ : Array;\n\n/**\n * Any compatible Long instance.\n * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js.\n * @interface Long\n * @property {number} low Low bits\n * @property {number} high High bits\n * @property {boolean} unsigned Whether unsigned or not\n */\n\n/**\n * Long.js's Long class if available.\n * @type {Constructor<Long>}\n */\nutil.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long\n || /* istanbul ignore next */ util.global.Long\n || util.inquire(\"long\");\n\n/**\n * Regular expression used to verify 2 bit (`bool`) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key2Re = /^true|false|0|1$/;\n\n/**\n * Regular expression used to verify 32 bit (`int32` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key32Re = /^-?(?:0|[1-9][0-9]*)$/;\n\n/**\n * Regular expression used to verify 64 bit (`int64` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key64Re = /^(?:[\\\\x00-\\\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;\n\n/**\n * Converts a number or long to an 8 characters long hash string.\n * @param {Long|number} value Value to convert\n * @returns {string} Hash\n */\nutil.longToHash = function longToHash(value) {\n return value\n ? util.LongBits.from(value).toHash()\n : util.LongBits.zeroHash;\n};\n\n/**\n * Converts an 8 characters long hash string to a long or number.\n * @param {string} hash Hash\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long|number} Original value\n */\nutil.longFromHash = function longFromHash(hash, unsigned) {\n var bits = util.LongBits.fromHash(hash);\n if (util.Long)\n return util.Long.fromBits(bits.lo, bits.hi, unsigned);\n return bits.toNumber(Boolean(unsigned));\n};\n\n/**\n * Merges the properties of the source object into the destination object.\n * @memberof util\n * @param {Object.<string,*>} dst Destination object\n * @param {Object.<string,*>} src Source object\n * @param {boolean} [ifNotSet=false] Merges only if the key is not already set\n * @returns {Object.<string,*>} Destination object\n */\nfunction merge(dst, src, ifNotSet) { // used by converters\n for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)\n if (dst[keys[i]] === undefined || !ifNotSet)\n dst[keys[i]] = src[keys[i]];\n return dst;\n}\n\nutil.merge = merge;\n\n/**\n * Converts the first character of a string to lower case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.lcFirst = function lcFirst(str) {\n return str.charAt(0).toLowerCase() + str.substring(1);\n};\n\n/**\n * Creates a custom error constructor.\n * @memberof util\n * @param {string} name Error name\n * @returns {Constructor<Error>} Custom error constructor\n */\nfunction newError(name) {\n\n function CustomError(message, properties) {\n\n if (!(this instanceof CustomError))\n return new CustomError(message, properties);\n\n // Error.call(this, message);\n // ^ just returns a new error instance because the ctor can be called as a function\n\n Object.defineProperty(this, \"message\", { get: function() { return message; } });\n\n /* istanbul ignore next */\n if (Error.captureStackTrace) // node\n Error.captureStackTrace(this, CustomError);\n else\n Object.defineProperty(this, \"stack\", { value: new Error().stack || \"\" });\n\n if (properties)\n merge(this, properties);\n }\n\n CustomError.prototype = Object.create(Error.prototype, {\n constructor: {\n value: CustomError,\n writable: true,\n enumerable: false,\n configurable: true,\n },\n name: {\n get: function get() { return name; },\n set: undefined,\n enumerable: false,\n // configurable: false would accurately preserve the behavior of\n // the original, but I'm guessing that was not intentional.\n // For an actual error subclass, this property would\n // be configurable.\n configurable: true,\n },\n toString: {\n value: function value() { return this.name + \": \" + this.message; },\n writable: true,\n enumerable: false,\n configurable: true,\n },\n });\n\n return CustomError;\n}\n\nutil.newError = newError;\n\n/**\n * Constructs a new protocol error.\n * @classdesc Error subclass indicating a protocol specifc error.\n * @memberof util\n * @extends Error\n * @template T extends Message<T>\n * @constructor\n * @param {string} message Error message\n * @param {Object.<string,*>} [properties] Additional properties\n * @example\n * try {\n * MyMessage.decode(someBuffer); // throws if required fields are missing\n * } catch (e) {\n * if (e instanceof ProtocolError && e.instance)\n * console.log(\"decoded so far: \" + JSON.stringify(e.instance));\n * }\n */\nutil.ProtocolError = newError(\"ProtocolError\");\n\n/**\n * So far decoded message instance.\n * @name util.ProtocolError#instance\n * @type {Message<T>}\n */\n\n/**\n * A OneOf getter as returned by {@link util.oneOfGetter}.\n * @typedef OneOfGetter\n * @type {function}\n * @returns {string|undefined} Set field name, if any\n */\n\n/**\n * Builds a getter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfGetter} Unbound getter\n */\nutil.oneOfGetter = function getOneOf(fieldNames) {\n var fieldMap = {};\n for (var i = 0; i < fieldNames.length; ++i)\n fieldMap[fieldNames[i]] = 1;\n\n /**\n * @returns {string|undefined} Set field name, if any\n * @this Object\n * @ignore\n */\n return function() { // eslint-disable-line consistent-return\n for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)\n if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)\n return keys[i];\n };\n};\n\n/**\n * A OneOf setter as returned by {@link util.oneOfSetter}.\n * @typedef OneOfSetter\n * @type {function}\n * @param {string|undefined} value Field name\n * @returns {undefined}\n */\n\n/**\n * Builds a setter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfSetter} Unbound setter\n */\nutil.oneOfSetter = function setOneOf(fieldNames) {\n\n /**\n * @param {string} name Field name\n * @returns {undefined}\n * @this Object\n * @ignore\n */\n return function(name) {\n for (var i = 0; i < fieldNames.length; ++i)\n if (fieldNames[i] !== name)\n delete this[fieldNames[i]];\n };\n};\n\n/**\n * Default conversion options used for {@link Message#toJSON} implementations.\n *\n * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:\n *\n * - Longs become strings\n * - Enums become string keys\n * - Bytes become base64 encoded strings\n * - (Sub-)Messages become plain objects\n * - Maps become plain objects with all string keys\n * - Repeated fields become arrays\n * - NaN and Infinity for float and double fields become strings\n *\n * @type {IConversionOptions}\n * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json\n */\nutil.toJSONOptions = {\n longs: String,\n enums: String,\n bytes: String,\n json: true\n};\n\n// Sets up buffer utility according to the environment (called in index-minimal)\nutil._configure = function() {\n var Buffer = util.Buffer;\n /* istanbul ignore if */\n if (!Buffer) {\n util._Buffer_from = util._Buffer_allocUnsafe = null;\n return;\n }\n // because node 4.x buffers are incompatible & immutable\n // see: https://github.com/dcodeIO/protobuf.js/pull/665\n util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||\n /* istanbul ignore next */\n function Buffer_from(value, encoding) {\n return new Buffer(value, encoding);\n };\n util._Buffer_allocUnsafe = Buffer.allocUnsafe ||\n /* istanbul ignore next */\n function Buffer_allocUnsafe(size) {\n return new Buffer(size);\n };\n};\n", "\"use strict\";\nmodule.exports = Writer;\n\nvar util = require(\"./util/minimal\");\n\nvar BufferWriter; // cyclic\n\nvar LongBits = util.LongBits,\n base64 = util.base64,\n utf8 = util.utf8;\n\n/**\n * Constructs a new writer operation instance.\n * @classdesc Scheduled writer operation.\n * @constructor\n * @param {function(*, Uint8Array, number)} fn Function to call\n * @param {number} len Value byte length\n * @param {*} val Value to write\n * @ignore\n */\nfunction Op(fn, len, val) {\n\n /**\n * Function to call.\n * @type {function(Uint8Array, number, *)}\n */\n this.fn = fn;\n\n /**\n * Value byte length.\n * @type {number}\n */\n this.len = len;\n\n /**\n * Next operation.\n * @type {Writer.Op|undefined}\n */\n this.next = undefined;\n\n /**\n * Value to write.\n * @type {*}\n */\n this.val = val; // type varies\n}\n\n/* istanbul ignore next */\nfunction noop() {} // eslint-disable-line no-empty-function\n\n/**\n * Constructs a new writer state instance.\n * @classdesc Copied writer state.\n * @memberof Writer\n * @constructor\n * @param {Writer} writer Writer to copy state from\n * @ignore\n */\nfunction State(writer) {\n\n /**\n * Current head.\n * @type {Writer.Op}\n */\n this.head = writer.head;\n\n /**\n * Current tail.\n * @type {Writer.Op}\n */\n this.tail = writer.tail;\n\n /**\n * Current buffer length.\n * @type {number}\n */\n this.len = writer.len;\n\n /**\n * Next state.\n * @type {State|null}\n */\n this.next = writer.states;\n}\n\n/**\n * Constructs a new writer instance.\n * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n */\nfunction Writer() {\n\n /**\n * Current length.\n * @type {number}\n */\n this.len = 0;\n\n /**\n * Operations head.\n * @type {Object}\n */\n this.head = new Op(noop, 0, 0);\n\n /**\n * Operations tail\n * @type {Object}\n */\n this.tail = this.head;\n\n /**\n * Linked forked states.\n * @type {Object|null}\n */\n this.states = null;\n\n // When a value is written, the writer calculates its byte length and puts it into a linked\n // list of operations to perform when finish() is called. This both allows us to allocate\n // buffers of the exact required size and reduces the amount of work we have to do compared\n // to first calculating over objects and then encoding over objects. In our case, the encoding\n // part is just a linked list walk calling operations with already prepared values.\n}\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup() {\n return (Writer.create = function create_buffer() {\n return new BufferWriter();\n })();\n }\n /* istanbul ignore next */\n : function create_array() {\n return new Writer();\n };\n};\n\n/**\n * Creates a new writer.\n * @function\n * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer}\n */\nWriter.create = create();\n\n/**\n * Allocates a buffer of the specified size.\n * @param {number} size Buffer size\n * @returns {Uint8Array} Buffer\n */\nWriter.alloc = function alloc(size) {\n return new util.Array(size);\n};\n\n// Use Uint8Array buffer pool in the browser, just like node does with buffers\n/* istanbul ignore else */\nif (util.Array !== Array)\n Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);\n\n/**\n * Pushes a new operation to the queue.\n * @param {function(Uint8Array, number, *)} fn Function to call\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @returns {Writer} `this`\n * @private\n */\nWriter.prototype._push = function push(fn, len, val) {\n this.tail = this.tail.next = new Op(fn, len, val);\n this.len += len;\n return this;\n};\n\nfunction writeByte(val, buf, pos) {\n buf[pos] = val & 255;\n}\n\nfunction writeVarint32(val, buf, pos) {\n while (val > 127) {\n buf[pos++] = val & 127 | 128;\n val >>>= 7;\n }\n buf[pos] = val;\n}\n\n/**\n * Constructs a new varint writer operation instance.\n * @classdesc Scheduled varint writer operation.\n * @extends Op\n * @constructor\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @ignore\n */\nfunction VarintOp(len, val) {\n this.len = len;\n this.next = undefined;\n this.val = val;\n}\n\nVarintOp.prototype = Object.create(Op.prototype);\nVarintOp.prototype.fn = writeVarint32;\n\n/**\n * Writes an unsigned 32 bit value as a varint.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.uint32 = function write_uint32(value) {\n // here, the call to this.push has been inlined and a varint specific Op subclass is used.\n // uint32 is by far the most frequently used operation and benefits significantly from this.\n this.len += (this.tail = this.tail.next = new VarintOp(\n (value = value >>> 0)\n < 128 ? 1\n : value < 16384 ? 2\n : value < 2097152 ? 3\n : value < 268435456 ? 4\n : 5,\n value)).len;\n return this;\n};\n\n/**\n * Writes a signed 32 bit value as a varint.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.int32 = function write_int32(value) {\n return value < 0\n ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec\n : this.uint32(value);\n};\n\n/**\n * Writes a 32 bit value as a varint, zig-zag encoded.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sint32 = function write_sint32(value) {\n return this.uint32((value << 1 ^ value >> 31) >>> 0);\n};\n\nfunction writeVarint64(val, buf, pos) {\n while (val.hi) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;\n val.hi >>>= 7;\n }\n while (val.lo > 127) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = val.lo >>> 7;\n }\n buf[pos++] = val.lo;\n}\n\n/**\n * Writes an unsigned 64 bit value as a varint.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.uint64 = function write_uint64(value) {\n var bits = LongBits.from(value);\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a signed 64 bit value as a varint.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.int64 = Writer.prototype.uint64;\n\n/**\n * Writes a signed 64 bit value as a varint, zig-zag encoded.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sint64 = function write_sint64(value) {\n var bits = LongBits.from(value).zzEncode();\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a boolish value as a varint.\n * @param {boolean} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bool = function write_bool(value) {\n return this._push(writeByte, 1, value ? 1 : 0);\n};\n\nfunction writeFixed32(val, buf, pos) {\n buf[pos ] = val & 255;\n buf[pos + 1] = val >>> 8 & 255;\n buf[pos + 2] = val >>> 16 & 255;\n buf[pos + 3] = val >>> 24;\n}\n\n/**\n * Writes an unsigned 32 bit value as fixed 32 bits.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.fixed32 = function write_fixed32(value) {\n return this._push(writeFixed32, 4, value >>> 0);\n};\n\n/**\n * Writes a signed 32 bit value as fixed 32 bits.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sfixed32 = Writer.prototype.fixed32;\n\n/**\n * Writes an unsigned 64 bit value as fixed 64 bits.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.fixed64 = function write_fixed64(value) {\n var bits = LongBits.from(value);\n return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);\n};\n\n/**\n * Writes a signed 64 bit value as fixed 64 bits.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sfixed64 = Writer.prototype.fixed64;\n\n/**\n * Writes a float (32 bit).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.float = function write_float(value) {\n return this._push(util.float.writeFloatLE, 4, value);\n};\n\n/**\n * Writes a double (64 bit float).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.double = function write_double(value) {\n return this._push(util.float.writeDoubleLE, 8, value);\n};\n\nvar writeBytes = util.Array.prototype.set\n ? function writeBytes_set(val, buf, pos) {\n buf.set(val, pos); // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytes_for(val, buf, pos) {\n for (var i = 0; i < val.length; ++i)\n buf[pos + i] = val[i];\n };\n\n/**\n * Writes a sequence of bytes.\n * @param {Uint8Array|string} value Buffer or base64 encoded string to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bytes = function write_bytes(value) {\n var len = value.length >>> 0;\n if (!len)\n return this._push(writeByte, 1, 0);\n if (util.isString(value)) {\n var buf = Writer.alloc(len = base64.length(value));\n base64.decode(value, buf, 0);\n value = buf;\n }\n return this.uint32(len)._push(writeBytes, len, value);\n};\n\n/**\n * Writes a string.\n * @param {string} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.string = function write_string(value) {\n var len = utf8.length(value);\n return len\n ? this.uint32(len)._push(utf8.write, len, value)\n : this._push(writeByte, 1, 0);\n};\n\n/**\n * Forks this writer's state by pushing it to a stack.\n * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.\n * @returns {Writer} `this`\n */\nWriter.prototype.fork = function fork() {\n this.states = new State(this);\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n return this;\n};\n\n/**\n * Resets this instance to the last state.\n * @returns {Writer} `this`\n */\nWriter.prototype.reset = function reset() {\n if (this.states) {\n this.head = this.states.head;\n this.tail = this.states.tail;\n this.len = this.states.len;\n this.states = this.states.next;\n } else {\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n }\n return this;\n};\n\n/**\n * Resets to the last state and appends the fork state's current write length as a varint followed by its operations.\n * @returns {Writer} `this`\n */\nWriter.prototype.ldelim = function ldelim() {\n var head = this.head,\n tail = this.tail,\n len = this.len;\n this.reset().uint32(len);\n if (len) {\n this.tail.next = head.next; // skip noop\n this.tail = tail;\n this.len += len;\n }\n return this;\n};\n\n/**\n * Finishes the write operation.\n * @returns {Uint8Array} Finished buffer\n */\nWriter.prototype.finish = function finish() {\n var head = this.head.next, // skip noop\n buf = this.constructor.alloc(this.len),\n pos = 0;\n while (head) {\n head.fn(head.val, buf, pos);\n pos += head.len;\n head = head.next;\n }\n // this.head = this.tail = null;\n return buf;\n};\n\nWriter._configure = function(BufferWriter_) {\n BufferWriter = BufferWriter_;\n Writer.create = create();\n BufferWriter._configure();\n};\n", "\"use strict\";\nmodule.exports = BufferWriter;\n\n// extends Writer\nvar Writer = require(\"./writer\");\n(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;\n\nvar util = require(\"./util/minimal\");\n\n/**\n * Constructs a new buffer writer instance.\n * @classdesc Wire format writer using node buffers.\n * @extends Writer\n * @constructor\n */\nfunction BufferWriter() {\n Writer.call(this);\n}\n\nBufferWriter._configure = function () {\n /**\n * Allocates a buffer of the specified size.\n * @function\n * @param {number} size Buffer size\n * @returns {Buffer} Buffer\n */\n BufferWriter.alloc = util._Buffer_allocUnsafe;\n\n BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === \"set\"\n ? function writeBytesBuffer_set(val, buf, pos) {\n buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited)\n // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytesBuffer_copy(val, buf, pos) {\n if (val.copy) // Buffer values\n val.copy(buf, pos, 0, val.length);\n else for (var i = 0; i < val.length;) // plain array values\n buf[pos++] = val[i++];\n };\n};\n\n\n/**\n * @override\n */\nBufferWriter.prototype.bytes = function write_bytes_buffer(value) {\n if (util.isString(value))\n value = util._Buffer_from(value, \"base64\");\n var len = value.length >>> 0;\n this.uint32(len);\n if (len)\n this._push(BufferWriter.writeBytesBuffer, len, value);\n return this;\n};\n\nfunction writeStringBuffer(val, buf, pos) {\n if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions)\n util.utf8.write(val, buf, pos);\n else if (buf.utf8Write)\n buf.utf8Write(val, pos);\n else\n buf.write(val, pos);\n}\n\n/**\n * @override\n */\nBufferWriter.prototype.string = function write_string_buffer(value) {\n var len = util.Buffer.byteLength(value);\n this.uint32(len);\n if (len)\n this._push(writeStringBuffer, len, value);\n return this;\n};\n\n\n/**\n * Finishes the write operation.\n * @name BufferWriter#finish\n * @function\n * @returns {Buffer} Finished buffer\n */\n\nBufferWriter._configure();\n", "\"use strict\";\nmodule.exports = Reader;\n\nvar util = require(\"./util/minimal\");\n\nvar BufferReader; // cyclic\n\nvar LongBits = util.LongBits,\n utf8 = util.utf8;\n\n/* istanbul ignore next */\nfunction indexOutOfRange(reader, writeLength) {\n return RangeError(\"index out of range: \" + reader.pos + \" + \" + (writeLength || 1) + \" > \" + reader.len);\n}\n\n/**\n * Constructs a new reader instance using the specified buffer.\n * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n * @param {Uint8Array} buffer Buffer to read from\n */\nfunction Reader(buffer) {\n\n /**\n * Read buffer.\n * @type {Uint8Array}\n */\n this.buf = buffer;\n\n /**\n * Read buffer position.\n * @type {number}\n */\n this.pos = 0;\n\n /**\n * Read buffer length.\n * @type {number}\n */\n this.len = buffer.length;\n}\n\nvar create_array = typeof Uint8Array !== \"undefined\"\n ? function create_typed_array(buffer) {\n if (buffer instanceof Uint8Array || Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n }\n /* istanbul ignore next */\n : function create_array(buffer) {\n if (Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n };\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup(buffer) {\n return (Reader.create = function create_buffer(buffer) {\n return util.Buffer.isBuffer(buffer)\n ? new BufferReader(buffer)\n /* istanbul ignore next */\n : create_array(buffer);\n })(buffer);\n }\n /* istanbul ignore next */\n : create_array;\n};\n\n/**\n * Creates a new reader using the specified buffer.\n * @function\n * @param {Uint8Array|Buffer} buffer Buffer to read from\n * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader}\n * @throws {Error} If `buffer` is not a valid buffer\n */\nReader.create = create();\n\nReader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice;\n\n/**\n * Reads a varint as an unsigned 32 bit value.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.uint32 = (function read_uint32_setup() {\n var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!)\n return function read_uint32() {\n value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;\n\n /* istanbul ignore if */\n if ((this.pos += 5) > this.len) {\n this.pos = this.len;\n throw indexOutOfRange(this, 10);\n }\n return value;\n };\n})();\n\n/**\n * Reads a varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.int32 = function read_int32() {\n return this.uint32() | 0;\n};\n\n/**\n * Reads a zig-zag encoded varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.sint32 = function read_sint32() {\n var value = this.uint32();\n return value >>> 1 ^ -(value & 1) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readLongVarint() {\n // tends to deopt with local vars for octet etc.\n var bits = new LongBits(0, 0);\n var i = 0;\n if (this.len - this.pos > 4) { // fast route (lo)\n for (; i < 4; ++i) {\n // 1st..4th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 5th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n i = 0;\n } else {\n for (; i < 3; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 1st..3th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 4th\n bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;\n return bits;\n }\n if (this.len - this.pos > 4) { // fast route (hi)\n for (; i < 5; ++i) {\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n } else {\n for (; i < 5; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n }\n /* istanbul ignore next */\n throw Error(\"invalid varint encoding\");\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads a varint as a signed 64 bit value.\n * @name Reader#int64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as an unsigned 64 bit value.\n * @name Reader#uint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a zig-zag encoded varint as a signed 64 bit value.\n * @name Reader#sint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as a boolean.\n * @returns {boolean} Value read\n */\nReader.prototype.bool = function read_bool() {\n return this.uint32() !== 0;\n};\n\nfunction readFixed32_end(buf, end) { // note that this uses `end`, not `pos`\n return (buf[end - 4]\n | buf[end - 3] << 8\n | buf[end - 2] << 16\n | buf[end - 1] << 24) >>> 0;\n}\n\n/**\n * Reads fixed 32 bits as an unsigned 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.fixed32 = function read_fixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4);\n};\n\n/**\n * Reads fixed 32 bits as a signed 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.sfixed32 = function read_sfixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readFixed64(/* this: Reader */) {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 8);\n\n return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads fixed 64 bits.\n * @name Reader#fixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads zig-zag encoded fixed 64 bits.\n * @name Reader#sfixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a float (32 bit) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.float = function read_float() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readFloatLE(this.buf, this.pos);\n this.pos += 4;\n return value;\n};\n\n/**\n * Reads a double (64 bit float) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.double = function read_double() {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readDoubleLE(this.buf, this.pos);\n this.pos += 8;\n return value;\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @returns {Uint8Array} Value read\n */\nReader.prototype.bytes = function read_bytes() {\n var length = this.uint32(),\n start = this.pos,\n end = this.pos + length;\n\n /* istanbul ignore if */\n if (end > this.len)\n throw indexOutOfRange(this, length);\n\n this.pos += length;\n if (Array.isArray(this.buf)) // plain array\n return this.buf.slice(start, end);\n\n if (start === end) { // fix for IE 10/Win8 and others' subarray returning array of size 1\n var nativeBuffer = util.Buffer;\n return nativeBuffer\n ? nativeBuffer.alloc(0)\n : new this.buf.constructor(0);\n }\n return this._slice.call(this.buf, start, end);\n};\n\n/**\n * Reads a string preceeded by its byte length as a varint.\n * @returns {string} Value read\n */\nReader.prototype.string = function read_string() {\n var bytes = this.bytes();\n return utf8.read(bytes, 0, bytes.length);\n};\n\n/**\n * Skips the specified number of bytes if specified, otherwise skips a varint.\n * @param {number} [length] Length if known, otherwise a varint is assumed\n * @returns {Reader} `this`\n */\nReader.prototype.skip = function skip(length) {\n if (typeof length === \"number\") {\n /* istanbul ignore if */\n if (this.pos + length > this.len)\n throw indexOutOfRange(this, length);\n this.pos += length;\n } else {\n do {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n } while (this.buf[this.pos++] & 128);\n }\n return this;\n};\n\n/**\n * Skips the next element of the specified wire type.\n * @param {number} wireType Wire type received\n * @returns {Reader} `this`\n */\nReader.prototype.skipType = function(wireType) {\n switch (wireType) {\n case 0:\n this.skip();\n break;\n case 1:\n this.skip(8);\n break;\n case 2:\n this.skip(this.uint32());\n break;\n case 3:\n while ((wireType = this.uint32() & 7) !== 4) {\n this.skipType(wireType);\n }\n break;\n case 5:\n this.skip(4);\n break;\n\n /* istanbul ignore next */\n default:\n throw Error(\"invalid wire type \" + wireType + \" at offset \" + this.pos);\n }\n return this;\n};\n\nReader._configure = function(BufferReader_) {\n BufferReader = BufferReader_;\n Reader.create = create();\n BufferReader._configure();\n\n var fn = util.Long ? \"toLong\" : /* istanbul ignore next */ \"toNumber\";\n util.merge(Reader.prototype, {\n\n int64: function read_int64() {\n return readLongVarint.call(this)[fn](false);\n },\n\n uint64: function read_uint64() {\n return readLongVarint.call(this)[fn](true);\n },\n\n sint64: function read_sint64() {\n return readLongVarint.call(this).zzDecode()[fn](false);\n },\n\n fixed64: function read_fixed64() {\n return readFixed64.call(this)[fn](true);\n },\n\n sfixed64: function read_sfixed64() {\n return readFixed64.call(this)[fn](false);\n }\n\n });\n};\n", "\"use strict\";\nmodule.exports = BufferReader;\n\n// extends Reader\nvar Reader = require(\"./reader\");\n(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;\n\nvar util = require(\"./util/minimal\");\n\n/**\n * Constructs a new buffer reader instance.\n * @classdesc Wire format reader using node buffers.\n * @extends Reader\n * @constructor\n * @param {Buffer} buffer Buffer to read from\n */\nfunction BufferReader(buffer) {\n Reader.call(this, buffer);\n\n /**\n * Read buffer.\n * @name BufferReader#buf\n * @type {Buffer}\n */\n}\n\nBufferReader._configure = function () {\n /* istanbul ignore else */\n if (util.Buffer)\n BufferReader.prototype._slice = util.Buffer.prototype.slice;\n};\n\n\n/**\n * @override\n */\nBufferReader.prototype.string = function read_string_buffer() {\n var len = this.uint32(); // modifies pos\n return this.buf.utf8Slice\n ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len))\n : this.buf.toString(\"utf-8\", this.pos, this.pos = Math.min(this.pos + len, this.len));\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @name BufferReader#bytes\n * @function\n * @returns {Buffer} Value read\n */\n\nBufferReader._configure();\n", "\"use strict\";\nmodule.exports = Service;\n\nvar util = require(\"../util/minimal\");\n\n// Extends EventEmitter\n(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;\n\n/**\n * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}.\n *\n * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`.\n * @typedef rpc.ServiceMethodCallback\n * @template TRes extends Message<TRes>\n * @type {function}\n * @param {Error|null} error Error, if any\n * @param {TRes} [response] Response message\n * @returns {undefined}\n */\n\n/**\n * A service method part of a {@link rpc.Service} as created by {@link Service.create}.\n * @typedef rpc.ServiceMethod\n * @template TReq extends Message<TReq>\n * @template TRes extends Message<TRes>\n * @type {function}\n * @param {TReq|Properties<TReq>} request Request message or plain object\n * @param {rpc.ServiceMethodCallback<TRes>} [callback] Node-style callback called with the error, if any, and the response message\n * @returns {Promise<Message<TRes>>} Promise if `callback` has been omitted, otherwise `undefined`\n */\n\n/**\n * Constructs a new RPC service instance.\n * @classdesc An RPC service as returned by {@link Service#create}.\n * @exports rpc.Service\n * @extends util.EventEmitter\n * @constructor\n * @param {RPCImpl} rpcImpl RPC implementation\n * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\n * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\n */\nfunction Service(rpcImpl, requestDelimited, responseDelimited) {\n\n if (typeof rpcImpl !== \"function\")\n throw TypeError(\"rpcImpl must be a function\");\n\n util.EventEmitter.call(this);\n\n /**\n * RPC implementation. Becomes `null` once the service is ended.\n * @type {RPCImpl|null}\n */\n this.rpcImpl = rpcImpl;\n\n /**\n * Whether requests are length-delimited.\n * @type {boolean}\n */\n this.requestDelimited = Boolean(requestDelimited);\n\n /**\n * Whether responses are length-delimited.\n * @type {boolean}\n */\n this.responseDelimited = Boolean(responseDelimited);\n}\n\n/**\n * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}.\n * @param {Method|rpc.ServiceMethod<TReq,TRes>} method Reflected or static method\n * @param {Constructor<TReq>} requestCtor Request constructor\n * @param {Constructor<TRes>} responseCtor Response constructor\n * @param {TReq|Properties<TReq>} request Request message or plain object\n * @param {rpc.ServiceMethodCallback<TRes>} callback Service callback\n * @returns {undefined}\n * @template TReq extends Message<TReq>\n * @template TRes extends Message<TRes>\n */\nService.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) {\n\n if (!request)\n throw TypeError(\"request must be specified\");\n\n var self = this;\n if (!callback)\n return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request);\n\n if (!self.rpcImpl) {\n setTimeout(function() { callback(Error(\"already ended\")); }, 0);\n return undefined;\n }\n\n try {\n return self.rpcImpl(\n method,\n requestCtor[self.requestDelimited ? \"encodeDelimited\" : \"encode\"](request).finish(),\n function rpcCallback(err, response) {\n\n if (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n\n if (response === null) {\n self.end(/* endedByRPC */ true);\n return undefined;\n }\n\n if (!(response instanceof responseCtor)) {\n try {\n response = responseCtor[self.responseDelimited ? \"decodeDelimited\" : \"decode\"](response);\n } catch (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n }\n\n self.emit(\"data\", response, method);\n return callback(null, response);\n }\n );\n } catch (err) {\n self.emit(\"error\", err, method);\n setTimeout(function() { callback(err); }, 0);\n return undefined;\n }\n};\n\n/**\n * Ends this service and emits the `end` event.\n * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation.\n * @returns {rpc.Service} `this`\n */\nService.prototype.end = function end(endedByRPC) {\n if (this.rpcImpl) {\n if (!endedByRPC) // signal end to rpcImpl\n this.rpcImpl(null, null, null);\n this.rpcImpl = null;\n this.emit(\"end\").off();\n }\n return this;\n};\n", "\"use strict\";\n\n/**\n * Streaming RPC helpers.\n * @namespace\n */\nvar rpc = exports;\n\n/**\n * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets.\n * @typedef RPCImpl\n * @type {function}\n * @param {Method|rpc.ServiceMethod<Message<{}>,Message<{}>>} method Reflected or static method being called\n * @param {Uint8Array} requestData Request data\n * @param {RPCImplCallback} callback Callback function\n * @returns {undefined}\n * @example\n * function rpcImpl(method, requestData, callback) {\n * if (protobuf.util.lcFirst(method.name) !== \"myMethod\") // compatible with static code\n * throw Error(\"no such method\");\n * asynchronouslyObtainAResponse(requestData, function(err, responseData) {\n * callback(err, responseData);\n * });\n * }\n */\n\n/**\n * Node-style callback as used by {@link RPCImpl}.\n * @typedef RPCImplCallback\n * @type {function}\n * @param {Error|null} error Error, if any, otherwise `null`\n * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error\n * @returns {undefined}\n */\n\nrpc.Service = require(\"./rpc/service\");\n", "\"use strict\";\nmodule.exports = {};\n\n/**\n * Named roots.\n * This is where pbjs stores generated structures (the option `-r, --root` specifies a name).\n * Can also be used manually to make roots available across modules.\n * @name roots\n * @type {Object.<string,Root>}\n * @example\n * // pbjs -r myroot -o compiled.js ...\n *\n * // in another module:\n * require(\"./compiled.js\");\n *\n * // in any subsequent module:\n * var root = protobuf.roots[\"myroot\"];\n */\n", "\"use strict\";\nvar protobuf = exports;\n\n/**\n * Build type, one of `\"full\"`, `\"light\"` or `\"minimal\"`.\n * @name build\n * @type {string}\n * @const\n */\nprotobuf.build = \"minimal\";\n\n// Serialization\nprotobuf.Writer = require(\"./writer\");\nprotobuf.BufferWriter = require(\"./writer_buffer\");\nprotobuf.Reader = require(\"./reader\");\nprotobuf.BufferReader = require(\"./reader_buffer\");\n\n// Utility\nprotobuf.util = require(\"./util/minimal\");\nprotobuf.rpc = require(\"./rpc\");\nprotobuf.roots = require(\"./roots\");\nprotobuf.configure = configure;\n\n/* istanbul ignore next */\n/**\n * Reconfigures the library according to the environment.\n * @returns {undefined}\n */\nfunction configure() {\n protobuf.util._configure();\n protobuf.Writer._configure(protobuf.BufferWriter);\n protobuf.Reader._configure(protobuf.BufferReader);\n}\n\n// Set up buffer utility according to the environment\nconfigure();\n", "// minimal library entry point.\n\n\"use strict\";\nmodule.exports = require(\"./src/index-minimal\");\n", "/*\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 * as api from '@opentelemetry/api';\nimport {\n InstrumentationLibrary,\n sanitizeAttributes,\n isTracingSuppressed,\n} from '@opentelemetry/core';\nimport { IResource } from '@opentelemetry/resources';\nimport { BasicTracerProvider } from './BasicTracerProvider';\nimport { Span } from './Span';\nimport { GeneralLimits, SpanLimits, TracerConfig } from './types';\nimport { mergeConfig } from './utility';\nimport { SpanProcessor } from './SpanProcessor';\nimport { Sampler } from './Sampler';\nimport { IdGenerator } from './IdGenerator';\nimport { RandomIdGenerator } from './platform';\n\n/**\n * This class represents a basic tracer.\n */\nexport class Tracer implements api.Tracer {\n private readonly _sampler: Sampler;\n private readonly _generalLimits: GeneralLimits;\n private readonly _spanLimits: SpanLimits;\n private readonly _idGenerator: IdGenerator;\n readonly resource: IResource;\n readonly instrumentationLibrary: InstrumentationLibrary;\n\n /**\n * Constructs a new Tracer instance.\n */\n constructor(\n instrumentationLibrary: InstrumentationLibrary,\n config: TracerConfig,\n private _tracerProvider: BasicTracerProvider\n ) {\n const localConfig = mergeConfig(config);\n this._sampler = localConfig.sampler;\n this._generalLimits = localConfig.generalLimits;\n this._spanLimits = localConfig.spanLimits;\n this._idGenerator = config.idGenerator || new RandomIdGenerator();\n this.resource = _tracerProvider.resource;\n this.instrumentationLibrary = instrumentationLibrary;\n }\n\n /**\n * Starts a new Span or returns the default NoopSpan based on the sampling\n * decision.\n */\n startSpan(\n name: string,\n options: api.SpanOptions = {},\n context = api.context.active()\n ): api.Span {\n // remove span from context in case a root span is requested via options\n if (options.root) {\n context = api.trace.deleteSpan(context);\n }\n const parentSpan = api.trace.getSpan(context);\n\n if (isTracingSuppressed(context)) {\n api.diag.debug('Instrumentation suppressed, returning Noop Span');\n const nonRecordingSpan = api.trace.wrapSpanContext(\n api.INVALID_SPAN_CONTEXT\n );\n return nonRecordingSpan;\n }\n\n const parentSpanContext = parentSpan?.spanContext();\n const spanId = this._idGenerator.generateSpanId();\n let traceId;\n let traceState;\n let parentSpanId;\n if (\n !parentSpanContext ||\n !api.trace.isSpanContextValid(parentSpanContext)\n ) {\n // New root span.\n traceId = this._idGenerator.generateTraceId();\n } else {\n // New child span.\n traceId = parentSpanContext.traceId;\n traceState = parentSpanContext.traceState;\n parentSpanId = parentSpanContext.spanId;\n }\n\n const spanKind = options.kind ?? api.SpanKind.INTERNAL;\n const links = (options.links ?? []).map(link => {\n return {\n context: link.context,\n attributes: sanitizeAttributes(link.attributes),\n };\n });\n const attributes = sanitizeAttributes(options.attributes);\n // make sampling decision\n const samplingResult = this._sampler.shouldSample(\n context,\n traceId,\n name,\n spanKind,\n attributes,\n links\n );\n\n traceState = samplingResult.traceState ?? traceState;\n\n const traceFlags =\n samplingResult.decision === api.SamplingDecision.RECORD_AND_SAMPLED\n ? api.TraceFlags.SAMPLED\n : api.TraceFlags.NONE;\n const spanContext = { traceId, spanId, traceFlags, traceState };\n if (samplingResult.decision === api.SamplingDecision.NOT_RECORD) {\n api.diag.debug(\n 'Recording is off, propagating context in a non-recording span'\n );\n const nonRecordingSpan = api.trace.wrapSpanContext(spanContext);\n return nonRecordingSpan;\n }\n\n // Set initial span attributes. The attributes object may have been mutated\n // by the sampler, so we sanitize the merged attributes before setting them.\n const initAttributes = sanitizeAttributes(\n Object.assign(attributes, samplingResult.attributes)\n );\n\n const span = new Span(\n this,\n context,\n name,\n spanContext,\n spanKind,\n parentSpanId,\n links,\n options.startTime,\n undefined,\n initAttributes\n );\n return span;\n }\n\n /**\n * Starts a new {@link Span} and calls the given function passing it the\n * created span as first argument.\n * Additionally the new span gets set in context and this context is activated\n * for the duration of the function call.\n *\n * @param name The name of the span\n * @param [options] SpanOptions used for span creation\n * @param [context] Context to use to extract parent\n * @param fn function called in the context of the span and receives the newly created span as an argument\n * @returns return value of fn\n * @example\n * const something = tracer.startActiveSpan('op', span => {\n * try {\n * do some work\n * span.setStatus({code: SpanStatusCode.OK});\n * return something;\n * } catch (err) {\n * span.setStatus({\n * code: SpanStatusCode.ERROR,\n * message: err.message,\n * });\n * throw err;\n * } finally {\n * span.end();\n * }\n * });\n * @example\n * const span = tracer.startActiveSpan('op', span => {\n * try {\n * do some work\n * return span;\n * } catch (err) {\n * span.setStatus({\n * code: SpanStatusCode.ERROR,\n * message: err.message,\n * });\n * throw err;\n * }\n * });\n * do some more work\n * span.end();\n */\n startActiveSpan<F extends (span: api.Span) => ReturnType<F>>(\n name: string,\n fn: F\n ): ReturnType<F>;\n startActiveSpan<F extends (span: api.Span) => ReturnType<F>>(\n name: string,\n opts: api.SpanOptions,\n fn: F\n ): ReturnType<F>;\n startActiveSpan<F extends (span: api.Span) => ReturnType<F>>(\n name: string,\n opts: api.SpanOptions,\n ctx: api.Context,\n fn: F\n ): ReturnType<F>;\n startActiveSpan<F extends (span: api.Span) => ReturnType<F>>(\n name: string,\n arg2?: F | api.SpanOptions,\n arg3?: F | api.Context,\n arg4?: F\n ): ReturnType<F> | undefined {\n let opts: api.SpanOptions | undefined;\n let ctx: api.Context | undefined;\n let fn: F;\n\n if (arguments.length < 2) {\n return;\n } else if (arguments.length === 2) {\n fn = arg2 as F;\n } else if (arguments.length === 3) {\n opts = arg2 as api.SpanOptions | undefined;\n fn = arg3 as F;\n } else {\n opts = arg2 as api.SpanOptions | undefined;\n ctx = arg3 as api.Context | undefined;\n fn = arg4 as F;\n }\n\n const parentContext = ctx ?? api.context.active();\n const span = this.startSpan(name, opts, parentContext);\n const contextWithSpanSet = api.trace.setSpan(parentContext, span);\n\n return api.context.with(contextWithSpanSet, fn, undefined, span);\n }\n\n /** Returns the active {@link GeneralLimits}. */\n getGeneralLimits(): GeneralLimits {\n return this._generalLimits;\n }\n\n /** Returns the active {@link SpanLimits}. */\n getSpanLimits(): SpanLimits {\n return this._spanLimits;\n }\n\n getActiveSpanProcessor(): SpanProcessor {\n return this._tracerProvider.getActiveSpanProcessor();\n }\n}\n", "/*\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 {\n Context,\n diag,\n Exception,\n HrTime,\n Link,\n Span as APISpan,\n SpanAttributes,\n SpanAttributeValue,\n SpanContext,\n SpanKind,\n SpanStatus,\n SpanStatusCode,\n TimeInput,\n} from '@opentelemetry/api';\nimport {\n addHrTimes,\n millisToHrTime,\n getTimeOrigin,\n hrTime,\n hrTimeDuration,\n InstrumentationLibrary,\n isAttributeValue,\n isTimeInput,\n isTimeInputHrTime,\n otperformance,\n sanitizeAttributes,\n} from '@opentelemetry/core';\nimport { IResource } from '@opentelemetry/resources';\nimport { SemanticAttributes } from '@opentelemetry/semantic-conventions';\nimport { ExceptionEventName } from './enums';\nimport { ReadableSpan } from './export/ReadableSpan';\nimport { SpanProcessor } from './SpanProcessor';\nimport { TimedEvent } from './TimedEvent';\nimport { Tracer } from './Tracer';\nimport { SpanLimits } from './types';\n\n/**\n * This class represents a span.\n */\nexport class Span implements APISpan, ReadableSpan {\n // Below properties are included to implement ReadableSpan for export\n // purposes but are not intended to be written-to directly.\n private readonly _spanContext: SpanContext;\n readonly kind: SpanKind;\n readonly parentSpanId?: string;\n readonly attributes: SpanAttributes = {};\n readonly links: Link[] = [];\n readonly events: TimedEvent[] = [];\n readonly startTime: HrTime;\n readonly resource: IResource;\n readonly instrumentationLibrary: InstrumentationLibrary;\n\n private _droppedAttributesCount = 0;\n private _droppedEventsCount: number = 0;\n private _droppedLinksCount: number = 0;\n\n name: string;\n status: SpanStatus = {\n code: SpanStatusCode.UNSET,\n };\n endTime: HrTime = [0, 0];\n private _ended = false;\n private _duration: HrTime = [-1, -1];\n private readonly _spanProcessor: SpanProcessor;\n private readonly _spanLimits: SpanLimits;\n private readonly _attributeValueLengthLimit: number;\n\n private readonly _performanceStartTime: number;\n private readonly _performanceOffset: number;\n private readonly _startTimeProvided: boolean;\n\n /**\n * Constructs a new Span instance.\n *\n * @deprecated calling Span constructor directly is not supported. Please use tracer.startSpan.\n * */\n constructor(\n parentTracer: Tracer,\n context: Context,\n spanName: string,\n spanContext: SpanContext,\n kind: SpanKind,\n parentSpanId?: string,\n links: Link[] = [],\n startTime?: TimeInput,\n _deprecatedClock?: unknown, // keeping this argument even though it is unused to ensure backwards compatibility\n attributes?: SpanAttributes\n ) {\n this.name = spanName;\n this._spanContext = spanContext;\n this.parentSpanId = parentSpanId;\n this.kind = kind;\n this.links = links;\n\n const now = Date.now();\n this._performanceStartTime = otperformance.now();\n this._performanceOffset =\n now - (this._performanceStartTime + getTimeOrigin());\n this._startTimeProvided = startTime != null;\n\n this.startTime = this._getTime(startTime ?? now);\n\n this.resource = parentTracer.resource;\n this.instrumentationLibrary = parentTracer.instrumentationLibrary;\n this._spanLimits = parentTracer.getSpanLimits();\n\n if (attributes != null) {\n this.setAttributes(attributes);\n }\n\n this._spanProcessor = parentTracer.getActiveSpanProcessor();\n this._spanProcessor.onStart(this, context);\n this._attributeValueLengthLimit =\n this._spanLimits.attributeValueLengthLimit || 0;\n }\n\n spanContext(): SpanContext {\n return this._spanContext;\n }\n\n setAttribute(key: string, value?: SpanAttributeValue): this;\n setAttribute(key: string, value: unknown): this {\n if (value == null || this._isSpanEnded()) return this;\n if (key.length === 0) {\n diag.warn(`Invalid attribute key: ${key}`);\n return this;\n }\n if (!isAttributeValue(value)) {\n diag.warn(`Invalid attribute value set for key: ${key}`);\n return this;\n }\n\n if (\n Object.keys(this.attributes).length >=\n this._spanLimits.attributeCountLimit! &&\n !Object.prototype.hasOwnProperty.call(this.attributes, key)\n ) {\n this._droppedAttributesCount++;\n return this;\n }\n this.attributes[key] = this._truncateToSize(value);\n return this;\n }\n\n setAttributes(attributes: SpanAttributes): this {\n for (const [k, v] of Object.entries(attributes)) {\n this.setAttribute(k, v);\n }\n return this;\n }\n\n /**\n *\n * @param name Span Name\n * @param [attributesOrStartTime] Span attributes or start time\n * if type is {@type TimeInput} and 3rd param is undefined\n * @param [timeStamp] Specified time stamp for the event\n */\n addEvent(\n name: string,\n attributesOrStartTime?: SpanAttributes | TimeInput,\n timeStamp?: TimeInput\n ): this {\n if (this._isSpanEnded()) return this;\n if (this._spanLimits.eventCountLimit === 0) {\n diag.warn('No events allowed.');\n this._droppedEventsCount++;\n return this;\n }\n if (this.events.length >= this._spanLimits.eventCountLimit!) {\n diag.warn('Dropping extra events.');\n this.events.shift();\n this._droppedEventsCount++;\n }\n\n if (isTimeInput(attributesOrStartTime)) {\n if (!isTimeInput(timeStamp)) {\n timeStamp = attributesOrStartTime;\n }\n attributesOrStartTime = undefined;\n }\n\n const attributes = sanitizeAttributes(attributesOrStartTime);\n\n this.events.push({\n name,\n attributes,\n time: this._getTime(timeStamp),\n droppedAttributesCount: 0,\n });\n return this;\n }\n\n setStatus(status: SpanStatus): this {\n if (this._isSpanEnded()) return this;\n this.status = status;\n return this;\n }\n\n updateName(name: string): this {\n if (this._isSpanEnded()) return this;\n this.name = name;\n return this;\n }\n\n end(endTime?: TimeInput): void {\n if (this._isSpanEnded()) {\n diag.error(\n `${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`\n );\n return;\n }\n this._ended = true;\n\n this.endTime = this._getTime(endTime);\n this._duration = hrTimeDuration(this.startTime, this.endTime);\n\n if (this._duration[0] < 0) {\n diag.warn(\n 'Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.',\n this.startTime,\n this.endTime\n );\n this.endTime = this.startTime.slice() as HrTime;\n this._duration = [0, 0];\n }\n\n this._spanProcessor.onEnd(this);\n }\n\n private _getTime(inp?: TimeInput): HrTime {\n if (typeof inp === 'number' && inp < otperformance.now()) {\n // must be a performance timestamp\n // apply correction and convert to hrtime\n return hrTime(inp + this._performanceOffset);\n }\n\n if (typeof inp === 'number') {\n return millisToHrTime(inp);\n }\n\n if (inp instanceof Date) {\n return millisToHrTime(inp.getTime());\n }\n\n if (isTimeInputHrTime(inp)) {\n return inp;\n }\n\n if (this._startTimeProvided) {\n // if user provided a time for the start manually\n // we can't use duration to calculate event/end times\n return millisToHrTime(Date.now());\n }\n\n const msDuration = otperformance.now() - this._performanceStartTime;\n return addHrTimes(this.startTime, millisToHrTime(msDuration));\n }\n\n isRecording(): boolean {\n return this._ended === false;\n }\n\n recordException(exception: Exception, time?: TimeInput): void {\n const attributes: SpanAttributes = {};\n if (typeof exception === 'string') {\n attributes[SemanticAttributes.EXCEPTION_MESSAGE] = exception;\n } else if (exception) {\n if (exception.code) {\n attributes[SemanticAttributes.EXCEPTION_TYPE] =\n exception.code.toString();\n } else if (exception.name) {\n attributes[SemanticAttributes.EXCEPTION_TYPE] = exception.name;\n }\n if (exception.message) {\n attributes[SemanticAttributes.EXCEPTION_MESSAGE] = exception.message;\n }\n if (exception.stack) {\n attributes[SemanticAttributes.EXCEPTION_STACKTRACE] = exception.stack;\n }\n }\n\n // these are minimum requirements from spec\n if (\n attributes[SemanticAttributes.EXCEPTION_TYPE] ||\n attributes[SemanticAttributes.EXCEPTION_MESSAGE]\n ) {\n this.addEvent(ExceptionEventName, attributes, time);\n } else {\n diag.warn(`Failed to record an exception ${exception}`);\n }\n }\n\n get duration(): HrTime {\n return this._duration;\n }\n\n get ended(): boolean {\n return this._ended;\n }\n\n get droppedAttributesCount(): number {\n return this._droppedAttributesCount;\n }\n\n get droppedEventsCount(): number {\n return this._droppedEventsCount;\n }\n\n get droppedLinksCount(): number {\n return this._droppedLinksCount;\n }\n\n private _isSpanEnded(): boolean {\n if (this._ended) {\n diag.warn(\n `Can not execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`\n );\n }\n return this._ended;\n }\n\n // Utility function to truncate given value within size\n // for value type of string, will truncate to given limit\n // for type of non-string, will return same value\n private _truncateToLimitUtil(value: string, limit: number): string {\n if (value.length <= limit) {\n return value;\n }\n return value.substr(0, limit);\n }\n\n /**\n * If the given attribute value is of type string and has more characters than given {@code attributeValueLengthLimit} then\n * return string with trucated to {@code attributeValueLengthLimit} characters\n *\n * If the given attribute value is array of strings then\n * return new array of strings with each element truncated to {@code attributeValueLengthLimit} characters\n *\n * Otherwise return same Attribute {@code value}\n *\n * @param value Attribute value\n * @returns truncated attribute value if required, otherwise same value\n */\n private _truncateToSize(value: SpanAttributeValue): SpanAttributeValue {\n const limit = this._attributeValueLengthLimit;\n // Check limit\n if (limit <= 0) {\n // Negative values are invalid, so do not truncate\n diag.warn(`Attribute value limit must be positive, got ${limit}`);\n return value;\n }\n\n // String\n if (typeof value === 'string') {\n return this._truncateToLimitUtil(value, limit);\n }\n\n // Array of strings\n if (Array.isArray(value)) {\n return (value as []).map(val =>\n typeof val === 'string' ? this._truncateToLimitUtil(val, limit) : val\n );\n }\n\n // Other types, no need to apply value length limit\n return value;\n }\n}\n", "/*\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// Event name definitions\nexport const ExceptionEventName = 'exception';\n", "/*\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 { diag } from '@opentelemetry/api';\nimport { getEnv, TracesSamplerValues, ENVIRONMENT } from '@opentelemetry/core';\nimport { Sampler } from './Sampler';\nimport { AlwaysOffSampler } from './sampler/AlwaysOffSampler';\nimport { AlwaysOnSampler } from './sampler/AlwaysOnSampler';\nimport { ParentBasedSampler } from './sampler/ParentBasedSampler';\nimport { TraceIdRatioBasedSampler } from './sampler/TraceIdRatioBasedSampler';\n\nconst env = getEnv();\nconst FALLBACK_OTEL_TRACES_SAMPLER = TracesSamplerValues.AlwaysOn;\nconst DEFAULT_RATIO = 1;\n\n/**\n * Load default configuration. For fields with primitive values, any user-provided\n * value will override the corresponding default value. For fields with\n * non-primitive values (like `spanLimits`), the user-provided value will be\n * used to extend the default value.\n */\n\n// object needs to be wrapped in this function and called when needed otherwise\n// envs are parsed before tests are ran - causes tests using these envs to fail\nexport function loadDefaultConfig() {\n return {\n sampler: buildSamplerFromEnv(env),\n forceFlushTimeoutMillis: 30000,\n generalLimits: {\n attributeValueLengthLimit: getEnv().OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT,\n attributeCountLimit: getEnv().OTEL_ATTRIBUTE_COUNT_LIMIT,\n },\n spanLimits: {\n attributeValueLengthLimit:\n getEnv().OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT,\n attributeCountLimit: getEnv().OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT,\n linkCountLimit: getEnv().OTEL_SPAN_LINK_COUNT_LIMIT,\n eventCountLimit: getEnv().OTEL_SPAN_EVENT_COUNT_LIMIT,\n attributePerEventCountLimit:\n getEnv().OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT,\n attributePerLinkCountLimit:\n getEnv().OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT,\n },\n };\n}\n\n/**\n * Based on environment, builds a sampler, complies with specification.\n * @param environment optional, by default uses getEnv(), but allows passing a value to reuse parsed environment\n */\nexport function buildSamplerFromEnv(\n environment: Required<ENVIRONMENT> = getEnv()\n): Sampler {\n switch (environment.OTEL_TRACES_SAMPLER) {\n case TracesSamplerValues.AlwaysOn:\n return new AlwaysOnSampler();\n case TracesSamplerValues.AlwaysOff:\n return new AlwaysOffSampler();\n case TracesSamplerValues.ParentBasedAlwaysOn:\n return new ParentBasedSampler({\n root: new AlwaysOnSampler(),\n });\n case TracesSamplerValues.ParentBasedAlwaysOff:\n return new ParentBasedSampler({\n root: new AlwaysOffSampler(),\n });\n case TracesSamplerValues.TraceIdRatio:\n return new TraceIdRatioBasedSampler(\n getSamplerProbabilityFromEnv(environment)\n );\n case TracesSamplerValues.ParentBasedTraceIdRatio:\n return new ParentBasedSampler({\n root: new TraceIdRatioBasedSampler(\n getSamplerProbabilityFromEnv(environment)\n ),\n });\n default:\n diag.error(\n `OTEL_TRACES_SAMPLER value \"${environment.OTEL_TRACES_SAMPLER} invalid, defaulting to ${FALLBACK_OTEL_TRACES_SAMPLER}\".`\n );\n return new AlwaysOnSampler();\n }\n}\n\nfunction getSamplerProbabilityFromEnv(\n environment: Required<ENVIRONMENT>\n): number | undefined {\n if (\n environment.OTEL_TRACES_SAMPLER_ARG === undefined ||\n environment.OTEL_TRACES_SAMPLER_ARG === ''\n ) {\n diag.error(\n `OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${DEFAULT_RATIO}.`\n );\n return DEFAULT_RATIO;\n }\n\n const probability = Number(environment.OTEL_TRACES_SAMPLER_ARG);\n\n if (isNaN(probability)) {\n diag.error(\n `OTEL_TRACES_SAMPLER_ARG=${environment.OTEL_TRACES_SAMPLER_ARG} was given, but it is invalid, defaulting to ${DEFAULT_RATIO}.`\n );\n return DEFAULT_RATIO;\n }\n\n if (probability < 0 || probability > 1) {\n diag.error(\n `OTEL_TRACES_SAMPLER_ARG=${environment.OTEL_TRACES_SAMPLER_ARG} was given, but it is out of range ([0..1]), defaulting to ${DEFAULT_RATIO}.`\n );\n return DEFAULT_RATIO;\n }\n\n return probability;\n}\n", "/*\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 {\n Context,\n Link,\n SpanAttributes,\n SpanKind,\n TraceState,\n} from '@opentelemetry/api';\n\n/**\n * A sampling decision that determines how a {@link Span} will be recorded\n * and collected.\n */\nexport enum SamplingDecision {\n /**\n * `Span.isRecording() === false`, span will not be recorded and all events\n * and attributes will be dropped.\n */\n NOT_RECORD,\n /**\n * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags}\n * MUST NOT be set.\n */\n RECORD,\n /**\n * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags}\n * MUST be set.\n */\n RECORD_AND_SAMPLED,\n}\n\n/**\n * A sampling result contains a decision for a {@link Span} and additional\n * attributes the sampler would like to added to the Span.\n */\nexport interface SamplingResult {\n /**\n * A sampling decision, refer to {@link SamplingDecision} for details.\n */\n decision: SamplingDecision;\n /**\n * The list of attributes returned by SamplingResult MUST be immutable.\n * Caller may call {@link Sampler}.shouldSample any number of times and\n * can safely cache the returned value.\n */\n attributes?: Readonly<SpanAttributes>;\n /**\n * A {@link TraceState} that will be associated with the {@link Span} through\n * the new {@link SpanContext}. Samplers SHOULD return the TraceState from\n * the passed-in {@link Context} if they do not intend to change it. Leaving\n * the value undefined will also leave the TraceState unchanged.\n */\n traceState?: TraceState;\n}\n\n/**\n * This interface represent a sampler. Sampling is a mechanism to control the\n * noise and overhead introduced by OpenTelemetry by reducing the number of\n * samples of traces collected and sent to the backend.\n */\nexport interface Sampler {\n /**\n * Checks whether span needs to be created and tracked.\n *\n * @param context Parent Context which may contain a span.\n * @param traceId of the span to be created. It can be different from the\n * traceId in the {@link SpanContext}. Typically in situations when the\n * span to be created starts a new trace.\n * @param spanName of the span to be created.\n * @param spanKind of the span to be created.\n * @param attributes Initial set of SpanAttributes for the Span being constructed.\n * @param links Collection of links that will be associated with the Span to\n * be created. Typically useful for batch operations.\n * @returns a {@link SamplingResult}.\n */\n shouldSample(\n context: Context,\n traceId: string,\n spanName: string,\n spanKind: SpanKind,\n attributes: SpanAttributes,\n links: Link[]\n ): SamplingResult;\n\n /** Returns the sampler name or short description with the configuration. */\n toString(): string;\n}\n", "/*\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 { Sampler, SamplingDecision, SamplingResult } from '../Sampler';\n\n/** Sampler that samples no traces. */\nexport class AlwaysOffSampler implements Sampler {\n shouldSample(): SamplingResult {\n return {\n decision: SamplingDecision.NOT_RECORD,\n };\n }\n\n toString(): string {\n return 'AlwaysOffSampler';\n }\n}\n", "/*\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 { Sampler, SamplingDecision, SamplingResult } from '../Sampler';\n\n/** Sampler that samples all traces. */\nexport class AlwaysOnSampler implements Sampler {\n shouldSample(): SamplingResult {\n return {\n decision: SamplingDecision.RECORD_AND_SAMPLED,\n };\n }\n\n toString(): string {\n return 'AlwaysOnSampler';\n }\n}\n", "/*\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 {\n Context,\n isSpanContextValid,\n Link,\n SpanAttributes,\n SpanKind,\n TraceFlags,\n trace,\n} from '@opentelemetry/api';\nimport { globalErrorHandler } from '@opentelemetry/core';\nimport { AlwaysOffSampler } from './AlwaysOffSampler';\nimport { AlwaysOnSampler } from './AlwaysOnSampler';\nimport { Sampler, SamplingResult } from '../Sampler';\n\n/**\n * A composite sampler that either respects the parent span's sampling decision\n * or delegates to `delegateSampler` for root spans.\n */\nexport class ParentBasedSampler implements Sampler {\n private _root: Sampler;\n private _remoteParentSampled: Sampler;\n private _remoteParentNotSampled: Sampler;\n private _localParentSampled: Sampler;\n private _localParentNotSampled: Sampler;\n\n constructor(config: ParentBasedSamplerConfig) {\n this._root = config.root;\n\n if (!this._root) {\n globalErrorHandler(\n new Error('ParentBasedSampler must have a root sampler configured')\n );\n this._root = new AlwaysOnSampler();\n }\n\n this._remoteParentSampled =\n config.remoteParentSampled ?? new AlwaysOnSampler();\n this._remoteParentNotSampled =\n config.remoteParentNotSampled ?? new AlwaysOffSampler();\n this._localParentSampled =\n config.localParentSampled ?? new AlwaysOnSampler();\n this._localParentNotSampled =\n config.localParentNotSampled ?? new AlwaysOffSampler();\n }\n\n shouldSample(\n context: Context,\n traceId: string,\n spanName: string,\n spanKind: SpanKind,\n attributes: SpanAttributes,\n links: Link[]\n ): SamplingResult {\n const parentContext = trace.getSpanContext(context);\n\n if (!parentContext || !isSpanContextValid(parentContext)) {\n return this._root.shouldSample(\n context,\n traceId,\n spanName,\n spanKind,\n attributes,\n links\n );\n }\n\n if (parentContext.isRemote) {\n if (parentContext.traceFlags & TraceFlags.SAMPLED) {\n return this._remoteParentSampled.shouldSample(\n context,\n traceId,\n spanName,\n spanKind,\n attributes,\n links\n );\n }\n return this._remoteParentNotSampled.shouldSample(\n context,\n traceId,\n spanName,\n spanKind,\n attributes,\n links\n );\n }\n\n if (parentContext.traceFlags & TraceFlags.SAMPLED) {\n return this._localParentSampled.shouldSample(\n context,\n traceId,\n spanName,\n spanKind,\n attributes,\n links\n );\n }\n\n return this._localParentNotSampled.shouldSample(\n context,\n traceId,\n spanName,\n spanKind,\n attributes,\n links\n );\n }\n\n toString(): string {\n return `ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`;\n }\n}\n\ninterface ParentBasedSamplerConfig {\n /** Sampler called for spans with no parent */\n root: Sampler;\n /** Sampler called for spans with a remote parent which was sampled. Default AlwaysOn */\n remoteParentSampled?: Sampler;\n /** Sampler called for spans with a remote parent which was not sampled. Default AlwaysOff */\n remoteParentNotSampled?: Sampler;\n /** Sampler called for spans with a local parent which was sampled. Default AlwaysOn */\n localParentSampled?: Sampler;\n /** Sampler called for spans with a local parent which was not sampled. Default AlwaysOff */\n localParentNotSampled?: Sampler;\n}\n", "/*\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 { isValidTraceId } from '@opentelemetry/api';\nimport { Sampler, SamplingDecision, SamplingResult } from '../Sampler';\n\n/** Sampler that samples a given fraction of traces based of trace id deterministically. */\nexport class TraceIdRatioBasedSampler implements Sampler {\n private _upperBound: number;\n\n constructor(private readonly _ratio: number = 0) {\n this._ratio = this._normalize(_ratio);\n this._upperBound = Math.floor(this._ratio * 0xffffffff);\n }\n\n shouldSample(context: unknown, traceId: string): SamplingResult {\n return {\n decision:\n isValidTraceId(traceId) && this._accumulate(traceId) < this._upperBound\n ? SamplingDecision.RECORD_AND_SAMPLED\n : SamplingDecision.NOT_RECORD,\n };\n }\n\n toString(): string {\n return `TraceIdRatioBased{${this._ratio}}`;\n }\n\n private _normalize(ratio: number): number {\n if (typeof ratio !== 'number' || isNaN(ratio)) return 0;\n return ratio >= 1 ? 1 : ratio <= 0 ? 0 : ratio;\n }\n\n private _accumulate(traceId: string): number {\n let accumulation = 0;\n for (let i = 0; i < traceId.length / 8; i++) {\n const pos = i * 8;\n const part = parseInt(traceId.slice(pos, pos + 8), 16);\n accumulation = (accumulation ^ part) >>> 0;\n }\n return accumulation;\n }\n}\n", "/*\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 { buildSamplerFromEnv, loadDefaultConfig } from './config';\nimport { Sampler } from './Sampler';\nimport { SpanLimits, TracerConfig, GeneralLimits } from './types';\nimport {\n DEFAULT_ATTRIBUTE_COUNT_LIMIT,\n DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,\n getEnvWithoutDefaults,\n} from '@opentelemetry/core';\n\n/**\n * Function to merge Default configuration (as specified in './config') with\n * user provided configurations.\n */\nexport function mergeConfig(userConfig: TracerConfig): TracerConfig & {\n sampler: Sampler;\n spanLimits: SpanLimits;\n generalLimits: GeneralLimits;\n} {\n const perInstanceDefaults: Partial<TracerConfig> = {\n sampler: buildSamplerFromEnv(),\n };\n\n const DEFAULT_CONFIG = loadDefaultConfig();\n\n const target = Object.assign(\n {},\n DEFAULT_CONFIG,\n perInstanceDefaults,\n userConfig\n );\n\n target.generalLimits = Object.assign(\n {},\n DEFAULT_CONFIG.generalLimits,\n userConfig.generalLimits || {}\n );\n\n target.spanLimits = Object.assign(\n {},\n DEFAULT_CONFIG.spanLimits,\n userConfig.spanLimits || {}\n );\n\n return target;\n}\n\n/**\n * When general limits are provided and model specific limits are not,\n * configures the model specific limits by using the values from the general ones.\n * @param userConfig User provided tracer configuration\n */\nexport function reconfigureLimits(userConfig: TracerConfig): TracerConfig {\n const spanLimits = Object.assign({}, userConfig.spanLimits);\n\n const parsedEnvConfig = getEnvWithoutDefaults();\n\n /**\n * Reassign span attribute count limit to use first non null value defined by user or use default value\n */\n spanLimits.attributeCountLimit =\n userConfig.spanLimits?.attributeCountLimit ??\n userConfig.generalLimits?.attributeCountLimit ??\n parsedEnvConfig.OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT ??\n parsedEnvConfig.OTEL_ATTRIBUTE_COUNT_LIMIT ??\n DEFAULT_ATTRIBUTE_COUNT_LIMIT;\n\n /**\n * Reassign span attribute value length limit to use first non null value defined by user or use default value\n */\n spanLimits.attributeValueLengthLimit =\n userConfig.spanLimits?.attributeValueLengthLimit ??\n userConfig.generalLimits?.attributeValueLengthLimit ??\n parsedEnvConfig.OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT ??\n parsedEnvConfig.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT ??\n DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT;\n\n return Object.assign({}, userConfig, { spanLimits });\n}\n", "/*\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 { context, Context, diag, TraceFlags } from '@opentelemetry/api';\nimport {\n BindOnceFuture,\n ExportResultCode,\n getEnv,\n globalErrorHandler,\n suppressTracing,\n unrefTimer,\n} from '@opentelemetry/core';\nimport { Span } from '../Span';\nimport { SpanProcessor } from '../SpanProcessor';\nimport { BufferConfig } from '../types';\nimport { ReadableSpan } from './ReadableSpan';\nimport { SpanExporter } from './SpanExporter';\n\n/**\n * Implementation of the {@link SpanProcessor} that batches spans exported by\n * the SDK then pushes them to the exporter pipeline.\n */\nexport abstract class BatchSpanProcessorBase<T extends BufferConfig>\n implements SpanProcessor\n{\n private readonly _maxExportBatchSize: number;\n private readonly _maxQueueSize: number;\n private readonly _scheduledDelayMillis: number;\n private readonly _exportTimeoutMillis: number;\n\n private _isExporting = false;\n private _finishedSpans: ReadableSpan[] = [];\n private _timer: NodeJS.Timeout | undefined;\n private _shutdownOnce: BindOnceFuture<void>;\n private _droppedSpansCount: number = 0;\n\n constructor(\n private readonly _exporter: SpanExporter,\n config?: T\n ) {\n const env = getEnv();\n this._maxExportBatchSize =\n typeof config?.maxExportBatchSize === 'number'\n ? config.maxExportBatchSize\n : env.OTEL_BSP_MAX_EXPORT_BATCH_SIZE;\n this._maxQueueSize =\n typeof config?.maxQueueSize === 'number'\n ? config.maxQueueSize\n : env.OTEL_BSP_MAX_QUEUE_SIZE;\n this._scheduledDelayMillis =\n typeof config?.scheduledDelayMillis === 'number'\n ? config.scheduledDelayMillis\n : env.OTEL_BSP_SCHEDULE_DELAY;\n this._exportTimeoutMillis =\n typeof config?.exportTimeoutMillis === 'number'\n ? config.exportTimeoutMillis\n : env.OTEL_BSP_EXPORT_TIMEOUT;\n\n this._shutdownOnce = new BindOnceFuture(this._shutdown, this);\n\n if (this._maxExportBatchSize > this._maxQueueSize) {\n diag.warn(\n 'BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize'\n );\n this._maxExportBatchSize = this._maxQueueSize;\n }\n }\n\n forceFlush(): Promise<void> {\n if (this._shutdownOnce.isCalled) {\n return this._shutdownOnce.promise;\n }\n return this._flushAll();\n }\n\n // does nothing.\n onStart(_span: Span, _parentContext: Context): void {}\n\n onEnd(span: ReadableSpan): void {\n if (this._shutdownOnce.isCalled) {\n return;\n }\n\n if ((span.spanContext().traceFlags & TraceFlags.SAMPLED) === 0) {\n return;\n }\n\n this._addToBuffer(span);\n }\n\n shutdown(): Promise<void> {\n return this._shutdownOnce.call();\n }\n\n private _shutdown() {\n return Promise.resolve()\n .then(() => {\n return this.onShutdown();\n })\n .then(() => {\n return this._flushAll();\n })\n .then(() => {\n return this._exporter.shutdown();\n });\n }\n\n /** Add a span in the buffer. */\n private _addToBuffer(span: ReadableSpan) {\n if (this._finishedSpans.length >= this._maxQueueSize) {\n // limit reached, drop span\n\n if (this._droppedSpansCount === 0) {\n diag.debug('maxQueueSize reached, dropping spans');\n }\n this._droppedSpansCount++;\n\n return;\n }\n\n if (this._droppedSpansCount > 0) {\n // some spans were dropped, log once with count of spans dropped\n diag.warn(\n `Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`\n );\n this._droppedSpansCount = 0;\n }\n\n this._finishedSpans.push(span);\n this._maybeStartTimer();\n }\n\n /**\n * Send all spans to the exporter respecting the batch size limit\n * This function is used only on forceFlush or shutdown,\n * for all other cases _flush should be used\n * */\n private _flushAll(): Promise<void> {\n return new Promise((resolve, reject) => {\n const promises = [];\n // calculate number of batches\n const count = Math.ceil(\n this._finishedSpans.length / this._maxExportBatchSize\n );\n for (let i = 0, j = count; i < j; i++) {\n promises.push(this._flushOneBatch());\n }\n Promise.all(promises)\n .then(() => {\n resolve();\n })\n .catch(reject);\n });\n }\n\n private _flushOneBatch(): Promise<void> {\n this._clearTimer();\n if (this._finishedSpans.length === 0) {\n return Promise.resolve();\n }\n return new Promise((resolve, reject) => {\n const timer = setTimeout(() => {\n // don't wait anymore for export, this way the next batch can start\n reject(new Error('Timeout'));\n }, this._exportTimeoutMillis);\n // prevent downstream exporter calls from generating spans\n context.with(suppressTracing(context.active()), () => {\n // Reset the finished spans buffer here because the next invocations of the _flush method\n // could pass the same finished spans to the exporter if the buffer is cleared\n // outside the execution of this callback.\n const spans = this._finishedSpans.splice(0, this._maxExportBatchSize);\n\n const doExport = () =>\n this._exporter.export(spans, result => {\n clearTimeout(timer);\n if (result.code === ExportResultCode.SUCCESS) {\n resolve();\n } else {\n reject(\n result.error ??\n new Error('BatchSpanProcessor: span export failed')\n );\n }\n });\n const pendingResources = spans\n .map(span => span.resource)\n .filter(resource => resource.asyncAttributesPending);\n\n // Avoid scheduling a promise to make the behavior more predictable and easier to test\n if (pendingResources.length === 0) {\n doExport();\n } else {\n Promise.all(\n pendingResources.map(\n resource => resource.waitForAsyncAttributes?.()\n )\n ).then(doExport, err => {\n globalErrorHandler(err);\n reject(err);\n });\n }\n });\n });\n }\n\n private _maybeStartTimer() {\n if (this._isExporting) return;\n const flush = () => {\n this._isExporting = true;\n this._flushOneBatch()\n .then(() => {\n this._isExporting = false;\n if (this._finishedSpans.length > 0) {\n this._clearTimer();\n this._maybeStartTimer();\n }\n })\n .catch(e => {\n this._isExporting = false;\n globalErrorHandler(e);\n });\n };\n // we only wait if the queue doesn't have enough elements yet\n if (this._finishedSpans.length >= this._maxExportBatchSize) {\n return flush();\n }\n if (this._timer !== undefined) return;\n this._timer = setTimeout(() => flush(), this._scheduledDelayMillis);\n unrefTimer(this._timer);\n }\n\n private _clearTimer() {\n if (this._timer !== undefined) {\n clearTimeout(this._timer);\n this._timer = undefined;\n }\n }\n\n protected abstract onShutdown(): void;\n}\n", "/*\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 { BatchSpanProcessorBase } from '../../../export/BatchSpanProcessorBase';\nimport { SpanExporter } from '../../../export/SpanExporter';\nimport { BatchSpanProcessorBrowserConfig } from '../../../types';\n\nexport class BatchSpanProcessor extends BatchSpanProcessorBase<BatchSpanProcessorBrowserConfig> {\n private _visibilityChangeListener?: () => void;\n private _pageHideListener?: () => void;\n\n constructor(\n _exporter: SpanExporter,\n config?: BatchSpanProcessorBrowserConfig\n ) {\n super(_exporter, config);\n this.onInit(config);\n }\n\n private onInit(config?: BatchSpanProcessorBrowserConfig): void {\n if (\n config?.disableAutoFlushOnDocumentHide !== true &&\n typeof document !== 'undefined'\n ) {\n this._visibilityChangeListener = () => {\n if (document.visibilityState === 'hidden') {\n void this.forceFlush();\n }\n };\n this._pageHideListener = () => {\n void this.forceFlush();\n };\n document.addEventListener(\n 'visibilitychange',\n this._visibilityChangeListener\n );\n\n // use 'pagehide' event as a fallback for Safari; see https://bugs.webkit.org/show_bug.cgi?id=116769\n document.addEventListener('pagehide', this._pageHideListener);\n }\n }\n\n protected onShutdown(): void {\n if (typeof document !== 'undefined') {\n if (this._visibilityChangeListener) {\n document.removeEventListener(\n 'visibilitychange',\n this._visibilityChangeListener\n );\n }\n if (this._pageHideListener) {\n document.removeEventListener('pagehide', this._pageHideListener);\n }\n }\n }\n}\n", "/*\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 { IdGenerator } from '../../IdGenerator';\n\nconst SPAN_ID_BYTES = 8;\nconst TRACE_ID_BYTES = 16;\n\nexport class RandomIdGenerator implements IdGenerator {\n /**\n * Returns a random 16-byte trace ID formatted/encoded as a 32 lowercase hex\n * characters corresponding to 128 bits.\n */\n generateTraceId = getIdGenerator(TRACE_ID_BYTES);\n\n /**\n * Returns a random 8-byte span ID formatted/encoded as a 16 lowercase hex\n * characters corresponding to 64 bits.\n */\n generateSpanId = getIdGenerator(SPAN_ID_BYTES);\n}\n\nconst SHARED_CHAR_CODES_ARRAY = Array(32);\nfunction getIdGenerator(bytes: number): () => string {\n return function generateId() {\n for (let i = 0; i < bytes * 2; i++) {\n SHARED_CHAR_CODES_ARRAY[i] = Math.floor(Math.random() * 16) + 48;\n // valid hex characters in the range 48-57 and 97-102\n if (SHARED_CHAR_CODES_ARRAY[i] >= 58) {\n SHARED_CHAR_CODES_ARRAY[i] += 39;\n }\n }\n return String.fromCharCode.apply(\n null,\n SHARED_CHAR_CODES_ARRAY.slice(0, bytes * 2)\n );\n };\n}\n", "/*\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 {\n context,\n diag,\n propagation,\n TextMapPropagator,\n trace,\n TracerProvider,\n} from '@opentelemetry/api';\nimport {\n CompositePropagator,\n W3CBaggagePropagator,\n W3CTraceContextPropagator,\n getEnv,\n merge,\n} from '@opentelemetry/core';\nimport { IResource, Resource } from '@opentelemetry/resources';\nimport { SpanProcessor, Tracer } from '.';\nimport { loadDefaultConfig } from './config';\nimport { MultiSpanProcessor } from './MultiSpanProcessor';\nimport { NoopSpanProcessor } from './export/NoopSpanProcessor';\nimport { SDKRegistrationConfig, TracerConfig } from './types';\nimport { SpanExporter } from './export/SpanExporter';\nimport { BatchSpanProcessor } from './platform';\nimport { reconfigureLimits } from './utility';\n\nexport type PROPAGATOR_FACTORY = () => TextMapPropagator;\nexport type EXPORTER_FACTORY = () => SpanExporter;\n\nexport enum ForceFlushState {\n 'resolved',\n 'timeout',\n 'error',\n 'unresolved',\n}\n\n/**\n * This class represents a basic tracer provider which platform libraries can extend\n */\nexport class BasicTracerProvider implements TracerProvider {\n protected static readonly _registeredPropagators = new Map<\n string,\n PROPAGATOR_FACTORY\n >([\n ['tracecontext', () => new W3CTraceContextPropagator()],\n ['baggage', () => new W3CBaggagePropagator()],\n ]);\n\n protected static readonly _registeredExporters = new Map<\n string,\n EXPORTER_FACTORY\n >();\n\n private readonly _config: TracerConfig;\n private readonly _registeredSpanProcessors: SpanProcessor[] = [];\n private readonly _tracers: Map<string, Tracer> = new Map();\n\n activeSpanProcessor: SpanProcessor;\n readonly resource: IResource;\n\n constructor(config: TracerConfig = {}) {\n const mergedConfig = merge(\n {},\n loadDefaultConfig(),\n reconfigureLimits(config)\n );\n this.resource = mergedConfig.resource ?? Resource.empty();\n this.resource = Resource.default().merge(this.resource);\n this._config = Object.assign({}, mergedConfig, {\n resource: this.resource,\n });\n\n const defaultExporter = this._buildExporterFromEnv();\n if (defaultExporter !== undefined) {\n const batchProcessor = new BatchSpanProcessor(defaultExporter);\n this.activeSpanProcessor = batchProcessor;\n } else {\n this.activeSpanProcessor = new NoopSpanProcessor();\n }\n }\n\n getTracer(\n name: string,\n version?: string,\n options?: { schemaUrl?: string }\n ): Tracer {\n const key = `${name}@${version || ''}:${options?.schemaUrl || ''}`;\n if (!this._tracers.has(key)) {\n this._tracers.set(\n key,\n new Tracer(\n { name, version, schemaUrl: options?.schemaUrl },\n this._config,\n this\n )\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this._tracers.get(key)!;\n }\n\n /**\n * Adds a new {@link SpanProcessor} to this tracer.\n * @param spanProcessor the new SpanProcessor to be added.\n */\n addSpanProcessor(spanProcessor: SpanProcessor): void {\n if (this._registeredSpanProcessors.length === 0) {\n // since we might have enabled by default a batchProcessor, we disable it\n // before adding the new one\n this.activeSpanProcessor\n .shutdown()\n .catch(err =>\n diag.error(\n 'Error while trying to shutdown current span processor',\n err\n )\n );\n }\n this._registeredSpanProcessors.push(spanProcessor);\n this.activeSpanProcessor = new MultiSpanProcessor(\n this._registeredSpanProcessors\n );\n }\n\n getActiveSpanProcessor(): SpanProcessor {\n return this.activeSpanProcessor;\n }\n\n /**\n * Register this TracerProvider for use with the OpenTelemetry API.\n * Undefined values may be replaced with defaults, and\n * null values will be skipped.\n *\n * @param config Configuration object for SDK registration\n */\n register(config: SDKRegistrationConfig = {}): void {\n trace.setGlobalTracerProvider(this);\n if (config.propagator === undefined) {\n config.propagator = this._buildPropagatorFromEnv();\n }\n\n if (config.contextManager) {\n context.setGlobalContextManager(config.contextManager);\n }\n\n if (config.propagator) {\n propagation.setGlobalPropagator(config.propagator);\n }\n }\n\n forceFlush(): Promise<void> {\n const timeout = this._config.forceFlushTimeoutMillis;\n const promises = this._registeredSpanProcessors.map(\n (spanProcessor: SpanProcessor) => {\n return new Promise(resolve => {\n let state: ForceFlushState;\n const timeoutInterval = setTimeout(() => {\n resolve(\n new Error(\n `Span processor did not completed within timeout period of ${timeout} ms`\n )\n );\n state = ForceFlushState.timeout;\n }, timeout);\n\n spanProcessor\n .forceFlush()\n .then(() => {\n clearTimeout(timeoutInterval);\n if (state !== ForceFlushState.timeout) {\n state = ForceFlushState.resolved;\n resolve(state);\n }\n })\n .catch(error => {\n clearTimeout(timeoutInterval);\n state = ForceFlushState.error;\n resolve(error);\n });\n });\n }\n );\n\n return new Promise<void>((resolve, reject) => {\n Promise.all(promises)\n .then(results => {\n const errors = results.filter(\n result => result !== ForceFlushState.resolved\n );\n if (errors.length > 0) {\n reject(errors);\n } else {\n resolve();\n }\n })\n .catch(error => reject([error]));\n });\n }\n\n shutdown(): Promise<void> {\n return this.activeSpanProcessor.shutdown();\n }\n\n /**\n * TS cannot yet infer the type of this.constructor:\n * https://github.com/Microsoft/TypeScript/issues/3841#issuecomment-337560146\n * There is no need to override either of the getters in your child class.\n * The type of the registered component maps should be the same across all\n * classes in the inheritance tree.\n */\n protected _getPropagator(name: string): TextMapPropagator | undefined {\n return (\n this.constructor as typeof BasicTracerProvider\n )._registeredPropagators.get(name)?.();\n }\n\n protected _getSpanExporter(name: string): SpanExporter | undefined {\n return (\n this.constructor as typeof BasicTracerProvider\n )._registeredExporters.get(name)?.();\n }\n\n protected _buildPropagatorFromEnv(): TextMapPropagator | undefined {\n // per spec, propagators from env must be deduplicated\n const uniquePropagatorNames = Array.from(\n new Set(getEnv().OTEL_PROPAGATORS)\n );\n\n const propagators = uniquePropagatorNames.map(name => {\n const propagator = this._getPropagator(name);\n if (!propagator) {\n diag.warn(\n `Propagator \"${name}\" requested through environment variable is unavailable.`\n );\n }\n\n return propagator;\n });\n const validPropagators = propagators.reduce<TextMapPropagator[]>(\n (list, item) => {\n if (item) {\n list.push(item);\n }\n return list;\n },\n []\n );\n\n if (validPropagators.length === 0) {\n return;\n } else if (uniquePropagatorNames.length === 1) {\n return validPropagators[0];\n } else {\n return new CompositePropagator({\n propagators: validPropagators,\n });\n }\n }\n\n protected _buildExporterFromEnv(): SpanExporter | undefined {\n const exporterName = getEnv().OTEL_TRACES_EXPORTER;\n if (exporterName === 'none' || exporterName === '') return;\n const exporter = this._getSpanExporter(exporterName);\n if (!exporter) {\n diag.error(\n `Exporter \"${exporterName}\" requested through environment variable is unavailable.`\n );\n }\n return exporter;\n }\n}\n", "/*\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 { diag } from '@opentelemetry/api';\nimport { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';\nimport { SDK_INFO } from '@opentelemetry/core';\nimport { ResourceAttributes } from './types';\nimport { defaultServiceName } from './platform';\nimport { IResource } from './IResource';\n\n/**\n * A Resource describes the entity for which a signals (metrics or trace) are\n * collected.\n */\nexport class Resource implements IResource {\n static readonly EMPTY = new Resource({});\n private _syncAttributes?: ResourceAttributes;\n private _asyncAttributesPromise?: Promise<ResourceAttributes>;\n private _attributes?: ResourceAttributes;\n\n /**\n * Check if async attributes have resolved. This is useful to avoid awaiting\n * waitForAsyncAttributes (which will introduce asynchronous behavior) when not necessary.\n *\n * @returns true if the resource \"attributes\" property is not yet settled to its final value\n */\n public asyncAttributesPending?: boolean;\n\n /**\n * Returns an empty Resource\n */\n static empty(): IResource {\n return Resource.EMPTY;\n }\n\n /**\n * Returns a Resource that identifies the SDK in use.\n */\n static default(): IResource {\n return new Resource({\n [SemanticResourceAttributes.SERVICE_NAME]: defaultServiceName(),\n [SemanticResourceAttributes.TELEMETRY_SDK_LANGUAGE]:\n SDK_INFO[SemanticResourceAttributes.TELEMETRY_SDK_LANGUAGE],\n [SemanticResourceAttributes.TELEMETRY_SDK_NAME]:\n SDK_INFO[SemanticResourceAttributes.TELEMETRY_SDK_NAME],\n [SemanticResourceAttributes.TELEMETRY_SDK_VERSION]:\n SDK_INFO[SemanticResourceAttributes.TELEMETRY_SDK_VERSION],\n });\n }\n\n constructor(\n /**\n * A dictionary of attributes with string keys and values that provide\n * information about the entity as numbers, strings or booleans\n * TODO: Consider to add check/validation on attributes.\n */\n attributes: ResourceAttributes,\n asyncAttributesPromise?: Promise<ResourceAttributes>\n ) {\n this._attributes = attributes;\n this.asyncAttributesPending = asyncAttributesPromise != null;\n this._syncAttributes = this._attributes ?? {};\n this._asyncAttributesPromise = asyncAttributesPromise?.then(\n asyncAttributes => {\n this._attributes = Object.assign({}, this._attributes, asyncAttributes);\n this.asyncAttributesPending = false;\n return asyncAttributes;\n },\n err => {\n diag.debug(\"a resource's async attributes promise rejected: %s\", err);\n this.asyncAttributesPending = false;\n return {};\n }\n );\n }\n\n get attributes(): ResourceAttributes {\n if (this.asyncAttributesPending) {\n diag.error(\n 'Accessing resource attributes before async attributes settled'\n );\n }\n\n return this._attributes ?? {};\n }\n\n /**\n * Returns a promise that will never be rejected. Resolves when all async attributes have finished being added to\n * this Resource's attributes. This is useful in exporters to block until resource detection\n * has finished.\n */\n async waitForAsyncAttributes?(): Promise<void> {\n if (this.asyncAttributesPending) {\n await this._asyncAttributesPromise;\n }\n }\n\n /**\n * Returns a new, merged {@link Resource} by merging the current Resource\n * with the other Resource. In case of a collision, other Resource takes\n * precedence.\n *\n * @param other the Resource that will be merged with this.\n * @returns the newly merged Resource.\n */\n merge(other: IResource | null): IResource {\n if (!other) return this;\n\n // SpanAttributes from other resource overwrite attributes from this resource.\n const mergedSyncAttributes = {\n ...this._syncAttributes,\n //Support for old resource implementation where _syncAttributes is not defined\n ...((other as Resource)._syncAttributes ?? other.attributes),\n };\n\n if (\n !this._asyncAttributesPromise &&\n !(other as Resource)._asyncAttributesPromise\n ) {\n return new Resource(mergedSyncAttributes);\n }\n\n const mergedAttributesPromise = Promise.all([\n this._asyncAttributesPromise,\n (other as Resource)._asyncAttributesPromise,\n ]).then(([thisAsyncAttributes, otherAsyncAttributes]) => {\n return {\n ...this._syncAttributes,\n ...thisAsyncAttributes,\n //Support for old resource implementation where _syncAttributes is not defined\n ...((other as Resource)._syncAttributes ?? other.attributes),\n ...otherAsyncAttributes,\n };\n });\n\n return new Resource(mergedSyncAttributes, mergedAttributesPromise);\n }\n}\n", "/*\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\nexport function defaultServiceName(): string {\n return 'unknown_service';\n}\n", "/*\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 { diag } from '@opentelemetry/api';\nimport { getEnv } from '@opentelemetry/core';\nimport { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';\nimport { Resource } from '../Resource';\nimport { DetectorSync, ResourceAttributes } from '../types';\nimport { ResourceDetectionConfig } from '../config';\nimport { IResource } from '../IResource';\n\n/**\n * EnvDetectorSync can be used to detect the presence of and create a Resource\n * from the OTEL_RESOURCE_ATTRIBUTES environment variable.\n */\nclass EnvDetectorSync implements DetectorSync {\n // Type, attribute keys, and attribute values should not exceed 256 characters.\n private readonly _MAX_LENGTH = 255;\n\n // OTEL_RESOURCE_ATTRIBUTES is a comma-separated list of attributes.\n private readonly _COMMA_SEPARATOR = ',';\n\n // OTEL_RESOURCE_ATTRIBUTES contains key value pair separated by '='.\n private readonly _LABEL_KEY_VALUE_SPLITTER = '=';\n\n private readonly _ERROR_MESSAGE_INVALID_CHARS =\n 'should be a ASCII string with a length greater than 0 and not exceed ' +\n this._MAX_LENGTH +\n ' characters.';\n\n private readonly _ERROR_MESSAGE_INVALID_VALUE =\n 'should be a ASCII string with a length not exceed ' +\n this._MAX_LENGTH +\n ' characters.';\n\n /**\n * Returns a {@link Resource} populated with attributes from the\n * OTEL_RESOURCE_ATTRIBUTES environment variable. Note this is an async\n * function to conform to the Detector interface.\n *\n * @param config The resource detection config\n */\n detect(_config?: ResourceDetectionConfig): IResource {\n const attributes: ResourceAttributes = {};\n const env = getEnv();\n\n const rawAttributes = env.OTEL_RESOURCE_ATTRIBUTES;\n const serviceName = env.OTEL_SERVICE_NAME;\n\n if (rawAttributes) {\n try {\n const parsedAttributes = this._parseResourceAttributes(rawAttributes);\n Object.assign(attributes, parsedAttributes);\n } catch (e) {\n diag.debug(`EnvDetector failed: ${e.message}`);\n }\n }\n\n if (serviceName) {\n attributes[SemanticResourceAttributes.SERVICE_NAME] = serviceName;\n }\n\n return new Resource(attributes);\n }\n\n /**\n * Creates an attribute map from the OTEL_RESOURCE_ATTRIBUTES environment\n * variable.\n *\n * OTEL_RESOURCE_ATTRIBUTES: A comma-separated list of attributes describing\n * the source in more detail, e.g. “key1=val1,key2=val2”. Domain names and\n * paths are accepted as attribute keys. Values may be quoted or unquoted in\n * general. If a value contains whitespaces, =, or \" characters, it must\n * always be quoted.\n *\n * @param rawEnvAttributes The resource attributes as a comma-seperated list\n * of key/value pairs.\n * @returns The sanitized resource attributes.\n */\n private _parseResourceAttributes(\n rawEnvAttributes?: string\n ): ResourceAttributes {\n if (!rawEnvAttributes) return {};\n\n const attributes: ResourceAttributes = {};\n const rawAttributes: string[] = rawEnvAttributes.split(\n this._COMMA_SEPARATOR,\n -1\n );\n for (const rawAttribute of rawAttributes) {\n const keyValuePair: string[] = rawAttribute.split(\n this._LABEL_KEY_VALUE_SPLITTER,\n -1\n );\n if (keyValuePair.length !== 2) {\n continue;\n }\n let [key, value] = keyValuePair;\n // Leading and trailing whitespaces are trimmed.\n key = key.trim();\n value = value.trim().split(/^\"|\"$/).join('');\n if (!this._isValidAndNotEmpty(key)) {\n throw new Error(`Attribute key ${this._ERROR_MESSAGE_INVALID_CHARS}`);\n }\n if (!this._isValid(value)) {\n throw new Error(`Attribute value ${this._ERROR_MESSAGE_INVALID_VALUE}`);\n }\n attributes[key] = decodeURIComponent(value);\n }\n return attributes;\n }\n\n /**\n * Determines whether the given String is a valid printable ASCII string with\n * a length not exceed _MAX_LENGTH characters.\n *\n * @param str The String to be validated.\n * @returns Whether the String is valid.\n */\n private _isValid(name: string): boolean {\n return name.length <= this._MAX_LENGTH && this._isBaggageOctetString(name);\n }\n\n // https://www.w3.org/TR/baggage/#definition\n private _isBaggageOctetString(str: string): boolean {\n for (let i = 0; i < str.length; i++) {\n const ch = str.charCodeAt(i);\n if (ch < 0x21 || ch === 0x2c || ch === 0x3b || ch === 0x5c || ch > 0x7e) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Determines whether the given String is a valid printable ASCII string with\n * a length greater than 0 and not exceed _MAX_LENGTH characters.\n *\n * @param str The String to be validated.\n * @returns Whether the String is valid and not empty.\n */\n private _isValidAndNotEmpty(str: string): boolean {\n return str.length > 0 && this._isValid(str);\n }\n}\n\nexport const envDetectorSync = new EnvDetectorSync();\n", "/*\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 { Resource } from './Resource';\nimport { ResourceDetectionConfig } from './config';\nimport { diag } from '@opentelemetry/api';\nimport { isPromiseLike } from './utils';\nimport { Detector, DetectorSync } from './types';\nimport { IResource } from './IResource';\n\n/**\n * Runs all resource detectors and returns the results merged into a single Resource. Promise\n * does not resolve until all the underlying detectors have resolved, unlike\n * detectResourcesSync.\n *\n * @deprecated use detectResourcesSync() instead.\n * @param config Configuration for resource detection\n */\nexport const detectResources = async (\n config: ResourceDetectionConfig = {}\n): Promise<IResource> => {\n const resources: IResource[] = await Promise.all(\n (config.detectors || []).map(async d => {\n try {\n const resource = await d.detect(config);\n diag.debug(`${d.constructor.name} found resource.`, resource);\n return resource;\n } catch (e) {\n diag.debug(`${d.constructor.name} failed: ${e.message}`);\n return Resource.empty();\n }\n })\n );\n\n // Future check if verbose logging is enabled issue #1903\n logResources(resources);\n\n return resources.reduce(\n (acc, resource) => acc.merge(resource),\n Resource.empty()\n );\n};\n\n/**\n * Runs all resource detectors synchronously, merging their results. In case of attribute collision later resources will take precedence.\n *\n * @param config Configuration for resource detection\n */\nexport const detectResourcesSync = (\n config: ResourceDetectionConfig = {}\n): IResource => {\n const resources: IResource[] = (config.detectors ?? []).map(\n (d: Detector | DetectorSync) => {\n try {\n const resourceOrPromise = d.detect(config);\n let resource: IResource;\n if (isPromiseLike<Resource>(resourceOrPromise)) {\n const createPromise = async () => {\n const resolvedResource = await resourceOrPromise;\n return resolvedResource.attributes;\n };\n resource = new Resource({}, createPromise());\n } else {\n resource = resourceOrPromise as IResource;\n }\n\n if (resource.waitForAsyncAttributes) {\n void resource\n .waitForAsyncAttributes()\n .then(() =>\n diag.debug(`${d.constructor.name} found resource.`, resource)\n );\n } else {\n diag.debug(`${d.constructor.name} found resource.`, resource);\n }\n\n return resource;\n } catch (e) {\n diag.error(`${d.constructor.name} failed: ${e.message}`);\n return Resource.empty();\n }\n }\n );\n\n const mergedResources = resources.reduce(\n (acc, resource) => acc.merge(resource),\n Resource.empty()\n );\n\n if (mergedResources.waitForAsyncAttributes) {\n void mergedResources.waitForAsyncAttributes().then(() => {\n // Future check if verbose logging is enabled issue #1903\n logResources(resources);\n });\n }\n\n return mergedResources;\n};\n\n/**\n * Writes debug information about the detected resources to the logger defined in the resource detection config, if one is provided.\n *\n * @param resources The array of {@link Resource} that should be logged. Empty entries will be ignored.\n */\nconst logResources = (resources: Array<IResource>) => {\n resources.forEach(resource => {\n // Print only populated resources\n if (Object.keys(resource.attributes).length > 0) {\n const resourceDebugString = JSON.stringify(resource.attributes, null, 4);\n diag.verbose(resourceDebugString);\n }\n });\n};\n", "/*\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\nexport const isPromiseLike = <R>(val: any): val is PromiseLike<R> => {\n return (\n val !== null && typeof val === 'object' && typeof val.then === 'function'\n );\n};\n", "/*\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 { Context } from '@opentelemetry/api';\nimport { globalErrorHandler } from '@opentelemetry/core';\nimport { ReadableSpan } from './export/ReadableSpan';\nimport { Span } from './Span';\nimport { SpanProcessor } from './SpanProcessor';\n\n/**\n * Implementation of the {@link SpanProcessor} that simply forwards all\n * received events to a list of {@link SpanProcessor}s.\n */\nexport class MultiSpanProcessor implements SpanProcessor {\n constructor(private readonly _spanProcessors: SpanProcessor[]) {}\n\n forceFlush(): Promise<void> {\n const promises: Promise<void>[] = [];\n\n for (const spanProcessor of this._spanProcessors) {\n promises.push(spanProcessor.forceFlush());\n }\n return new Promise(resolve => {\n Promise.all(promises)\n .then(() => {\n resolve();\n })\n .catch(error => {\n globalErrorHandler(\n error || new Error('MultiSpanProcessor: forceFlush failed')\n );\n resolve();\n });\n });\n }\n\n onStart(span: Span, context: Context): void {\n for (const spanProcessor of this._spanProcessors) {\n spanProcessor.onStart(span, context);\n }\n }\n\n onEnd(span: ReadableSpan): void {\n for (const spanProcessor of this._spanProcessors) {\n spanProcessor.onEnd(span);\n }\n }\n\n shutdown(): Promise<void> {\n const promises: Promise<void>[] = [];\n\n for (const spanProcessor of this._spanProcessors) {\n promises.push(spanProcessor.shutdown());\n }\n return new Promise((resolve, reject) => {\n Promise.all(promises).then(() => {\n resolve();\n }, reject);\n });\n }\n}\n", "/*\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 { Context } from '@opentelemetry/api';\nimport { ReadableSpan } from './ReadableSpan';\nimport { Span } from '../Span';\nimport { SpanProcessor } from '../SpanProcessor';\n\n/** No-op implementation of SpanProcessor */\nexport class NoopSpanProcessor implements SpanProcessor {\n onStart(_span: Span, _context: Context): void {}\n onEnd(_span: ReadableSpan): void {}\n shutdown(): Promise<void> {\n return Promise.resolve();\n }\n forceFlush(): Promise<void> {\n return Promise.resolve();\n }\n}\n", "import type { ContextManager, TextMapPropagator } from \"@opentelemetry/api\";\nimport type { InstrumentationOption } from \"@opentelemetry/instrumentation\";\nimport type { ResourceDetectionConfig } from \"@opentelemetry/resources\";\nimport type {\n Sampler,\n SpanExporter,\n SpanProcessor,\n} from \"@opentelemetry/sdk-trace-base\";\nimport {\n AlwaysOffSampler,\n AlwaysOnSampler,\n ParentBasedSampler,\n TraceIdRatioBasedSampler,\n BasicTracerProvider,\n BatchSpanProcessor,\n RandomIdGenerator,\n} from \"@opentelemetry/sdk-trace-base\";\nimport { metrics, diag, DiagConsoleLogger, DiagLogLevel } from \"@opentelemetry/api\";\nimport { logs } from \"@opentelemetry/api-logs\";\nimport { registerInstrumentations } from \"@opentelemetry/instrumentation/build/src/autoLoader\";\nimport {\n detectResourcesSync,\n envDetectorSync,\n Resource,\n} from \"@opentelemetry/resources\";\nimport { LoggerProvider } from \"@opentelemetry/sdk-logs\";\nimport { MeterProvider } from \"@opentelemetry/sdk-metrics\";\nimport { SemanticResourceAttributes } from \"@opentelemetry/semantic-conventions\";\nimport {\n parseEnvironment,\n DEFAULT_ENVIRONMENT,\n} from \"@opentelemetry/core/build/src/utils/environment\";\nimport { AsyncLocalStorageContextManager } from \"@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager\";\nimport {\n CompositePropagator,\n W3CBaggagePropagator,\n baggageUtils,\n} from \"@opentelemetry/core\";\nimport { CompositeSpanProcessor } from \"./processor/composite-span-processor\";\nimport { OTLPHttpJsonTraceExporter } from \"./exporters/exporter-trace-otlp-http-fetch\";\nimport { OTLPHttpProtoTraceExporter } from \"./exporters/exporter-trace-otlp-proto-fetch\";\nimport { omitUndefinedAttributes } from \"./util/attributes\";\nimport type {\n Configuration,\n InstrumentationConfiguration,\n InstrumentationOptionOrName,\n PropagatorOrName,\n SampleOrName,\n SpanProcessorOrName,\n} from \"./types\";\nimport { FetchInstrumentation } from \"./instrumentations/fetch\";\nimport { W3CTraceContextPropagator } from \"./propagators/w3c-tracecontext-propagator\";\nimport { VercelRuntimePropagator } from \"./vercel-request-context/propagator\";\nimport { VercelRuntimeSpanExporter } from \"./vercel-request-context/exporter\";\n\ntype Env = ReturnType<typeof parseEnvironment>;\n\nconst logLevelMap: Record<string, DiagLogLevel> = {\n ALL: DiagLogLevel.ALL,\n VERBOSE: DiagLogLevel.VERBOSE,\n DEBUG: DiagLogLevel.DEBUG,\n INFO: DiagLogLevel.INFO,\n WARN: DiagLogLevel.WARN,\n ERROR: DiagLogLevel.ERROR,\n NONE: DiagLogLevel.NONE,\n};\n\nexport class Sdk {\n private contextManager: ContextManager | undefined;\n private tracerProvider: BasicTracerProvider | undefined;\n private loggerProvider: LoggerProvider | undefined;\n private meterProvider: MeterProvider | undefined;\n private disableInstrumentations: (() => void) | undefined;\n\n public constructor(private configuration: Configuration = {}) { }\n\n public start(): void {\n const env = getEnv();\n const configuration = this.configuration;\n const runtime = process.env.NEXT_RUNTIME || \"nodejs\";\n\n const disabled = Boolean(env.OTEL_SDK_DISABLED);\n\n // Default is INFO, use environment without defaults to check\n // if the user originally set the environment variable.\n if (process.env.OTEL_LOG_LEVEL) {\n diag.setLogger(new DiagConsoleLogger(), {\n logLevel: logLevelMap[process.env.OTEL_LOG_LEVEL.toUpperCase()],\n });\n }\n\n if (disabled) {\n return;\n }\n\n const idGenerator = configuration.idGenerator ?? new RandomIdGenerator();\n\n const contextManager =\n configuration.contextManager ?? new AsyncLocalStorageContextManager();\n contextManager.enable();\n this.contextManager = contextManager;\n\n const serviceName =\n env.OTEL_SERVICE_NAME || configuration.serviceName || \"app\";\n let resource = new Resource(\n omitUndefinedAttributes({\n [SemanticResourceAttributes.SERVICE_NAME]: serviceName,\n\n // Node.\n \"node.ci\": process.env.CI ? true : undefined,\n \"node.env\": process.env.NODE_ENV,\n\n // Vercel.\n // https://vercel.com/docs/projects/environment-variables/system-environment-variables\n // Vercel Env set as top level attribute for simplicity. One of 'production', 'preview' or 'development'.\n env: process.env.VERCEL_ENV || process.env.NEXT_PUBLIC_VERCEL_ENV,\n \"vercel.region\": process.env.VERCEL_REGION,\n \"vercel.runtime\": runtime,\n \"vercel.sha\":\n process.env.VERCEL_GIT_COMMIT_SHA ||\n process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA,\n \"vercel.host\":\n process.env.VERCEL_URL ||\n process.env.NEXT_PUBLIC_VERCEL_URL ||\n undefined,\n \"vercel.branch_host\":\n process.env.VERCEL_BRANCH_URL ||\n process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL ||\n undefined,\n \"vercel.deployment_id\": process.env.VERCEL_DEPLOYMENT_ID || undefined,\n [SemanticResourceAttributes.SERVICE_VERSION]:\n process.env.VERCEL_DEPLOYMENT_ID,\n\n ...configuration.attributes,\n })\n );\n const resourceDetectors = configuration.resourceDetectors ?? [\n envDetectorSync,\n ];\n const autoDetectResources = configuration.autoDetectResources ?? true;\n if (autoDetectResources) {\n const internalConfig: ResourceDetectionConfig = {\n detectors: resourceDetectors,\n };\n resource = resource.merge(detectResourcesSync(internalConfig));\n }\n\n const propagators = parsePropagators(\n configuration.propagators,\n configuration,\n env\n );\n const traceSampler = parseSampler(configuration.traceSampler, env);\n const spanProcessors = parseSpanProcessor(\n configuration.spanProcessors,\n configuration,\n env\n );\n if (spanProcessors.length === 0) {\n diag.warn(\n \"@vercel/otel: No span processors configured. No spans will be exported.\"\n );\n }\n const spanLimits = configuration.spanLimits;\n const tracerProvider = new BasicTracerProvider({\n resource,\n idGenerator,\n sampler: traceSampler,\n spanLimits,\n });\n tracerProvider.addSpanProcessor(\n new CompositeSpanProcessor(\n spanProcessors,\n configuration.attributesFromHeaders\n )\n );\n tracerProvider.register({\n contextManager,\n propagator: new CompositePropagator({ propagators }),\n });\n this.tracerProvider = tracerProvider;\n\n if (configuration.logRecordProcessor) {\n const loggerProvider = new LoggerProvider({ resource });\n this.loggerProvider = loggerProvider;\n loggerProvider.addLogRecordProcessor(configuration.logRecordProcessor);\n logs.setGlobalLoggerProvider(loggerProvider);\n }\n\n if (configuration.metricReader || configuration.views) {\n const meterProvider = new MeterProvider({\n resource,\n views: configuration.views ?? [],\n });\n if (configuration.metricReader) {\n meterProvider.addMetricReader(configuration.metricReader);\n }\n metrics.setGlobalMeterProvider(meterProvider);\n this.meterProvider = meterProvider;\n }\n\n const instrumentations = parseInstrumentations(\n configuration.instrumentations,\n configuration.instrumentationConfig\n );\n this.disableInstrumentations = registerInstrumentations({\n instrumentations,\n });\n\n diag.info(\"@vercel/otel: started\", serviceName, runtime);\n }\n\n public async shutdown(): Promise<void> {\n const promises: Promise<unknown>[] = [];\n\n if (this.tracerProvider) {\n promises.push(this.tracerProvider.shutdown());\n }\n if (this.loggerProvider) {\n promises.push(this.loggerProvider.shutdown());\n }\n if (this.meterProvider) {\n promises.push(this.meterProvider.shutdown());\n }\n\n diag.info(\n \"@vercel/otel: shutting down\",\n promises.length,\n process.env.NEXT_RUNTIME\n );\n\n await Promise.all(promises);\n\n if (this.contextManager) {\n this.contextManager.disable();\n }\n const { disableInstrumentations } = this;\n if (disableInstrumentations) {\n disableInstrumentations();\n }\n }\n}\n\nfunction getEnv(): Env {\n const processEnv = parseEnvironment(process.env);\n return { ...DEFAULT_ENVIRONMENT, ...processEnv };\n}\n\nfunction parseInstrumentations(\n arg: InstrumentationOptionOrName[] | undefined,\n instrumentationConfig: InstrumentationConfiguration | undefined\n): InstrumentationOption[] {\n return (arg ?? [\"auto\"])\n .map((instrumentationOrName) => {\n if (instrumentationOrName === \"auto\") {\n diag.debug(\n \"@vercel/otel: Configure instrumentations: fetch\",\n instrumentationConfig?.fetch\n );\n return [new FetchInstrumentation(instrumentationConfig?.fetch)];\n }\n if (instrumentationOrName === \"fetch\") {\n diag.debug(\n \"@vercel/otel: Configure instrumentations: fetch\",\n instrumentationConfig?.fetch\n );\n return new FetchInstrumentation(instrumentationConfig?.fetch);\n }\n return instrumentationOrName;\n })\n .flat();\n}\n\nfunction parsePropagators(\n arg: PropagatorOrName[] | undefined,\n configuration: Configuration,\n env: Env\n): TextMapPropagator[] {\n const envPropagators =\n process.env.OTEL_PROPAGATORS &&\n env.OTEL_PROPAGATORS && env.OTEL_PROPAGATORS.length > 0\n ? env.OTEL_PROPAGATORS\n : undefined;\n return (arg ?? envPropagators ?? [\"auto\"])\n .map((propagatorOrName) => {\n if (propagatorOrName === \"none\") {\n return [];\n }\n if (propagatorOrName === \"auto\") {\n const autoList: { name: string; propagator: TextMapPropagator }[] = [];\n autoList.push({\n name: \"tracecontext\",\n propagator: new W3CTraceContextPropagator(),\n });\n autoList.push({\n name: \"baggage\",\n propagator: new W3CBaggagePropagator(),\n });\n\n diag.debug(\n `@vercel/otel: Configure propagators: ${autoList\n .map((i) => i.name)\n .join(\", \")}`\n );\n return autoList.map((i) => i.propagator);\n }\n if (propagatorOrName === \"experimental-vercel-trace\") {\n diag.debug(\"@vercel/otel: Configure propagator: vercel-runtime\");\n return new VercelRuntimePropagator();\n }\n if (propagatorOrName === \"tracecontext\") {\n diag.debug(\"@vercel/otel: Configure propagator: tracecontext\");\n return new W3CTraceContextPropagator();\n }\n if (propagatorOrName === \"baggage\") {\n diag.debug(\"@vercel/otel: Configure propagator: baggage\");\n return new W3CBaggagePropagator();\n }\n if (typeof propagatorOrName === \"string\") {\n throw new Error(`Unknown propagator: \"${propagatorOrName}\"`);\n }\n return propagatorOrName;\n })\n .flat();\n}\n\nconst FALLBACK_OTEL_TRACES_SAMPLER = \"always_on\";\nconst DEFAULT_RATIO = 1;\n\n/**\n * The code below is borrowed from the https://github.com/open-telemetry/opentelemetry-js/blob/b6e532bf52c9553e51aa6d3375e85f0dd9bd67c1/packages/opentelemetry-sdk-trace-base/src/config.ts#L64\n * bacause, unfortunately, OpenTelemetry API doesn't export it directly.\n */\nfunction parseSampler(arg: SampleOrName | undefined, env: Env): Sampler {\n if (arg && typeof arg !== \"string\") {\n return arg;\n }\n\n const name =\n arg && arg !== \"auto\"\n ? arg\n : env.OTEL_TRACES_SAMPLER || FALLBACK_OTEL_TRACES_SAMPLER;\n diag.debug(\"@vercel/otel: Configure sampler: \", name);\n switch (name) {\n case \"always_on\":\n return new AlwaysOnSampler();\n case \"always_off\":\n return new AlwaysOffSampler();\n case \"parentbased_always_on\":\n return new ParentBasedSampler({\n root: new AlwaysOnSampler(),\n });\n case \"parentbased_always_off\":\n return new ParentBasedSampler({\n root: new AlwaysOffSampler(),\n });\n case \"traceidratio\":\n return new TraceIdRatioBasedSampler(getSamplerProbabilityFromEnv(env));\n case \"parentbased_traceidratio\":\n return new ParentBasedSampler({\n root: new TraceIdRatioBasedSampler(getSamplerProbabilityFromEnv(env)),\n });\n default:\n diag.error(\n `@vercel/otel: OTEL_TRACES_SAMPLER value \"${String(\n env.OTEL_TRACES_SAMPLER\n )} invalid, defaulting to ${FALLBACK_OTEL_TRACES_SAMPLER}\".`\n );\n return new AlwaysOnSampler();\n }\n}\n\nfunction getSamplerProbabilityFromEnv(env: Env): number {\n if (\n env.OTEL_TRACES_SAMPLER_ARG === undefined ||\n env.OTEL_TRACES_SAMPLER_ARG === \"\"\n ) {\n diag.error(\n `@vercel/otel: OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${DEFAULT_RATIO}.`\n );\n return DEFAULT_RATIO;\n }\n\n diag.debug(\n \"@vercel/otel: Configure sampler probability: \",\n env.OTEL_TRACES_SAMPLER_ARG\n );\n const probability = Number(env.OTEL_TRACES_SAMPLER_ARG);\n\n if (isNaN(probability)) {\n diag.error(\n `@vercel/otel: OTEL_TRACES_SAMPLER_ARG=${env.OTEL_TRACES_SAMPLER_ARG} was given, but it is invalid, defaulting to ${DEFAULT_RATIO}.`\n );\n return DEFAULT_RATIO;\n }\n\n if (probability < 0 || probability > 1) {\n diag.error(\n `@vercel/otel: OTEL_TRACES_SAMPLER_ARG=${env.OTEL_TRACES_SAMPLER_ARG} was given, but it is out of range ([0..1]), defaulting to ${DEFAULT_RATIO}.`\n );\n return DEFAULT_RATIO;\n }\n\n return probability;\n}\n\nfunction parseSpanProcessor(\n arg: SpanProcessorOrName[] | undefined,\n configuration: Configuration,\n env: Env\n): SpanProcessor[] {\n return [\n ...(arg ?? [\"auto\"])\n .map((spanProcessorOrName) => {\n if (spanProcessorOrName === \"auto\") {\n if (process.env.VERCEL_OTEL_ENDPOINTS) {\n // OTEL collector is configured on 4318 port.\n const port = process.env.VERCEL_OTEL_ENDPOINTS_PORT || \"4318\";\n // It's important to use x-protobuf here because the Vercel collector\n // doesn't correctly process `TimeUnixNano{low, high}` encoding.\n const protocol =\n process.env.VERCEL_OTEL_ENDPOINTS_PROTOCOL || \"http/protobuf\";\n diag.debug(\n \"@vercel/otel: Configure vercel otel collector on port: \",\n port,\n protocol\n );\n const config = {\n url: `http://localhost:${port}/v1/traces`,\n headers: {},\n };\n const exporter =\n protocol === \"http/protobuf\"\n ? new OTLPHttpProtoTraceExporter(config)\n : new OTLPHttpJsonTraceExporter(config);\n return new BatchSpanProcessor(exporter);\n }\n\n // Consider going throw `VERCEL_OTEL_ENDPOINTS` (otel collector) for OTLP.\n if (\n !configuration.traceExporter ||\n configuration.traceExporter === \"auto\" ||\n env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT ||\n env.OTEL_EXPORTER_OTLP_ENDPOINT\n ) {\n return new BatchSpanProcessor(parseTraceExporter(env));\n }\n\n return undefined;\n } else if (spanProcessorOrName === 'experimental-vercel-trace') {\n diag.debug(\"@vercel/otel: Configure vercel-runtime exporter\");\n return new BatchSpanProcessor(new VercelRuntimeSpanExporter());\n }\n return spanProcessorOrName;\n })\n .filter(isNotNull),\n ...(configuration.traceExporter && configuration.traceExporter !== \"auto\"\n ? [new BatchSpanProcessor(configuration.traceExporter)]\n : []),\n ];\n}\n\n/**\n * This code is moved from the https://github.com/open-telemetry/opentelemetry-js/blob/00e78efd840d3f49d9d4b025a9965e8d3f2913ad/experimental/packages/opentelemetry-sdk-node/src/TracerProviderWithEnvExporter.ts#L41\n * due to the https://github.com/open-telemetry/opentelemetry-js/issues/4212\n */\nfunction parseTraceExporter(env: Env): SpanExporter {\n const protocol =\n process.env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL ??\n process.env.OTEL_EXPORTER_OTLP_PROTOCOL ??\n \"http/protobuf\";\n const url = buildExporterUrlFromEnv(env);\n const headers = {\n ...baggageUtils.parseKeyPairsIntoRecord(env.OTEL_EXPORTER_OTLP_HEADERS),\n ...baggageUtils.parseKeyPairsIntoRecord(\n env.OTEL_EXPORTER_OTLP_TRACES_HEADERS\n ),\n };\n diag.debug(\n \"@vercel/otel: Configure trace exporter: \",\n protocol,\n url,\n `headers: ${Object.keys(headers).join(\",\") || \"<none>\"}`\n );\n switch (protocol) {\n case \"http/json\":\n return new OTLPHttpJsonTraceExporter({ url, headers });\n case \"http/protobuf\":\n return new OTLPHttpProtoTraceExporter({ url, headers });\n default:\n // \"grpc\" protocol is not supported in Edge.\n diag.warn(\n `@vercel/otel: Unsupported OTLP traces protocol: ${protocol}. Using http/protobuf.`\n );\n return new OTLPHttpProtoTraceExporter();\n }\n}\n\nconst DEFAULT_COLLECTOR_RESOURCE_PATH = \"v1/traces\";\nconst DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;\n\nfunction buildExporterUrlFromEnv(env: Env): string {\n const defaultUrlFromEnv = env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT;\n if (defaultUrlFromEnv && typeof defaultUrlFromEnv === \"string\") {\n return defaultUrlFromEnv;\n }\n\n const defaultUrlFromEnvAll = env.OTEL_EXPORTER_OTLP_ENDPOINT;\n if (defaultUrlFromEnvAll && typeof defaultUrlFromEnvAll === \"string\") {\n return `${defaultUrlFromEnvAll}/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;\n }\n\n return DEFAULT_COLLECTOR_URL;\n}\n\nfunction isNotNull<T>(x: T | null | undefined): x is T {\n return x !== null && x !== undefined;\n}\n", "export * from \"@opentelemetry/api-logs\"", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { diag } from '@opentelemetry/api';\nimport type * as logsAPI from '@opentelemetry/api-logs';\nimport { NOOP_LOGGER } from '@opentelemetry/api-logs';\nimport { Resource } from '@opentelemetry/resources';\nimport { BindOnceFuture, merge } from '@opentelemetry/core';\n\nimport type { LoggerProviderConfig } from './types';\nimport type { LogRecordProcessor } from './LogRecordProcessor';\nimport { Logger } from './Logger';\nimport { loadDefaultConfig, reconfigureLimits } from './config';\nimport { MultiLogRecordProcessor } from './MultiLogRecordProcessor';\nimport { LoggerProviderSharedState } from './internal/LoggerProviderSharedState';\n\nexport const DEFAULT_LOGGER_NAME = 'unknown';\n\nexport class LoggerProvider implements logsAPI.LoggerProvider {\n private _shutdownOnce: BindOnceFuture<void>;\n private readonly _sharedState: LoggerProviderSharedState;\n\n constructor(config: LoggerProviderConfig = {}) {\n const {\n resource = Resource.default(),\n logRecordLimits,\n forceFlushTimeoutMillis,\n } = merge({}, loadDefaultConfig(), config);\n this._sharedState = new LoggerProviderSharedState(\n resource,\n forceFlushTimeoutMillis,\n reconfigureLimits(logRecordLimits)\n );\n this._shutdownOnce = new BindOnceFuture(this._shutdown, this);\n }\n\n /**\n * Get a logger with the configuration of the LoggerProvider.\n */\n public getLogger(\n name: string,\n version?: string,\n options?: logsAPI.LoggerOptions\n ): logsAPI.Logger {\n if (this._shutdownOnce.isCalled) {\n diag.warn('A shutdown LoggerProvider cannot provide a Logger');\n return NOOP_LOGGER;\n }\n\n if (!name) {\n diag.warn('Logger requested without instrumentation scope name.');\n }\n const loggerName = name || DEFAULT_LOGGER_NAME;\n const key = `${loggerName}@${version || ''}:${options?.schemaUrl || ''}`;\n if (!this._sharedState.loggers.has(key)) {\n this._sharedState.loggers.set(\n key,\n new Logger(\n { name: loggerName, version, schemaUrl: options?.schemaUrl },\n this._sharedState\n )\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this._sharedState.loggers.get(key)!;\n }\n\n /**\n * Adds a new {@link LogRecordProcessor} to this logger.\n * @param processor the new LogRecordProcessor to be added.\n */\n public addLogRecordProcessor(processor: LogRecordProcessor) {\n if (this._sharedState.registeredLogRecordProcessors.length === 0) {\n // since we might have enabled by default a batchProcessor, we disable it\n // before adding the new one\n this._sharedState.activeProcessor\n .shutdown()\n .catch(err =>\n diag.error(\n 'Error while trying to shutdown current log record processor',\n err\n )\n );\n }\n this._sharedState.registeredLogRecordProcessors.push(processor);\n this._sharedState.activeProcessor = new MultiLogRecordProcessor(\n this._sharedState.registeredLogRecordProcessors,\n this._sharedState.forceFlushTimeoutMillis\n );\n }\n\n /**\n * Notifies all registered LogRecordProcessor to flush any buffered data.\n *\n * Returns a promise which is resolved when all flushes are complete.\n */\n public forceFlush(): Promise<void> {\n // do not flush after shutdown\n if (this._shutdownOnce.isCalled) {\n diag.warn('invalid attempt to force flush after LoggerProvider shutdown');\n return this._shutdownOnce.promise;\n }\n return this._sharedState.activeProcessor.forceFlush();\n }\n\n /**\n * Flush all buffered data and shut down the LoggerProvider and all registered\n * LogRecordProcessor.\n *\n * Returns a promise which is resolved when all flushes are complete.\n */\n public shutdown(): Promise<void> {\n if (this._shutdownOnce.isCalled) {\n diag.warn('shutdown may only be called once per LoggerProvider');\n return this._shutdownOnce.promise;\n }\n return this._shutdownOnce.call();\n }\n\n private _shutdown(): Promise<void> {\n return this._sharedState.activeProcessor.shutdown();\n }\n}\n", "/*\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 type * as logsAPI from '@opentelemetry/api-logs';\nimport type { InstrumentationScope } from '@opentelemetry/core';\nimport { context } from '@opentelemetry/api';\n\nimport { LogRecord } from './LogRecord';\nimport { LoggerProviderSharedState } from './internal/LoggerProviderSharedState';\n\nexport class Logger implements logsAPI.Logger {\n constructor(\n public readonly instrumentationScope: InstrumentationScope,\n private _sharedState: LoggerProviderSharedState\n ) {}\n\n public emit(logRecord: logsAPI.LogRecord): void {\n const currentContext = logRecord.context || context.active();\n /**\n * If a Logger was obtained with include_trace_context=true,\n * the LogRecords it emits MUST automatically include the Trace Context from the active Context,\n * if Context has not been explicitly set.\n */\n const logRecordInstance = new LogRecord(\n this._sharedState,\n this.instrumentationScope,\n {\n context: currentContext,\n ...logRecord,\n }\n );\n /**\n * the explicitly passed Context,\n * the current Context, or an empty Context if the Logger was obtained with include_trace_context=false\n */\n this._sharedState.activeProcessor.onEmit(logRecordInstance, currentContext);\n /**\n * A LogRecordProcessor may freely modify logRecord for the duration of the OnEmit call.\n * If logRecord is needed after OnEmit returns (i.e. for asynchronous processing) only reads are permitted.\n */\n logRecordInstance._makeReadonly();\n }\n}\n", "/*\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 { AttributeValue, diag } from '@opentelemetry/api';\nimport type * as logsAPI from '@opentelemetry/api-logs';\nimport * as api from '@opentelemetry/api';\nimport {\n timeInputToHrTime,\n isAttributeValue,\n InstrumentationScope,\n} from '@opentelemetry/core';\nimport type { IResource } from '@opentelemetry/resources';\n\nimport type { ReadableLogRecord } from './export/ReadableLogRecord';\nimport type { LogRecordLimits } from './types';\nimport { LogAttributes } from '@opentelemetry/api-logs';\nimport { LoggerProviderSharedState } from './internal/LoggerProviderSharedState';\n\nexport class LogRecord implements ReadableLogRecord {\n readonly hrTime: api.HrTime;\n readonly hrTimeObserved: api.HrTime;\n readonly spanContext?: api.SpanContext;\n readonly resource: IResource;\n readonly instrumentationScope: InstrumentationScope;\n readonly attributes: logsAPI.LogAttributes = {};\n private _severityText?: string;\n private _severityNumber?: logsAPI.SeverityNumber;\n private _body?: string;\n private totalAttributesCount: number = 0;\n\n private _isReadonly: boolean = false;\n private readonly _logRecordLimits: Required<LogRecordLimits>;\n\n set severityText(severityText: string | undefined) {\n if (this._isLogRecordReadonly()) {\n return;\n }\n this._severityText = severityText;\n }\n get severityText(): string | undefined {\n return this._severityText;\n }\n\n set severityNumber(severityNumber: logsAPI.SeverityNumber | undefined) {\n if (this._isLogRecordReadonly()) {\n return;\n }\n this._severityNumber = severityNumber;\n }\n get severityNumber(): logsAPI.SeverityNumber | undefined {\n return this._severityNumber;\n }\n\n set body(body: string | undefined) {\n if (this._isLogRecordReadonly()) {\n return;\n }\n this._body = body;\n }\n get body(): string | undefined {\n return this._body;\n }\n\n get droppedAttributesCount(): number {\n return this.totalAttributesCount - Object.keys(this.attributes).length;\n }\n\n constructor(\n _sharedState: LoggerProviderSharedState,\n instrumentationScope: InstrumentationScope,\n logRecord: logsAPI.LogRecord\n ) {\n const {\n timestamp,\n observedTimestamp,\n severityNumber,\n severityText,\n body,\n attributes = {},\n context,\n } = logRecord;\n\n const now = Date.now();\n this.hrTime = timeInputToHrTime(timestamp ?? now);\n this.hrTimeObserved = timeInputToHrTime(observedTimestamp ?? now);\n\n if (context) {\n const spanContext = api.trace.getSpanContext(context);\n if (spanContext && api.isSpanContextValid(spanContext)) {\n this.spanContext = spanContext;\n }\n }\n this.severityNumber = severityNumber;\n this.severityText = severityText;\n this.body = body;\n this.resource = _sharedState.resource;\n this.instrumentationScope = instrumentationScope;\n this._logRecordLimits = _sharedState.logRecordLimits;\n this.setAttributes(attributes);\n }\n\n public setAttribute(key: string, value?: LogAttributes | AttributeValue) {\n if (this._isLogRecordReadonly()) {\n return this;\n }\n if (value === null) {\n return this;\n }\n if (key.length === 0) {\n api.diag.warn(`Invalid attribute key: ${key}`);\n return this;\n }\n if (\n !isAttributeValue(value) &&\n !(\n typeof value === 'object' &&\n !Array.isArray(value) &&\n Object.keys(value).length > 0\n )\n ) {\n api.diag.warn(`Invalid attribute value set for key: ${key}`);\n return this;\n }\n this.totalAttributesCount += 1;\n if (\n Object.keys(this.attributes).length >=\n this._logRecordLimits.attributeCountLimit &&\n !Object.prototype.hasOwnProperty.call(this.attributes, key)\n ) {\n return this;\n }\n if (isAttributeValue(value)) {\n this.attributes[key] = this._truncateToSize(value);\n } else {\n this.attributes[key] = value;\n }\n return this;\n }\n\n public setAttributes(attributes: LogAttributes) {\n for (const [k, v] of Object.entries(attributes)) {\n this.setAttribute(k, v);\n }\n return this;\n }\n\n public setBody(body: string) {\n this.body = body;\n return this;\n }\n\n public setSeverityNumber(severityNumber: logsAPI.SeverityNumber) {\n this.severityNumber = severityNumber;\n return this;\n }\n\n public setSeverityText(severityText: string) {\n this.severityText = severityText;\n return this;\n }\n\n /**\n * @internal\n * A LogRecordProcessor may freely modify logRecord for the duration of the OnEmit call.\n * If logRecord is needed after OnEmit returns (i.e. for asynchronous processing) only reads are permitted.\n */\n _makeReadonly() {\n this._isReadonly = true;\n }\n\n private _truncateToSize(value: AttributeValue): AttributeValue {\n const limit = this._logRecordLimits.attributeValueLengthLimit;\n // Check limit\n if (limit <= 0) {\n // Negative values are invalid, so do not truncate\n api.diag.warn(`Attribute value limit must be positive, got ${limit}`);\n return value;\n }\n\n // String\n if (typeof value === 'string') {\n return this._truncateToLimitUtil(value, limit);\n }\n\n // Array of strings\n if (Array.isArray(value)) {\n return (value as []).map(val =>\n typeof val === 'string' ? this._truncateToLimitUtil(val, limit) : val\n );\n }\n\n // Other types, no need to apply value length limit\n return value;\n }\n\n private _truncateToLimitUtil(value: string, limit: number): string {\n if (value.length <= limit) {\n return value;\n }\n return value.substring(0, limit);\n }\n\n private _isLogRecordReadonly(): boolean {\n if (this._isReadonly) {\n diag.warn('Can not execute the operation on emitted log record');\n }\n return this._isReadonly;\n }\n}\n", "/*\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 {\n DEFAULT_ATTRIBUTE_COUNT_LIMIT,\n DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,\n getEnv,\n getEnvWithoutDefaults,\n} from '@opentelemetry/core';\nimport { LogRecordLimits } from './types';\n\nexport function loadDefaultConfig() {\n return {\n forceFlushTimeoutMillis: 30000,\n logRecordLimits: {\n attributeValueLengthLimit:\n getEnv().OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT,\n attributeCountLimit: getEnv().OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT,\n },\n includeTraceContext: true,\n };\n}\n\n/**\n * When general limits are provided and model specific limits are not,\n * configures the model specific limits by using the values from the general ones.\n * @param logRecordLimits User provided limits configuration\n */\nexport function reconfigureLimits(\n logRecordLimits: LogRecordLimits\n): Required<LogRecordLimits> {\n const parsedEnvConfig = getEnvWithoutDefaults();\n\n return {\n /**\n * Reassign log record attribute count limit to use first non null value defined by user or use default value\n */\n attributeCountLimit:\n logRecordLimits.attributeCountLimit ??\n parsedEnvConfig.OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT ??\n parsedEnvConfig.OTEL_ATTRIBUTE_COUNT_LIMIT ??\n DEFAULT_ATTRIBUTE_COUNT_LIMIT,\n /**\n * Reassign log record attribute value length limit to use first non null value defined by user or use default value\n */\n attributeValueLengthLimit:\n logRecordLimits.attributeValueLengthLimit ??\n parsedEnvConfig.OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT ??\n parsedEnvConfig.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT ??\n DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,\n };\n}\n", "/*\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 { callWithTimeout } from '@opentelemetry/core';\nimport type { Context } from '@opentelemetry/api';\nimport type { LogRecordProcessor } from './LogRecordProcessor';\nimport type { LogRecord } from './LogRecord';\n\n/**\n * Implementation of the {@link LogRecordProcessor} that simply forwards all\n * received events to a list of {@link LogRecordProcessor}s.\n */\nexport class MultiLogRecordProcessor implements LogRecordProcessor {\n constructor(\n public readonly processors: LogRecordProcessor[],\n public readonly forceFlushTimeoutMillis: number\n ) {}\n\n public async forceFlush(): Promise<void> {\n const timeout = this.forceFlushTimeoutMillis;\n await Promise.all(\n this.processors.map(processor =>\n callWithTimeout(processor.forceFlush(), timeout)\n )\n );\n }\n\n public onEmit(logRecord: LogRecord, context?: Context): void {\n this.processors.forEach(processors =>\n processors.onEmit(logRecord, context)\n );\n }\n\n public async shutdown(): Promise<void> {\n await Promise.all(this.processors.map(processor => processor.shutdown()));\n }\n}\n", "/*\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 { Context } from '@opentelemetry/api';\nimport { LogRecordProcessor } from '../LogRecordProcessor';\nimport { ReadableLogRecord } from './ReadableLogRecord';\n\nexport class NoopLogRecordProcessor implements LogRecordProcessor {\n forceFlush(): Promise<void> {\n return Promise.resolve();\n }\n\n onEmit(_logRecord: ReadableLogRecord, _context: Context): void {}\n\n shutdown(): Promise<void> {\n return Promise.resolve();\n }\n}\n", "/*\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 { Logger } from '@opentelemetry/api-logs';\nimport { IResource } from '@opentelemetry/resources';\nimport { LogRecordProcessor } from '../LogRecordProcessor';\nimport { LogRecordLimits } from '../types';\nimport { NoopLogRecordProcessor } from '../export/NoopLogRecordProcessor';\n\nexport class LoggerProviderSharedState {\n readonly loggers: Map<string, Logger> = new Map();\n activeProcessor: LogRecordProcessor;\n readonly registeredLogRecordProcessors: LogRecordProcessor[] = [];\n\n constructor(\n readonly resource: IResource,\n readonly forceFlushTimeoutMillis: number,\n readonly logRecordLimits: Required<LogRecordLimits>\n ) {\n this.activeProcessor = new NoopLogRecordProcessor();\n }\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * AggregationTemporality indicates the way additive quantities are expressed.\n */\nexport enum AggregationTemporality {\n DELTA,\n CUMULATIVE,\n}\n", "/*\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 { MetricAttributes } from '@opentelemetry/api';\nimport { InstrumentationScope } from '@opentelemetry/core';\n\nexport type Maybe<T> = T | undefined;\n\nexport function isNotNullish<T>(item: Maybe<T>): item is T {\n return item !== undefined && item !== null;\n}\n\n/**\n * Converting the unordered attributes into unique identifier string.\n * @param attributes user provided unordered MetricAttributes.\n */\nexport function hashAttributes(attributes: MetricAttributes): string {\n let keys = Object.keys(attributes);\n if (keys.length === 0) return '';\n\n // Return a string that is stable on key orders.\n keys = keys.sort();\n return JSON.stringify(keys.map(key => [key, attributes[key]]));\n}\n\n/**\n * Converting the instrumentation scope object to a unique identifier string.\n * @param instrumentationScope\n */\nexport function instrumentationScopeId(\n instrumentationScope: InstrumentationScope\n): string {\n return `${instrumentationScope.name}:${instrumentationScope.version ?? ''}:${\n instrumentationScope.schemaUrl ?? ''\n }`;\n}\n\n/**\n * Error that is thrown on timeouts.\n */\nexport class TimeoutError extends Error {\n constructor(message?: string) {\n super(message);\n\n // manually adjust prototype to retain `instanceof` functionality when targeting ES5, see:\n // https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(this, TimeoutError.prototype);\n }\n}\n\n/**\n * Adds a timeout to a promise and rejects if the specified timeout has elapsed. Also rejects if the specified promise\n * rejects, and resolves if the specified promise resolves.\n *\n * <p> NOTE: this operation will continue even after it throws a {@link TimeoutError}.\n *\n * @param promise promise to use with timeout.\n * @param timeout the timeout in milliseconds until the returned promise is rejected.\n */\nexport function callWithTimeout<T>(\n promise: Promise<T>,\n timeout: number\n): Promise<T> {\n let timeoutHandle: ReturnType<typeof setTimeout>;\n\n const timeoutPromise = new Promise<never>(function timeoutFunction(\n _resolve,\n reject\n ) {\n timeoutHandle = setTimeout(function timeoutHandler() {\n reject(new TimeoutError('Operation timed out.'));\n }, timeout);\n });\n\n return Promise.race([promise, timeoutPromise]).then(\n result => {\n clearTimeout(timeoutHandle);\n return result;\n },\n reason => {\n clearTimeout(timeoutHandle);\n throw reason;\n }\n );\n}\n\nexport interface PromiseAllSettledFulfillResult<T> {\n status: 'fulfilled';\n value: T;\n}\n\nexport interface PromiseAllSettledRejectionResult {\n status: 'rejected';\n reason: unknown;\n}\n\nexport type PromiseAllSettledResult<T> =\n | PromiseAllSettledFulfillResult<T>\n | PromiseAllSettledRejectionResult;\n\n/**\n * Node.js v12.9 lower and browser compatible `Promise.allSettled`.\n */\nexport async function PromiseAllSettled<T>(\n promises: Promise<T>[]\n): Promise<PromiseAllSettledResult<T>[]> {\n return Promise.all(\n promises.map<Promise<PromiseAllSettledResult<T>>>(async p => {\n try {\n const ret = await p;\n return {\n status: 'fulfilled',\n value: ret,\n };\n } catch (e) {\n return {\n status: 'rejected',\n reason: e,\n };\n }\n })\n );\n}\n\nexport function isPromiseAllSettledRejectionResult(\n it: PromiseAllSettledResult<unknown>\n): it is PromiseAllSettledRejectionResult {\n return it.status === 'rejected';\n}\n\n/**\n * Node.js v11.0 lower and browser compatible `Array.prototype.flatMap`.\n */\nexport function FlatMap<T, R>(arr: T[], fn: (it: T) => R[]): R[] {\n const result: R[] = [];\n arr.forEach(it => {\n result.push(...fn(it));\n });\n return result;\n}\n\nexport function setEquals(lhs: Set<unknown>, rhs: Set<unknown>): boolean {\n if (lhs.size !== rhs.size) {\n return false;\n }\n for (const item of lhs) {\n if (!rhs.has(item)) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Binary search the sorted array to the find lower bound for the value.\n * @param arr\n * @param value\n * @returns\n */\nexport function binarySearchLB(arr: number[], value: number): number {\n let lo = 0;\n let hi = arr.length - 1;\n\n while (hi - lo > 1) {\n const mid = Math.trunc((hi + lo) / 2);\n if (arr[mid] <= value) {\n lo = mid;\n } else {\n hi = mid - 1;\n }\n }\n\n if (arr[hi] <= value) {\n return hi;\n } else if (arr[lo] <= value) {\n return lo;\n }\n return -1;\n}\n\nexport function equalsCaseInsensitive(lhs: string, rhs: string): boolean {\n return lhs.toLowerCase() === rhs.toLowerCase();\n}\n", "/*\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 { MetricOptions, ValueType, diag } from '@opentelemetry/api';\nimport { View } from './view/View';\nimport { equalsCaseInsensitive } from './utils';\n\n/**\n * Supported types of metric instruments.\n */\nexport enum InstrumentType {\n COUNTER = 'COUNTER',\n HISTOGRAM = 'HISTOGRAM',\n UP_DOWN_COUNTER = 'UP_DOWN_COUNTER',\n OBSERVABLE_COUNTER = 'OBSERVABLE_COUNTER',\n OBSERVABLE_GAUGE = 'OBSERVABLE_GAUGE',\n OBSERVABLE_UP_DOWN_COUNTER = 'OBSERVABLE_UP_DOWN_COUNTER',\n}\n\n/**\n * An internal interface describing the instrument.\n *\n * This is intentionally distinguished from the public MetricDescriptor (a.k.a. InstrumentDescriptor)\n * which may not contains internal fields like metric advice.\n */\nexport interface InstrumentDescriptor {\n readonly name: string;\n readonly description: string;\n readonly unit: string;\n readonly type: InstrumentType;\n readonly valueType: ValueType;\n /**\n * @experimental\n *\n * This is intentionally not using the API's type as it's only available from @opentelemetry/api 1.7.0 and up.\n * In SDK 2.0 we'll be able to bump the minimum API version and remove this workaround.\n */\n readonly advice: {\n /**\n * Hint the explicit bucket boundaries for SDK if the metric has been\n * aggregated with a HistogramAggregator.\n */\n explicitBucketBoundaries?: number[];\n };\n}\n\nexport function createInstrumentDescriptor(\n name: string,\n type: InstrumentType,\n options?: MetricOptions\n): InstrumentDescriptor {\n if (!isValidName(name)) {\n diag.warn(\n `Invalid metric name: \"${name}\". The metric name should be a ASCII string with a length no greater than 255 characters.`\n );\n }\n return {\n name,\n type,\n description: options?.description ?? '',\n unit: options?.unit ?? '',\n valueType: options?.valueType ?? ValueType.DOUBLE,\n advice: options?.advice ?? {},\n };\n}\n\nexport function createInstrumentDescriptorWithView(\n view: View,\n instrument: InstrumentDescriptor\n): InstrumentDescriptor {\n return {\n name: view.name ?? instrument.name,\n description: view.description ?? instrument.description,\n type: instrument.type,\n unit: instrument.unit,\n valueType: instrument.valueType,\n advice: instrument.advice,\n };\n}\n\nexport function isDescriptorCompatibleWith(\n descriptor: InstrumentDescriptor,\n otherDescriptor: InstrumentDescriptor\n) {\n // Names are case-insensitive strings.\n return (\n equalsCaseInsensitive(descriptor.name, otherDescriptor.name) &&\n descriptor.unit === otherDescriptor.unit &&\n descriptor.type === otherDescriptor.type &&\n descriptor.valueType === otherDescriptor.valueType\n );\n}\n\n// ASCII string with a length no greater than 255 characters.\n// NB: the first character counted separately from the rest.\nconst NAME_REGEXP = /^[a-z][a-z0-9_.\\-/]{0,254}$/i;\nexport function isValidName(name: string): boolean {\n return name.match(NAME_REGEXP) != null;\n}\n", "/*\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 {\n diag,\n MeterProvider as IMeterProvider,\n Meter as IMeter,\n MeterOptions,\n createNoopMeter,\n} from '@opentelemetry/api';\nimport { IResource, Resource } from '@opentelemetry/resources';\nimport { MetricReader } from './export/MetricReader';\nimport { MeterProviderSharedState } from './state/MeterProviderSharedState';\nimport { MetricCollector } from './state/MetricCollector';\nimport { ForceFlushOptions, ShutdownOptions } from './types';\nimport { View } from './view/View';\n\n/**\n * MeterProviderOptions provides an interface for configuring a MeterProvider.\n */\nexport interface MeterProviderOptions {\n /** Resource associated with metric telemetry */\n resource?: IResource;\n views?: View[];\n}\n\n/**\n * This class implements the {@link MeterProvider} interface.\n */\nexport class MeterProvider implements IMeterProvider {\n private _sharedState: MeterProviderSharedState;\n private _shutdown = false;\n\n constructor(options?: MeterProviderOptions) {\n const resource = Resource.default().merge(\n options?.resource ?? Resource.empty()\n );\n this._sharedState = new MeterProviderSharedState(resource);\n if (options?.views != null && options.views.length > 0) {\n for (const view of options.views) {\n this._sharedState.viewRegistry.addView(view);\n }\n }\n }\n\n /**\n * Get a meter with the configuration of the MeterProvider.\n */\n getMeter(name: string, version = '', options: MeterOptions = {}): IMeter {\n // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#meter-creation\n if (this._shutdown) {\n diag.warn('A shutdown MeterProvider cannot provide a Meter');\n return createNoopMeter();\n }\n\n return this._sharedState.getMeterSharedState({\n name,\n version,\n schemaUrl: options.schemaUrl,\n }).meter;\n }\n\n /**\n * Register a {@link MetricReader} to the meter provider. After the\n * registration, the MetricReader can start metrics collection.\n *\n * @param metricReader the metric reader to be registered.\n */\n addMetricReader(metricReader: MetricReader) {\n const collector = new MetricCollector(this._sharedState, metricReader);\n metricReader.setMetricProducer(collector);\n this._sharedState.metricCollectors.push(collector);\n }\n\n /**\n * Flush all buffered data and shut down the MeterProvider and all registered\n * MetricReaders.\n *\n * Returns a promise which is resolved when all flushes are complete.\n */\n async shutdown(options?: ShutdownOptions): Promise<void> {\n if (this._shutdown) {\n diag.warn('shutdown may only be called once per MeterProvider');\n return;\n }\n\n this._shutdown = true;\n\n await Promise.all(\n this._sharedState.metricCollectors.map(collector => {\n return collector.shutdown(options);\n })\n );\n }\n\n /**\n * Notifies all registered MetricReaders to flush any buffered data.\n *\n * Returns a promise which is resolved when all flushes are complete.\n */\n async forceFlush(options?: ForceFlushOptions): Promise<void> {\n // do not flush after shutdown\n if (this._shutdown) {\n diag.warn('invalid attempt to force flush after MeterProvider shutdown');\n return;\n }\n\n await Promise.all(\n this._sharedState.metricCollectors.map(collector => {\n return collector.forceFlush(options);\n })\n );\n }\n}\n", "/*\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 { InstrumentationScope } from '@opentelemetry/core';\nimport { InstrumentDescriptor } from '../InstrumentDescriptor';\nimport { InstrumentSelector } from './InstrumentSelector';\nimport { MeterSelector } from './MeterSelector';\nimport { View } from './View';\n\nexport class ViewRegistry {\n private _registeredViews: View[] = [];\n\n addView(view: View) {\n this._registeredViews.push(view);\n }\n\n findViews(\n instrument: InstrumentDescriptor,\n meter: InstrumentationScope\n ): View[] {\n const views = this._registeredViews.filter(registeredView => {\n return (\n this._matchInstrument(registeredView.instrumentSelector, instrument) &&\n this._matchMeter(registeredView.meterSelector, meter)\n );\n });\n\n return views;\n }\n\n private _matchInstrument(\n selector: InstrumentSelector,\n instrument: InstrumentDescriptor\n ): boolean {\n return (\n (selector.getType() === undefined ||\n instrument.type === selector.getType()) &&\n selector.getNameFilter().match(instrument.name) &&\n selector.getUnitFilter().match(instrument.unit)\n );\n }\n\n private _matchMeter(\n selector: MeterSelector,\n meter: InstrumentationScope\n ): boolean {\n return (\n selector.getNameFilter().match(meter.name) &&\n (meter.version === undefined ||\n selector.getVersionFilter().match(meter.version)) &&\n (meter.schemaUrl === undefined ||\n selector.getSchemaUrlFilter().match(meter.schemaUrl))\n );\n }\n}\n", "/*\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 {\n context as contextApi,\n diag,\n Context,\n MetricAttributes,\n ValueType,\n UpDownCounter,\n Counter,\n Histogram,\n Observable,\n ObservableCallback,\n ObservableCounter,\n ObservableGauge,\n ObservableUpDownCounter,\n} from '@opentelemetry/api';\nimport { millisToHrTime } from '@opentelemetry/core';\nimport { InstrumentDescriptor } from './InstrumentDescriptor';\nimport { ObservableRegistry } from './state/ObservableRegistry';\nimport {\n AsyncWritableMetricStorage,\n WritableMetricStorage,\n} from './state/WritableMetricStorage';\n\nexport class SyncInstrument {\n constructor(\n private _writableMetricStorage: WritableMetricStorage,\n protected _descriptor: InstrumentDescriptor\n ) {}\n\n protected _record(\n value: number,\n attributes: MetricAttributes = {},\n context: Context = contextApi.active()\n ) {\n if (typeof value !== 'number') {\n diag.warn(\n `non-number value provided to metric ${this._descriptor.name}: ${value}`\n );\n return;\n }\n if (\n this._descriptor.valueType === ValueType.INT &&\n !Number.isInteger(value)\n ) {\n diag.warn(\n `INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`\n );\n value = Math.trunc(value);\n // ignore non-finite values.\n if (!Number.isInteger(value)) {\n return;\n }\n }\n this._writableMetricStorage.record(\n value,\n attributes,\n context,\n millisToHrTime(Date.now())\n );\n }\n}\n\n/**\n * The class implements {@link UpDownCounter} interface.\n */\nexport class UpDownCounterInstrument\n extends SyncInstrument\n implements UpDownCounter\n{\n /**\n * Increment value of counter by the input. Inputs may be negative.\n */\n add(value: number, attributes?: MetricAttributes, ctx?: Context): void {\n this._record(value, attributes, ctx);\n }\n}\n\n/**\n * The class implements {@link Counter} interface.\n */\nexport class CounterInstrument extends SyncInstrument implements Counter {\n /**\n * Increment value of counter by the input. Inputs may not be negative.\n */\n add(value: number, attributes?: MetricAttributes, ctx?: Context): void {\n if (value < 0) {\n diag.warn(\n `negative value provided to counter ${this._descriptor.name}: ${value}`\n );\n return;\n }\n\n this._record(value, attributes, ctx);\n }\n}\n\n/**\n * The class implements {@link Histogram} interface.\n */\nexport class HistogramInstrument extends SyncInstrument implements Histogram {\n /**\n * Records a measurement. Value of the measurement must not be negative.\n */\n record(value: number, attributes?: MetricAttributes, ctx?: Context): void {\n if (value < 0) {\n diag.warn(\n `negative value provided to histogram ${this._descriptor.name}: ${value}`\n );\n return;\n }\n this._record(value, attributes, ctx);\n }\n}\n\nexport class ObservableInstrument implements Observable {\n /** @internal */\n _metricStorages: AsyncWritableMetricStorage[];\n /** @internal */\n _descriptor: InstrumentDescriptor;\n\n constructor(\n descriptor: InstrumentDescriptor,\n metricStorages: AsyncWritableMetricStorage[],\n private _observableRegistry: ObservableRegistry\n ) {\n this._descriptor = descriptor;\n this._metricStorages = metricStorages;\n }\n\n /**\n * @see {Observable.addCallback}\n */\n addCallback(callback: ObservableCallback) {\n this._observableRegistry.addCallback(callback, this);\n }\n\n /**\n * @see {Observable.removeCallback}\n */\n removeCallback(callback: ObservableCallback) {\n this._observableRegistry.removeCallback(callback, this);\n }\n}\n\nexport class ObservableCounterInstrument\n extends ObservableInstrument\n implements ObservableCounter {}\nexport class ObservableGaugeInstrument\n extends ObservableInstrument\n implements ObservableGauge {}\nexport class ObservableUpDownCounterInstrument\n extends ObservableInstrument\n implements ObservableUpDownCounter {}\n\nexport function isObservableInstrument(\n it: unknown\n): it is ObservableInstrument {\n return it instanceof ObservableInstrument;\n}\n", "/*\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 {\n Meter as IMeter,\n MetricOptions,\n Histogram,\n Counter,\n UpDownCounter,\n ObservableGauge,\n ObservableCounter,\n ObservableUpDownCounter,\n BatchObservableCallback,\n Observable,\n} from '@opentelemetry/api';\nimport {\n createInstrumentDescriptor,\n InstrumentType,\n} from './InstrumentDescriptor';\nimport {\n CounterInstrument,\n HistogramInstrument,\n ObservableCounterInstrument,\n ObservableGaugeInstrument,\n ObservableUpDownCounterInstrument,\n UpDownCounterInstrument,\n} from './Instruments';\nimport { MeterSharedState } from './state/MeterSharedState';\n\n/**\n * This class implements the {@link IMeter} interface.\n */\nexport class Meter implements IMeter {\n constructor(private _meterSharedState: MeterSharedState) {}\n\n /**\n * Create a {@link Histogram} instrument.\n */\n createHistogram(name: string, options?: MetricOptions): Histogram {\n const descriptor = createInstrumentDescriptor(\n name,\n InstrumentType.HISTOGRAM,\n options\n );\n const storage = this._meterSharedState.registerMetricStorage(descriptor);\n return new HistogramInstrument(storage, descriptor);\n }\n\n /**\n * Create a {@link Counter} instrument.\n */\n createCounter(name: string, options?: MetricOptions): Counter {\n const descriptor = createInstrumentDescriptor(\n name,\n InstrumentType.COUNTER,\n options\n );\n const storage = this._meterSharedState.registerMetricStorage(descriptor);\n return new CounterInstrument(storage, descriptor);\n }\n\n /**\n * Create a {@link UpDownCounter} instrument.\n */\n createUpDownCounter(name: string, options?: MetricOptions): UpDownCounter {\n const descriptor = createInstrumentDescriptor(\n name,\n InstrumentType.UP_DOWN_COUNTER,\n options\n );\n const storage = this._meterSharedState.registerMetricStorage(descriptor);\n return new UpDownCounterInstrument(storage, descriptor);\n }\n\n /**\n * Create a {@link ObservableGauge} instrument.\n */\n createObservableGauge(\n name: string,\n options?: MetricOptions\n ): ObservableGauge {\n const descriptor = createInstrumentDescriptor(\n name,\n InstrumentType.OBSERVABLE_GAUGE,\n options\n );\n const storages =\n this._meterSharedState.registerAsyncMetricStorage(descriptor);\n return new ObservableGaugeInstrument(\n descriptor,\n storages,\n this._meterSharedState.observableRegistry\n );\n }\n\n /**\n * Create a {@link ObservableCounter} instrument.\n */\n createObservableCounter(\n name: string,\n options?: MetricOptions\n ): ObservableCounter {\n const descriptor = createInstrumentDescriptor(\n name,\n InstrumentType.OBSERVABLE_COUNTER,\n options\n );\n const storages =\n this._meterSharedState.registerAsyncMetricStorage(descriptor);\n return new ObservableCounterInstrument(\n descriptor,\n storages,\n this._meterSharedState.observableRegistry\n );\n }\n\n /**\n * Create a {@link ObservableUpDownCounter} instrument.\n */\n createObservableUpDownCounter(\n name: string,\n options?: MetricOptions\n ): ObservableUpDownCounter {\n const descriptor = createInstrumentDescriptor(\n name,\n InstrumentType.OBSERVABLE_UP_DOWN_COUNTER,\n options\n );\n const storages =\n this._meterSharedState.registerAsyncMetricStorage(descriptor);\n return new ObservableUpDownCounterInstrument(\n descriptor,\n storages,\n this._meterSharedState.observableRegistry\n );\n }\n\n /**\n * @see {@link Meter.addBatchObservableCallback}\n */\n addBatchObservableCallback(\n callback: BatchObservableCallback,\n observables: Observable[]\n ) {\n this._meterSharedState.observableRegistry.addBatchCallback(\n callback,\n observables\n );\n }\n\n /**\n * @see {@link Meter.removeBatchObservableCallback}\n */\n removeBatchObservableCallback(\n callback: BatchObservableCallback,\n observables: Observable[]\n ) {\n this._meterSharedState.observableRegistry.removeBatchCallback(\n callback,\n observables\n );\n }\n}\n", "/*\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 { HrTime } from '@opentelemetry/api';\nimport { MetricData } from '../export/MetricData';\nimport { Maybe } from '../utils';\nimport { MetricCollectorHandle } from './MetricCollector';\nimport {\n createInstrumentDescriptor,\n InstrumentDescriptor,\n} from '../InstrumentDescriptor';\n\n/**\n * Internal interface.\n *\n * Represents a storage from which we can collect metrics.\n */\nexport abstract class MetricStorage {\n constructor(protected _instrumentDescriptor: InstrumentDescriptor) {}\n\n /**\n * Collects the metrics from this storage.\n *\n * Note: This is a stateful operation and may reset any interval-related\n * state for the MetricCollector.\n */\n abstract collect(\n collector: MetricCollectorHandle,\n collectionTime: HrTime\n ): Maybe<MetricData>;\n\n getInstrumentDescriptor(): Readonly<InstrumentDescriptor> {\n return this._instrumentDescriptor;\n }\n\n updateDescription(description: string): void {\n this._instrumentDescriptor = createInstrumentDescriptor(\n this._instrumentDescriptor.name,\n this._instrumentDescriptor.type,\n {\n description: description,\n valueType: this._instrumentDescriptor.valueType,\n unit: this._instrumentDescriptor.unit,\n advice: this._instrumentDescriptor.advice,\n }\n );\n }\n}\n", "/*\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 { MetricAttributes } from '@opentelemetry/api';\nimport { hashAttributes } from '../utils';\n\nexport interface Hash<ValueType, HashCodeType> {\n (value: ValueType): HashCodeType;\n}\n\nexport class HashMap<KeyType, ValueType, HashCodeType> {\n private _valueMap = new Map<HashCodeType, ValueType>();\n private _keyMap = new Map<HashCodeType, KeyType>();\n\n constructor(private _hash: Hash<KeyType, HashCodeType>) {}\n\n get(key: KeyType, hashCode?: HashCodeType) {\n hashCode ??= this._hash(key);\n return this._valueMap.get(hashCode);\n }\n\n getOrDefault(key: KeyType, defaultFactory: () => ValueType) {\n const hash = this._hash(key);\n if (this._valueMap.has(hash)) {\n return this._valueMap.get(hash);\n }\n const val = defaultFactory();\n if (!this._keyMap.has(hash)) {\n this._keyMap.set(hash, key);\n }\n this._valueMap.set(hash, val);\n return val;\n }\n\n set(key: KeyType, value: ValueType, hashCode?: HashCodeType) {\n hashCode ??= this._hash(key);\n if (!this._keyMap.has(hashCode)) {\n this._keyMap.set(hashCode, key);\n }\n this._valueMap.set(hashCode, value);\n }\n\n has(key: KeyType, hashCode?: HashCodeType) {\n hashCode ??= this._hash(key);\n return this._valueMap.has(hashCode);\n }\n\n *keys(): IterableIterator<[KeyType, HashCodeType]> {\n const keyIterator = this._keyMap.entries();\n let next = keyIterator.next();\n while (next.done !== true) {\n yield [next.value[1], next.value[0]];\n next = keyIterator.next();\n }\n }\n\n *entries(): IterableIterator<[KeyType, ValueType, HashCodeType]> {\n const valueIterator = this._valueMap.entries();\n let next = valueIterator.next();\n while (next.done !== true) {\n // next.value[0] here can not be undefined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n yield [this._keyMap.get(next.value[0])!, next.value[1], next.value[0]];\n next = valueIterator.next();\n }\n }\n\n get size() {\n return this._valueMap.size;\n }\n}\n\nexport class AttributeHashMap<ValueType> extends HashMap<\n MetricAttributes,\n ValueType,\n string\n> {\n constructor() {\n super(hashAttributes);\n }\n}\n", "/*\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 { Context, HrTime, MetricAttributes } from '@opentelemetry/api';\nimport { Maybe } from '../utils';\nimport { Accumulation, Aggregator } from '../aggregator/types';\nimport { AttributeHashMap } from './HashMap';\n\n/**\n * Internal interface.\n *\n * Allows synchronous collection of metrics. This processor should allow\n * allocation of new aggregation cells for metrics and convert cumulative\n * recording to delta data points.\n */\nexport class DeltaMetricProcessor<T extends Maybe<Accumulation>> {\n private _activeCollectionStorage = new AttributeHashMap<T>();\n // TODO: find a reasonable mean to clean the memo;\n // https://github.com/open-telemetry/opentelemetry-specification/pull/2208\n private _cumulativeMemoStorage = new AttributeHashMap<T>();\n\n constructor(private _aggregator: Aggregator<T>) {}\n\n record(\n value: number,\n attributes: MetricAttributes,\n _context: Context,\n collectionTime: HrTime\n ) {\n const accumulation = this._activeCollectionStorage.getOrDefault(\n attributes,\n () => this._aggregator.createAccumulation(collectionTime)\n );\n accumulation?.record(value);\n }\n\n batchCumulate(\n measurements: AttributeHashMap<number>,\n collectionTime: HrTime\n ) {\n Array.from(measurements.entries()).forEach(\n ([attributes, value, hashCode]) => {\n const accumulation =\n this._aggregator.createAccumulation(collectionTime);\n accumulation?.record(value);\n let delta = accumulation;\n // Diff with recorded cumulative memo.\n if (this._cumulativeMemoStorage.has(attributes, hashCode)) {\n // has() returned true, previous is present.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const previous = this._cumulativeMemoStorage.get(\n attributes,\n hashCode\n )!;\n delta = this._aggregator.diff(previous, accumulation);\n }\n // Merge with uncollected active delta.\n if (this._activeCollectionStorage.has(attributes, hashCode)) {\n // has() returned true, previous is present.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const active = this._activeCollectionStorage.get(\n attributes,\n hashCode\n )!;\n delta = this._aggregator.merge(active, delta);\n }\n\n // Save the current record and the delta record.\n this._cumulativeMemoStorage.set(attributes, accumulation, hashCode);\n this._activeCollectionStorage.set(attributes, delta, hashCode);\n }\n );\n }\n\n /**\n * Returns a collection of delta metrics. Start time is the when first\n * time event collected.\n */\n collect() {\n const unreportedDelta = this._activeCollectionStorage;\n this._activeCollectionStorage = new AttributeHashMap();\n return unreportedDelta;\n }\n}\n", "/*\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 { HrTime } from '@opentelemetry/api';\nimport {\n Accumulation,\n AccumulationRecord,\n Aggregator,\n} from '../aggregator/types';\nimport { MetricData } from '../export/MetricData';\nimport { InstrumentDescriptor } from '../InstrumentDescriptor';\nimport { AggregationTemporality } from '../export/AggregationTemporality';\nimport { Maybe } from '../utils';\nimport { MetricCollectorHandle } from './MetricCollector';\nimport { AttributeHashMap } from './HashMap';\n\n/**\n * Remembers what was presented to a specific exporter.\n */\ninterface LastReportedHistory<T extends Maybe<Accumulation>> {\n /**\n * The last accumulation of metric data.\n */\n accumulations: AttributeHashMap<T>;\n /**\n * The timestamp the data was reported.\n */\n collectionTime: HrTime;\n /**\n * The AggregationTemporality used to aggregate reports.\n */\n aggregationTemporality: AggregationTemporality;\n}\n\n/**\n * Internal interface.\n *\n * Provides unique reporting for each collector. Allows synchronous collection\n * of metrics and reports given temporality values.\n */\nexport class TemporalMetricProcessor<T extends Maybe<Accumulation>> {\n private _unreportedAccumulations = new Map<\n MetricCollectorHandle,\n AttributeHashMap<T>[]\n >();\n private _reportHistory = new Map<\n MetricCollectorHandle,\n LastReportedHistory<T>\n >();\n\n constructor(\n private _aggregator: Aggregator<T>,\n collectorHandles: MetricCollectorHandle[]\n ) {\n collectorHandles.forEach(handle => {\n this._unreportedAccumulations.set(handle, []);\n });\n }\n\n /**\n * Builds the {@link MetricData} streams to report against a specific MetricCollector.\n * @param collector The information of the MetricCollector.\n * @param collectors The registered collectors.\n * @param instrumentDescriptor The instrumentation descriptor that these metrics generated with.\n * @param currentAccumulations The current accumulation of metric data from instruments.\n * @param collectionTime The current collection timestamp.\n * @returns The {@link MetricData} points or `null`.\n */\n buildMetrics(\n collector: MetricCollectorHandle,\n instrumentDescriptor: InstrumentDescriptor,\n currentAccumulations: AttributeHashMap<T>,\n collectionTime: HrTime\n ): Maybe<MetricData> {\n this._stashAccumulations(currentAccumulations);\n const unreportedAccumulations =\n this._getMergedUnreportedAccumulations(collector);\n\n let result = unreportedAccumulations;\n let aggregationTemporality: AggregationTemporality;\n // Check our last report time.\n if (this._reportHistory.has(collector)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const last = this._reportHistory.get(collector)!;\n const lastCollectionTime = last.collectionTime;\n aggregationTemporality = last.aggregationTemporality;\n\n // Use aggregation temporality + instrument to determine if we do a merge or a diff of\n // previous. We have the following four scenarios:\n // 1. Cumulative Aggregation (temporality) + Delta recording (sync instrument).\n // Here we merge with our last record to get a cumulative aggregation.\n // 2. Cumulative Aggregation + Cumulative recording (async instrument).\n // Cumulative records are converted to delta recording with DeltaMetricProcessor.\n // Here we merge with our last record to get a cumulative aggregation.\n // 3. Delta Aggregation + Delta recording\n // Calibrate the startTime of metric streams to be the reader's lastCollectionTime.\n // 4. Delta Aggregation + Cumulative recording.\n // Cumulative records are converted to delta recording with DeltaMetricProcessor.\n // Calibrate the startTime of metric streams to be the reader's lastCollectionTime.\n if (aggregationTemporality === AggregationTemporality.CUMULATIVE) {\n // We need to make sure the current delta recording gets merged into the previous cumulative\n // for the next cumulative recording.\n result = TemporalMetricProcessor.merge(\n last.accumulations,\n unreportedAccumulations,\n this._aggregator\n );\n } else {\n result = TemporalMetricProcessor.calibrateStartTime(\n last.accumulations,\n unreportedAccumulations,\n lastCollectionTime\n );\n }\n } else {\n // Call into user code to select aggregation temporality for the instrument.\n aggregationTemporality = collector.selectAggregationTemporality(\n instrumentDescriptor.type\n );\n }\n\n // Update last reported (cumulative) accumulation.\n this._reportHistory.set(collector, {\n accumulations: result,\n collectionTime,\n aggregationTemporality,\n });\n\n const accumulationRecords = AttributesMapToAccumulationRecords(result);\n\n // do not convert to metric data if there is nothing to convert.\n if (accumulationRecords.length === 0) {\n return undefined;\n }\n\n return this._aggregator.toMetricData(\n instrumentDescriptor,\n aggregationTemporality,\n accumulationRecords,\n /* endTime */ collectionTime\n );\n }\n\n private _stashAccumulations(currentAccumulation: AttributeHashMap<T>) {\n const registeredCollectors = this._unreportedAccumulations.keys();\n for (const collector of registeredCollectors) {\n let stash = this._unreportedAccumulations.get(collector);\n if (stash === undefined) {\n stash = [];\n this._unreportedAccumulations.set(collector, stash);\n }\n stash.push(currentAccumulation);\n }\n }\n\n private _getMergedUnreportedAccumulations(collector: MetricCollectorHandle) {\n let result = new AttributeHashMap<T>();\n const unreportedList = this._unreportedAccumulations.get(collector);\n this._unreportedAccumulations.set(collector, []);\n if (unreportedList === undefined) {\n return result;\n }\n for (const it of unreportedList) {\n result = TemporalMetricProcessor.merge(result, it, this._aggregator);\n }\n return result;\n }\n\n static merge<T extends Maybe<Accumulation>>(\n last: AttributeHashMap<T>,\n current: AttributeHashMap<T>,\n aggregator: Aggregator<T>\n ) {\n const result = last;\n const iterator = current.entries();\n let next = iterator.next();\n while (next.done !== true) {\n const [key, record, hash] = next.value;\n if (last.has(key, hash)) {\n const lastAccumulation = last.get(key, hash);\n // last.has() returned true, lastAccumulation is present.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const accumulation = aggregator.merge(lastAccumulation!, record);\n result.set(key, accumulation, hash);\n } else {\n result.set(key, record, hash);\n }\n\n next = iterator.next();\n }\n return result;\n }\n\n /**\n * Calibrate the reported metric streams' startTime to lastCollectionTime. Leaves\n * the new stream to be the initial observation time unchanged.\n */\n static calibrateStartTime<T extends Maybe<Accumulation>>(\n last: AttributeHashMap<T>,\n current: AttributeHashMap<T>,\n lastCollectionTime: HrTime\n ) {\n for (const [key, hash] of last.keys()) {\n const currentAccumulation = current.get(key, hash);\n currentAccumulation?.setStartTime(lastCollectionTime);\n }\n return current;\n }\n}\n\n// TypeScript complains about converting 3 elements tuple to AccumulationRecord<T>.\nfunction AttributesMapToAccumulationRecords<T>(\n map: AttributeHashMap<T>\n): AccumulationRecord<T>[] {\n return Array.from(map.entries()) as unknown as AccumulationRecord<T>[];\n}\n", "/*\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 { HrTime } from '@opentelemetry/api';\nimport { Accumulation, Aggregator } from '../aggregator/types';\nimport { InstrumentDescriptor } from '../InstrumentDescriptor';\nimport { AttributesProcessor } from '../view/AttributesProcessor';\nimport { MetricStorage } from './MetricStorage';\nimport { MetricData } from '../export/MetricData';\nimport { DeltaMetricProcessor } from './DeltaMetricProcessor';\nimport { TemporalMetricProcessor } from './TemporalMetricProcessor';\nimport { Maybe } from '../utils';\nimport { MetricCollectorHandle } from './MetricCollector';\nimport { AttributeHashMap } from './HashMap';\nimport { AsyncWritableMetricStorage } from './WritableMetricStorage';\n\n/**\n * Internal interface.\n *\n * Stores and aggregates {@link MetricData} for asynchronous instruments.\n */\nexport class AsyncMetricStorage<T extends Maybe<Accumulation>>\n extends MetricStorage\n implements AsyncWritableMetricStorage\n{\n private _deltaMetricStorage: DeltaMetricProcessor<T>;\n private _temporalMetricStorage: TemporalMetricProcessor<T>;\n\n constructor(\n _instrumentDescriptor: InstrumentDescriptor,\n aggregator: Aggregator<T>,\n private _attributesProcessor: AttributesProcessor,\n collectorHandles: MetricCollectorHandle[]\n ) {\n super(_instrumentDescriptor);\n this._deltaMetricStorage = new DeltaMetricProcessor(aggregator);\n this._temporalMetricStorage = new TemporalMetricProcessor(\n aggregator,\n collectorHandles\n );\n }\n\n record(measurements: AttributeHashMap<number>, observationTime: HrTime) {\n const processed = new AttributeHashMap<number>();\n Array.from(measurements.entries()).forEach(([attributes, value]) => {\n processed.set(this._attributesProcessor.process(attributes), value);\n });\n this._deltaMetricStorage.batchCumulate(processed, observationTime);\n }\n\n /**\n * Collects the metrics from this storage. The ObservableCallback is invoked\n * during the collection.\n *\n * Note: This is a stateful operation and may reset any interval-related\n * state for the MetricCollector.\n */\n collect(\n collector: MetricCollectorHandle,\n collectionTime: HrTime\n ): Maybe<MetricData> {\n const accumulations = this._deltaMetricStorage.collect();\n\n return this._temporalMetricStorage.buildMetrics(\n collector,\n this._instrumentDescriptor,\n accumulations,\n collectionTime\n );\n }\n}\n", "/*\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 { MetricStorage } from './MetricStorage';\nimport {\n InstrumentDescriptor,\n isDescriptorCompatibleWith,\n} from '../InstrumentDescriptor';\nimport * as api from '@opentelemetry/api';\nimport {\n getConflictResolutionRecipe,\n getIncompatibilityDetails,\n} from '../view/RegistrationConflicts';\nimport { MetricCollectorHandle } from './MetricCollector';\n\ntype StorageMap = Map<string, MetricStorage[]>;\n\n/**\n * Internal class for storing {@link MetricStorage}\n */\nexport class MetricStorageRegistry {\n private readonly _sharedRegistry: StorageMap = new Map();\n private readonly _perCollectorRegistry = new Map<\n MetricCollectorHandle,\n StorageMap\n >();\n\n static create() {\n return new MetricStorageRegistry();\n }\n\n getStorages(collector: MetricCollectorHandle): MetricStorage[] {\n let storages: MetricStorage[] = [];\n for (const metricStorages of this._sharedRegistry.values()) {\n storages = storages.concat(metricStorages);\n }\n\n const perCollectorStorages = this._perCollectorRegistry.get(collector);\n if (perCollectorStorages != null) {\n for (const metricStorages of perCollectorStorages.values()) {\n storages = storages.concat(metricStorages);\n }\n }\n\n return storages;\n }\n\n register(storage: MetricStorage) {\n this._registerStorage(storage, this._sharedRegistry);\n }\n\n registerForCollector(\n collector: MetricCollectorHandle,\n storage: MetricStorage\n ) {\n let storageMap = this._perCollectorRegistry.get(collector);\n if (storageMap == null) {\n storageMap = new Map();\n this._perCollectorRegistry.set(collector, storageMap);\n }\n this._registerStorage(storage, storageMap);\n }\n\n findOrUpdateCompatibleStorage<T extends MetricStorage>(\n expectedDescriptor: InstrumentDescriptor\n ): T | null {\n const storages = this._sharedRegistry.get(expectedDescriptor.name);\n if (storages === undefined) {\n return null;\n }\n\n // If the descriptor is compatible, the type of their metric storage\n // (either SyncMetricStorage or AsyncMetricStorage) must be compatible.\n return this._findOrUpdateCompatibleStorage<T>(expectedDescriptor, storages);\n }\n\n findOrUpdateCompatibleCollectorStorage<T extends MetricStorage>(\n collector: MetricCollectorHandle,\n expectedDescriptor: InstrumentDescriptor\n ): T | null {\n const storageMap = this._perCollectorRegistry.get(collector);\n if (storageMap === undefined) {\n return null;\n }\n\n const storages = storageMap.get(expectedDescriptor.name);\n if (storages === undefined) {\n return null;\n }\n\n // If the descriptor is compatible, the type of their metric storage\n // (either SyncMetricStorage or AsyncMetricStorage) must be compatible.\n return this._findOrUpdateCompatibleStorage<T>(expectedDescriptor, storages);\n }\n\n private _registerStorage(storage: MetricStorage, storageMap: StorageMap) {\n const descriptor = storage.getInstrumentDescriptor();\n const storages = storageMap.get(descriptor.name);\n\n if (storages === undefined) {\n storageMap.set(descriptor.name, [storage]);\n return;\n }\n\n storages.push(storage);\n }\n\n private _findOrUpdateCompatibleStorage<T extends MetricStorage>(\n expectedDescriptor: InstrumentDescriptor,\n existingStorages: MetricStorage[]\n ): T | null {\n let compatibleStorage = null;\n\n for (const existingStorage of existingStorages) {\n const existingDescriptor = existingStorage.getInstrumentDescriptor();\n\n if (isDescriptorCompatibleWith(existingDescriptor, expectedDescriptor)) {\n // Use the longer description if it does not match.\n if (existingDescriptor.description !== expectedDescriptor.description) {\n if (\n expectedDescriptor.description.length >\n existingDescriptor.description.length\n ) {\n existingStorage.updateDescription(expectedDescriptor.description);\n }\n\n api.diag.warn(\n 'A view or instrument with the name ',\n expectedDescriptor.name,\n ' has already been registered, but has a different description and is incompatible with another registered view.\\n',\n 'Details:\\n',\n getIncompatibilityDetails(existingDescriptor, expectedDescriptor),\n 'The longer description will be used.\\nTo resolve the conflict:',\n getConflictResolutionRecipe(existingDescriptor, expectedDescriptor)\n );\n }\n // Storage is fully compatible. There will never be more than one pre-existing fully compatible storage.\n compatibleStorage = existingStorage as T;\n } else {\n // The implementation SHOULD warn about duplicate instrument registration\n // conflicts after applying View configuration.\n api.diag.warn(\n 'A view or instrument with the name ',\n expectedDescriptor.name,\n ' has already been registered and is incompatible with another registered view.\\n',\n 'Details:\\n',\n getIncompatibilityDetails(existingDescriptor, expectedDescriptor),\n 'To resolve the conflict:\\n',\n getConflictResolutionRecipe(existingDescriptor, expectedDescriptor)\n );\n }\n }\n\n return compatibleStorage;\n }\n}\n", "/*\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 { InstrumentSelectorCriteria } from './InstrumentSelector';\nimport { InstrumentDescriptor } from '../InstrumentDescriptor';\n\nexport function getIncompatibilityDetails(\n existing: InstrumentDescriptor,\n otherDescriptor: InstrumentDescriptor\n) {\n let incompatibility = '';\n if (existing.unit !== otherDescriptor.unit) {\n incompatibility += `\\t- Unit '${existing.unit}' does not match '${otherDescriptor.unit}'\\n`;\n }\n if (existing.type !== otherDescriptor.type) {\n incompatibility += `\\t- Type '${existing.type}' does not match '${otherDescriptor.type}'\\n`;\n }\n if (existing.valueType !== otherDescriptor.valueType) {\n incompatibility += `\\t- Value Type '${existing.valueType}' does not match '${otherDescriptor.valueType}'\\n`;\n }\n if (existing.description !== otherDescriptor.description) {\n incompatibility += `\\t- Description '${existing.description}' does not match '${otherDescriptor.description}'\\n`;\n }\n\n return incompatibility;\n}\n\nexport function getValueTypeConflictResolutionRecipe(\n existing: InstrumentDescriptor,\n otherDescriptor: InstrumentDescriptor\n) {\n return `\\t- use valueType '${existing.valueType}' on instrument creation or use an instrument name other than '${otherDescriptor.name}'`;\n}\n\nexport function getUnitConflictResolutionRecipe(\n existing: InstrumentDescriptor,\n otherDescriptor: InstrumentDescriptor\n) {\n return `\\t- use unit '${existing.unit}' on instrument creation or use an instrument name other than '${otherDescriptor.name}'`;\n}\n\nexport function getTypeConflictResolutionRecipe(\n existing: InstrumentDescriptor,\n otherDescriptor: InstrumentDescriptor\n) {\n const selector: InstrumentSelectorCriteria = {\n name: otherDescriptor.name,\n type: otherDescriptor.type,\n unit: otherDescriptor.unit,\n };\n\n const selectorString = JSON.stringify(selector);\n\n return `\\t- create a new view with a name other than '${existing.name}' and InstrumentSelector '${selectorString}'`;\n}\n\nexport function getDescriptionResolutionRecipe(\n existing: InstrumentDescriptor,\n otherDescriptor: InstrumentDescriptor\n): string {\n const selector: InstrumentSelectorCriteria = {\n name: otherDescriptor.name,\n type: otherDescriptor.type,\n unit: otherDescriptor.unit,\n };\n\n const selectorString = JSON.stringify(selector);\n\n return `\\t- create a new view with a name other than '${existing.name}' and InstrumentSelector '${selectorString}'\n \\t- OR - create a new view with the name ${existing.name} and description '${existing.description}' and InstrumentSelector ${selectorString}\n \\t- OR - create a new view with the name ${otherDescriptor.name} and description '${existing.description}' and InstrumentSelector ${selectorString}`;\n}\n\nexport function getConflictResolutionRecipe(\n existing: InstrumentDescriptor,\n otherDescriptor: InstrumentDescriptor\n): string {\n // Conflicts that cannot be solved via views.\n if (existing.valueType !== otherDescriptor.valueType) {\n return getValueTypeConflictResolutionRecipe(existing, otherDescriptor);\n }\n\n if (existing.unit !== otherDescriptor.unit) {\n return getUnitConflictResolutionRecipe(existing, otherDescriptor);\n }\n\n // Conflicts that can be solved via views.\n if (existing.type !== otherDescriptor.type) {\n // this will automatically solve possible description conflicts.\n return getTypeConflictResolutionRecipe(existing, otherDescriptor);\n }\n\n if (existing.description !== otherDescriptor.description) {\n return getDescriptionResolutionRecipe(existing, otherDescriptor);\n }\n\n return '';\n}\n", "/*\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 { Context, HrTime, MetricAttributes } from '@opentelemetry/api';\nimport { WritableMetricStorage } from './WritableMetricStorage';\n\n/**\n * Internal interface.\n */\nexport class MultiMetricStorage implements WritableMetricStorage {\n constructor(private readonly _backingStorages: WritableMetricStorage[]) {}\n\n record(\n value: number,\n attributes: MetricAttributes,\n context: Context,\n recordTime: HrTime\n ) {\n this._backingStorages.forEach(it => {\n it.record(value, attributes, context, recordTime);\n });\n }\n}\n", "/*\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 {\n diag,\n HrTime,\n BatchObservableCallback,\n Observable,\n ObservableCallback,\n} from '@opentelemetry/api';\nimport { isObservableInstrument, ObservableInstrument } from '../Instruments';\nimport {\n BatchObservableResultImpl,\n ObservableResultImpl,\n} from '../ObservableResult';\nimport {\n callWithTimeout,\n PromiseAllSettled,\n isPromiseAllSettledRejectionResult,\n setEquals,\n} from '../utils';\n\n/**\n * Records for single instrument observable callback.\n */\ninterface ObservableCallbackRecord {\n callback: ObservableCallback;\n instrument: ObservableInstrument;\n}\n\n/**\n * Records for multiple instruments observable callback.\n */\ninterface BatchObservableCallbackRecord {\n callback: BatchObservableCallback;\n instruments: Set<ObservableInstrument>;\n}\n\n/**\n * An internal interface for managing ObservableCallbacks.\n *\n * Every registered callback associated with a set of instruments are be evaluated\n * exactly once during collection prior to reading data for that instrument.\n */\nexport class ObservableRegistry {\n private _callbacks: ObservableCallbackRecord[] = [];\n private _batchCallbacks: BatchObservableCallbackRecord[] = [];\n\n addCallback(callback: ObservableCallback, instrument: ObservableInstrument) {\n const idx = this._findCallback(callback, instrument);\n if (idx >= 0) {\n return;\n }\n this._callbacks.push({ callback, instrument });\n }\n\n removeCallback(\n callback: ObservableCallback,\n instrument: ObservableInstrument\n ) {\n const idx = this._findCallback(callback, instrument);\n if (idx < 0) {\n return;\n }\n this._callbacks.splice(idx, 1);\n }\n\n addBatchCallback(\n callback: BatchObservableCallback,\n instruments: Observable[]\n ) {\n // Create a set of unique instruments.\n const observableInstruments = new Set(\n instruments.filter(isObservableInstrument)\n );\n if (observableInstruments.size === 0) {\n diag.error(\n 'BatchObservableCallback is not associated with valid instruments',\n instruments\n );\n return;\n }\n const idx = this._findBatchCallback(callback, observableInstruments);\n if (idx >= 0) {\n return;\n }\n this._batchCallbacks.push({ callback, instruments: observableInstruments });\n }\n\n removeBatchCallback(\n callback: BatchObservableCallback,\n instruments: Observable[]\n ) {\n // Create a set of unique instruments.\n const observableInstruments = new Set(\n instruments.filter(isObservableInstrument)\n );\n const idx = this._findBatchCallback(callback, observableInstruments);\n if (idx < 0) {\n return;\n }\n this._batchCallbacks.splice(idx, 1);\n }\n\n /**\n * @returns a promise of rejected reasons for invoking callbacks.\n */\n async observe(\n collectionTime: HrTime,\n timeoutMillis?: number\n ): Promise<unknown[]> {\n const callbackFutures = this._observeCallbacks(\n collectionTime,\n timeoutMillis\n );\n const batchCallbackFutures = this._observeBatchCallbacks(\n collectionTime,\n timeoutMillis\n );\n\n const results = await PromiseAllSettled([\n ...callbackFutures,\n ...batchCallbackFutures,\n ]);\n\n const rejections = results\n .filter(isPromiseAllSettledRejectionResult)\n .map(it => it.reason);\n return rejections;\n }\n\n private _observeCallbacks(observationTime: HrTime, timeoutMillis?: number) {\n return this._callbacks.map(async ({ callback, instrument }) => {\n const observableResult = new ObservableResultImpl(\n instrument._descriptor.name,\n instrument._descriptor.valueType\n );\n let callPromise: Promise<void> = Promise.resolve(\n callback(observableResult)\n );\n if (timeoutMillis != null) {\n callPromise = callWithTimeout(callPromise, timeoutMillis);\n }\n await callPromise;\n instrument._metricStorages.forEach(metricStorage => {\n metricStorage.record(observableResult._buffer, observationTime);\n });\n });\n }\n\n private _observeBatchCallbacks(\n observationTime: HrTime,\n timeoutMillis?: number\n ) {\n return this._batchCallbacks.map(async ({ callback, instruments }) => {\n const observableResult = new BatchObservableResultImpl();\n let callPromise: Promise<void> = Promise.resolve(\n callback(observableResult)\n );\n if (timeoutMillis != null) {\n callPromise = callWithTimeout(callPromise, timeoutMillis);\n }\n await callPromise;\n instruments.forEach(instrument => {\n const buffer = observableResult._buffer.get(instrument);\n if (buffer == null) {\n return;\n }\n instrument._metricStorages.forEach(metricStorage => {\n metricStorage.record(buffer, observationTime);\n });\n });\n });\n }\n\n private _findCallback(\n callback: ObservableCallback,\n instrument: ObservableInstrument\n ) {\n return this._callbacks.findIndex(record => {\n return record.callback === callback && record.instrument === instrument;\n });\n }\n\n private _findBatchCallback(\n callback: BatchObservableCallback,\n instruments: Set<ObservableInstrument>\n ) {\n return this._batchCallbacks.findIndex(record => {\n return (\n record.callback === callback &&\n setEquals(record.instruments, instruments)\n );\n });\n }\n}\n", "/*\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 {\n diag,\n ObservableResult,\n MetricAttributes,\n ValueType,\n BatchObservableResult,\n Observable,\n} from '@opentelemetry/api';\nimport { AttributeHashMap } from './state/HashMap';\nimport { isObservableInstrument, ObservableInstrument } from './Instruments';\n\n/**\n * The class implements {@link ObservableResult} interface.\n */\nexport class ObservableResultImpl implements ObservableResult {\n /**\n * @internal\n */\n _buffer = new AttributeHashMap<number>();\n\n constructor(\n private _instrumentName: string,\n private _valueType: ValueType\n ) {}\n\n /**\n * Observe a measurement of the value associated with the given attributes.\n */\n observe(value: number, attributes: MetricAttributes = {}): void {\n if (typeof value !== 'number') {\n diag.warn(\n `non-number value provided to metric ${this._instrumentName}: ${value}`\n );\n return;\n }\n if (this._valueType === ValueType.INT && !Number.isInteger(value)) {\n diag.warn(\n `INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`\n );\n value = Math.trunc(value);\n // ignore non-finite values.\n if (!Number.isInteger(value)) {\n return;\n }\n }\n this._buffer.set(attributes, value);\n }\n}\n\n/**\n * The class implements {@link BatchObservableCallback} interface.\n */\nexport class BatchObservableResultImpl implements BatchObservableResult {\n /**\n * @internal\n */\n _buffer: Map<ObservableInstrument, AttributeHashMap<number>> = new Map();\n\n /**\n * Observe a measurement of the value associated with the given attributes.\n */\n observe(\n metric: Observable,\n value: number,\n attributes: MetricAttributes = {}\n ): void {\n if (!isObservableInstrument(metric)) {\n return;\n }\n let map = this._buffer.get(metric);\n if (map == null) {\n map = new AttributeHashMap();\n this._buffer.set(metric, map);\n }\n if (typeof value !== 'number') {\n diag.warn(\n `non-number value provided to metric ${metric._descriptor.name}: ${value}`\n );\n return;\n }\n if (\n metric._descriptor.valueType === ValueType.INT &&\n !Number.isInteger(value)\n ) {\n diag.warn(\n `INT value type cannot accept a floating-point value for ${metric._descriptor.name}, ignoring the fractional digits.`\n );\n value = Math.trunc(value);\n // ignore non-finite values.\n if (!Number.isInteger(value)) {\n return;\n }\n }\n map.set(attributes, value);\n }\n}\n", "/*\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 { Context, HrTime, MetricAttributes } from '@opentelemetry/api';\nimport { WritableMetricStorage } from './WritableMetricStorage';\nimport { Accumulation, Aggregator } from '../aggregator/types';\nimport { InstrumentDescriptor } from '../InstrumentDescriptor';\nimport { AttributesProcessor } from '../view/AttributesProcessor';\nimport { MetricStorage } from './MetricStorage';\nimport { MetricData } from '../export/MetricData';\nimport { DeltaMetricProcessor } from './DeltaMetricProcessor';\nimport { TemporalMetricProcessor } from './TemporalMetricProcessor';\nimport { Maybe } from '../utils';\nimport { MetricCollectorHandle } from './MetricCollector';\n\n/**\n * Internal interface.\n *\n * Stores and aggregates {@link MetricData} for synchronous instruments.\n */\nexport class SyncMetricStorage<T extends Maybe<Accumulation>>\n extends MetricStorage\n implements WritableMetricStorage\n{\n private _deltaMetricStorage: DeltaMetricProcessor<T>;\n private _temporalMetricStorage: TemporalMetricProcessor<T>;\n\n constructor(\n instrumentDescriptor: InstrumentDescriptor,\n aggregator: Aggregator<T>,\n private _attributesProcessor: AttributesProcessor,\n collectorHandles: MetricCollectorHandle[]\n ) {\n super(instrumentDescriptor);\n this._deltaMetricStorage = new DeltaMetricProcessor(aggregator);\n this._temporalMetricStorage = new TemporalMetricProcessor(\n aggregator,\n collectorHandles\n );\n }\n\n record(\n value: number,\n attributes: MetricAttributes,\n context: Context,\n recordTime: HrTime\n ) {\n attributes = this._attributesProcessor.process(attributes, context);\n this._deltaMetricStorage.record(value, attributes, context, recordTime);\n }\n\n /**\n * Collects the metrics from this storage.\n *\n * Note: This is a stateful operation and may reset any interval-related\n * state for the MetricCollector.\n */\n collect(\n collector: MetricCollectorHandle,\n collectionTime: HrTime\n ): Maybe<MetricData> {\n const accumulations = this._deltaMetricStorage.collect();\n\n return this._temporalMetricStorage.buildMetrics(\n collector,\n this._instrumentDescriptor,\n accumulations,\n collectionTime\n );\n }\n}\n", "/*\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 { Context, MetricAttributes } from '@opentelemetry/api';\n\n/**\n * The {@link AttributesProcessor} is responsible for customizing which\n * attribute(s) are to be reported as metrics dimension(s) and adding\n * additional dimension(s) from the {@link Context}.\n */\nexport abstract class AttributesProcessor {\n /**\n * Process the metric instrument attributes.\n *\n * @param incoming The metric instrument attributes.\n * @param context The active context when the instrument is synchronous.\n * `undefined` otherwise.\n */\n abstract process(\n incoming: MetricAttributes,\n context?: Context\n ): MetricAttributes;\n\n static Noop() {\n return NOOP;\n }\n}\n\nexport class NoopAttributesProcessor extends AttributesProcessor {\n process(incoming: MetricAttributes, _context?: Context) {\n return incoming;\n }\n}\n\n/**\n * {@link AttributesProcessor} that filters by allowed attribute names and drops any names that are not in the\n * allow list.\n */\nexport class FilteringAttributesProcessor extends AttributesProcessor {\n constructor(private _allowedAttributeNames: string[]) {\n super();\n }\n\n process(incoming: MetricAttributes, _context: Context): MetricAttributes {\n const filteredAttributes: MetricAttributes = {};\n Object.keys(incoming)\n .filter(attributeName =>\n this._allowedAttributeNames.includes(attributeName)\n )\n .forEach(\n attributeName =>\n (filteredAttributes[attributeName] = incoming[attributeName])\n );\n return filteredAttributes;\n }\n}\n\nconst NOOP = new NoopAttributesProcessor();\n", "/*\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 { HrTime } from '@opentelemetry/api';\nimport { InstrumentationScope } from '@opentelemetry/core';\nimport { MetricCollectOptions } from '../export/MetricProducer';\nimport { ScopeMetrics } from '../export/MetricData';\nimport {\n createInstrumentDescriptorWithView,\n InstrumentDescriptor,\n} from '../InstrumentDescriptor';\nimport { Meter } from '../Meter';\nimport { isNotNullish, Maybe } from '../utils';\nimport { AsyncMetricStorage } from './AsyncMetricStorage';\nimport { MeterProviderSharedState } from './MeterProviderSharedState';\nimport { MetricCollectorHandle } from './MetricCollector';\nimport { MetricStorageRegistry } from './MetricStorageRegistry';\nimport { MultiMetricStorage } from './MultiWritableMetricStorage';\nimport { ObservableRegistry } from './ObservableRegistry';\nimport { SyncMetricStorage } from './SyncMetricStorage';\nimport { Accumulation, Aggregator } from '../aggregator/types';\nimport { AttributesProcessor } from '../view/AttributesProcessor';\nimport { MetricStorage } from './MetricStorage';\n\n/**\n * An internal record for shared meter provider states.\n */\nexport class MeterSharedState {\n metricStorageRegistry = new MetricStorageRegistry();\n observableRegistry = new ObservableRegistry();\n meter: Meter;\n\n constructor(\n private _meterProviderSharedState: MeterProviderSharedState,\n private _instrumentationScope: InstrumentationScope\n ) {\n this.meter = new Meter(this);\n }\n\n registerMetricStorage(descriptor: InstrumentDescriptor) {\n const storages = this._registerMetricStorage(descriptor, SyncMetricStorage);\n\n if (storages.length === 1) {\n return storages[0];\n }\n return new MultiMetricStorage(storages);\n }\n\n registerAsyncMetricStorage(descriptor: InstrumentDescriptor) {\n const storages = this._registerMetricStorage(\n descriptor,\n AsyncMetricStorage\n );\n\n return storages;\n }\n\n /**\n * @param collector opaque handle of {@link MetricCollector} which initiated the collection.\n * @param collectionTime the HrTime at which the collection was initiated.\n * @param options options for collection.\n * @returns the list of metric data collected.\n */\n async collect(\n collector: MetricCollectorHandle,\n collectionTime: HrTime,\n options?: MetricCollectOptions\n ): Promise<ScopeMetricsResult | null> {\n /**\n * 1. Call all observable callbacks first.\n * 2. Collect metric result for the collector.\n */\n const errors = await this.observableRegistry.observe(\n collectionTime,\n options?.timeoutMillis\n );\n const storages = this.metricStorageRegistry.getStorages(collector);\n\n // prevent more allocations if there are no storages.\n if (storages.length === 0) {\n return null;\n }\n\n const metricDataList = storages\n .map(metricStorage => {\n return metricStorage.collect(collector, collectionTime);\n })\n .filter(isNotNullish);\n\n // skip this scope if no data was collected (storage created, but no data observed)\n if (metricDataList.length === 0) {\n return { errors };\n }\n\n return {\n scopeMetrics: {\n scope: this._instrumentationScope,\n metrics: metricDataList,\n },\n errors,\n };\n }\n\n private _registerMetricStorage<\n MetricStorageType extends MetricStorageConstructor,\n R extends InstanceType<MetricStorageType>,\n >(\n descriptor: InstrumentDescriptor,\n MetricStorageType: MetricStorageType\n ): R[] {\n const views = this._meterProviderSharedState.viewRegistry.findViews(\n descriptor,\n this._instrumentationScope\n );\n let storages = views.map(view => {\n const viewDescriptor = createInstrumentDescriptorWithView(\n view,\n descriptor\n );\n const compatibleStorage =\n this.metricStorageRegistry.findOrUpdateCompatibleStorage<R>(\n viewDescriptor\n );\n if (compatibleStorage != null) {\n return compatibleStorage;\n }\n const aggregator = view.aggregation.createAggregator(viewDescriptor);\n const viewStorage = new MetricStorageType(\n viewDescriptor,\n aggregator,\n view.attributesProcessor,\n this._meterProviderSharedState.metricCollectors\n ) as R;\n this.metricStorageRegistry.register(viewStorage);\n return viewStorage;\n });\n\n // Fallback to the per-collector aggregations if no view is configured for the instrument.\n if (storages.length === 0) {\n const perCollectorAggregations =\n this._meterProviderSharedState.selectAggregations(descriptor.type);\n const collectorStorages = perCollectorAggregations.map(\n ([collector, aggregation]) => {\n const compatibleStorage =\n this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage<R>(\n collector,\n descriptor\n );\n if (compatibleStorage != null) {\n return compatibleStorage;\n }\n const aggregator = aggregation.createAggregator(descriptor);\n const storage = new MetricStorageType(\n descriptor,\n aggregator,\n AttributesProcessor.Noop(),\n [collector]\n ) as R;\n this.metricStorageRegistry.registerForCollector(collector, storage);\n return storage;\n }\n );\n storages = storages.concat(collectorStorages);\n }\n\n return storages;\n }\n}\n\ninterface ScopeMetricsResult {\n scopeMetrics?: ScopeMetrics;\n errors: unknown[];\n}\n\ninterface MetricStorageConstructor {\n new (\n instrumentDescriptor: InstrumentDescriptor,\n aggregator: Aggregator<Maybe<Accumulation>>,\n attributesProcessor: AttributesProcessor,\n collectors: MetricCollectorHandle[]\n ): MetricStorage;\n}\n", "/*\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 { InstrumentationScope } from '@opentelemetry/core';\nimport { IResource } from '@opentelemetry/resources';\nimport { Aggregation, InstrumentType } from '..';\nimport { instrumentationScopeId } from '../utils';\nimport { ViewRegistry } from '../view/ViewRegistry';\nimport { MeterSharedState } from './MeterSharedState';\nimport { MetricCollector, MetricCollectorHandle } from './MetricCollector';\n\n/**\n * An internal record for shared meter provider states.\n */\nexport class MeterProviderSharedState {\n viewRegistry = new ViewRegistry();\n\n metricCollectors: MetricCollector[] = [];\n\n meterSharedStates: Map<string, MeterSharedState> = new Map();\n\n constructor(public resource: IResource) {}\n\n getMeterSharedState(instrumentationScope: InstrumentationScope) {\n const id = instrumentationScopeId(instrumentationScope);\n let meterSharedState = this.meterSharedStates.get(id);\n if (meterSharedState == null) {\n meterSharedState = new MeterSharedState(this, instrumentationScope);\n this.meterSharedStates.set(id, meterSharedState);\n }\n return meterSharedState;\n }\n\n selectAggregations(instrumentType: InstrumentType) {\n const result: [MetricCollectorHandle, Aggregation][] = [];\n for (const collector of this.metricCollectors) {\n result.push([collector, collector.selectAggregation(instrumentType)]);\n }\n return result;\n }\n}\n", "/*\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 { millisToHrTime } from '@opentelemetry/core';\nimport { AggregationTemporalitySelector } from '../export/AggregationSelector';\nimport { CollectionResult, ScopeMetrics } from '../export/MetricData';\nimport { MetricProducer, MetricCollectOptions } from '../export/MetricProducer';\nimport { MetricReader } from '../export/MetricReader';\nimport { InstrumentType } from '../InstrumentDescriptor';\nimport { ForceFlushOptions, ShutdownOptions } from '../types';\nimport { MeterProviderSharedState } from './MeterProviderSharedState';\n\n/**\n * An internal opaque interface that the MetricReader receives as\n * MetricProducer. It acts as the storage key to the internal metric stream\n * state for each MetricReader.\n */\nexport class MetricCollector implements MetricProducer {\n constructor(\n private _sharedState: MeterProviderSharedState,\n private _metricReader: MetricReader\n ) {}\n\n async collect(options?: MetricCollectOptions): Promise<CollectionResult> {\n const collectionTime = millisToHrTime(Date.now());\n const scopeMetrics: ScopeMetrics[] = [];\n const errors: unknown[] = [];\n\n const meterCollectionPromises = Array.from(\n this._sharedState.meterSharedStates.values()\n ).map(async meterSharedState => {\n const current = await meterSharedState.collect(\n this,\n collectionTime,\n options\n );\n\n // only add scope metrics if available\n if (current?.scopeMetrics != null) {\n scopeMetrics.push(current.scopeMetrics);\n }\n\n // only add errors if available\n if (current?.errors != null) {\n errors.push(...current.errors);\n }\n });\n await Promise.all(meterCollectionPromises);\n\n return {\n resourceMetrics: {\n resource: this._sharedState.resource,\n scopeMetrics: scopeMetrics,\n },\n errors: errors,\n };\n }\n\n /**\n * Delegates for MetricReader.forceFlush.\n */\n async forceFlush(options?: ForceFlushOptions): Promise<void> {\n await this._metricReader.forceFlush(options);\n }\n\n /**\n * Delegates for MetricReader.shutdown.\n */\n async shutdown(options?: ShutdownOptions): Promise<void> {\n await this._metricReader.shutdown(options);\n }\n\n selectAggregationTemporality(instrumentType: InstrumentType) {\n return this._metricReader.selectAggregationTemporality(instrumentType);\n }\n\n selectAggregation(instrumentType: InstrumentType) {\n return this._metricReader.selectAggregation(instrumentType);\n }\n}\n\n/**\n * An internal interface for MetricCollector. Exposes the necessary\n * information for metric collection.\n */\nexport interface MetricCollectorHandle {\n selectAggregationTemporality: AggregationTemporalitySelector;\n}\n", "import type { Attributes, Context } from \"@opentelemetry/api\";\nimport { diag, SpanKind } from \"@opentelemetry/api\";\nimport type {\n Span,\n ReadableSpan,\n SpanProcessor,\n} from \"@opentelemetry/sdk-trace-base\";\nimport { getVercelRequestContext } from \"../vercel-request-context/api\";\nimport { getVercelRequestContextAttributes } from \"../vercel-request-context/attributes\";\nimport { isSampled } from \"../util/sampled\";\nimport type { AttributesFromHeaders } from \"../types\";\n\n/** @internal */\nexport class CompositeSpanProcessor implements SpanProcessor {\n private readonly rootSpanIds = new Map<\n string,\n { rootSpanId: string; open: Span[] }\n >();\n private readonly waitSpanEnd = new Map<string, () => void>();\n\n constructor(\n private processors: SpanProcessor[],\n private attributesFromHeaders: AttributesFromHeaders | undefined\n ) {}\n\n forceFlush(): Promise<void> {\n return Promise.all(\n this.processors.map((p) =>\n p.forceFlush().catch((e) => {\n diag.error(\"@vercel/otel: forceFlush failed:\", e);\n })\n )\n ).then(() => undefined);\n }\n\n shutdown(): Promise<void> {\n return Promise.all(\n this.processors.map((p) => p.shutdown().catch(() => undefined))\n ).then(() => undefined);\n }\n\n onStart(span: Span, parentContext: Context): void {\n const { traceId, spanId, traceFlags } = span.spanContext();\n const isRoot = !span.parentSpanId || !this.rootSpanIds.has(traceId);\n if (isRoot) {\n this.rootSpanIds.set(traceId, { rootSpanId: spanId, open: [] });\n } else {\n this.rootSpanIds.get(traceId)?.open.push(span);\n }\n if (isRoot && isSampled(traceFlags)) {\n const vrc = getVercelRequestContext();\n const vercelRequestContextAttrs = getVercelRequestContextAttributes(\n vrc,\n this.attributesFromHeaders\n );\n if (vercelRequestContextAttrs) {\n span.setAttributes(vercelRequestContextAttrs);\n }\n\n // Flush the streams to avoid data loss.\n if (vrc) {\n vrc.waitUntil(async () => {\n if (this.rootSpanIds.has(traceId)) {\n // Not root has not completed yet, so no point in flushing.\n // Need to wait for onEnd.\n const promise = new Promise<void>((resolve) => {\n this.waitSpanEnd.set(traceId, resolve);\n });\n let timer: NodeJS.Timeout | undefined;\n await Promise.race([\n promise,\n new Promise((resolve) => {\n timer = setTimeout(() => {\n this.waitSpanEnd.delete(traceId);\n resolve(undefined);\n }, 50);\n }),\n ]);\n if (timer) {\n clearTimeout(timer);\n }\n }\n return this.forceFlush();\n });\n }\n }\n\n for (const spanProcessor of this.processors) {\n spanProcessor.onStart(span, parentContext);\n }\n }\n\n onEnd(span: ReadableSpan): void {\n const { traceId, spanId, traceFlags } = span.spanContext();\n const sampled = isSampled(traceFlags);\n const rootObj = this.rootSpanIds.get(traceId);\n const isRoot = rootObj?.rootSpanId === spanId;\n\n if (sampled) {\n const resourceAttributes = getResourceAttributes(span);\n if (resourceAttributes) {\n Object.assign(span.attributes, resourceAttributes);\n }\n }\n\n if (isRoot) {\n this.rootSpanIds.delete(traceId);\n if (rootObj.open.length > 0) {\n for (const openSpan of rootObj.open) {\n if (!openSpan.ended && openSpan.spanContext().spanId !== spanId) {\n try {\n openSpan.end();\n } catch (e) {\n diag.error(\"@vercel/otel: onEnd failed:\", e);\n }\n }\n }\n }\n } else if (rootObj) {\n for (let i = 0; i < rootObj.open.length; i++) {\n if (rootObj.open[i]?.spanContext().spanId === spanId) {\n rootObj.open.splice(i, 1);\n }\n }\n }\n\n for (const spanProcessor of this.processors) {\n spanProcessor.onEnd(span);\n }\n\n if (isRoot) {\n const pending = this.waitSpanEnd.get(traceId);\n if (pending) {\n this.waitSpanEnd.delete(traceId);\n pending();\n }\n }\n }\n}\n\nconst SPAN_KIND_NAME: { [key in SpanKind]: string } = {\n [SpanKind.INTERNAL]: \"internal\",\n [SpanKind.SERVER]: \"server\",\n [SpanKind.CLIENT]: \"client\",\n [SpanKind.PRODUCER]: \"producer\",\n [SpanKind.CONSUMER]: \"consumer\",\n};\n\nfunction getResourceAttributes(span: ReadableSpan): Attributes | undefined {\n const { kind, attributes } = span;\n const {\n \"operation.name\": operationName,\n \"resource.name\": resourceName,\n \"span.type\": spanTypeAttr,\n \"next.span_type\": nextSpanType,\n \"http.method\": httpMethod,\n \"http.route\": httpRoute,\n } = attributes;\n if (operationName) {\n return undefined;\n }\n\n const resourceNameResolved =\n resourceName ??\n (httpMethod &&\n typeof httpMethod === \"string\" &&\n httpRoute &&\n typeof httpRoute === \"string\"\n ? `${httpMethod} ${httpRoute}`\n : httpRoute);\n\n if (\n span.kind === SpanKind.SERVER &&\n httpMethod &&\n httpRoute &&\n typeof httpMethod === \"string\" &&\n typeof httpRoute === \"string\"\n ) {\n return {\n \"operation.name\": \"web.request\",\n \"resource.name\": resourceNameResolved,\n };\n }\n\n // Per https://github.com/DataDog/datadog-agent/blob/main/pkg/config/config_template.yaml,\n // the default operation.name is \"library name + span kind\".\n const libraryName = span.instrumentationLibrary.name;\n const spanType = nextSpanType ?? spanTypeAttr;\n if (spanType && typeof spanType === \"string\") {\n const nextOperationName = toOperationName(libraryName, spanType);\n if (httpRoute) {\n return {\n \"operation.name\": nextOperationName,\n \"resource.name\": resourceNameResolved,\n };\n }\n return { \"operation.name\": nextOperationName };\n }\n\n return {\n \"operation.name\": toOperationName(\n libraryName,\n kind === SpanKind.INTERNAL ? \"\" : SPAN_KIND_NAME[kind]\n ),\n };\n}\n\nfunction toOperationName(libraryName: string, name: string): string {\n if (!libraryName) {\n return name;\n }\n let cleanLibraryName = libraryName.replace(/[ @./]/g, \"_\");\n if (cleanLibraryName.startsWith(\"_\")) {\n cleanLibraryName = cleanLibraryName.slice(1);\n }\n return name ? `${cleanLibraryName}.${name}` : cleanLibraryName;\n}\n", "/**\n * TODO: Placeholder for the `@vercel/request-context-storage` package.\n * Replace with the real package once it's published.\n */\n\nimport type { SpanContext } from \"@opentelemetry/api\";\n\n/** @internal */\nexport interface VercelRequestContext {\n waitUntil: (\n promiseOrFunc: Promise<unknown> | (() => Promise<unknown>)\n ) => void;\n headers: Record<string, string | undefined>;\n url: string;\n telemetry?: {\n reportSpans: (data: unknown) => void;\n rootSpanContext?: SpanContext;\n };\n [key: symbol]: unknown;\n}\n\ninterface Reader {\n get: () => VercelRequestContext | undefined;\n}\n\nconst symbol = Symbol.for(\"@vercel/request-context\");\n\ninterface GlobalWithReader {\n [symbol]?: Reader;\n}\n\n/** @internal */\nexport function getVercelRequestContext(): VercelRequestContext | undefined {\n const reader = (globalThis as GlobalWithReader)[symbol];\n return reader?.get();\n}\n", "import type { Attributes, TextMapGetter } from \"@opentelemetry/api\";\nimport { SemanticAttributes } from \"@opentelemetry/semantic-conventions\";\nimport { omitUndefinedAttributes } from \"../util/attributes\";\nimport { parseRequestId } from \"../util/request-id\";\nimport type { AttributesFromHeaders } from \"../types\";\nimport type { VercelRequestContext } from \"./api\";\nimport { getVercelRequestContext } from \"./api\";\n\n/** @internal */\nexport function getVercelRequestContextAttributes(\n context: VercelRequestContext | undefined = getVercelRequestContext(),\n attributesFromHeaders?: AttributesFromHeaders\n): Attributes | undefined {\n if (!context) {\n return undefined;\n }\n\n const rootAttrs = attributesFromHeaders\n ? resolveAttributesFromHeaders(attributesFromHeaders, context.headers)\n : undefined;\n\n return omitUndefinedAttributes({\n [SemanticAttributes.HTTP_HOST]: context.headers.host,\n [SemanticAttributes.HTTP_USER_AGENT]: context.headers[\"user-agent\"],\n \"http.referer\": context.headers.referer,\n\n \"vercel.request_id\": parseRequestId(context.headers[\"x-vercel-id\"]),\n \"vercel.matched_path\": context.headers[\"x-matched-path\"],\n \"vercel.edge_region\": process.env.VERCEL_REGION,\n\n ...rootAttrs,\n });\n}\n\ntype VercelRequestContextHeaders = VercelRequestContext[\"headers\"];\n\nconst getter: TextMapGetter<VercelRequestContextHeaders> = {\n keys(_carrier: VercelRequestContextHeaders): string[] {\n return [];\n },\n get(\n carrier: VercelRequestContextHeaders,\n key: string\n ): string | string[] | undefined {\n return carrier[key.toLocaleLowerCase()];\n },\n};\n\nfunction resolveAttributesFromHeaders(\n attributesFromHeaders: AttributesFromHeaders,\n headers: VercelRequestContextHeaders\n): Attributes | undefined {\n if (typeof attributesFromHeaders === \"function\") {\n return attributesFromHeaders(headers, getter);\n }\n\n const attrs: Attributes = {};\n for (const [attrName, headerName] of Object.entries(attributesFromHeaders)) {\n const headerValue = headers[headerName.toLocaleLowerCase()];\n if (headerValue !== undefined) {\n attrs[attrName] = headerValue;\n }\n }\n return attrs;\n}\n", "import type { Attributes } from \"@opentelemetry/api\";\n\n/** @internal */\nexport function omitUndefinedAttributes<T extends Attributes = Attributes>(\n obj: T\n): T {\n return Object.fromEntries(\n Object.entries(obj).filter(([_, value]) => value !== undefined)\n ) as T;\n}\n", "/** @internal */\nexport function parseRequestId(header: string | undefined): string | undefined {\n if (!header) {\n return undefined;\n }\n const parts = header.split(\"::\");\n return parts.at(-1);\n}\n", "import { TraceFlags } from \"@opentelemetry/api\";\n\nexport function isSampled(traceFlags: number): boolean {\n // eslint-disable-next-line no-bitwise\n return (traceFlags & TraceFlags.SAMPLED) !== 0;\n}\n", "import type { ReadableSpan, SpanExporter } from \"@opentelemetry/sdk-trace-base\";\nimport type { IExportTraceServiceRequest } from \"@opentelemetry/otlp-transformer\";\nimport { createExportTraceServiceRequest } from \"@opentelemetry/otlp-transformer/build/src/trace\";\nimport type { ExportResult } from \"@opentelemetry/core\";\nimport { OTLPExporterEdgeBase } from \"./otlp-exporter-base\";\nimport { getDefaultUrl } from \"./trace-config\";\nimport type { OTLPExporterConfig } from \"./config\";\n\n/**\n * OTLP exporter for the `http/json` protocol. Compatible with the \"edge\" runtime.\n */\nexport class OTLPHttpJsonTraceExporter implements SpanExporter {\n /** @internal */\n private readonly impl: Impl;\n\n constructor(config: OTLPExporterConfig = {}) {\n this.impl = new Impl(config);\n }\n\n /** See `SpanExporter#export()` */\n export(\n spans: ReadableSpan[],\n resultCallback: (result: ExportResult) => void\n ): void {\n this.impl.export(spans, resultCallback);\n }\n\n /** See `SpanExporter#shutdown()` */\n shutdown(): Promise<void> {\n return this.impl.shutdown();\n }\n\n /** See `SpanExporter#forceFlush()` */\n forceFlush(): Promise<void> {\n return this.impl.forceFlush();\n }\n}\n\n/** @internal */\nclass Impl extends OTLPExporterEdgeBase<\n ReadableSpan,\n IExportTraceServiceRequest\n> {\n convert(spans: ReadableSpan[]): IExportTraceServiceRequest {\n return createExportTraceServiceRequest(spans, {\n useHex: true,\n useLongBits: false,\n });\n }\n\n override toMessage(serviceRequest: IExportTraceServiceRequest): {\n body: string | Uint8Array | Blob;\n contentType: string;\n headers?: Record<string, string> | undefined;\n } {\n return {\n body: JSON.stringify(serviceRequest),\n contentType: \"application/json\",\n };\n }\n\n getDefaultUrl(config: OTLPExporterConfig): string {\n return getDefaultUrl(config);\n }\n}\n", "import type { OTLPExporterError } from \"@opentelemetry/otlp-exporter-base\";\nimport { OTLPExporterBase } from \"@opentelemetry/otlp-exporter-base/build/src/OTLPExporterBase\";\nimport { diag } from \"@opentelemetry/api\";\nimport type { OTLPExporterConfig } from \"./config\";\n\n/** @internal */\nexport abstract class OTLPExporterEdgeBase<\n ExportItem,\n ServiceRequest,\n> extends OTLPExporterBase<OTLPExporterConfig, ExportItem, ServiceRequest> {\n /** @internal */\n private _headers: Record<string, unknown> | undefined;\n\n constructor(config: OTLPExporterConfig = {}) {\n super(config);\n if (config.headers) {\n this._headers = config.headers;\n }\n }\n\n onShutdown(): void {\n diag.debug(\"@vercel/otel/otlp: onShutdown\");\n }\n\n onInit(): void {\n diag.debug(\"@vercel/otel/otlp: onInit\");\n }\n\n send(\n items: ExportItem[],\n onSuccess: () => void,\n onError: (error: OTLPExporterError) => void\n ): void {\n if (this._shutdownOnce.isCalled) {\n diag.debug(\n \"@vercel/otel/otlp: Shutdown already started. Cannot send objects\"\n );\n return;\n }\n\n const serviceRequest = this.convert(items);\n\n let body: string | Uint8Array | Blob;\n let contentType: string;\n let headers: Record<string, string> | undefined;\n try {\n const message = this.toMessage(serviceRequest);\n ({ body, contentType, headers } = message);\n } catch (e) {\n diag.warn(\"@vercel/otel/otlp: no proto\", e);\n return;\n }\n\n const promise = fetch(this.url, {\n method: \"POST\",\n body,\n headers: {\n ...this._headers,\n ...headers,\n \"Content-Type\": contentType,\n \"User-Agent\": \"OTel-OTLP-Exporter-JavaScript/0.46.0\",\n },\n // @ts-expect-error - this handles a Next.js specific issue\n next: { internal: true },\n })\n .then((res) => {\n diag.debug(\"@vercel/otel/otlp: onSuccess\", res.status, res.statusText);\n onSuccess();\n // Drain the response body.\n void res.arrayBuffer().catch(() => undefined);\n })\n .catch((err) => {\n diag.error(\"@vercel/otel/otlp: onError\", err);\n onError(err as OTLPExporterError);\n })\n .finally(() => {\n const index = this._sendingPromises.indexOf(promise);\n this._sendingPromises.splice(index, 1);\n });\n\n this._sendingPromises.push(promise);\n }\n\n getDefaultUrl(_config: OTLPExporterConfig): string {\n throw new Error(\"Method not implemented.\");\n }\n\n abstract toMessage(serviceRequest: ServiceRequest): {\n body: string | Uint8Array | Blob;\n contentType: string;\n headers?: Record<string, string>;\n };\n}\n", "import type { OTLPExporterConfig } from \"./config\";\n\nconst DEFAULT_COLLECTOR_RESOURCE_PATH = \"v1/traces\";\nconst DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;\n\n/** @internal */\nexport function getDefaultUrl(config: OTLPExporterConfig): string {\n if (typeof config.url === \"string\") {\n return config.url;\n }\n return DEFAULT_COLLECTOR_URL;\n}\n", "import type { ReadableSpan, SpanExporter } from \"@opentelemetry/sdk-trace-base\";\nimport type { IExportTraceServiceRequest } from \"@opentelemetry/otlp-transformer\";\nimport { createExportTraceServiceRequest } from \"@opentelemetry/otlp-transformer/build/src/trace\";\nimport type { ExportResult } from \"@opentelemetry/core\";\nimport { OTLPExporterEdgeBase } from \"./otlp-exporter-base\";\nimport { getDefaultUrl } from \"./trace-config\";\nimport type { OTLPExporterConfig } from \"./config\";\nimport { encodeTraceServiceRequest } from \"./proto\";\n\n/**\n * OTLP exporter for the `http/protobuf` protocol. Compatible with the \"edge\" runtime.\n */\nexport class OTLPHttpProtoTraceExporter implements SpanExporter {\n /** @internal */\n private readonly impl: Impl;\n\n constructor(config: OTLPExporterConfig = {}) {\n this.impl = new Impl(config);\n }\n\n /** See `SpanExporter#export()` */\n export(\n spans: ReadableSpan[],\n resultCallback: (result: ExportResult) => void\n ): void {\n this.impl.export(spans, resultCallback);\n }\n\n /** See `SpanExporter#shutdown()` */\n shutdown(): Promise<void> {\n return this.impl.shutdown();\n }\n\n /** See `SpanExporter#forceFlush()` */\n forceFlush(): Promise<void> {\n return this.impl.forceFlush();\n }\n}\n\n/** @internal */\nclass Impl extends OTLPExporterEdgeBase<\n ReadableSpan,\n IExportTraceServiceRequest\n> {\n convert(spans: ReadableSpan[]): IExportTraceServiceRequest {\n return createExportTraceServiceRequest(spans, undefined);\n }\n\n override toMessage(serviceRequest: IExportTraceServiceRequest): {\n body: string | Uint8Array | Blob;\n contentType: string;\n headers?: Record<string, string> | undefined;\n } {\n const body = encodeTraceServiceRequest(serviceRequest);\n return {\n body,\n contentType: \"application/x-protobuf\",\n headers: { accept: \"application/x-protobuf\" },\n };\n }\n\n getDefaultUrl(config: OTLPExporterConfig): string {\n return getDefaultUrl(config);\n }\n}\n", "/* eslint-disable eslint-comments/disable-enable-pair */\n/* eslint-disable camelcase */\n/* eslint-disable eqeqeq */\n\n/* eslint-disable @typescript-eslint/prefer-optional-chain */\n/* eslint-disable @typescript-eslint/prefer-for-of */\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n/* eslint-disable @typescript-eslint/no-unnecessary-condition */\n\n/**\n * This file is constructed by:\n *\n * 1. Clone https://github.com/open-telemetry/opentelemetry-js.git\n * 2. Run `protos:generate` in `experimental/packages/otlp-proto-exporter-base/`\n * 3. Fork `experimental/packages/otlp-proto-exporter-base/src/generated/root.js` and inline all encode methods. Throw away the rest of the code.\n *\n * The OTLP protocol is very stable, so these steps would only need to be done rarely.\n */\n\nimport type {\n IAnyValue,\n IArrayValue,\n IEvent,\n IExportTraceServiceRequest,\n IInstrumentationScope,\n IKeyValue,\n IKeyValueList,\n ILink,\n IResource,\n IResourceSpans,\n IScopeSpans,\n ISpan,\n IStatus,\n} from \"@opentelemetry/otlp-transformer\";\nimport type { Long } from \"protobufjs/minimal\";\nimport { Writer } from \"protobufjs/minimal\";\n\nexport function encodeTraceServiceRequest(\n message: IExportTraceServiceRequest\n): Uint8Array {\n const writer = new Writer();\n ExportTraceServiceRequest_encode(message, writer);\n return writer.finish();\n}\n\nexport function ExportTraceServiceRequest_encode(\n message: IExportTraceServiceRequest,\n writer: Writer\n): Writer {\n if (message.resourceSpans != null && message.resourceSpans.length)\n for (let i = 0; i < message.resourceSpans.length; ++i)\n ResourceSpans_encode(\n message.resourceSpans[i]!,\n writer.uint32(/* id 1, wireType 2 =*/ 10).fork()\n ).ldelim();\n return writer;\n}\n\nfunction ResourceSpans_encode(message: IResourceSpans, writer: Writer): Writer {\n if (message.resource != null)\n Resource_encode(\n message.resource,\n writer.uint32(/* id 1, wireType 2 =*/ 10).fork()\n ).ldelim();\n if (message.scopeSpans != null && message.scopeSpans.length)\n for (let i = 0; i < message.scopeSpans.length; ++i)\n ScopeSpans_encode(\n message.scopeSpans[i]!,\n writer.uint32(/* id 2, wireType 2 =*/ 18).fork()\n ).ldelim();\n if (message.schemaUrl != null)\n writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.schemaUrl);\n return writer;\n}\n\nfunction Resource_encode(message: IResource, writer: Writer): Writer {\n if (message.attributes != null && message.attributes.length)\n for (let i = 0; i < message.attributes.length; ++i)\n KeyValue_encode(\n message.attributes[i]!,\n writer.uint32(/* id 1, wireType 2 =*/ 10).fork()\n ).ldelim();\n if (message.droppedAttributesCount != null)\n writer\n .uint32(/* id 2, wireType 0 =*/ 16)\n .uint32(message.droppedAttributesCount);\n return writer;\n}\n\nfunction ScopeSpans_encode(message: IScopeSpans, writer: Writer): Writer {\n if (message.scope != null)\n InstrumentationScope_encode(\n message.scope,\n writer.uint32(/* id 1, wireType 2 =*/ 10).fork()\n ).ldelim();\n if (message.spans != null && message.spans.length)\n for (let i = 0; i < message.spans.length; ++i)\n Span_encode(\n message.spans[i]!,\n writer.uint32(/* id 2, wireType 2 =*/ 18).fork()\n ).ldelim();\n if (message.schemaUrl != null)\n writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.schemaUrl);\n return writer;\n}\n\nfunction KeyValue_encode(message: IKeyValue, writer: Writer): Writer {\n if (message.key != null)\n writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.key);\n if (message.value != null)\n AnyValue_encode(\n message.value,\n writer.uint32(/* id 2, wireType 2 =*/ 18).fork()\n ).ldelim();\n return writer;\n}\n\nfunction AnyValue_encode(message: IAnyValue, writer: Writer): Writer {\n if (message.stringValue != null)\n writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.stringValue);\n if (message.boolValue != null)\n writer.uint32(/* id 2, wireType 0 =*/ 16).bool(message.boolValue);\n if (message.intValue != null)\n writer.uint32(/* id 3, wireType 0 =*/ 24).int64(message.intValue);\n if (message.doubleValue != null)\n writer.uint32(/* id 4, wireType 1 =*/ 33).double(message.doubleValue);\n if (message.arrayValue != null)\n ArrayValue_encode(\n message.arrayValue,\n writer.uint32(/* id 5, wireType 2 =*/ 42).fork()\n ).ldelim();\n if (message.kvlistValue != null)\n KeyValueList_encode(\n message.kvlistValue,\n writer.uint32(/* id 6, wireType 2 =*/ 50).fork()\n ).ldelim();\n if (message.bytesValue != null)\n writer.uint32(/* id 7, wireType 2 =*/ 58).bytes(message.bytesValue);\n return writer;\n}\n\nfunction ArrayValue_encode(message: IArrayValue, writer: Writer): Writer {\n if (message.values != null && message.values.length)\n for (let i = 0; i < message.values.length; ++i)\n AnyValue_encode(\n message.values[i]!,\n writer.uint32(/* id 1, wireType 2 =*/ 10).fork()\n ).ldelim();\n return writer;\n}\n\nfunction KeyValueList_encode(message: IKeyValueList, writer: Writer): Writer {\n if (message.values != null && message.values.length)\n for (let i = 0; i < message.values.length; ++i)\n KeyValue_encode(\n message.values[i]!,\n writer.uint32(/* id 1, wireType 2 =*/ 10).fork()\n ).ldelim();\n return writer;\n}\n\nfunction InstrumentationScope_encode(\n message: IInstrumentationScope,\n writer: Writer\n): Writer {\n if (message.name != null)\n writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.name);\n if (message.version != null)\n writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.version);\n if (message.attributes != null && message.attributes.length)\n for (let i = 0; i < message.attributes.length; ++i)\n KeyValue_encode(\n message.attributes[i]!,\n writer.uint32(/* id 3, wireType 2 =*/ 26).fork()\n ).ldelim();\n if (message.droppedAttributesCount != null)\n writer\n .uint32(/* id 4, wireType 0 =*/ 32)\n .uint32(message.droppedAttributesCount);\n return writer;\n}\n\nfunction Span_encode(message: ISpan, writer: Writer): Writer {\n if (message.traceId != null)\n writer.uint32(/* id 1, wireType 2 =*/ 10).bytes(message.traceId);\n if (message.spanId != null)\n writer.uint32(/* id 2, wireType 2 =*/ 18).bytes(message.spanId);\n if (message.traceState != null)\n writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.traceState);\n if (message.parentSpanId != null)\n writer.uint32(/* id 4, wireType 2 =*/ 34).bytes(message.parentSpanId);\n if (message.name != null)\n writer.uint32(/* id 5, wireType 2 =*/ 42).string(message.name);\n if (message.kind != null)\n writer.uint32(/* id 6, wireType 0 =*/ 48).int32(message.kind);\n if (message.startTimeUnixNano != null)\n writer\n .uint32(/* id 7, wireType 1 =*/ 57)\n .fixed64(message.startTimeUnixNano as Long);\n if (message.endTimeUnixNano != null)\n writer\n .uint32(/* id 8, wireType 1 =*/ 65)\n .fixed64(message.endTimeUnixNano as Long);\n if (message.attributes != null && message.attributes.length)\n for (let i = 0; i < message.attributes.length; ++i)\n KeyValue_encode(\n message.attributes[i]!,\n writer.uint32(/* id 9, wireType 2 =*/ 74).fork()\n ).ldelim();\n if (message.droppedAttributesCount != null)\n writer\n .uint32(/* id 10, wireType 0 =*/ 80)\n .uint32(message.droppedAttributesCount);\n if (message.events != null && message.events.length)\n for (let i = 0; i < message.events.length; ++i)\n Event_encode(\n message.events[i]!,\n writer.uint32(/* id 11, wireType 2 =*/ 90).fork()\n ).ldelim();\n if (message.droppedEventsCount != null)\n writer\n .uint32(/* id 12, wireType 0 =*/ 96)\n .uint32(message.droppedEventsCount);\n if (message.links != null && message.links.length)\n for (let i = 0; i < message.links.length; ++i)\n Link_encode(\n message.links[i]!,\n writer.uint32(/* id 13, wireType 2 =*/ 106).fork()\n ).ldelim();\n if (message.droppedLinksCount != null)\n writer\n .uint32(/* id 14, wireType 0 =*/ 112)\n .uint32(message.droppedLinksCount);\n if (message.status != null)\n Status_encode(\n message.status,\n writer.uint32(/* id 15, wireType 2 =*/ 122).fork()\n ).ldelim();\n return writer;\n}\n\nfunction Status_encode(message: IStatus, writer: Writer): Writer {\n if (message.message != null)\n writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.message);\n if (message.code != null)\n writer.uint32(/* id 3, wireType 0 =*/ 24).int32(message.code);\n return writer;\n}\n\nfunction Event_encode(message: IEvent, writer: Writer): Writer {\n if (message.timeUnixNano != null)\n writer\n .uint32(/* id 1, wireType 1 =*/ 9)\n .fixed64(message.timeUnixNano as Long);\n if (message.name != null)\n writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.name);\n if (message.attributes != null && message.attributes.length)\n for (let i = 0; i < message.attributes.length; ++i)\n KeyValue_encode(\n message.attributes[i]!,\n writer.uint32(/* id 3, wireType 2 =*/ 26).fork()\n ).ldelim();\n if (message.droppedAttributesCount != null)\n writer\n .uint32(/* id 4, wireType 0 =*/ 32)\n .uint32(message.droppedAttributesCount);\n return writer;\n}\n\nfunction Link_encode(message: ILink, writer: Writer): Writer {\n if (message.traceId != null)\n writer.uint32(/* id 1, wireType 2 =*/ 10).bytes(message.traceId);\n if (message.spanId != null)\n writer.uint32(/* id 2, wireType 2 =*/ 18).bytes(message.spanId);\n if (message.traceState != null)\n writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.traceState);\n if (message.attributes != null && message.attributes.length)\n for (let i = 0; i < message.attributes.length; ++i)\n KeyValue_encode(\n message.attributes[i]!,\n writer.uint32(/* id 4, wireType 2 =*/ 34).fork()\n ).ldelim();\n if (message.droppedAttributesCount != null)\n writer\n .uint32(/* id 5, wireType 0 =*/ 40)\n .uint32(message.droppedAttributesCount);\n return writer;\n}\n", "import {\n SpanKind,\n SpanStatusCode,\n propagation,\n context,\n trace as traceApi,\n} from \"@opentelemetry/api\";\nimport type {\n Attributes,\n Span,\n TextMapSetter,\n TracerProvider,\n} from \"@opentelemetry/api\";\nimport type {\n Instrumentation,\n InstrumentationConfig,\n} from \"@opentelemetry/instrumentation\";\nimport { SemanticAttributes } from \"@opentelemetry/semantic-conventions\";\nimport { resolveTemplate } from \"../util/template\";\nimport { getVercelRequestContext } from \"../vercel-request-context/api\";\nimport { isSampled } from \"../util/sampled\";\n\n/**\n * Configuration for the \"fetch\" instrumentation.\n *\n * Some of this configuration can be overriden on a per-fetch call basis by\n * using the `opentelemetry` property in the `RequestInit` object (requires Next 14.1.1 or above).\n * This property can include:\n * - `ignore`: boolean - whether to ignore the fetch call from tracing. Overrides\n * `ignoreUrls`.\n * - `propagateContext: boolean`: overrides `propagateContextUrls` for this call.\n * - `spanName: string`: overrides the computed span name for this call.\n * - `attributes: Attributes`: overrides the computed attributes for this call.\n */\nexport interface FetchInstrumentationConfig extends InstrumentationConfig {\n /**\n * A set of URL matchers (string prefix or regex) that should be ignored from tracing.\n * By default all URLs are traced.\n * Can be overriden by the `opentelemetry.ignore` property in the `RequestInit` object.\n *\n * Example: `fetch: { ignoreUrls: [/example.com/] }`.\n */\n ignoreUrls?: (string | RegExp)[];\n\n /**\n * A set of URL matchers (string prefix or regex) for which the tracing context\n * should be propagated (see [`propagators`](Configuration#propagators)).\n * By default the context is propagated _only_ for the\n * [deployment URLs](https://vercel.com/docs/deployments/generated-urls), all\n * other URLs should be enabled explicitly.\n * Can be overriden by the `opentelemetry.propagateContext` property in the `RequestInit` object.\n *\n * Example: `fetch: { propagateContextUrls: [ /my.api/ ] }`.\n */\n propagateContextUrls?: (string | RegExp)[];\n\n /**\n * A set of URL matchers (string prefix or regex) for which the tracing context\n * should not be propagated (see [`propagators`](Configuration#propagators)). This allows you to exclude a\n * subset of URLs allowed by the [`propagateContextUrls`](FetchInstrumentationConfig#propagateContextUrls).\n * Can be overriden by the `opentelemetry.propagateContext` property in the `RequestInit` object.\n */\n dontPropagateContextUrls?: (string | RegExp)[];\n\n /**\n * A string for the \"resource.name\" attribute that can include attribute expressions in `{}`.\n * Can be overriden by the `opentelemetry.attributes` property in the `RequestInit` object.\n *\n * Example: `fetch: { resourceNameTemplate: \"{http.host}\" }`.\n */\n resourceNameTemplate?: string;\n\n /**\n * A map of attributes that should be created from the request headers. The keys of the map are\n * attribute names and the values are request header names. If a resonse header doesn't exist, no\n * attribute will be created for it.\n *\n * Example: `fetch: { attributesFromRequestHeaders: { \"attr1\": \"X-Attr\" } }`\n */\n attributesFromRequestHeaders?: Record<string, string>;\n\n /**\n * A map of attributes that should be created from the response headers. The keys of the map are\n * attribute names and the values are response header names. If a resonse header doesn't exist, no\n * attribute will be created for it.\n *\n * Example: `fetch: { attributesFromResponseHeaders: { \"attr1\": \"X-Attr\" } }`\n */\n attributesFromResponseHeaders?: Record<string, string>;\n}\n\ndeclare global {\n interface RequestInit {\n opentelemetry?: {\n ignore?: boolean;\n propagateContext?: boolean;\n spanName?: string;\n attributes?: Attributes;\n };\n }\n}\n\ntype InternalRequestInit = RequestInit & {\n next?: {\n internal: boolean;\n };\n};\n\nexport class FetchInstrumentation implements Instrumentation {\n instrumentationName = \"@vercel/otel/fetch\";\n instrumentationVersion = \"1.0.0\";\n /** @internal */\n private config: FetchInstrumentationConfig;\n /** @internal */\n private originalFetch: typeof fetch | undefined;\n /** @internal */\n private tracerProvider: TracerProvider | undefined;\n\n constructor(config: FetchInstrumentationConfig = {}) {\n this.config = config;\n }\n\n getConfig(): FetchInstrumentationConfig {\n return this.config;\n }\n\n setConfig(): void {\n // Nothing.\n }\n\n setTracerProvider(tracerProvider: TracerProvider): void {\n this.tracerProvider = tracerProvider;\n }\n\n setMeterProvider(): void {\n // Nothing.\n }\n\n public enable(): void {\n this.disable();\n\n const { tracerProvider } = this;\n if (!tracerProvider) {\n return;\n }\n\n const tracer = tracerProvider.getTracer(\n this.instrumentationName,\n this.instrumentationVersion\n );\n\n const ignoreUrls = this.config.ignoreUrls ?? [];\n\n const shouldIgnore = (\n url: URL,\n init: InternalRequestInit | undefined\n ): boolean => {\n if (init?.opentelemetry?.ignore !== undefined) {\n return init.opentelemetry.ignore;\n }\n if (ignoreUrls.length === 0) {\n return false;\n }\n const urlString = url.toString();\n return ignoreUrls.some((match) => {\n if (typeof match === \"string\") {\n if (match === \"*\") {\n return true;\n }\n return urlString.startsWith(match);\n }\n return match.test(urlString);\n });\n };\n\n const host =\n process.env.VERCEL_URL || process.env.NEXT_PUBLIC_VERCEL_URL || null;\n const branchHost =\n process.env.VERCEL_BRANCH_URL ||\n process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL ||\n null;\n const propagateContextUrls = this.config.propagateContextUrls ?? [];\n const dontPropagateContextUrls = this.config.dontPropagateContextUrls ?? [];\n const resourceNameTemplate = this.config.resourceNameTemplate;\n const { attributesFromRequestHeaders, attributesFromResponseHeaders } =\n this.config;\n\n const shouldPropagate = (\n url: URL,\n init: InternalRequestInit | undefined\n ): boolean => {\n if (init?.opentelemetry?.propagateContext) {\n return init.opentelemetry.propagateContext;\n }\n const urlString = url.toString();\n if (\n dontPropagateContextUrls.length > 0 &&\n dontPropagateContextUrls.some((match) => {\n if (typeof match === \"string\") {\n if (match === \"*\") {\n return true;\n }\n return urlString.startsWith(match);\n }\n return match.test(urlString);\n })\n ) {\n return false;\n }\n // Allow same origin.\n if (\n host &&\n url.protocol === \"https:\" &&\n (url.host === host ||\n url.host === branchHost ||\n url.host === getVercelRequestContext()?.headers.host)\n ) {\n return true;\n }\n // Allow localhost for testing in a dev mode.\n if (!host && url.protocol === \"http:\" && url.hostname === \"localhost\") {\n return true;\n }\n return propagateContextUrls.some((match) => {\n if (typeof match === \"string\") {\n if (match === \"*\") {\n return true;\n }\n return urlString.startsWith(match);\n }\n return match.test(urlString);\n });\n };\n\n // Disable fetch tracing in Next.js.\n process.env.NEXT_OTEL_FETCH_DISABLED = \"1\";\n\n const originalFetch = globalThis.fetch;\n this.originalFetch = originalFetch;\n\n const doFetch: typeof fetch = async (input, initArg) => {\n const init = initArg as InternalRequestInit | undefined;\n\n // Passthrough internal requests.\n if (init?.next?.internal) {\n return originalFetch(input, init);\n }\n\n const req = new Request(\n // The input Request must be cloned to avoid the bug\n // on Edge runtime where the `new Request()` eagerly\n // consumes the body of the original Request.\n input instanceof Request ? input.clone() : input,\n init\n );\n const url = new URL(req.url);\n if (shouldIgnore(url, init)) {\n return originalFetch(input, init);\n }\n\n const attrs = {\n [SemanticAttributes.HTTP_METHOD]: req.method,\n [SemanticAttributes.HTTP_URL]: req.url,\n [SemanticAttributes.HTTP_HOST]: url.host,\n [SemanticAttributes.HTTP_SCHEME]: url.protocol.replace(\":\", \"\"),\n [SemanticAttributes.NET_PEER_NAME]: url.hostname,\n [SemanticAttributes.NET_PEER_PORT]: url.port,\n };\n const resourceName = resourceNameTemplate\n ? resolveTemplate(resourceNameTemplate, attrs)\n : removeSearch(req.url);\n\n const spanName =\n init?.opentelemetry?.spanName ?? `fetch ${req.method} ${req.url}`;\n\n const parentContext = context.active();\n\n const span = tracer.startSpan(\n spanName,\n {\n kind: SpanKind.CLIENT,\n attributes: {\n ...attrs,\n \"operation.name\": `fetch.${req.method}`,\n \"resource.name\": resourceName,\n ...init?.opentelemetry?.attributes,\n },\n },\n parentContext\n );\n if (!span.isRecording() || !isSampled(span.spanContext().traceFlags)) {\n span.end();\n return originalFetch(input, init);\n }\n\n if (shouldPropagate(url, init)) {\n const fetchContext = traceApi.setSpan(parentContext, span);\n propagation.inject(fetchContext, req.headers, HEADERS_SETTER);\n }\n\n if (attributesFromRequestHeaders) {\n headersToAttributes(span, attributesFromRequestHeaders, req.headers);\n }\n\n try {\n const startTime = Date.now();\n // Remove \"content-type\" for a FormData body because undici regenerates\n // a new multipart separator each time.\n if (init?.body && init.body instanceof FormData) {\n req.headers.delete(\"content-type\");\n }\n const res = await originalFetch(input, {\n ...init,\n headers: req.headers,\n });\n const duration = Date.now() - startTime;\n span.setAttribute(SemanticAttributes.HTTP_STATUS_CODE, res.status);\n span.setAttribute(\"http.response_time\", duration);\n if (attributesFromResponseHeaders) {\n headersToAttributes(span, attributesFromResponseHeaders, res.headers);\n }\n if (res.status >= 500) {\n onError(span, `Status: ${res.status} (${res.statusText})`);\n }\n\n // Flush body, but non-blocking.\n if (res.body) {\n void pipeResponse(res).then(\n (byteLength) => {\n if (span.isRecording()) {\n span.setAttribute(\n SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED,\n byteLength\n );\n span.end();\n }\n },\n (err) => {\n if (span.isRecording()) {\n onError(span, err);\n span.end();\n }\n }\n );\n } else {\n span.end();\n }\n\n return res;\n } catch (e) {\n onError(span, e);\n span.end();\n throw e;\n }\n };\n globalThis.fetch = doFetch;\n }\n\n public disable(): void {\n if (this.originalFetch) {\n globalThis.fetch = this.originalFetch;\n }\n }\n}\n\nconst HEADERS_SETTER: TextMapSetter<Headers> = {\n set(carrier: Headers, key: string, value: string): void {\n carrier.set(key, value);\n },\n};\n\nfunction removeSearch(url: string): string {\n const index = url.indexOf(\"?\");\n return index === -1 ? url : url.substring(0, index);\n}\n\nfunction pipeResponse(res: Response): Promise<number> {\n let length = 0;\n const clone = res.clone();\n const reader = clone.body?.getReader();\n if (!reader) {\n return Promise.resolve(0);\n }\n const read = (): Promise<void> => {\n return reader.read().then(({ done, value }) => {\n if (done) {\n return;\n }\n length += value.byteLength;\n return read();\n });\n };\n return read().then(() => length);\n}\n\nfunction onError(span: Span, err: unknown): void {\n if (err instanceof Error) {\n span.recordException(err);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: err.message,\n });\n } else {\n const message = String(err);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message,\n });\n }\n}\n\nfunction headersToAttributes(\n span: Span,\n attrsToHeadersMap: Record<string, string>,\n headers: Headers\n): void {\n for (const [attrName, headerName] of Object.entries(attrsToHeadersMap)) {\n const headerValue = headers.get(headerName);\n if (headerValue !== null) {\n span.setAttribute(attrName, headerValue);\n }\n }\n}\n", "import type { Attributes } from \"@opentelemetry/api\";\n\nexport function resolveTemplate(template: string, attrs: Attributes): string {\n return template.replace(/\\{(?<temp1>[^{}]+)\\}/g, (match, key) => {\n const value = attrs[key as string];\n if (value !== undefined) {\n return String(value);\n }\n return match;\n });\n}\n", "import {\n createTraceState,\n isSpanContextValid,\n trace as traceApi,\n} from \"@opentelemetry/api\";\nimport type {\n Context,\n SpanContext,\n TextMapGetter,\n TextMapPropagator,\n TextMapSetter,\n} from \"@opentelemetry/api\";\nimport { isTracingSuppressed } from \"@opentelemetry/core\";\n\nconst VERSION = \"00\";\n\nconst TRACE_PARENT_HEADER = \"traceparent\";\nconst TRACE_STATE_HEADER = \"tracestate\";\n\n/**\n * Same as the `W3CTraceContextPropagator` from `@opentelemetry/core`, but with\n * a workaround for RegExp issue in Edge.\n */\nexport class W3CTraceContextPropagator implements TextMapPropagator {\n fields(): string[] {\n return [TRACE_PARENT_HEADER, TRACE_STATE_HEADER];\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n inject(context: Context, carrier: any, setter: TextMapSetter): void {\n const spanContext = traceApi.getSpanContext(context);\n if (\n !spanContext ||\n isTracingSuppressed(context) ||\n !isSpanContextValid(spanContext)\n )\n return;\n\n const traceParent = `${VERSION}-${spanContext.traceId}-${\n spanContext.spanId\n }-0${Number(spanContext.traceFlags || 0).toString(16)}`;\n\n setter.set(carrier, TRACE_PARENT_HEADER, traceParent);\n if (spanContext.traceState) {\n setter.set(\n carrier,\n TRACE_STATE_HEADER,\n spanContext.traceState.serialize()\n );\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n extract(context: Context, carrier: any, getter: TextMapGetter): Context {\n const traceParentHeader = getter.get(carrier, TRACE_PARENT_HEADER);\n if (!traceParentHeader) return context;\n const traceParent = Array.isArray(traceParentHeader)\n ? traceParentHeader[0]\n : traceParentHeader;\n if (typeof traceParent !== \"string\") return context;\n const spanContext = parseTraceParent(traceParent);\n if (!spanContext) return context;\n\n spanContext.isRemote = true;\n\n const traceStateHeader = getter.get(carrier, TRACE_STATE_HEADER);\n if (traceStateHeader) {\n // If more than one `tracestate` header is found, we merge them into a\n // single header.\n const state = Array.isArray(traceStateHeader)\n ? traceStateHeader.join(\",\")\n : traceStateHeader;\n spanContext.traceState = createTraceState(\n typeof state === \"string\" ? state : undefined\n );\n }\n return traceApi.setSpanContext(context, spanContext);\n }\n}\n\nfunction parseTraceParent(traceParent: string): SpanContext | null {\n const [version, traceId, spanId, traceFlags, other] = traceParent.split(\"-\");\n if (\n !version ||\n !traceId ||\n !spanId ||\n !traceFlags ||\n version.length !== 2 ||\n traceId.length !== 32 ||\n spanId.length !== 16 ||\n traceFlags.length !== 2\n )\n return null;\n\n // According to the specification the implementation should be compatible\n // with future versions. If there are more parts, we only reject it if it's using version 00\n // See https://www.w3.org/TR/trace-context/#versioning-of-traceparent\n if (version === \"00\" && other) return null;\n\n return {\n traceId,\n spanId,\n traceFlags: parseInt(traceFlags, 16),\n };\n}\n", "import type { Context, TextMapPropagator } from \"@opentelemetry/api\";\nimport { diag, TraceFlags, trace as tracing } from \"@opentelemetry/api\";\nimport { getVercelRequestContext } from \"./api\";\n\nexport class VercelRuntimePropagator implements TextMapPropagator {\n fields(): string[] {\n return [];\n }\n\n inject(): void {\n // Nothing.\n }\n\n extract(context: Context): Context {\n const vrc = getVercelRequestContext();\n if (!vrc?.telemetry) {\n diag.warn(\"@vercel/otel: Vercel telemetry extension not found.\");\n return context;\n }\n\n const { rootSpanContext } = vrc.telemetry;\n if (!rootSpanContext) {\n return context;\n }\n\n diag.debug(\n \"@vercel/otel: Extracted root SpanContext from Vercel request context.\",\n rootSpanContext\n );\n return tracing.setSpanContext(context, {\n ...rootSpanContext,\n isRemote: true,\n traceFlags: rootSpanContext.traceFlags || TraceFlags.SAMPLED,\n });\n }\n}\n", "import { diag } from \"@opentelemetry/api\";\nimport type { ReadableSpan, SpanExporter } from \"@opentelemetry/sdk-trace-base\";\nimport { ExportResultCode, type ExportResult } from \"@opentelemetry/core\";\nimport { createExportTraceServiceRequest } from \"@opentelemetry/otlp-transformer\";\nimport { getVercelRequestContext } from \"./api\";\n\nexport class VercelRuntimeSpanExporter implements SpanExporter {\n export(\n spans: ReadableSpan[],\n resultCallback: (result: ExportResult) => void\n ): void {\n const context = getVercelRequestContext();\n if (!context?.telemetry) {\n diag.warn(\"@vercel/otel: no telemetry context found\");\n resultCallback({ code: ExportResultCode.SUCCESS, error: undefined });\n return;\n }\n\n try {\n // Converts a Span to IResourceSpans > IScopeSpans > ISpan structure, which\n // is OTLP format. It's can be directly serialized to JSON or converted\n // to Protobuf.\n // {\n // // Uses hex-encoding trace and span IDs. Otherwise, base64 is used.\n // useHex: true,\n // // Uses `{high, low}` format for timestamps. Otherwise, `unixNanon` is used.\n // // TODO Fix this\n // useLongBits: false,\n // }\n const data = createExportTraceServiceRequest(spans, {\n useHex: true,\n useLongBits: false,\n });\n\n context.telemetry.reportSpans(data);\n resultCallback({ code: ExportResultCode.SUCCESS, error: undefined });\n } catch (e) {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: e instanceof Error ? e : new Error(String(e)),\n });\n }\n }\n\n shutdown(): Promise<void> {\n return Promise.resolve();\n }\n\n forceFlush?(): Promise<void> {\n return Promise.resolve();\n }\n}\n", "/*\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 type { OtlpEncodingOptions, Fixed64, LongBits } from './types';\nimport { HrTime } from '@opentelemetry/api';\nimport { hexToBase64, hrTimeToNanoseconds } from '@opentelemetry/core';\n\nconst NANOSECONDS = BigInt(1_000_000_000);\n\nexport function hrTimeToNanos(hrTime: HrTime): bigint {\n return BigInt(hrTime[0]) * NANOSECONDS + BigInt(hrTime[1]);\n}\n\nexport function toLongBits(value: bigint): LongBits {\n const low = Number(BigInt.asUintN(32, value));\n const high = Number(BigInt.asUintN(32, value >> BigInt(32)));\n return { low, high };\n}\n\nexport function encodeAsLongBits(hrTime: HrTime): LongBits {\n const nanos = hrTimeToNanos(hrTime);\n return toLongBits(nanos);\n}\n\nexport function encodeAsString(hrTime: HrTime): string {\n const nanos = hrTimeToNanos(hrTime);\n return nanos.toString();\n}\n\nconst encodeTimestamp =\n typeof BigInt !== 'undefined' ? encodeAsString : hrTimeToNanoseconds;\n\nexport type HrTimeEncodeFunction = (hrTime: HrTime) => Fixed64;\nexport type SpanContextEncodeFunction = (spanContext: string) => string;\nexport type OptionalSpanContextEncodeFunction = (\n spanContext: string | undefined\n) => string | undefined;\n\nexport interface Encoder {\n encodeHrTime: HrTimeEncodeFunction;\n encodeSpanContext: SpanContextEncodeFunction;\n encodeOptionalSpanContext: OptionalSpanContextEncodeFunction;\n}\n\nfunction identity<T>(value: T): T {\n return value;\n}\n\nfunction optionalHexToBase64(str: string | undefined): string | undefined {\n if (str === undefined) return undefined;\n return hexToBase64(str);\n}\n\nconst DEFAULT_ENCODER: Encoder = {\n encodeHrTime: encodeAsLongBits,\n encodeSpanContext: hexToBase64,\n encodeOptionalSpanContext: optionalHexToBase64,\n};\n\nexport function getOtlpEncoder(options?: OtlpEncodingOptions): Encoder {\n if (options === undefined) {\n return DEFAULT_ENCODER;\n }\n\n const useLongBits = options.useLongBits ?? true;\n const useHex = options.useHex ?? false;\n return {\n encodeHrTime: useLongBits ? encodeAsLongBits : encodeTimestamp,\n encodeSpanContext: useHex ? identity : hexToBase64,\n encodeOptionalSpanContext: useHex ? identity : optionalHexToBase64,\n };\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport type { IAnyValue, IKeyValue } from './types';\nimport { Attributes } from '@opentelemetry/api';\n\nexport function toAttributes(attributes: Attributes): IKeyValue[] {\n return Object.keys(attributes).map(key => toKeyValue(key, attributes[key]));\n}\n\nexport function toKeyValue(key: string, value: unknown): IKeyValue {\n return {\n key: key,\n value: toAnyValue(value),\n };\n}\n\nexport function toAnyValue(value: unknown): IAnyValue {\n const t = typeof value;\n if (t === 'string') return { stringValue: value as string };\n if (t === 'number') {\n if (!Number.isInteger(value)) return { doubleValue: value as number };\n return { intValue: value as number };\n }\n if (t === 'boolean') return { boolValue: value as boolean };\n if (value instanceof Uint8Array) return { bytesValue: value };\n if (Array.isArray(value))\n return { arrayValue: { values: value.map(toAnyValue) } };\n if (t === 'object' && value != null)\n return {\n kvlistValue: {\n values: Object.entries(value as object).map(([k, v]) =>\n toKeyValue(k, v)\n ),\n },\n };\n\n return {};\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport type { Link } from '@opentelemetry/api';\nimport type { ReadableSpan, TimedEvent } from '@opentelemetry/sdk-trace-base';\nimport type { Encoder } from '../common';\nimport { toAttributes } from '../common/internal';\nimport { EStatusCode, IEvent, ILink, ISpan } from './types';\n\nexport function sdkSpanToOtlpSpan(span: ReadableSpan, encoder: Encoder): ISpan {\n const ctx = span.spanContext();\n const status = span.status;\n return {\n traceId: encoder.encodeSpanContext(ctx.traceId),\n spanId: encoder.encodeSpanContext(ctx.spanId),\n parentSpanId: encoder.encodeOptionalSpanContext(span.parentSpanId),\n traceState: ctx.traceState?.serialize(),\n name: span.name,\n // Span kind is offset by 1 because the API does not define a value for unset\n kind: span.kind == null ? 0 : span.kind + 1,\n startTimeUnixNano: encoder.encodeHrTime(span.startTime),\n endTimeUnixNano: encoder.encodeHrTime(span.endTime),\n attributes: toAttributes(span.attributes),\n droppedAttributesCount: span.droppedAttributesCount,\n events: span.events.map(event => toOtlpSpanEvent(event, encoder)),\n droppedEventsCount: span.droppedEventsCount,\n status: {\n // API and proto enums share the same values\n code: status.code as unknown as EStatusCode,\n message: status.message,\n },\n links: span.links.map(link => toOtlpLink(link, encoder)),\n droppedLinksCount: span.droppedLinksCount,\n };\n}\n\nexport function toOtlpLink(link: Link, encoder: Encoder): ILink {\n return {\n attributes: link.attributes ? toAttributes(link.attributes) : [],\n spanId: encoder.encodeSpanContext(link.context.spanId),\n traceId: encoder.encodeSpanContext(link.context.traceId),\n traceState: link.context.traceState?.serialize(),\n droppedAttributesCount: link.droppedAttributesCount || 0,\n };\n}\n\nexport function toOtlpSpanEvent(\n timedEvent: TimedEvent,\n encoder: Encoder\n): IEvent {\n return {\n attributes: timedEvent.attributes\n ? toAttributes(timedEvent.attributes)\n : [],\n name: timedEvent.name,\n timeUnixNano: encoder.encodeHrTime(timedEvent.time),\n droppedAttributesCount: timedEvent.droppedAttributesCount || 0,\n };\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport type { IResource } from '@opentelemetry/resources';\nimport type { ReadableSpan } from '@opentelemetry/sdk-trace-base';\nimport type { OtlpEncodingOptions } from '../common/types';\nimport { toAttributes } from '../common/internal';\nimport { sdkSpanToOtlpSpan } from './internal';\nimport {\n IExportTraceServiceRequest,\n IResourceSpans,\n IScopeSpans,\n} from './types';\nimport { Encoder, getOtlpEncoder } from '../common';\n\nexport function createExportTraceServiceRequest(\n spans: ReadableSpan[],\n options?: OtlpEncodingOptions\n): IExportTraceServiceRequest {\n const encoder = getOtlpEncoder(options);\n return {\n resourceSpans: spanRecordsToResourceSpans(spans, encoder),\n };\n}\n\nfunction createResourceMap(readableSpans: ReadableSpan[]) {\n const resourceMap: Map<IResource, Map<string, ReadableSpan[]>> = new Map();\n for (const record of readableSpans) {\n let ilmMap = resourceMap.get(record.resource);\n\n if (!ilmMap) {\n ilmMap = new Map();\n resourceMap.set(record.resource, ilmMap);\n }\n\n // TODO this is duplicated in basic tracer. Consolidate on a common helper in core\n const instrumentationLibraryKey = `${record.instrumentationLibrary.name}@${\n record.instrumentationLibrary.version || ''\n }:${record.instrumentationLibrary.schemaUrl || ''}`;\n let records = ilmMap.get(instrumentationLibraryKey);\n\n if (!records) {\n records = [];\n ilmMap.set(instrumentationLibraryKey, records);\n }\n\n records.push(record);\n }\n\n return resourceMap;\n}\n\nfunction spanRecordsToResourceSpans(\n readableSpans: ReadableSpan[],\n encoder: Encoder\n): IResourceSpans[] {\n const resourceMap = createResourceMap(readableSpans);\n const out: IResourceSpans[] = [];\n\n const entryIterator = resourceMap.entries();\n let entry = entryIterator.next();\n while (!entry.done) {\n const [resource, ilmMap] = entry.value;\n const scopeResourceSpans: IScopeSpans[] = [];\n const ilmIterator = ilmMap.values();\n let ilmEntry = ilmIterator.next();\n while (!ilmEntry.done) {\n const scopeSpans = ilmEntry.value;\n if (scopeSpans.length > 0) {\n const { name, version, schemaUrl } =\n scopeSpans[0].instrumentationLibrary;\n const spans = scopeSpans.map(readableSpan =>\n sdkSpanToOtlpSpan(readableSpan, encoder)\n );\n\n scopeResourceSpans.push({\n scope: { name, version },\n spans: spans,\n schemaUrl: schemaUrl,\n });\n }\n ilmEntry = ilmIterator.next();\n }\n // TODO SDK types don't provide resource schema URL at this time\n const transformedSpans: IResourceSpans = {\n resource: {\n attributes: toAttributes(resource.attributes),\n droppedAttributesCount: 0,\n },\n scopeSpans: scopeResourceSpans,\n schemaUrl: undefined,\n };\n\n out.push(transformedSpans);\n entry = entryIterator.next();\n }\n\n return out;\n}\n", "import type { Configuration } from \"./types\";\nimport { Sdk } from \"./sdk\";\n\nexport type * from \"./types\";\nexport type { OTLPExporterConfig } from \"./exporters/config\";\nexport { OTLPHttpJsonTraceExporter } from \"./exporters/exporter-trace-otlp-http-fetch\";\nexport { OTLPHttpProtoTraceExporter } from \"./exporters/exporter-trace-otlp-proto-fetch\";\nexport {\n type FetchInstrumentationConfig,\n FetchInstrumentation,\n} from \"./instrumentations/fetch\";\n\n/**\n * Registers the OpenTelemetry SDK with the specified service name and the default configuration.\n * Should be included in the `instrumentation.ts`. For example:\n *\n * ```ts\n * import { registerOTel } from \"@vercel/otel\";\n *\n * export function register() {\n * registerOTel({\n * serviceName: \"my-app\",\n * ...\n * });\n * }\n * ```\n *\n * @param optionsOrServiceName - Either a service name as a string or a configuration object.\n */\nexport function registerOTel(\n optionsOrServiceName?: Configuration | string\n): void {\n let options: Configuration;\n if (!optionsOrServiceName) {\n options = {};\n } else if (typeof optionsOrServiceName === \"string\") {\n options = { serviceName: optionsOrServiceName };\n } else {\n options = optionsOrServiceName;\n }\n const sdk = new Sdk(options);\n sdk.start();\n}\n"],
|
|
5
|
-
"mappings": ";;;spBAAA,IAAAA,EAAA,aAAAC,OAAc,qBAAd,IAAAC,EAAAC,GAAA,KAAAC,EAAAJ,EAAAC,yJCgBA,IAAAI,GAAA,WAEMC,MAAuBD,GAAA,kBAC3B,gDAAgD,EAGlD,SAAgBE,GAAgBC,EAAgB,CAC9C,OAAOA,EAAQ,SAASF,GAAsB,EAAI,CACpD,CAFAG,GAAA,gBAAAF,GAIA,SAAgBG,GAAkBF,EAAgB,CAChD,OAAOA,EAAQ,YAAYF,EAAoB,CACjD,CAFAG,GAAA,kBAAAC,GAIA,SAAgBC,GAAoBH,EAAgB,CAClD,OAAOA,EAAQ,SAASF,EAAoB,IAAM,EACpD,CAFAG,GAAA,oBAAAE,2RCdaC,EAAA,2BAA6B,IAC7BA,EAAA,6BAA+B,IAC/BA,EAAA,wBAA0B,IAG1BA,EAAA,eAAiB,UAEjBA,EAAA,6BAA+B,IAE/BA,EAAA,iCAAmC,KAEnCA,EAAA,yBAA2B,+KCZxC,IAAAC,GAAA,WAKAC,GAAA,KAaA,SAAgBC,GAAkBC,EAAkB,CAClD,OAAOA,EAAS,OAAO,CAACC,EAAgBC,IAAmB,CACzD,IAAMC,EAAQ,GAAGF,CAAM,GACrBA,IAAW,GAAKH,GAAA,wBAA0B,EAC5C,GAAGI,CAAO,GACV,OAAOC,EAAM,OAASL,GAAA,yBAA2BG,EAASE,CAC5D,EAAG,EAAE,CACP,CAPAC,GAAA,kBAAAL,GASA,SAAgBM,GAAYC,EAAgB,CAC1C,OAAOA,EAAQ,cAAa,EAAG,IAAI,CAAC,CAACC,EAAKJ,CAAK,IAAK,CAClD,IAAIK,EAAQ,GAAG,mBAAmBD,CAAG,CAAC,IAAI,mBAAmBJ,EAAM,KAAK,CAAC,GAIzE,OA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KACH,mDAAmDX,CAAQ,wBAC7D,EACO,IAAIG,EACf,CACF,CAEA,IAAMS,GAAkC,YAClCC,GAAwB,yBAAyBD,EAA+B,GAEtF,SAASF,GAAwBjE,EAAkB,CACjD,IAAMqE,EAAoBrE,EAAI,mCAC9B,GAAIqE,GAAqB,OAAOA,GAAsB,SACpD,OAAOA,EAGT,IAAMC,EAAuBtE,EAAI,4BACjC,OAAIsE,GAAwB,OAAOA,GAAyB,SACnD,GAAGA,CAAoB,IAAIH,EAA+B,GAG5DC,EACT,CAEA,SAASL,GAAaQ,EAAiC,CACrD,OAAOA,GAAM,IACf,CmDxeO,SAASC,GACdC,EACM,CACN,IAAIC,EACCD,EAEM,OAAOA,GAAyB,SACzCC,EAAU,CAAE,YAAaD,CAAqB,EAE9CC,EAAUD,EAJVC,EAAU,CAAC,EAMD,IAAIC,GAAID,CAAO,EACvB,MAAM,CACZ",
|
|
6
|
-
"names": ["api_exports", "api_star", "init_api", "__esmMin", "__reExport", "api_1", "SUPPRESS_TRACING_KEY", "suppressTracing", "context", "exports", "unsuppressTracing", "isTracingSuppressed", "exports", "api_1", "constants_1", "serializeKeyPairs", "keyPairs", "hValue", "current", "value", "exports", "getKeyPairs", "baggage", "key", "entry", "parsePairKeyValue", "valueProps", "keyPairPart", "separatorIndex", "metadata", "parseKeyPairsIntoRecord", "keyPair", "headers", "api_1", "suppress_tracing_1", "constants_1", "utils_1", "W3CBaggagePropagator", "context", "carrier", "setter", "baggage", "keyPairs", "pair", "headerValue", "getter", "baggageString", "entry", "keyPair", "baggageEntry", "exports", "AnchoredClock", "systemClock", "monotonicClock", "delta", "exports", "api_1", "sanitizeAttributes", "attributes", "out", "key", "val", "isAttributeKey", "isAttributeValue", "exports", "isHomogeneousAttributeValueArray", "isValidPrimitiveAttributeValue", "arr", "type", "element", "api_1", "loggingErrorHandler", "ex", "stringifyException", "exports", "flattenException", "result", "current", "propertyName", "value", "logging_error_handler_1", "delegateHandler", "setGlobalErrorHandler", "handler", "exports", "globalErrorHandler", "ex", "TracesSamplerValues", "exports", "exports", "api_1", "sampling_1", "globalThis_1", "DEFAULT_LIST_SEPARATOR", "ENVIRONMENT_BOOLEAN_KEYS", "isEnvVarABoolean", "key", "ENVIRONMENT_NUMBERS_KEYS", "isEnvVarANumber", "ENVIRONMENT_LISTS_KEYS", "isEnvVarAList", "exports", "parseBoolean", "environment", "values", "value", "parseNumber", "name", "min", "max", "parseStringList", "output", "input", "separator", "givenValue", "v", "logLevelMap", "setLogLevelFromEnv", "theLevel", "parseEnvironment", "env", "getEnvWithoutDefaults", "environment_1", "globalThis_1", "getEnv", "globalEnv", "exports", "hexToBase64", "hexStr", "hexStrLen", "hexAsciiCharsStr", "i", "hexPair", "hexVal", "exports", "SPAN_ID_BYTES", "TRACE_ID_BYTES", "RandomIdGenerator", "getIdGenerator", "exports", "SHARED_CHAR_CODES_ARRAY", "bytes", "i", "exports", "exports", "exports", "__exportStar", "exports", "exports", "__exportStar", "exports", "__exportStar", "exports", "version_1", "semantic_conventions_1", "exports", "unrefTimer", "_timer", "exports", "__exportStar", "exports", "platform_1", "NANOSECOND_DIGITS", "NANOSECOND_DIGITS_IN_MILLIS", "MILLISECONDS_TO_NANOSECONDS", "SECOND_TO_NANOSECONDS", "millisToHrTime", "epochMillis", "epochSeconds", "seconds", "nanos", "exports", "getTimeOrigin", "timeOrigin", "perf", "hrTime", "performanceNow", "now", "addHrTimes", "timeInputToHrTime", "time", "isTimeInputHrTime", "hrTimeDuration", "startTime", "endTime", "hrTimeToTimeStamp", "precision", "tmp", "nanoString", "hrTimeToNanoseconds", "hrTimeToMilliseconds", "hrTimeToMicroseconds", "value", "isTimeInput", "time1", "time2", "out", "ExportResultCode", "exports", "api_1", "CompositePropagator", "config", "_a", "p", "x", "y", "context", "carrier", "setter", "propagator", "err", "getter", "ctx", "exports", "VALID_KEY_CHAR_RANGE", "VALID_KEY", "VALID_VENDOR_KEY", "VALID_KEY_REGEX", "VALID_VALUE_BASE_REGEX", "INVALID_VALUE_COMMA_EQUAL_REGEX", "validateKey", "key", "exports", "validateValue", "value", "validators_1", "MAX_TRACE_STATE_ITEMS", "MAX_TRACE_STATE_LEN", "LIST_MEMBERS_SEPARATOR", "LIST_MEMBER_KEY_VALUE_SPLITTER", "TraceState", "_TraceState", "rawTraceState", "key", "value", "traceState", "agg", "part", "listMember", "exports", "api_1", "suppress_tracing_1", "TraceState_1", "exports", "VERSION", "VERSION_PART", "TRACE_ID_PART", "PARENT_ID_PART", "FLAGS_PART", "TRACE_PARENT_REGEX", "parseTraceParent", "traceParent", "match", "W3CTraceContextPropagator", "context", "carrier", "setter", "spanContext", "getter", "traceParentHeader", "traceStateHeader", "state", "api_1", "RPC_METADATA_KEY", "RPCType", "exports", "setRPCMetadata", "context", "meta", "deleteRPCMetadata", "getRPCMetadata", "api_1", "AlwaysOffSampler", "exports", "api_1", "AlwaysOnSampler", "exports", "api_1", "global_error_handler_1", "AlwaysOffSampler_1", "AlwaysOnSampler_1", "ParentBasedSampler", "config", "_a", "_b", "_c", "_d", "context", "traceId", "spanName", "spanKind", "attributes", "links", "parentContext", "exports", "api_1", "TraceIdRatioBasedSampler", "_ratio", "context", "traceId", "ratio", "accumulation", "i", "pos", "part", "exports", "objectTag", "nullTag", "undefinedTag", "funcProto", "funcToString", "objectCtorString", "getPrototype", "overArg", "objectProto", "hasOwnProperty", "symToStringTag", "nativeObjectToString", "func", "transform", "arg", "isPlainObject", "value", "isObjectLike", "baseGetTag", "proto", "Ctor", "exports", "getRawTag", "objectToString", "isOwn", "tag", "unmasked", "result", "lodash_merge_1", "MAX_LEVEL", "merge", "args", "result", "objects", "mergeTwoObjects", "exports", "takeValue", "value", "isArray", "one", "two", "level", "isPrimitive", "isFunction", "j", "isObject", "keys", "i", "key", "shouldMerge", "twoValue", "obj1", "obj2", "wasObjectReferenced", "arr1", "arr2", "obj", "arr", "info", "TimeoutError", "_TimeoutError", "message", "exports", "callWithTimeout", "promise", "timeout", "timeoutHandle", "timeoutPromise", "_resolve", "reject", "result", "reason", "urlMatches", "url", "urlToMatch", "exports", "isUrlIgnored", "ignoredUrls", "ignoreUrl", "isWrapped", "func", "exports", "Deferred", "resolve", "reject", "val", "err", "exports", "promise_1", "BindOnceFuture", "_callback", "_that", "args", "val", "err", "exports", "api_1", "suppress_tracing_1", "_export", "exporter", "arg", "resolve", "result", "exports", "__exportStar", "exports", "exporter_1", "parseInstrumentationOptions", "options", "instrumentations", "i", "j", "option", "results", "exports", "enableInstrumentations", "tracerProvider", "meterProvider", "instrumentation", "disableInstrumentations", "api_1", "autoLoaderUtils_1", "registerInstrumentations", "options", "instrumentations", "tracerProvider", "meterProvider", "exports", "async_hooks_exports", "async_hooks_star", "init_async_hooks", "__esmMin", "__reExport", "events_exports", "events_star", "init_events", "__esmMin", "__reExport", "events_1", "ADD_LISTENER_METHODS", "AbstractAsyncHooksContextManager", "context", "target", "manager", "contextWrapper", "args", "ee", "methodName", "original", "contextManager", "event", "listener", "events", "_a", "patchedListener", "map", "listeners", "exports", "api_1", "async_hooks_1", "AbstractAsyncHooksContextManager_1", "AsyncLocalStorageContextManager", "_a", "context", "fn", "thisArg", "args", "cb", "exports", "toAttributes", "attributes", "key", "toKeyValue", "exports", "value", "toAnyValue", "t", "k", "v", "internal_1", "sdkSpanToOtlpSpan", "span", "encoder", "ctx", "status", "_a", "event", "toOtlpSpanEvent", "link", "toOtlpLink", "exports", "timedEvent", "core_1", "NANOSECONDS", "hrTimeToNanos", "hrTime", "exports", "toLongBits", "value", "low", "high", "encodeAsLongBits", "nanos", "encodeAsString", "encodeTimestamp", "identity", "optionalHexToBase64", "str", "DEFAULT_ENCODER", "getOtlpEncoder", "options", "useLongBits", "_a", "useHex", "_b", "internal_1", "internal_2", "common_1", "createExportTraceServiceRequest", "spans", "options", "encoder", "spanRecordsToResourceSpans", "exports", "createResourceMap", "readableSpans", "resourceMap", "record", "ilmMap", "instrumentationLibraryKey", "records", "out", "entryIterator", "entry", "resource", "scopeResourceSpans", "ilmIterator", "ilmEntry", "scopeSpans", "name", "version", "schemaUrl", "readableSpan", "transformedSpans", "api_1", "core_1", "DEFAULT_TRACE_TIMEOUT", "exports", "parseHeaders", "partialHeaders", "headers", "key", "value", "appendResourcePathToUrl", "url", "path", "appendRootPathToUrlIfNeeded", "parsedUrl", "configureExporterTimeout", "timeoutMillis", "invalidTimeout", "getExporterTimeoutFromEnv", "definedTimeout", "_a", "timeout", "defaultTimeout", "isExportRetryable", "statusCode", "parseRetryAfterToMills", "retryAfter", "seconds", "delay", "api_1", "core_1", "util_1", "OTLPExporterBase", "config", "items", "resultCallback", "error", "resolve", "reject", "e", "exports", "require_aspromise", "__commonJSMin", "exports", "module", "asPromise", "fn", "ctx", "params", "offset", "index", "pending", "resolve", "reject", "err", "require_base64", "__commonJSMin", "exports", "base64", "string", "p", "b64", "s64", "i", "buffer", "start", "end", "parts", "chunk", "j", "t", "b", "invalidEncoding", "offset", "require_eventemitter", "__commonJSMin", "exports", "module", "EventEmitter", "evt", "fn", "ctx", "listeners", "i", "args", "require_float", "__commonJSMin", "exports", "module", "factory", "f32", "f8b", "le", "writeFloat_f32_cpy", "val", "buf", "pos", "writeFloat_f32_rev", "readFloat_f32_cpy", "readFloat_f32_rev", "writeFloat_ieee754", "writeUint", "sign", "exponent", "mantissa", "writeUintLE", "writeUintBE", "readFloat_ieee754", "readUint", "uint", "readUintLE", "readUintBE", "f64", "writeDouble_f64_cpy", "writeDouble_f64_rev", "readDouble_f64_cpy", "readDouble_f64_rev", "writeDouble_ieee754", "off0", "off1", "readDouble_ieee754", "lo", "hi", "require_inquire", "__commonJSMin", "exports", "module", "inquire", "moduleName", "require_utf8", "__commonJSMin", "exports", "utf8", "string", "len", "c", "i", "buffer", "start", "end", "parts", "chunk", "t", "offset", "c1", "c2", "require_pool", "__commonJSMin", "exports", "module", "pool", "alloc", "slice", "size", "SIZE", "MAX", "slab", "offset", "buf", "require_longbits", "__commonJSMin", "exports", "module", "LongBits", "util", "lo", "hi", "zero", "zeroHash", "value", "sign", "unsigned", "charCodeAt", "hash", "mask", "part0", "part1", "part2", "require_minimal", "__commonJSMin", "exports", "util", "value", "obj", "prop", "Buffer", "sizeOrArray", "hash", "unsigned", "bits", "merge", "dst", "src", "ifNotSet", "keys", "i", "str", "newError", "name", "CustomError", "message", "properties", "fieldNames", "fieldMap", "encoding", "size", "require_writer", "__commonJSMin", "exports", "module", "Writer", "util", "BufferWriter", "LongBits", "base64", "utf8", "Op", "fn", "len", "val", "noop", "State", "writer", "create", "size", "writeByte", "buf", "pos", "writeVarint32", "VarintOp", "value", "writeVarint64", "bits", "writeFixed32", "writeBytes", "i", "head", "tail", "BufferWriter_", "require_writer_buffer", "__commonJSMin", "exports", "module", "BufferWriter", "Writer", "util", "val", "buf", "pos", "i", "value", "len", "writeStringBuffer", "require_reader", "__commonJSMin", "exports", "module", "Reader", "util", "BufferReader", "LongBits", "utf8", "indexOutOfRange", "reader", "writeLength", "buffer", "create_array", "create", "value", "readLongVarint", "bits", "i", "readFixed32_end", "buf", "end", "readFixed64", "length", "start", "nativeBuffer", "bytes", "wireType", "BufferReader_", "fn", "require_reader_buffer", "__commonJSMin", "exports", "module", "BufferReader", "Reader", "util", "buffer", "len", "require_service", "__commonJSMin", "exports", "module", "Service", "util", "rpcImpl", "requestDelimited", "responseDelimited", "rpcCall", "method", "requestCtor", "responseCtor", "request", "callback", "self", "err", "response", "endedByRPC", "require_rpc", "__commonJSMin", "exports", "rpc", "require_roots", "__commonJSMin", "exports", "module", "require_index_minimal", "__commonJSMin", "exports", "protobuf", "configure", "require_minimal", "__commonJSMin", "exports", "module", "init_api", "import_core", "init_api", "import_core", "import_semantic_conventions", "ExceptionEventName", "Span", "parentTracer", "context", "spanName", "spanContext", "kind", "parentSpanId", "links", "startTime", "_deprecatedClock", "attributes", "now", "key", "value", "_b", "__values", "_c", "_d", "__read", "k", "v", "name", "attributesOrStartTime", "timeStamp", "status", "endTime", "inp", "msDuration", "exception", "time", "ExceptionEventName", "limit", "_this", "val", "init_api", "import_core", "SamplingDecision", "AlwaysOffSampler", "SamplingDecision", "AlwaysOnSampler", "SamplingDecision", "init_api", "import_core", "ParentBasedSampler", "config", "AlwaysOnSampler", "_a", "_b", "AlwaysOffSampler", "_c", "_d", "context", "traceId", "spanName", "spanKind", "attributes", "links", "parentContext", "init_api", "TraceIdRatioBasedSampler", "_ratio", "context", "traceId", "SamplingDecision", "ratio", "accumulation", "i", "pos", "part", "env", "FALLBACK_OTEL_TRACES_SAMPLER", "DEFAULT_RATIO", "loadDefaultConfig", "buildSamplerFromEnv", "environment", "AlwaysOnSampler", "AlwaysOffSampler", "ParentBasedSampler", "TraceIdRatioBasedSampler", "getSamplerProbabilityFromEnv", "probability", "import_core", "mergeConfig", "userConfig", "perInstanceDefaults", "buildSamplerFromEnv", "DEFAULT_CONFIG", "loadDefaultConfig", "target", "reconfigureLimits", "spanLimits", "parsedEnvConfig", "_f", "_e", "_d", "_b", "_a", "_c", "_m", "_l", "_k", "_h", "_g", "_j", "init_api", "import_core", "BatchSpanProcessorBase", "_exporter", "config", "env", "_span", "_parentContext", "span", "_this", "resolve", "reject", "promises", "count", "i", "j", "timer", "spans", "doExport", "result", "_a", "pendingResources", "resource", "err", "flush", "e", "BatchSpanProcessor", "_super", "__extends", "_exporter", "config", "_this", "BatchSpanProcessorBase", "SPAN_ID_BYTES", "TRACE_ID_BYTES", "RandomIdGenerator", "getIdGenerator", "SHARED_CHAR_CODES_ARRAY", "getIdGenerator", "bytes", "i", "Tracer", "instrumentationLibrary", "config", "_tracerProvider", "localConfig", "mergeConfig", "RandomIdGenerator", "name", "options", "context", "parentSpan", "nonRecordingSpan", "parentSpanContext", "spanId", "traceId", "traceState", "parentSpanId", "spanKind", "_a", "links", "_b", "link", "attributes", "samplingResult", "_c", "traceFlags", "spanContext", "initAttributes", "span", "Span", "arg2", "arg3", "arg4", "opts", "ctx", "fn", "parentContext", "contextWithSpanSet", "init_api", "import_core", "init_api", "import_semantic_conventions", "import_core", "defaultServiceName", "Resource", "attributes", "asyncAttributesPromise", "_this", "_a", "asyncAttributes", "err", "defaultServiceName", "other", "mergedSyncAttributes", "__assign", "mergedAttributesPromise", "_c", "__read", "thisAsyncAttributes", "otherAsyncAttributes", "_b", "init_api", "import_core", "import_semantic_conventions", "EnvDetectorSync", "_config", "attributes", "env", "rawAttributes", "serviceName", "parsedAttributes", "e", "Resource", "rawEnvAttributes", "rawAttributes_1", "__values", "rawAttributes_1_1", "rawAttribute", "keyValuePair", "_b", "__read", "key", "value", "name", "str", "i", "ch", "envDetectorSync", "init_api", "isPromiseLike", "val", "detectResourcesSync", "config", "resources", "_a", "d", "resourceOrPromise_1", "resource_1", "isPromiseLike", "createPromise", "__awaiter", "resolvedResource", "Resource", "e", "mergedResources", "acc", "resource", "logResources", "resourceDebugString", "import_core", "MultiSpanProcessor", "_spanProcessors", "promises", "_b", "__values", "_c", "spanProcessor", "resolve", "error", "span", "context", "reject", "NoopSpanProcessor", "_span", "_context", "ForceFlushState", "BasicTracerProvider", "config", "mergedConfig", "loadDefaultConfig", "reconfigureLimits", "_a", "Resource", "defaultExporter", "batchProcessor", "BatchSpanProcessor", "NoopSpanProcessor", "name", "version", "options", "key", "Tracer", "spanProcessor", "err", "MultiSpanProcessor", "timeout", "promises", "resolve", "state", "timeoutInterval", "error", "reject", "results", "errors", "result", "_this", "uniquePropagatorNames", "propagators", "propagator", "validPropagators", "list", "item", "exporterName", "exporter", "init_api", "api_logs_exports", "__reExport", "api_logs_star", "import_autoLoader", "init_api", "import_core", "init_api", "init_api", "import_core", "LogRecord", "_sharedState", "instrumentationScope", "logRecord", "timestamp", "observedTimestamp", "severityNumber", "severityText", "body", "_a", "attributes", "context", "now", "spanContext", "key", "value", "_b", "__values", "_c", "_d", "__read", "k", "v", "_this", "limit", "val", "Logger", "instrumentationScope", "_sharedState", "logRecord", "currentContext", "logRecordInstance", "LogRecord", "__assign", "import_core", "loadDefaultConfig", "reconfigureLimits", "logRecordLimits", "parsedEnvConfig", "_c", "_b", "_a", "_f", "_e", "_d", "import_core", "MultiLogRecordProcessor", "processors", "forceFlushTimeoutMillis", "timeout", "processor", "_a", "logRecord", "context", "NoopLogRecordProcessor", "_logRecord", "_context", "LoggerProviderSharedState", "resource", "forceFlushTimeoutMillis", "logRecordLimits", "NoopLogRecordProcessor", "DEFAULT_LOGGER_NAME", "LoggerProvider", "config", "_a", "loadDefaultConfig", "_b", "resource", "Resource", "logRecordLimits", "forceFlushTimeoutMillis", "LoggerProviderSharedState", "reconfigureLimits", "name", "version", "options", "loggerName", "key", "Logger", "processor", "err", "MultiLogRecordProcessor", "AggregationTemporality", "isNotNullish", "item", "hashAttributes", "attributes", "keys", "key", "instrumentationScopeId", "instrumentationScope", "_a", "_b", "TimeoutError", "_super", "__extends", "message", "_this", "callWithTimeout", "promise", "timeout", "timeoutHandle", "timeoutPromise", "_resolve", "reject", "TimeoutError", "result", "reason", "PromiseAllSettled", "promises", "p", "__awaiter", "_this", "ret", "_a", "e_1", "isPromiseAllSettledRejectionResult", "it", "setEquals", "lhs", "rhs", "lhs_1", "__values", "lhs_1_1", "item", "equalsCaseInsensitive", "lhs", "rhs", "init_api", "InstrumentType", "createInstrumentDescriptor", "name", "type", "options", "isValidName", "_a", "_b", "_c", "_d", "createInstrumentDescriptorWithView", "view", "instrument", "isDescriptorCompatibleWith", "descriptor", "otherDescriptor", "equalsCaseInsensitive", "NAME_REGEXP", "init_api", "ViewRegistry", "view", "instrument", "meter", "_this", "views", "registeredView", "selector", "init_api", "import_core", "SyncInstrument", "_writableMetricStorage", "_descriptor", "value", "attributes", "context", "contextApi", "UpDownCounterInstrument", "_super", "__extends", "value", "attributes", "ctx", "SyncInstrument", "CounterInstrument", "_super", "__extends", "value", "attributes", "ctx", "SyncInstrument", "HistogramInstrument", "_super", "__extends", "value", "attributes", "ctx", "SyncInstrument", "ObservableInstrument", "descriptor", "metricStorages", "_observableRegistry", "callback", "ObservableCounterInstrument", "_super", "__extends", "ObservableInstrument", "ObservableGaugeInstrument", "_super", "__extends", "ObservableInstrument", "ObservableUpDownCounterInstrument", "_super", "__extends", "ObservableInstrument", "isObservableInstrument", "it", "ObservableInstrument", "Meter", "_meterSharedState", "name", "options", "descriptor", "createInstrumentDescriptor", "InstrumentType", "storage", "HistogramInstrument", "CounterInstrument", "UpDownCounterInstrument", "storages", "ObservableGaugeInstrument", "ObservableCounterInstrument", "ObservableUpDownCounterInstrument", "callback", "observables", "MetricStorage", "_instrumentDescriptor", "description", "createInstrumentDescriptor", "HashMap", "_hash", "key", "hashCode", "defaultFactory", "hash", "val", "value", "keyIterator", "next", "_a", "valueIterator", "AttributeHashMap", "_super", "__extends", "hashAttributes", "HashMap", "DeltaMetricProcessor", "_aggregator", "AttributeHashMap", "value", "attributes", "_context", "collectionTime", "_this", "accumulation", "measurements", "_a", "_b", "__read", "hashCode", "delta", "previous", "active", "unreportedDelta", "TemporalMetricProcessor", "_aggregator", "collectorHandles", "_this", "handle", "collector", "instrumentDescriptor", "currentAccumulations", "collectionTime", "unreportedAccumulations", "result", "aggregationTemporality", "last", "lastCollectionTime", "AggregationTemporality", "accumulationRecords", "AttributesMapToAccumulationRecords", "currentAccumulation", "registeredCollectors", "registeredCollectors_1", "__values", "registeredCollectors_1_1", "stash", "AttributeHashMap", "unreportedList", "unreportedList_1", "unreportedList_1_1", "it_1", "current", "aggregator", "iterator", "next", "_a", "__read", "key", "record", "hash", "lastAccumulation", "accumulation", "_b", "_c", "_d", "AttributesMapToAccumulationRecords", "map", "AsyncMetricStorage", "_super", "__extends", "_instrumentDescriptor", "aggregator", "_attributesProcessor", "collectorHandles", "_this", "DeltaMetricProcessor", "TemporalMetricProcessor", "measurements", "observationTime", "processed", "AttributeHashMap", "_a", "_b", "__read", "attributes", "value", "collector", "collectionTime", "accumulations", "MetricStorage", "init_api", "getIncompatibilityDetails", "existing", "otherDescriptor", "incompatibility", "getValueTypeConflictResolutionRecipe", "getUnitConflictResolutionRecipe", "getTypeConflictResolutionRecipe", "selector", "selectorString", "getDescriptionResolutionRecipe", "getConflictResolutionRecipe", "MetricStorageRegistry", "collector", "storages", "_c", "__values", "_d", "metricStorages", "perCollectorStorages", "_e", "_f", "storage", "storageMap", "expectedDescriptor", "descriptor", "existingStorages", "compatibleStorage", "existingStorages_1", "existingStorages_1_1", "existingStorage", "existingDescriptor", "isDescriptorCompatibleWith", "getIncompatibilityDetails", "getConflictResolutionRecipe", "MultiMetricStorage", "_backingStorages", "value", "attributes", "context", "recordTime", "it", "init_api", "init_api", "ObservableResultImpl", "_instrumentName", "_valueType", "AttributeHashMap", "value", "attributes", "BatchObservableResultImpl", "metric", "value", "attributes", "isObservableInstrument", "map", "AttributeHashMap", "ObservableRegistry", "callback", "instrument", "idx", "instruments", "observableInstruments", "isObservableInstrument", "collectionTime", "timeoutMillis", "callbackFutures", "batchCallbackFutures", "PromiseAllSettled", "__spreadArray", "__read", "results", "_a", "rejections", "isPromiseAllSettledRejectionResult", "it", "observationTime", "_this", "observableResult", "ObservableResultImpl", "callPromise", "callWithTimeout", "_b", "metricStorage", "BatchObservableResultImpl", "buffer", "record", "setEquals", "SyncMetricStorage", "_super", "__extends", "instrumentDescriptor", "aggregator", "_attributesProcessor", "collectorHandles", "_this", "DeltaMetricProcessor", "TemporalMetricProcessor", "value", "attributes", "context", "recordTime", "collector", "collectionTime", "accumulations", "MetricStorage", "AttributesProcessor", "NOOP", "NoopAttributesProcessor", "_super", "__extends", "incoming", "_context", "AttributesProcessor", "FilteringAttributesProcessor", "_super", "__extends", "_allowedAttributeNames", "_this", "incoming", "_context", "filteredAttributes", "attributeName", "AttributesProcessor", "NOOP", "NoopAttributesProcessor", "MeterSharedState", "_meterProviderSharedState", "_instrumentationScope", "MetricStorageRegistry", "ObservableRegistry", "Meter", "descriptor", "storages", "SyncMetricStorage", "MultiMetricStorage", "AsyncMetricStorage", "collector", "collectionTime", "options", "errors", "_a", "metricDataList", "metricStorage", "isNotNullish", "MetricStorageType", "_this", "views", "view", "viewDescriptor", "createInstrumentDescriptorWithView", "compatibleStorage", "aggregator", "viewStorage", "perCollectorAggregations", "collectorStorages", "_b", "__read", "aggregation", "storage", "AttributesProcessor", "MeterProviderSharedState", "resource", "ViewRegistry", "instrumentationScope", "id", "instrumentationScopeId", "meterSharedState", "MeterSharedState", "instrumentType", "result", "_b", "__values", "_c", "collector", "import_core", "MetricCollector", "_sharedState", "_metricReader", "options", "collectionTime", "scopeMetrics", "errors", "meterCollectionPromises", "meterSharedState", "__awaiter", "_this", "current", "_a", "__spreadArray", "__read", "instrumentType", "MeterProvider", "options", "resource", "Resource", "_b", "MeterProviderSharedState", "_c", "__values", "_d", "view", "name", "version", "metricReader", "collector", "MetricCollector", "_a", "import_semantic_conventions", "import_environment", "import_AsyncLocalStorageContextManager", "import_core", "init_api", "symbol", "getVercelRequestContext", "import_semantic_conventions", "omitUndefinedAttributes", "obj", "_", "value", "parseRequestId", "header", "getVercelRequestContextAttributes", "context", "getVercelRequestContext", "attributesFromHeaders", "rootAttrs", "resolveAttributesFromHeaders", "omitUndefinedAttributes", "parseRequestId", "getter", "_carrier", "carrier", "key", "headers", "attrs", "attrName", "headerName", "headerValue", "init_api", "isSampled", "traceFlags", "CompositeSpanProcessor", "processors", "attributesFromHeaders", "p", "e", "span", "parentContext", "traceId", "spanId", "traceFlags", "isRoot", "isSampled", "vrc", "getVercelRequestContext", "vercelRequestContextAttrs", "getVercelRequestContextAttributes", "promise", "resolve", "timer", "spanProcessor", "sampled", "rootObj", "resourceAttributes", "getResourceAttributes", "openSpan", "i", "pending", "SPAN_KIND_NAME", "kind", "attributes", "operationName", "resourceName", "spanTypeAttr", "nextSpanType", "httpMethod", "httpRoute", "resourceNameResolved", "libraryName", "spanType", "nextOperationName", "toOperationName", "name", "cleanLibraryName", "import_trace", "import_OTLPExporterBase", "init_api", "OTLPExporterEdgeBase", "config", "items", "onSuccess", "onError", "serviceRequest", "body", "contentType", "headers", "e", "promise", "res", "err", "index", "_config", "DEFAULT_COLLECTOR_RESOURCE_PATH", "DEFAULT_COLLECTOR_URL", "getDefaultUrl", "config", "OTLPHttpJsonTraceExporter", "config", "Impl", "spans", "resultCallback", "OTLPExporterEdgeBase", "serviceRequest", "getDefaultUrl", "import_trace", "import_minimal", "encodeTraceServiceRequest", "message", "writer", "ExportTraceServiceRequest_encode", "i", "ResourceSpans_encode", "Resource_encode", "ScopeSpans_encode", "KeyValue_encode", "InstrumentationScope_encode", "Span_encode", "AnyValue_encode", "ArrayValue_encode", "KeyValueList_encode", "Event_encode", "Link_encode", "Status_encode", "OTLPHttpProtoTraceExporter", "config", "Impl", "spans", "resultCallback", "OTLPExporterEdgeBase", "serviceRequest", "encodeTraceServiceRequest", "getDefaultUrl", "init_api", "import_semantic_conventions", "resolveTemplate", "template", "attrs", "match", "key", "value", "FetchInstrumentation", "config", "tracerProvider", "tracer", "ignoreUrls", "shouldIgnore", "url", "init", "urlString", "match", "host", "branchHost", "propagateContextUrls", "dontPropagateContextUrls", "resourceNameTemplate", "attributesFromRequestHeaders", "attributesFromResponseHeaders", "shouldPropagate", "getVercelRequestContext", "originalFetch", "doFetch", "input", "initArg", "req", "attrs", "resourceName", "resolveTemplate", "removeSearch", "spanName", "parentContext", "span", "isSampled", "fetchContext", "traceApi", "HEADERS_SETTER", "headersToAttributes", "startTime", "res", "duration", "onError", "pipeResponse", "byteLength", "err", "e", "carrier", "key", "value", "index", "length", "reader", "read", "done", "message", "attrsToHeadersMap", "headers", "attrName", "headerName", "headerValue", "init_api", "import_core", "VERSION", "TRACE_PARENT_HEADER", "TRACE_STATE_HEADER", "W3CTraceContextPropagator", "context", "carrier", "setter", "spanContext", "traceApi", "traceParent", "getter", "traceParentHeader", "parseTraceParent", "traceStateHeader", "state", "version", "traceId", "spanId", "traceFlags", "other", "init_api", "VercelRuntimePropagator", "context", "vrc", "getVercelRequestContext", "rootSpanContext", "tracing", "init_api", "import_core", "import_core", "NANOSECONDS", "hrTimeToNanos", "hrTime", "toLongBits", "value", "low", "high", "encodeAsLongBits", "nanos", "encodeAsString", "encodeTimestamp", "identity", "optionalHexToBase64", "str", "DEFAULT_ENCODER", "getOtlpEncoder", "options", "useLongBits", "_a", "useHex", "_b", "toAttributes", "attributes", "key", "toKeyValue", "value", "toAnyValue", "t", "_a", "_b", "__read", "k", "v", "sdkSpanToOtlpSpan", "span", "encoder", "ctx", "status", "_a", "toAttributes", "event", "toOtlpSpanEvent", "link", "toOtlpLink", "timedEvent", "createExportTraceServiceRequest", "spans", "options", "encoder", "getOtlpEncoder", "spanRecordsToResourceSpans", "createResourceMap", "readableSpans", "resourceMap", "readableSpans_1", "__values", "readableSpans_1_1", "record", "ilmMap", "instrumentationLibraryKey", "records", "out", "entryIterator", "entry", "_a", "__read", "resource", "scopeResourceSpans", "ilmIterator", "ilmEntry", "scopeSpans", "_b", "name_1", "version", "schemaUrl", "readableSpan", "sdkSpanToOtlpSpan", "transformedSpans", "toAttributes", "VercelRuntimeSpanExporter", "spans", "resultCallback", "context", "getVercelRequestContext", "data", "createExportTraceServiceRequest", "e", "logLevelMap", "Sdk", "configuration", "env", "getEnv", "runtime", "disabled", "idGenerator", "RandomIdGenerator", "contextManager", "serviceName", "resource", "Resource", "omitUndefinedAttributes", "resourceDetectors", "envDetectorSync", "internalConfig", "detectResourcesSync", "propagators", "parsePropagators", "traceSampler", "parseSampler", "spanProcessors", "parseSpanProcessor", "spanLimits", "tracerProvider", "BasicTracerProvider", "CompositeSpanProcessor", "loggerProvider", "LoggerProvider", "meterProvider", "MeterProvider", "instrumentations", "parseInstrumentations", "promises", "disableInstrumentations", "processEnv", "arg", "instrumentationConfig", "instrumentationOrName", "FetchInstrumentation", "envPropagators", "propagatorOrName", "autoList", "W3CTraceContextPropagator", "i", "VercelRuntimePropagator", "FALLBACK_OTEL_TRACES_SAMPLER", "DEFAULT_RATIO", "name", "AlwaysOnSampler", "AlwaysOffSampler", "ParentBasedSampler", "TraceIdRatioBasedSampler", "getSamplerProbabilityFromEnv", "probability", "spanProcessorOrName", "port", "protocol", "config", "exporter", "OTLPHttpProtoTraceExporter", "OTLPHttpJsonTraceExporter", "BatchSpanProcessor", "parseTraceExporter", "VercelRuntimeSpanExporter", "isNotNull", "url", "buildExporterUrlFromEnv", "headers", "DEFAULT_COLLECTOR_RESOURCE_PATH", "DEFAULT_COLLECTOR_URL", "defaultUrlFromEnv", "defaultUrlFromEnvAll", "x", "registerOTel", "optionsOrServiceName", "options", "Sdk"]
|
|
4
|
+
"sourcesContent": ["export * from \"@opentelemetry/api\"", "/*\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 { Context, createContextKey } from '@opentelemetry/api';\n\nconst SUPPRESS_TRACING_KEY = createContextKey(\n 'OpenTelemetry SDK Context Key SUPPRESS_TRACING'\n);\n\nexport function suppressTracing(context: Context): Context {\n return context.setValue(SUPPRESS_TRACING_KEY, true);\n}\n\nexport function unsuppressTracing(context: Context): Context {\n return context.deleteValue(SUPPRESS_TRACING_KEY);\n}\n\nexport function isTracingSuppressed(context: Context): boolean {\n return context.getValue(SUPPRESS_TRACING_KEY) === true;\n}\n", "/*\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\nexport const BAGGAGE_KEY_PAIR_SEPARATOR = '=';\nexport const BAGGAGE_PROPERTIES_SEPARATOR = ';';\nexport const BAGGAGE_ITEMS_SEPARATOR = ',';\n\n// Name of the http header used to propagate the baggage\nexport const BAGGAGE_HEADER = 'baggage';\n// Maximum number of name-value pairs allowed by w3c spec\nexport const BAGGAGE_MAX_NAME_VALUE_PAIRS = 180;\n// Maximum number of bytes per a single name-value pair allowed by w3c spec\nexport const BAGGAGE_MAX_PER_NAME_VALUE_PAIRS = 4096;\n// Maximum total length of all name-value pairs allowed by w3c spec\nexport const BAGGAGE_MAX_TOTAL_LENGTH = 8192;\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Baggage,\n BaggageEntryMetadata,\n baggageEntryMetadataFromString,\n} from '@opentelemetry/api';\nimport {\n BAGGAGE_ITEMS_SEPARATOR,\n BAGGAGE_PROPERTIES_SEPARATOR,\n BAGGAGE_KEY_PAIR_SEPARATOR,\n BAGGAGE_MAX_TOTAL_LENGTH,\n} from './constants';\n\ntype ParsedBaggageKeyValue = {\n key: string;\n value: string;\n metadata: BaggageEntryMetadata | undefined;\n};\n\nexport function serializeKeyPairs(keyPairs: string[]): string {\n return keyPairs.reduce((hValue: string, current: string) => {\n const value = `${hValue}${\n hValue !== '' ? BAGGAGE_ITEMS_SEPARATOR : ''\n }${current}`;\n return value.length > BAGGAGE_MAX_TOTAL_LENGTH ? hValue : value;\n }, '');\n}\n\nexport function getKeyPairs(baggage: Baggage): string[] {\n return baggage.getAllEntries().map(([key, value]) => {\n let entry = `${encodeURIComponent(key)}=${encodeURIComponent(value.value)}`;\n\n // include opaque metadata if provided\n // NOTE: we intentionally don't URI-encode the metadata - that responsibility falls on the metadata implementation\n if (value.metadata !== undefined) {\n entry += BAGGAGE_PROPERTIES_SEPARATOR + value.metadata.toString();\n }\n\n return entry;\n });\n}\n\nexport function parsePairKeyValue(\n entry: string\n): ParsedBaggageKeyValue | undefined {\n const valueProps = entry.split(BAGGAGE_PROPERTIES_SEPARATOR);\n if (valueProps.length <= 0) return;\n const keyPairPart = valueProps.shift();\n if (!keyPairPart) return;\n const separatorIndex = keyPairPart.indexOf(BAGGAGE_KEY_PAIR_SEPARATOR);\n if (separatorIndex <= 0) return;\n const key = decodeURIComponent(\n keyPairPart.substring(0, separatorIndex).trim()\n );\n const value = decodeURIComponent(\n keyPairPart.substring(separatorIndex + 1).trim()\n );\n let metadata;\n if (valueProps.length > 0) {\n metadata = baggageEntryMetadataFromString(\n valueProps.join(BAGGAGE_PROPERTIES_SEPARATOR)\n );\n }\n return { key, value, metadata };\n}\n\n/**\n * Parse a string serialized in the baggage HTTP Format (without metadata):\n * https://github.com/w3c/baggage/blob/master/baggage/HTTP_HEADER_FORMAT.md\n */\nexport function parseKeyPairsIntoRecord(\n value?: string\n): Record<string, string> {\n if (typeof value !== 'string' || value.length === 0) return {};\n return value\n .split(BAGGAGE_ITEMS_SEPARATOR)\n .map(entry => {\n return parsePairKeyValue(entry);\n })\n .filter(keyPair => keyPair !== undefined && keyPair.value.length > 0)\n .reduce<Record<string, string>>((headers, keyPair) => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n headers[keyPair!.key] = keyPair!.value;\n return headers;\n }, {});\n}\n", "/*\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 {\n BaggageEntry,\n Context,\n propagation,\n TextMapGetter,\n TextMapPropagator,\n TextMapSetter,\n} from '@opentelemetry/api';\n\nimport { isTracingSuppressed } from '../../trace/suppress-tracing';\nimport {\n BAGGAGE_HEADER,\n BAGGAGE_ITEMS_SEPARATOR,\n BAGGAGE_MAX_NAME_VALUE_PAIRS,\n BAGGAGE_MAX_PER_NAME_VALUE_PAIRS,\n} from '../constants';\nimport { getKeyPairs, parsePairKeyValue, serializeKeyPairs } from '../utils';\n\n/**\n * Propagates {@link Baggage} through Context format propagation.\n *\n * Based on the Baggage specification:\n * https://w3c.github.io/baggage/\n */\nexport class W3CBaggagePropagator implements TextMapPropagator {\n inject(context: Context, carrier: unknown, setter: TextMapSetter): void {\n const baggage = propagation.getBaggage(context);\n if (!baggage || isTracingSuppressed(context)) return;\n const keyPairs = getKeyPairs(baggage)\n .filter((pair: string) => {\n return pair.length <= BAGGAGE_MAX_PER_NAME_VALUE_PAIRS;\n })\n .slice(0, BAGGAGE_MAX_NAME_VALUE_PAIRS);\n const headerValue = serializeKeyPairs(keyPairs);\n if (headerValue.length > 0) {\n setter.set(carrier, BAGGAGE_HEADER, headerValue);\n }\n }\n\n extract(context: Context, carrier: unknown, getter: TextMapGetter): Context {\n const headerValue = getter.get(carrier, BAGGAGE_HEADER);\n const baggageString = Array.isArray(headerValue)\n ? headerValue.join(BAGGAGE_ITEMS_SEPARATOR)\n : headerValue;\n if (!baggageString) return context;\n const baggage: Record<string, BaggageEntry> = {};\n if (baggageString.length === 0) {\n return context;\n }\n const pairs = baggageString.split(BAGGAGE_ITEMS_SEPARATOR);\n pairs.forEach(entry => {\n const keyPair = parsePairKeyValue(entry);\n if (keyPair) {\n const baggageEntry: BaggageEntry = { value: keyPair.value };\n if (keyPair.metadata) {\n baggageEntry.metadata = keyPair.metadata;\n }\n baggage[keyPair.key] = baggageEntry;\n }\n });\n if (Object.entries(baggage).length === 0) {\n return context;\n }\n return propagation.setBaggage(context, propagation.createBaggage(baggage));\n }\n\n fields(): string[] {\n return [BAGGAGE_HEADER];\n }\n}\n", "/*\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\nexport interface Clock {\n /**\n * Return the current time in milliseconds from some epoch such as the Unix epoch or process start\n */\n now(): number;\n}\n\n/**\n * A utility for returning wall times anchored to a given point in time. Wall time measurements will\n * not be taken from the system, but instead are computed by adding a monotonic clock time\n * to the anchor point.\n *\n * This is needed because the system time can change and result in unexpected situations like\n * spans ending before they are started. Creating an anchored clock for each local root span\n * ensures that span timings and durations are accurate while preventing span times from drifting\n * too far from the system clock.\n *\n * Only creating an anchored clock once per local trace ensures span times are correct relative\n * to each other. For example, a child span will never have a start time before its parent even\n * if the system clock is corrected during the local trace.\n *\n * Heavily inspired by the OTel Java anchored clock\n * https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk/trace/src/main/java/io/opentelemetry/sdk/trace/AnchoredClock.java\n */\nexport class AnchoredClock implements Clock {\n private _monotonicClock: Clock;\n private _epochMillis: number;\n private _performanceMillis: number;\n\n /**\n * Create a new AnchoredClock anchored to the current time returned by systemClock.\n *\n * @param systemClock should be a clock that returns the number of milliseconds since January 1 1970 such as Date\n * @param monotonicClock should be a clock that counts milliseconds monotonically such as window.performance or perf_hooks.performance\n */\n public constructor(systemClock: Clock, monotonicClock: Clock) {\n this._monotonicClock = monotonicClock;\n this._epochMillis = systemClock.now();\n this._performanceMillis = monotonicClock.now();\n }\n\n /**\n * Returns the current time by adding the number of milliseconds since the\n * AnchoredClock was created to the creation epoch time\n */\n public now(): number {\n const delta = this._monotonicClock.now() - this._performanceMillis;\n return this._epochMillis + delta;\n }\n}\n", "/*\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 { diag, SpanAttributeValue, SpanAttributes } from '@opentelemetry/api';\n\nexport function sanitizeAttributes(attributes: unknown): SpanAttributes {\n const out: SpanAttributes = {};\n\n if (typeof attributes !== 'object' || attributes == null) {\n return out;\n }\n\n for (const [key, val] of Object.entries(attributes)) {\n if (!isAttributeKey(key)) {\n diag.warn(`Invalid attribute key: ${key}`);\n continue;\n }\n if (!isAttributeValue(val)) {\n diag.warn(`Invalid attribute value set for key: ${key}`);\n continue;\n }\n if (Array.isArray(val)) {\n out[key] = val.slice();\n } else {\n out[key] = val;\n }\n }\n\n return out;\n}\n\nexport function isAttributeKey(key: unknown): key is string {\n return typeof key === 'string' && key.length > 0;\n}\n\nexport function isAttributeValue(val: unknown): val is SpanAttributeValue {\n if (val == null) {\n return true;\n }\n\n if (Array.isArray(val)) {\n return isHomogeneousAttributeValueArray(val);\n }\n\n return isValidPrimitiveAttributeValue(val);\n}\n\nfunction isHomogeneousAttributeValueArray(arr: unknown[]): boolean {\n let type: string | undefined;\n\n for (const element of arr) {\n // null/undefined elements are allowed\n if (element == null) continue;\n\n if (!type) {\n if (isValidPrimitiveAttributeValue(element)) {\n type = typeof element;\n continue;\n }\n // encountered an invalid primitive\n return false;\n }\n\n if (typeof element === type) {\n continue;\n }\n\n return false;\n }\n\n return true;\n}\n\nfunction isValidPrimitiveAttributeValue(val: unknown): boolean {\n switch (typeof val) {\n case 'number':\n case 'boolean':\n case 'string':\n return true;\n }\n\n return false;\n}\n", "/*\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 { diag, Exception } from '@opentelemetry/api';\nimport { ErrorHandler } from './types';\n\n/**\n * Returns a function that logs an error using the provided logger, or a\n * console logger if one was not provided.\n */\nexport function loggingErrorHandler(): ErrorHandler {\n return (ex: Exception) => {\n diag.error(stringifyException(ex));\n };\n}\n\n/**\n * Converts an exception into a string representation\n * @param {Exception} ex\n */\nfunction stringifyException(ex: Exception | string): string {\n if (typeof ex === 'string') {\n return ex;\n } else {\n return JSON.stringify(flattenException(ex));\n }\n}\n\n/**\n * Flattens an exception into key-value pairs by traversing the prototype chain\n * and coercing values to strings. Duplicate properties will not be overwritten;\n * the first insert wins.\n */\nfunction flattenException(ex: Exception): Record<string, string> {\n const result = {} as Record<string, string>;\n let current = ex;\n\n while (current !== null) {\n Object.getOwnPropertyNames(current).forEach(propertyName => {\n if (result[propertyName]) return;\n const value = current[propertyName as keyof typeof current];\n if (value) {\n result[propertyName] = String(value);\n }\n });\n current = Object.getPrototypeOf(current);\n }\n\n return result;\n}\n", "/*\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 { Exception } from '@opentelemetry/api';\nimport { loggingErrorHandler } from './logging-error-handler';\nimport { ErrorHandler } from './types';\n\n/** The global error handler delegate */\nlet delegateHandler = loggingErrorHandler();\n\n/**\n * Set the global error handler\n * @param {ErrorHandler} handler\n */\nexport function setGlobalErrorHandler(handler: ErrorHandler): void {\n delegateHandler = handler;\n}\n\n/**\n * Return the global error handler\n * @param {Exception} ex\n */\nexport function globalErrorHandler(ex: Exception): void {\n try {\n delegateHandler(ex);\n } catch {} // eslint-disable-line no-empty\n}\n", "/*\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\nexport enum TracesSamplerValues {\n AlwaysOff = 'always_off',\n AlwaysOn = 'always_on',\n ParentBasedAlwaysOff = 'parentbased_always_off',\n ParentBasedAlwaysOn = 'parentbased_always_on',\n ParentBasedTraceIdRatio = 'parentbased_traceidratio',\n TraceIdRatio = 'traceidratio',\n}\n", "/*\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// Updates to this file should also be replicated to @opentelemetry/api too.\n\n/**\n * - globalThis (New standard)\n * - self (Will return the current window instance for supported browsers)\n * - window (fallback for older browser implementations)\n * - global (NodeJS implementation)\n * - <object> (When all else fails)\n */\n\n/** only globals that common to node and browsers are allowed */\n// eslint-disable-next-line node/no-unsupported-features/es-builtins, no-undef\nexport const _globalThis: typeof globalThis =\n typeof globalThis === 'object'\n ? globalThis\n : typeof self === 'object'\n ? self\n : typeof window === 'object'\n ? window\n : typeof global === 'object'\n ? global\n : ({} as typeof globalThis);\n", "/*\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 { DiagLogLevel } from '@opentelemetry/api';\nimport { TracesSamplerValues } from './sampling';\nimport { _globalThis } from '../platform/browser/globalThis';\n\nconst DEFAULT_LIST_SEPARATOR = ',';\n\n/**\n * Environment interface to define all names\n */\n\nconst ENVIRONMENT_BOOLEAN_KEYS = ['OTEL_SDK_DISABLED'] as const;\n\ntype ENVIRONMENT_BOOLEANS = {\n [K in (typeof ENVIRONMENT_BOOLEAN_KEYS)[number]]?: boolean;\n};\n\nfunction isEnvVarABoolean(key: unknown): key is keyof ENVIRONMENT_BOOLEANS {\n return (\n ENVIRONMENT_BOOLEAN_KEYS.indexOf(key as keyof ENVIRONMENT_BOOLEANS) > -1\n );\n}\n\nconst ENVIRONMENT_NUMBERS_KEYS = [\n 'OTEL_BSP_EXPORT_TIMEOUT',\n 'OTEL_BSP_MAX_EXPORT_BATCH_SIZE',\n 'OTEL_BSP_MAX_QUEUE_SIZE',\n 'OTEL_BSP_SCHEDULE_DELAY',\n 'OTEL_BLRP_EXPORT_TIMEOUT',\n 'OTEL_BLRP_MAX_EXPORT_BATCH_SIZE',\n 'OTEL_BLRP_MAX_QUEUE_SIZE',\n 'OTEL_BLRP_SCHEDULE_DELAY',\n 'OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT',\n 'OTEL_ATTRIBUTE_COUNT_LIMIT',\n 'OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT',\n 'OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT',\n 'OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT',\n 'OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT',\n 'OTEL_SPAN_EVENT_COUNT_LIMIT',\n 'OTEL_SPAN_LINK_COUNT_LIMIT',\n 'OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT',\n 'OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT',\n 'OTEL_EXPORTER_OTLP_TIMEOUT',\n 'OTEL_EXPORTER_OTLP_TRACES_TIMEOUT',\n 'OTEL_EXPORTER_OTLP_METRICS_TIMEOUT',\n 'OTEL_EXPORTER_OTLP_LOGS_TIMEOUT',\n 'OTEL_EXPORTER_JAEGER_AGENT_PORT',\n] as const;\n\ntype ENVIRONMENT_NUMBERS = {\n [K in (typeof ENVIRONMENT_NUMBERS_KEYS)[number]]?: number;\n};\n\nfunction isEnvVarANumber(key: unknown): key is keyof ENVIRONMENT_NUMBERS {\n return (\n ENVIRONMENT_NUMBERS_KEYS.indexOf(key as keyof ENVIRONMENT_NUMBERS) > -1\n );\n}\n\nconst ENVIRONMENT_LISTS_KEYS = [\n 'OTEL_NO_PATCH_MODULES',\n 'OTEL_PROPAGATORS',\n] as const;\n\ntype ENVIRONMENT_LISTS = {\n [K in (typeof ENVIRONMENT_LISTS_KEYS)[number]]?: string[];\n};\n\nfunction isEnvVarAList(key: unknown): key is keyof ENVIRONMENT_LISTS {\n return ENVIRONMENT_LISTS_KEYS.indexOf(key as keyof ENVIRONMENT_LISTS) > -1;\n}\n\nexport type ENVIRONMENT = {\n CONTAINER_NAME?: string;\n ECS_CONTAINER_METADATA_URI_V4?: string;\n ECS_CONTAINER_METADATA_URI?: string;\n HOSTNAME?: string;\n KUBERNETES_SERVICE_HOST?: string;\n NAMESPACE?: string;\n OTEL_EXPORTER_JAEGER_AGENT_HOST?: string;\n OTEL_EXPORTER_JAEGER_ENDPOINT?: string;\n OTEL_EXPORTER_JAEGER_PASSWORD?: string;\n OTEL_EXPORTER_JAEGER_USER?: string;\n OTEL_EXPORTER_OTLP_ENDPOINT?: string;\n OTEL_EXPORTER_OTLP_TRACES_ENDPOINT?: string;\n OTEL_EXPORTER_OTLP_METRICS_ENDPOINT?: string;\n OTEL_EXPORTER_OTLP_LOGS_ENDPOINT?: string;\n OTEL_EXPORTER_OTLP_HEADERS?: string;\n OTEL_EXPORTER_OTLP_TRACES_HEADERS?: string;\n OTEL_EXPORTER_OTLP_METRICS_HEADERS?: string;\n OTEL_EXPORTER_OTLP_LOGS_HEADERS?: string;\n OTEL_EXPORTER_ZIPKIN_ENDPOINT?: string;\n OTEL_LOG_LEVEL?: DiagLogLevel;\n OTEL_RESOURCE_ATTRIBUTES?: string;\n OTEL_SERVICE_NAME?: string;\n OTEL_TRACES_EXPORTER?: string;\n OTEL_TRACES_SAMPLER_ARG?: string;\n OTEL_TRACES_SAMPLER?: string;\n OTEL_LOGS_EXPORTER?: string;\n OTEL_EXPORTER_OTLP_INSECURE?: string;\n OTEL_EXPORTER_OTLP_TRACES_INSECURE?: string;\n OTEL_EXPORTER_OTLP_METRICS_INSECURE?: string;\n OTEL_EXPORTER_OTLP_LOGS_INSECURE?: string;\n OTEL_EXPORTER_OTLP_CERTIFICATE?: string;\n OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE?: string;\n OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE?: string;\n OTEL_EXPORTER_OTLP_LOGS_CERTIFICATE?: string;\n OTEL_EXPORTER_OTLP_COMPRESSION?: string;\n OTEL_EXPORTER_OTLP_TRACES_COMPRESSION?: string;\n OTEL_EXPORTER_OTLP_METRICS_COMPRESSION?: string;\n OTEL_EXPORTER_OTLP_LOGS_COMPRESSION?: string;\n OTEL_EXPORTER_OTLP_CLIENT_KEY?: string;\n OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY?: string;\n OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY?: string;\n OTEL_EXPORTER_OTLP_LOGS_CLIENT_KEY?: string;\n OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE?: string;\n OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE?: string;\n OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE?: string;\n OTEL_EXPORTER_OTLP_LOGS_CLIENT_CERTIFICATE?: string;\n OTEL_EXPORTER_OTLP_PROTOCOL?: string;\n OTEL_EXPORTER_OTLP_TRACES_PROTOCOL?: string;\n OTEL_EXPORTER_OTLP_METRICS_PROTOCOL?: string;\n OTEL_EXPORTER_OTLP_LOGS_PROTOCOL?: string;\n OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE?: string;\n} & ENVIRONMENT_BOOLEANS &\n ENVIRONMENT_NUMBERS &\n ENVIRONMENT_LISTS;\n\nexport type RAW_ENVIRONMENT = {\n [key: string]: string | number | undefined | string[];\n};\n\nexport const DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT = Infinity;\n\nexport const DEFAULT_ATTRIBUTE_COUNT_LIMIT = 128;\n\nexport const DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT = 128;\nexport const DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT = 128;\n\n/**\n * Default environment variables\n */\nexport const DEFAULT_ENVIRONMENT: Required<ENVIRONMENT> = {\n OTEL_SDK_DISABLED: false,\n CONTAINER_NAME: '',\n ECS_CONTAINER_METADATA_URI_V4: '',\n ECS_CONTAINER_METADATA_URI: '',\n HOSTNAME: '',\n KUBERNETES_SERVICE_HOST: '',\n NAMESPACE: '',\n OTEL_BSP_EXPORT_TIMEOUT: 30000,\n OTEL_BSP_MAX_EXPORT_BATCH_SIZE: 512,\n OTEL_BSP_MAX_QUEUE_SIZE: 2048,\n OTEL_BSP_SCHEDULE_DELAY: 5000,\n OTEL_BLRP_EXPORT_TIMEOUT: 30000,\n OTEL_BLRP_MAX_EXPORT_BATCH_SIZE: 512,\n OTEL_BLRP_MAX_QUEUE_SIZE: 2048,\n OTEL_BLRP_SCHEDULE_DELAY: 5000,\n OTEL_EXPORTER_JAEGER_AGENT_HOST: '',\n OTEL_EXPORTER_JAEGER_AGENT_PORT: 6832,\n OTEL_EXPORTER_JAEGER_ENDPOINT: '',\n OTEL_EXPORTER_JAEGER_PASSWORD: '',\n OTEL_EXPORTER_JAEGER_USER: '',\n OTEL_EXPORTER_OTLP_ENDPOINT: '',\n OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: '',\n OTEL_EXPORTER_OTLP_METRICS_ENDPOINT: '',\n OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: '',\n OTEL_EXPORTER_OTLP_HEADERS: '',\n OTEL_EXPORTER_OTLP_TRACES_HEADERS: '',\n OTEL_EXPORTER_OTLP_METRICS_HEADERS: '',\n OTEL_EXPORTER_OTLP_LOGS_HEADERS: '',\n OTEL_EXPORTER_OTLP_TIMEOUT: 10000,\n OTEL_EXPORTER_OTLP_TRACES_TIMEOUT: 10000,\n OTEL_EXPORTER_OTLP_METRICS_TIMEOUT: 10000,\n OTEL_EXPORTER_OTLP_LOGS_TIMEOUT: 10000,\n OTEL_EXPORTER_ZIPKIN_ENDPOINT: 'http://localhost:9411/api/v2/spans',\n OTEL_LOG_LEVEL: DiagLogLevel.INFO,\n OTEL_NO_PATCH_MODULES: [],\n OTEL_PROPAGATORS: ['tracecontext', 'baggage'],\n OTEL_RESOURCE_ATTRIBUTES: '',\n OTEL_SERVICE_NAME: '',\n OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT: DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,\n OTEL_ATTRIBUTE_COUNT_LIMIT: DEFAULT_ATTRIBUTE_COUNT_LIMIT,\n OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT: DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,\n OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT: DEFAULT_ATTRIBUTE_COUNT_LIMIT,\n OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT:\n DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,\n OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT: DEFAULT_ATTRIBUTE_COUNT_LIMIT,\n OTEL_SPAN_EVENT_COUNT_LIMIT: 128,\n OTEL_SPAN_LINK_COUNT_LIMIT: 128,\n OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT:\n DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT,\n OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT:\n DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT,\n OTEL_TRACES_EXPORTER: '',\n OTEL_TRACES_SAMPLER: TracesSamplerValues.ParentBasedAlwaysOn,\n OTEL_TRACES_SAMPLER_ARG: '',\n OTEL_LOGS_EXPORTER: '',\n OTEL_EXPORTER_OTLP_INSECURE: '',\n OTEL_EXPORTER_OTLP_TRACES_INSECURE: '',\n OTEL_EXPORTER_OTLP_METRICS_INSECURE: '',\n OTEL_EXPORTER_OTLP_LOGS_INSECURE: '',\n OTEL_EXPORTER_OTLP_CERTIFICATE: '',\n OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE: '',\n OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE: '',\n OTEL_EXPORTER_OTLP_LOGS_CERTIFICATE: '',\n OTEL_EXPORTER_OTLP_COMPRESSION: '',\n OTEL_EXPORTER_OTLP_TRACES_COMPRESSION: '',\n OTEL_EXPORTER_OTLP_METRICS_COMPRESSION: '',\n OTEL_EXPORTER_OTLP_LOGS_COMPRESSION: '',\n OTEL_EXPORTER_OTLP_CLIENT_KEY: '',\n OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY: '',\n OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY: '',\n OTEL_EXPORTER_OTLP_LOGS_CLIENT_KEY: '',\n OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE: '',\n OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE: '',\n OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE: '',\n OTEL_EXPORTER_OTLP_LOGS_CLIENT_CERTIFICATE: '',\n OTEL_EXPORTER_OTLP_PROTOCOL: 'http/protobuf',\n OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: 'http/protobuf',\n OTEL_EXPORTER_OTLP_METRICS_PROTOCOL: 'http/protobuf',\n OTEL_EXPORTER_OTLP_LOGS_PROTOCOL: 'http/protobuf',\n OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE: 'cumulative',\n};\n\n/**\n * @param key\n * @param environment\n * @param values\n */\nfunction parseBoolean(\n key: keyof ENVIRONMENT_BOOLEANS,\n environment: ENVIRONMENT,\n values: RAW_ENVIRONMENT\n) {\n if (typeof values[key] === 'undefined') {\n return;\n }\n\n const value = String(values[key]);\n // support case-insensitive \"true\"\n environment[key] = value.toLowerCase() === 'true';\n}\n\n/**\n * Parses a variable as number with number validation\n * @param name\n * @param environment\n * @param values\n * @param min\n * @param max\n */\nfunction parseNumber(\n name: keyof ENVIRONMENT_NUMBERS,\n environment: ENVIRONMENT,\n values: RAW_ENVIRONMENT,\n min = -Infinity,\n max = Infinity\n) {\n if (typeof values[name] !== 'undefined') {\n const value = Number(values[name] as string);\n if (!isNaN(value)) {\n if (value < min) {\n environment[name] = min;\n } else if (value > max) {\n environment[name] = max;\n } else {\n environment[name] = value;\n }\n }\n }\n}\n\n/**\n * Parses list-like strings from input into output.\n * @param name\n * @param environment\n * @param values\n * @param separator\n */\nfunction parseStringList(\n name: keyof ENVIRONMENT_LISTS,\n output: ENVIRONMENT,\n input: RAW_ENVIRONMENT,\n separator = DEFAULT_LIST_SEPARATOR\n) {\n const givenValue = input[name];\n if (typeof givenValue === 'string') {\n output[name] = givenValue.split(separator).map(v => v.trim());\n }\n}\n\n// The support string -> DiagLogLevel mappings\nconst logLevelMap: { [key: string]: DiagLogLevel } = {\n ALL: DiagLogLevel.ALL,\n VERBOSE: DiagLogLevel.VERBOSE,\n DEBUG: DiagLogLevel.DEBUG,\n INFO: DiagLogLevel.INFO,\n WARN: DiagLogLevel.WARN,\n ERROR: DiagLogLevel.ERROR,\n NONE: DiagLogLevel.NONE,\n};\n\n/**\n * Environmentally sets log level if valid log level string is provided\n * @param key\n * @param environment\n * @param values\n */\nfunction setLogLevelFromEnv(\n key: keyof ENVIRONMENT,\n environment: RAW_ENVIRONMENT | ENVIRONMENT,\n values: RAW_ENVIRONMENT\n) {\n const value = values[key];\n if (typeof value === 'string') {\n const theLevel = logLevelMap[value.toUpperCase()];\n if (theLevel != null) {\n environment[key] = theLevel;\n }\n }\n}\n\n/**\n * Parses environment values\n * @param values\n */\nexport function parseEnvironment(values: RAW_ENVIRONMENT): ENVIRONMENT {\n const environment: ENVIRONMENT = {};\n\n for (const env in DEFAULT_ENVIRONMENT) {\n const key = env as keyof ENVIRONMENT;\n\n switch (key) {\n case 'OTEL_LOG_LEVEL':\n setLogLevelFromEnv(key, environment, values);\n break;\n\n default:\n if (isEnvVarABoolean(key)) {\n parseBoolean(key, environment, values);\n } else if (isEnvVarANumber(key)) {\n parseNumber(key, environment, values);\n } else if (isEnvVarAList(key)) {\n parseStringList(key, environment, values);\n } else {\n const value = values[key];\n if (typeof value !== 'undefined' && value !== null) {\n environment[key] = String(value);\n }\n }\n }\n }\n\n return environment;\n}\n\n/**\n * Get environment in node or browser without\n * populating default values.\n */\nexport function getEnvWithoutDefaults(): ENVIRONMENT {\n return typeof process !== 'undefined' && process && process.env\n ? parseEnvironment(process.env as RAW_ENVIRONMENT)\n : parseEnvironment(_globalThis as typeof globalThis & RAW_ENVIRONMENT);\n}\n", "/*\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 {\n DEFAULT_ENVIRONMENT,\n ENVIRONMENT,\n RAW_ENVIRONMENT,\n parseEnvironment,\n} from '../../utils/environment';\nimport { _globalThis } from './globalThis';\n\n/**\n * Gets the environment variables\n */\nexport function getEnv(): Required<ENVIRONMENT> {\n const globalEnv = parseEnvironment(\n _globalThis as typeof globalThis & RAW_ENVIRONMENT\n );\n return Object.assign({}, DEFAULT_ENVIRONMENT, globalEnv);\n}\n", "/*\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 */\nexport function hexToBase64(hexStr: string): string {\n const hexStrLen = hexStr.length;\n let hexAsciiCharsStr = '';\n for (let i = 0; i < hexStrLen; i += 2) {\n const hexPair = hexStr.substring(i, i + 2);\n const hexVal = parseInt(hexPair, 16);\n hexAsciiCharsStr += String.fromCharCode(hexVal);\n }\n return btoa(hexAsciiCharsStr);\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { IdGenerator } from '../../trace/IdGenerator';\n\nconst SPAN_ID_BYTES = 8;\nconst TRACE_ID_BYTES = 16;\n\n/**\n * @deprecated Use the one defined in @opentelemetry/sdk-trace-base instead.\n */\nexport class RandomIdGenerator implements IdGenerator {\n /**\n * Returns a random 16-byte trace ID formatted/encoded as a 32 lowercase hex\n * characters corresponding to 128 bits.\n */\n generateTraceId = getIdGenerator(TRACE_ID_BYTES);\n\n /**\n * Returns a random 8-byte span ID formatted/encoded as a 16 lowercase hex\n * characters corresponding to 64 bits.\n */\n generateSpanId = getIdGenerator(SPAN_ID_BYTES);\n}\n\nconst SHARED_CHAR_CODES_ARRAY = Array(32);\nfunction getIdGenerator(bytes: number): () => string {\n return function generateId() {\n for (let i = 0; i < bytes * 2; i++) {\n SHARED_CHAR_CODES_ARRAY[i] = Math.floor(Math.random() * 16) + 48;\n // valid hex characters in the range 48-57 and 97-102\n if (SHARED_CHAR_CODES_ARRAY[i] >= 58) {\n SHARED_CHAR_CODES_ARRAY[i] += 39;\n }\n }\n return String.fromCharCode.apply(\n null,\n SHARED_CHAR_CODES_ARRAY.slice(0, bytes * 2)\n );\n };\n}\n", "/*\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\nexport const otperformance = performance;\n", "/*\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 = '1.19.0';\n", "/*\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// DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates//templates/SemanticAttributes.ts.j2\nexport const SemanticAttributes = {\n /**\n * The full invoked ARN as provided on the `Context` passed to the function (`Lambda-Runtime-Invoked-Function-Arn` header on the `/runtime/invocation/next` applicable).\n *\n * Note: This may be different from `faas.id` if an alias is involved.\n */\n AWS_LAMBDA_INVOKED_ARN: 'aws.lambda.invoked_arn',\n\n /**\n * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers.\n */\n DB_SYSTEM: 'db.system',\n\n /**\n * The connection string used to connect to the database. It is recommended to remove embedded credentials.\n */\n DB_CONNECTION_STRING: 'db.connection_string',\n\n /**\n * Username for accessing the database.\n */\n DB_USER: 'db.user',\n\n /**\n * The fully-qualified class name of the [Java Database Connectivity (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver used to connect.\n */\n DB_JDBC_DRIVER_CLASSNAME: 'db.jdbc.driver_classname',\n\n /**\n * If no [tech-specific attribute](#call-level-attributes-for-specific-technologies) is defined, this attribute is used to report the name of the database being accessed. For commands that switch the database, this should be set to the target database (even if the command fails).\n *\n * Note: In some SQL databases, the database name to be used is called "schema name".\n */\n DB_NAME: 'db.name',\n\n /**\n * The database statement being executed.\n *\n * Note: The value may be sanitized to exclude sensitive information.\n */\n DB_STATEMENT: 'db.statement',\n\n /**\n * The name of the operation being executed, e.g. the [MongoDB command name](https://docs.mongodb.com/manual/reference/command/#database-operations) such as `findAndModify`, or the SQL keyword.\n *\n * Note: When setting this to an SQL keyword, it is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if the operation name is provided by the library being instrumented. If the SQL statement has an ambiguous operation, or performs more than one operation, this value may be omitted.\n */\n DB_OPERATION: 'db.operation',\n\n /**\n * The Microsoft SQL Server [instance name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) connecting to. This name is used to determine the port of a named instance.\n *\n * Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no longer required (but still recommended if non-standard).\n */\n DB_MSSQL_INSTANCE_NAME: 'db.mssql.instance_name',\n\n /**\n * The name of the keyspace being accessed. To be used instead of the generic `db.name` attribute.\n */\n DB_CASSANDRA_KEYSPACE: 'db.cassandra.keyspace',\n\n /**\n * The fetch size used for paging, i.e. how many rows will be returned at once.\n */\n DB_CASSANDRA_PAGE_SIZE: 'db.cassandra.page_size',\n\n /**\n * The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html).\n */\n DB_CASSANDRA_CONSISTENCY_LEVEL: 'db.cassandra.consistency_level',\n\n /**\n * The name of the primary table that the operation is acting upon, including the schema name (if applicable).\n *\n * Note: This mirrors the db.sql.table attribute but references cassandra rather than sql. It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set.\n */\n DB_CASSANDRA_TABLE: 'db.cassandra.table',\n\n /**\n * Whether or not the query is idempotent.\n */\n DB_CASSANDRA_IDEMPOTENCE: 'db.cassandra.idempotence',\n\n /**\n * The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively.\n */\n DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT:\n 'db.cassandra.speculative_execution_count',\n\n /**\n * The ID of the coordinating node for a query.\n */\n DB_CASSANDRA_COORDINATOR_ID: 'db.cassandra.coordinator.id',\n\n /**\n * The data center of the coordinating node for a query.\n */\n DB_CASSANDRA_COORDINATOR_DC: 'db.cassandra.coordinator.dc',\n\n /**\n * The [HBase namespace](https://hbase.apache.org/book.html#_namespace) being accessed. To be used instead of the generic `db.name` attribute.\n */\n DB_HBASE_NAMESPACE: 'db.hbase.namespace',\n\n /**\n * The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select), provided as an integer. To be used instead of the generic `db.name` attribute.\n */\n DB_REDIS_DATABASE_INDEX: 'db.redis.database_index',\n\n /**\n * The collection being accessed within the database stated in `db.name`.\n */\n DB_MONGODB_COLLECTION: 'db.mongodb.collection',\n\n /**\n * The name of the primary table that the operation is acting upon, including the schema name (if applicable).\n *\n * Note: It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set.\n */\n DB_SQL_TABLE: 'db.sql.table',\n\n /**\n * The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it.\n */\n EXCEPTION_TYPE: 'exception.type',\n\n /**\n * The exception message.\n */\n EXCEPTION_MESSAGE: 'exception.message',\n\n /**\n * A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG.\n */\n EXCEPTION_STACKTRACE: 'exception.stacktrace',\n\n /**\n * SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span.\n *\n * Note: An exception is considered to have escaped (or left) the scope of a span,\nif that span is ended while the exception is still logically "in flight".\nThis may be actually "in flight" in some languages (e.g. if the exception\nis passed to a Context manager's `__exit__` method in Python) but will\nusually be caught at the point of recording the exception in most languages.\n\nIt is usually not possible to determine at the point where an exception is thrown\nwhether it will escape the scope of a span.\nHowever, it is trivial to know that an exception\nwill escape, if one checks for an active exception just before ending the span,\nas done in the [example above](#exception-end-example).\n\nIt follows that an exception may still escape the scope of the span\neven if the `exception.escaped` attribute was not set or set to false,\nsince the event might have been recorded at a time where it was not\nclear whether the exception will escape.\n */\n EXCEPTION_ESCAPED: 'exception.escaped',\n\n /**\n * Type of the trigger on which the function is executed.\n */\n FAAS_TRIGGER: 'faas.trigger',\n\n /**\n * The execution ID of the current function execution.\n */\n FAAS_EXECUTION: 'faas.execution',\n\n /**\n * The name of the source on which the triggering operation was performed. For example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the database name.\n */\n FAAS_DOCUMENT_COLLECTION: 'faas.document.collection',\n\n /**\n * Describes the type of the operation that was performed on the data.\n */\n FAAS_DOCUMENT_OPERATION: 'faas.document.operation',\n\n /**\n * A string containing the time when the data was accessed in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime).\n */\n FAAS_DOCUMENT_TIME: 'faas.document.time',\n\n /**\n * The document name/table subjected to the operation. For example, in Cloud Storage or S3 is the name of the file, and in Cosmos DB the table name.\n */\n FAAS_DOCUMENT_NAME: 'faas.document.name',\n\n /**\n * A string containing the function invocation time in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime).\n */\n FAAS_TIME: 'faas.time',\n\n /**\n * A string containing the schedule period as [Cron Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm).\n */\n FAAS_CRON: 'faas.cron',\n\n /**\n * A boolean that is true if the serverless function is executed for the first time (aka cold-start).\n */\n FAAS_COLDSTART: 'faas.coldstart',\n\n /**\n * The name of the invoked function.\n *\n * Note: SHOULD be equal to the `faas.name` resource attribute of the invoked function.\n */\n FAAS_INVOKED_NAME: 'faas.invoked_name',\n\n /**\n * The cloud provider of the invoked function.\n *\n * Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked function.\n */\n FAAS_INVOKED_PROVIDER: 'faas.invoked_provider',\n\n /**\n * The cloud region of the invoked function.\n *\n * Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked function.\n */\n FAAS_INVOKED_REGION: 'faas.invoked_region',\n\n /**\n * Transport protocol used. See note below.\n */\n NET_TRANSPORT: 'net.transport',\n\n /**\n * Remote address of the peer (dotted decimal for IPv4 or [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6).\n */\n NET_PEER_IP: 'net.peer.ip',\n\n /**\n * Remote port number.\n */\n NET_PEER_PORT: 'net.peer.port',\n\n /**\n * Remote hostname or similar, see note below.\n */\n NET_PEER_NAME: 'net.peer.name',\n\n /**\n * Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host.\n */\n NET_HOST_IP: 'net.host.ip',\n\n /**\n * Like `net.peer.port` but for the host port.\n */\n NET_HOST_PORT: 'net.host.port',\n\n /**\n * Local hostname or similar, see note below.\n */\n NET_HOST_NAME: 'net.host.name',\n\n /**\n * The internet connection type currently being used by the host.\n */\n NET_HOST_CONNECTION_TYPE: 'net.host.connection.type',\n\n /**\n * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection.\n */\n NET_HOST_CONNECTION_SUBTYPE: 'net.host.connection.subtype',\n\n /**\n * The name of the mobile carrier.\n */\n NET_HOST_CARRIER_NAME: 'net.host.carrier.name',\n\n /**\n * The mobile carrier country code.\n */\n NET_HOST_CARRIER_MCC: 'net.host.carrier.mcc',\n\n /**\n * The mobile carrier network code.\n */\n NET_HOST_CARRIER_MNC: 'net.host.carrier.mnc',\n\n /**\n * The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network.\n */\n NET_HOST_CARRIER_ICC: 'net.host.carrier.icc',\n\n /**\n * The [`service.name`](../../resource/semantic_conventions/README.md#service) of the remote service. SHOULD be equal to the actual `service.name` resource attribute of the remote service if any.\n */\n PEER_SERVICE: 'peer.service',\n\n /**\n * Username or client_id extracted from the access token or [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in the inbound request from outside the system.\n */\n ENDUSER_ID: 'enduser.id',\n\n /**\n * Actual/assumed role the client is making the request under extracted from token or application security context.\n */\n ENDUSER_ROLE: 'enduser.role',\n\n /**\n * Scopes or granted authorities the client currently possesses extracted from token or application security context. The value would come from the scope associated with an [OAuth 2.0 Access Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute value in a [SAML 2.0 Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html).\n */\n ENDUSER_SCOPE: 'enduser.scope',\n\n /**\n * Current "managed" thread ID (as opposed to OS thread ID).\n */\n THREAD_ID: 'thread.id',\n\n /**\n * Current thread name.\n */\n THREAD_NAME: 'thread.name',\n\n /**\n * The method or function name, or equivalent (usually rightmost part of the code unit's name).\n */\n CODE_FUNCTION: 'code.function',\n\n /**\n * The "namespace" within which `code.function` is defined. Usually the qualified class or module name, such that `code.namespace` + some separator + `code.function` form a unique identifier for the code unit.\n */\n CODE_NAMESPACE: 'code.namespace',\n\n /**\n * The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path).\n */\n CODE_FILEPATH: 'code.filepath',\n\n /**\n * The line number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`.\n */\n CODE_LINENO: 'code.lineno',\n\n /**\n * HTTP request method.\n */\n HTTP_METHOD: 'http.method',\n\n /**\n * Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is not transmitted over HTTP, but if it is known, it should be included nevertheless.\n *\n * Note: `http.url` MUST NOT contain credentials passed via URL in form of `https://username:password@www.example.com/`. In such case the attribute's value should be `https://www.example.com/`.\n */\n HTTP_URL: 'http.url',\n\n /**\n * The full request target as passed in a HTTP request line or equivalent.\n */\n HTTP_TARGET: 'http.target',\n\n /**\n * The value of the [HTTP host header](https://tools.ietf.org/html/rfc7230#section-5.4). An empty Host header should also be reported, see note.\n *\n * Note: When the header is present but empty the attribute SHOULD be set to the empty string. Note that this is a valid situation that is expected in certain cases, according the aforementioned [section of RFC 7230](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is not set the attribute MUST NOT be set.\n */\n HTTP_HOST: 'http.host',\n\n /**\n * The URI scheme identifying the used protocol.\n */\n HTTP_SCHEME: 'http.scheme',\n\n /**\n * [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).\n */\n HTTP_STATUS_CODE: 'http.status_code',\n\n /**\n * Kind of HTTP protocol used.\n *\n * Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed.\n */\n HTTP_FLAVOR: 'http.flavor',\n\n /**\n * Value of the [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the client.\n */\n HTTP_USER_AGENT: 'http.user_agent',\n\n /**\n * The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For requests using transport encoding, this should be the compressed size.\n */\n HTTP_REQUEST_CONTENT_LENGTH: 'http.request_content_length',\n\n /**\n * The size of the uncompressed request payload body after transport decoding. Not set if transport encoding not used.\n */\n HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED:\n 'http.request_content_length_uncompressed',\n\n /**\n * The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For requests using transport encoding, this should be the compressed size.\n */\n HTTP_RESPONSE_CONTENT_LENGTH: 'http.response_content_length',\n\n /**\n * The size of the uncompressed response payload body after transport decoding. Not set if transport encoding not used.\n */\n HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED:\n 'http.response_content_length_uncompressed',\n\n /**\n * The primary server name of the matched virtual host. This should be obtained via configuration. If no such configuration can be obtained, this attribute MUST NOT be set ( `net.host.name` should be used instead).\n *\n * Note: `http.url` is usually not readily available on the server side but would have to be assembled in a cumbersome and sometimes lossy process from other information (see e.g. open-telemetry/opentelemetry-python/pull/148). It is thus preferred to supply the raw data that is available.\n */\n HTTP_SERVER_NAME: 'http.server_name',\n\n /**\n * The matched route (path template).\n */\n HTTP_ROUTE: 'http.route',\n\n /**\n * The IP address of the original client behind all proxies, if known (e.g. from [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)).\n *\n * Note: This is not necessarily the same as `net.peer.ip`, which would\nidentify the network-level peer, which may be a proxy.\n\nThis attribute should be set when a source of information different\nfrom the one used for `net.peer.ip`, is available even if that other\nsource just confirms the same value as `net.peer.ip`.\nRationale: For `net.peer.ip`, one typically does not know if it\ncomes from a proxy, reverse proxy, or the actual client. Setting\n`http.client_ip` when it's the same as `net.peer.ip` means that\none is at least somewhat confident that the address is not that of\nthe closest proxy.\n */\n HTTP_CLIENT_IP: 'http.client_ip',\n\n /**\n * The keys in the `RequestItems` object field.\n */\n AWS_DYNAMODB_TABLE_NAMES: 'aws.dynamodb.table_names',\n\n /**\n * The JSON-serialized value of each item in the `ConsumedCapacity` response field.\n */\n AWS_DYNAMODB_CONSUMED_CAPACITY: 'aws.dynamodb.consumed_capacity',\n\n /**\n * The JSON-serialized value of the `ItemCollectionMetrics` response field.\n */\n AWS_DYNAMODB_ITEM_COLLECTION_METRICS: 'aws.dynamodb.item_collection_metrics',\n\n /**\n * The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter.\n */\n AWS_DYNAMODB_PROVISIONED_READ_CAPACITY:\n 'aws.dynamodb.provisioned_read_capacity',\n\n /**\n * The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter.\n */\n AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY:\n 'aws.dynamodb.provisioned_write_capacity',\n\n /**\n * The value of the `ConsistentRead` request parameter.\n */\n AWS_DYNAMODB_CONSISTENT_READ: 'aws.dynamodb.consistent_read',\n\n /**\n * The value of the `ProjectionExpression` request parameter.\n */\n AWS_DYNAMODB_PROJECTION: 'aws.dynamodb.projection',\n\n /**\n * The value of the `Limit` request parameter.\n */\n AWS_DYNAMODB_LIMIT: 'aws.dynamodb.limit',\n\n /**\n * The value of the `AttributesToGet` request parameter.\n */\n AWS_DYNAMODB_ATTRIBUTES_TO_GET: 'aws.dynamodb.attributes_to_get',\n\n /**\n * The value of the `IndexName` request parameter.\n */\n AWS_DYNAMODB_INDEX_NAME: 'aws.dynamodb.index_name',\n\n /**\n * The value of the `Select` request parameter.\n */\n AWS_DYNAMODB_SELECT: 'aws.dynamodb.select',\n\n /**\n * The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field.\n */\n AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES:\n 'aws.dynamodb.global_secondary_indexes',\n\n /**\n * The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field.\n */\n AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES: 'aws.dynamodb.local_secondary_indexes',\n\n /**\n * The value of the `ExclusiveStartTableName` request parameter.\n */\n AWS_DYNAMODB_EXCLUSIVE_START_TABLE: 'aws.dynamodb.exclusive_start_table',\n\n /**\n * The the number of items in the `TableNames` response parameter.\n */\n AWS_DYNAMODB_TABLE_COUNT: 'aws.dynamodb.table_count',\n\n /**\n * The value of the `ScanIndexForward` request parameter.\n */\n AWS_DYNAMODB_SCAN_FORWARD: 'aws.dynamodb.scan_forward',\n\n /**\n * The value of the `Segment` request parameter.\n */\n AWS_DYNAMODB_SEGMENT: 'aws.dynamodb.segment',\n\n /**\n * The value of the `TotalSegments` request parameter.\n */\n AWS_DYNAMODB_TOTAL_SEGMENTS: 'aws.dynamodb.total_segments',\n\n /**\n * The value of the `Count` response parameter.\n */\n AWS_DYNAMODB_COUNT: 'aws.dynamodb.count',\n\n /**\n * The value of the `ScannedCount` response parameter.\n */\n AWS_DYNAMODB_SCANNED_COUNT: 'aws.dynamodb.scanned_count',\n\n /**\n * The JSON-serialized value of each item in the `AttributeDefinitions` request field.\n */\n AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS: 'aws.dynamodb.attribute_definitions',\n\n /**\n * The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` request field.\n */\n AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES:\n 'aws.dynamodb.global_secondary_index_updates',\n\n /**\n * A string identifying the messaging system.\n */\n MESSAGING_SYSTEM: 'messaging.system',\n\n /**\n * The message destination name. This might be equal to the span name but is required nevertheless.\n */\n MESSAGING_DESTINATION: 'messaging.destination',\n\n /**\n * The kind of message destination.\n */\n MESSAGING_DESTINATION_KIND: 'messaging.destination_kind',\n\n /**\n * A boolean that is true if the message destination is temporary.\n */\n MESSAGING_TEMP_DESTINATION: 'messaging.temp_destination',\n\n /**\n * The name of the transport protocol.\n */\n MESSAGING_PROTOCOL: 'messaging.protocol',\n\n /**\n * The version of the transport protocol.\n */\n MESSAGING_PROTOCOL_VERSION: 'messaging.protocol_version',\n\n /**\n * Connection string.\n */\n MESSAGING_URL: 'messaging.url',\n\n /**\n * A value used by the messaging system as an identifier for the message, represented as a string.\n */\n MESSAGING_MESSAGE_ID: 'messaging.message_id',\n\n /**\n * The [conversation ID](#conversations) identifying the conversation to which the message belongs, represented as a string. Sometimes called "Correlation ID".\n */\n MESSAGING_CONVERSATION_ID: 'messaging.conversation_id',\n\n /**\n * The (uncompressed) size of the message payload in bytes. Also use this attribute if it is unknown whether the compressed or uncompressed payload size is reported.\n */\n MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES: 'messaging.message_payload_size_bytes',\n\n /**\n * The compressed size of the message payload in bytes.\n */\n MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES:\n 'messaging.message_payload_compressed_size_bytes',\n\n /**\n * A string identifying the kind of message consumption as defined in the [Operation names](#operation-names) section above. If the operation is "send", this attribute MUST NOT be set, since the operation can be inferred from the span kind in that case.\n */\n MESSAGING_OPERATION: 'messaging.operation',\n\n /**\n * The identifier for the consumer receiving a message. For Kafka, set it to `{messaging.kafka.consumer_group} - {messaging.kafka.client_id}`, if both are present, or only `messaging.kafka.consumer_group`. For brokers, such as RabbitMQ and Artemis, set it to the `client_id` of the client consuming the message.\n */\n MESSAGING_CONSUMER_ID: 'messaging.consumer_id',\n\n /**\n * RabbitMQ message routing key.\n */\n MESSAGING_RABBITMQ_ROUTING_KEY: 'messaging.rabbitmq.routing_key',\n\n /**\n * Message keys in Kafka are used for grouping alike messages to ensure they're processed on the same partition. They differ from `messaging.message_id` in that they're not unique. If the key is `null`, the attribute MUST NOT be set.\n *\n * Note: If the key type is not string, it's string representation has to be supplied for the attribute. If the key has no unambiguous, canonical string form, don't include its value.\n */\n MESSAGING_KAFKA_MESSAGE_KEY: 'messaging.kafka.message_key',\n\n /**\n * Name of the Kafka Consumer Group that is handling the message. Only applies to consumers, not producers.\n */\n MESSAGING_KAFKA_CONSUMER_GROUP: 'messaging.kafka.consumer_group',\n\n /**\n * Client Id for the Consumer or Producer that is handling the message.\n */\n MESSAGING_KAFKA_CLIENT_ID: 'messaging.kafka.client_id',\n\n /**\n * Partition the message is sent to.\n */\n MESSAGING_KAFKA_PARTITION: 'messaging.kafka.partition',\n\n /**\n * A boolean that is true if the message is a tombstone.\n */\n MESSAGING_KAFKA_TOMBSTONE: 'messaging.kafka.tombstone',\n\n /**\n * A string identifying the remoting system.\n */\n RPC_SYSTEM: 'rpc.system',\n\n /**\n * The full (logical) name of the service being called, including its package name, if applicable.\n *\n * Note: This is the logical name of the service from the RPC interface perspective, which can be different from the name of any implementing class. The `code.namespace` attribute may be used to store the latter (despite the attribute name, it may include a class name; e.g., class with method actually executing the call on the server side, RPC client stub class on the client side).\n */\n RPC_SERVICE: 'rpc.service',\n\n /**\n * The name of the (logical) method being called, must be equal to the $method part in the span name.\n *\n * Note: This is the logical name of the method from the RPC interface perspective, which can be different from the name of any implementing method/function. The `code.function` attribute may be used to store the latter (e.g., method actually executing the call on the server side, RPC client stub method on the client side).\n */\n RPC_METHOD: 'rpc.method',\n\n /**\n * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request.\n */\n RPC_GRPC_STATUS_CODE: 'rpc.grpc.status_code',\n\n /**\n * Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 does not specify this, the value can be omitted.\n */\n RPC_JSONRPC_VERSION: 'rpc.jsonrpc.version',\n\n /**\n * `id` property of request or response. Since protocol allows id to be int, string, `null` or missing (for notifications), value is expected to be cast to string for simplicity. Use empty string in case of `null` value. Omit entirely if this is a notification.\n */\n RPC_JSONRPC_REQUEST_ID: 'rpc.jsonrpc.request_id',\n\n /**\n * `error.code` property of response if it is an error response.\n */\n RPC_JSONRPC_ERROR_CODE: 'rpc.jsonrpc.error_code',\n\n /**\n * `error.message` property of response if it is an error response.\n */\n RPC_JSONRPC_ERROR_MESSAGE: 'rpc.jsonrpc.error_message',\n\n /**\n * Whether this is a received or sent message.\n */\n MESSAGE_TYPE: 'message.type',\n\n /**\n * MUST be calculated as two different counters starting from `1` one for sent messages and one for received message.\n *\n * Note: This way we guarantee that the values will be consistent between different implementations.\n */\n MESSAGE_ID: 'message.id',\n\n /**\n * Compressed size of the message in bytes.\n */\n MESSAGE_COMPRESSED_SIZE: 'message.compressed_size',\n\n /**\n * Uncompressed size of the message in bytes.\n */\n MESSAGE_UNCOMPRESSED_SIZE: 'message.uncompressed_size',\n};\n\nexport const DbSystemValues = {\n /** Some other SQL database. Fallback only. See notes. */\n OTHER_SQL: 'other_sql',\n /** Microsoft SQL Server. */\n MSSQL: 'mssql',\n /** MySQL. */\n MYSQL: 'mysql',\n /** Oracle Database. */\n ORACLE: 'oracle',\n /** IBM Db2. */\n DB2: 'db2',\n /** PostgreSQL. */\n POSTGRESQL: 'postgresql',\n /** Amazon Redshift. */\n REDSHIFT: 'redshift',\n /** Apache Hive. */\n HIVE: 'hive',\n /** Cloudscape. */\n CLOUDSCAPE: 'cloudscape',\n /** HyperSQL DataBase. */\n HSQLDB: 'hsqldb',\n /** Progress Database. */\n PROGRESS: 'progress',\n /** SAP MaxDB. */\n MAXDB: 'maxdb',\n /** SAP HANA. */\n HANADB: 'hanadb',\n /** Ingres. */\n INGRES: 'ingres',\n /** FirstSQL. */\n FIRSTSQL: 'firstsql',\n /** EnterpriseDB. */\n EDB: 'edb',\n /** InterSystems Caché. */\n CACHE: 'cache',\n /** Adabas (Adaptable Database System). */\n ADABAS: 'adabas',\n /** Firebird. */\n FIREBIRD: 'firebird',\n /** Apache Derby. */\n DERBY: 'derby',\n /** FileMaker. */\n FILEMAKER: 'filemaker',\n /** Informix. */\n INFORMIX: 'informix',\n /** InstantDB. */\n INSTANTDB: 'instantdb',\n /** InterBase. */\n INTERBASE: 'interbase',\n /** MariaDB. */\n MARIADB: 'mariadb',\n /** Netezza. */\n NETEZZA: 'netezza',\n /** Pervasive PSQL. */\n PERVASIVE: 'pervasive',\n /** PointBase. */\n POINTBASE: 'pointbase',\n /** SQLite. */\n SQLITE: 'sqlite',\n /** Sybase. */\n SYBASE: 'sybase',\n /** Teradata. */\n TERADATA: 'teradata',\n /** Vertica. */\n VERTICA: 'vertica',\n /** H2. */\n H2: 'h2',\n /** ColdFusion IMQ. */\n COLDFUSION: 'coldfusion',\n /** Apache Cassandra. */\n CASSANDRA: 'cassandra',\n /** Apache HBase. */\n HBASE: 'hbase',\n /** MongoDB. */\n MONGODB: 'mongodb',\n /** Redis. */\n REDIS: 'redis',\n /** Couchbase. */\n COUCHBASE: 'couchbase',\n /** CouchDB. */\n COUCHDB: 'couchdb',\n /** Microsoft Azure Cosmos DB. */\n COSMOSDB: 'cosmosdb',\n /** Amazon DynamoDB. */\n DYNAMODB: 'dynamodb',\n /** Neo4j. */\n NEO4J: 'neo4j',\n /** Apache Geode. */\n GEODE: 'geode',\n /** Elasticsearch. */\n ELASTICSEARCH: 'elasticsearch',\n /** Memcached. */\n MEMCACHED: 'memcached',\n /** CockroachDB. */\n COCKROACHDB: 'cockroachdb',\n} as const;\nexport type DbSystemValues =\n (typeof DbSystemValues)[keyof typeof DbSystemValues];\n\nexport const DbCassandraConsistencyLevelValues = {\n /** all. */\n ALL: 'all',\n /** each_quorum. */\n EACH_QUORUM: 'each_quorum',\n /** quorum. */\n QUORUM: 'quorum',\n /** local_quorum. */\n LOCAL_QUORUM: 'local_quorum',\n /** one. */\n ONE: 'one',\n /** two. */\n TWO: 'two',\n /** three. */\n THREE: 'three',\n /** local_one. */\n LOCAL_ONE: 'local_one',\n /** any. */\n ANY: 'any',\n /** serial. */\n SERIAL: 'serial',\n /** local_serial. */\n LOCAL_SERIAL: 'local_serial',\n} as const;\nexport type DbCassandraConsistencyLevelValues =\n (typeof DbCassandraConsistencyLevelValues)[keyof typeof DbCassandraConsistencyLevelValues];\n\nexport const FaasTriggerValues = {\n /** A response to some data source operation such as a database or filesystem read/write. */\n DATASOURCE: 'datasource',\n /** To provide an answer to an inbound HTTP request. */\n HTTP: 'http',\n /** A function is set to be executed when messages are sent to a messaging system. */\n PUBSUB: 'pubsub',\n /** A function is scheduled to be executed regularly. */\n TIMER: 'timer',\n /** If none of the others apply. */\n OTHER: 'other',\n} as const;\nexport type FaasTriggerValues =\n (typeof FaasTriggerValues)[keyof typeof FaasTriggerValues];\n\nexport const FaasDocumentOperationValues = {\n /** When a new object is created. */\n INSERT: 'insert',\n /** When an object is modified. */\n EDIT: 'edit',\n /** When an object is deleted. */\n DELETE: 'delete',\n} as const;\nexport type FaasDocumentOperationValues =\n (typeof FaasDocumentOperationValues)[keyof typeof FaasDocumentOperationValues];\n\nexport const FaasInvokedProviderValues = {\n /** Alibaba Cloud. */\n ALIBABA_CLOUD: 'alibaba_cloud',\n /** Amazon Web Services. */\n AWS: 'aws',\n /** Microsoft Azure. */\n AZURE: 'azure',\n /** Google Cloud Platform. */\n GCP: 'gcp',\n} as const;\nexport type FaasInvokedProviderValues =\n (typeof FaasInvokedProviderValues)[keyof typeof FaasInvokedProviderValues];\n\nexport const NetTransportValues = {\n /** ip_tcp. */\n IP_TCP: 'ip_tcp',\n /** ip_udp. */\n IP_UDP: 'ip_udp',\n /** Another IP-based protocol. */\n IP: 'ip',\n /** Unix Domain socket. See below. */\n UNIX: 'unix',\n /** Named or anonymous pipe. See note below. */\n PIPE: 'pipe',\n /** In-process communication. */\n INPROC: 'inproc',\n /** Something else (non IP-based). */\n OTHER: 'other',\n} as const;\nexport type NetTransportValues =\n (typeof NetTransportValues)[keyof typeof NetTransportValues];\n\nexport const NetHostConnectionTypeValues = {\n /** wifi. */\n WIFI: 'wifi',\n /** wired. */\n WIRED: 'wired',\n /** cell. */\n CELL: 'cell',\n /** unavailable. */\n UNAVAILABLE: 'unavailable',\n /** unknown. */\n UNKNOWN: 'unknown',\n} as const;\nexport type NetHostConnectionTypeValues =\n (typeof NetHostConnectionTypeValues)[keyof typeof NetHostConnectionTypeValues];\n\nexport const NetHostConnectionSubtypeValues = {\n /** GPRS. */\n GPRS: 'gprs',\n /** EDGE. */\n EDGE: 'edge',\n /** UMTS. */\n UMTS: 'umts',\n /** CDMA. */\n CDMA: 'cdma',\n /** EVDO Rel. 0. */\n EVDO_0: 'evdo_0',\n /** EVDO Rev. A. */\n EVDO_A: 'evdo_a',\n /** CDMA2000 1XRTT. */\n CDMA2000_1XRTT: 'cdma2000_1xrtt',\n /** HSDPA. */\n HSDPA: 'hsdpa',\n /** HSUPA. */\n HSUPA: 'hsupa',\n /** HSPA. */\n HSPA: 'hspa',\n /** IDEN. */\n IDEN: 'iden',\n /** EVDO Rev. B. */\n EVDO_B: 'evdo_b',\n /** LTE. */\n LTE: 'lte',\n /** EHRPD. */\n EHRPD: 'ehrpd',\n /** HSPAP. */\n HSPAP: 'hspap',\n /** GSM. */\n GSM: 'gsm',\n /** TD-SCDMA. */\n TD_SCDMA: 'td_scdma',\n /** IWLAN. */\n IWLAN: 'iwlan',\n /** 5G NR (New Radio). */\n NR: 'nr',\n /** 5G NRNSA (New Radio Non-Standalone). */\n NRNSA: 'nrnsa',\n /** LTE CA. */\n LTE_CA: 'lte_ca',\n} as const;\nexport type NetHostConnectionSubtypeValues =\n (typeof NetHostConnectionSubtypeValues)[keyof typeof NetHostConnectionSubtypeValues];\n\nexport const HttpFlavorValues = {\n /** HTTP 1.0. */\n HTTP_1_0: '1.0',\n /** HTTP 1.1. */\n HTTP_1_1: '1.1',\n /** HTTP 2. */\n HTTP_2_0: '2.0',\n /** SPDY protocol. */\n SPDY: 'SPDY',\n /** QUIC protocol. */\n QUIC: 'QUIC',\n} as const;\nexport type HttpFlavorValues =\n (typeof HttpFlavorValues)[keyof typeof HttpFlavorValues];\n\nexport const MessagingDestinationKindValues = {\n /** A message sent to a queue. */\n QUEUE: 'queue',\n /** A message sent to a topic. */\n TOPIC: 'topic',\n} as const;\nexport type MessagingDestinationKindValues =\n (typeof MessagingDestinationKindValues)[keyof typeof MessagingDestinationKindValues];\n\nexport const MessagingOperationValues = {\n /** receive. */\n RECEIVE: 'receive',\n /** process. */\n PROCESS: 'process',\n} as const;\nexport type MessagingOperationValues =\n (typeof MessagingOperationValues)[keyof typeof MessagingOperationValues];\n\nexport const RpcGrpcStatusCodeValues = {\n /** OK. */\n OK: 0,\n /** CANCELLED. */\n CANCELLED: 1,\n /** UNKNOWN. */\n UNKNOWN: 2,\n /** INVALID_ARGUMENT. */\n INVALID_ARGUMENT: 3,\n /** DEADLINE_EXCEEDED. */\n DEADLINE_EXCEEDED: 4,\n /** NOT_FOUND. */\n NOT_FOUND: 5,\n /** ALREADY_EXISTS. */\n ALREADY_EXISTS: 6,\n /** PERMISSION_DENIED. */\n PERMISSION_DENIED: 7,\n /** RESOURCE_EXHAUSTED. */\n RESOURCE_EXHAUSTED: 8,\n /** FAILED_PRECONDITION. */\n FAILED_PRECONDITION: 9,\n /** ABORTED. */\n ABORTED: 10,\n /** OUT_OF_RANGE. */\n OUT_OF_RANGE: 11,\n /** UNIMPLEMENTED. */\n UNIMPLEMENTED: 12,\n /** INTERNAL. */\n INTERNAL: 13,\n /** UNAVAILABLE. */\n UNAVAILABLE: 14,\n /** DATA_LOSS. */\n DATA_LOSS: 15,\n /** UNAUTHENTICATED. */\n UNAUTHENTICATED: 16,\n} as const;\nexport type RpcGrpcStatusCodeValues =\n (typeof RpcGrpcStatusCodeValues)[keyof typeof RpcGrpcStatusCodeValues];\n\nexport const MessageTypeValues = {\n /** sent. */\n SENT: 'SENT',\n /** received. */\n RECEIVED: 'RECEIVED',\n} as const;\nexport type MessageTypeValues =\n (typeof MessageTypeValues)[keyof typeof MessageTypeValues];\n", "/*\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 */\nexport * from './SemanticAttributes';\n", "/*\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// DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates//templates/SemanticAttributes.ts.j2\nexport const SemanticResourceAttributes = {\n /**\n * Name of the cloud provider.\n */\n CLOUD_PROVIDER: 'cloud.provider',\n\n /**\n * The cloud account ID the resource is assigned to.\n */\n CLOUD_ACCOUNT_ID: 'cloud.account.id',\n\n /**\n * The geographical region the resource is running. Refer to your provider's docs to see the available regions, for example [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), or [Google Cloud regions](https://cloud.google.com/about/locations).\n */\n CLOUD_REGION: 'cloud.region',\n\n /**\n * Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running.\n *\n * Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud.\n */\n CLOUD_AVAILABILITY_ZONE: 'cloud.availability_zone',\n\n /**\n * The cloud platform in use.\n *\n * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`.\n */\n CLOUD_PLATFORM: 'cloud.platform',\n\n /**\n * The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html).\n */\n AWS_ECS_CONTAINER_ARN: 'aws.ecs.container.arn',\n\n /**\n * The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html).\n */\n AWS_ECS_CLUSTER_ARN: 'aws.ecs.cluster.arn',\n\n /**\n * The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) for an ECS task.\n */\n AWS_ECS_LAUNCHTYPE: 'aws.ecs.launchtype',\n\n /**\n * The ARN of an [ECS task definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html).\n */\n AWS_ECS_TASK_ARN: 'aws.ecs.task.arn',\n\n /**\n * The task definition family this task definition is a member of.\n */\n AWS_ECS_TASK_FAMILY: 'aws.ecs.task.family',\n\n /**\n * The revision for this task definition.\n */\n AWS_ECS_TASK_REVISION: 'aws.ecs.task.revision',\n\n /**\n * The ARN of an EKS cluster.\n */\n AWS_EKS_CLUSTER_ARN: 'aws.eks.cluster.arn',\n\n /**\n * The name(s) of the AWS log group(s) an application is writing to.\n *\n * Note: Multiple log groups must be supported for cases like multi-container applications, where a single application has sidecar containers, and each write to their own log group.\n */\n AWS_LOG_GROUP_NAMES: 'aws.log.group.names',\n\n /**\n * The Amazon Resource Name(s) (ARN) of the AWS log group(s).\n *\n * Note: See the [log group ARN format documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format).\n */\n AWS_LOG_GROUP_ARNS: 'aws.log.group.arns',\n\n /**\n * The name(s) of the AWS log stream(s) an application is writing to.\n */\n AWS_LOG_STREAM_NAMES: 'aws.log.stream.names',\n\n /**\n * The ARN(s) of the AWS log stream(s).\n *\n * Note: See the [log stream ARN format documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain several log streams, so these ARNs necessarily identify both a log group and a log stream.\n */\n AWS_LOG_STREAM_ARNS: 'aws.log.stream.arns',\n\n /**\n * Container name.\n */\n CONTAINER_NAME: 'container.name',\n\n /**\n * Container ID. Usually a UUID, as for example used to [identify Docker containers](https://docs.docker.com/engine/reference/run/#container-identification). The UUID might be abbreviated.\n */\n CONTAINER_ID: 'container.id',\n\n /**\n * The container runtime managing this container.\n */\n CONTAINER_RUNTIME: 'container.runtime',\n\n /**\n * Name of the image the container was built on.\n */\n CONTAINER_IMAGE_NAME: 'container.image.name',\n\n /**\n * Container image tag.\n */\n CONTAINER_IMAGE_TAG: 'container.image.tag',\n\n /**\n * Name of the [deployment environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka deployment tier).\n */\n DEPLOYMENT_ENVIRONMENT: 'deployment.environment',\n\n /**\n * A unique identifier representing the device.\n *\n * Note: The device identifier MUST only be defined using the values outlined below. This value is not an advertising identifier and MUST NOT be used as such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the Firebase Installation ID or a globally unique UUID which is persisted across sessions in your application. More information can be found [here](https://developer.android.com/training/articles/user-data-ids) on best practices and exact implementation details. Caution should be taken when storing personal data or anything which can identify a user. GDPR and data protection laws may apply, ensure you do your own due diligence.\n */\n DEVICE_ID: 'device.id',\n\n /**\n * The model identifier for the device.\n *\n * Note: It's recommended this value represents a machine readable version of the model identifier rather than the market or consumer-friendly name of the device.\n */\n DEVICE_MODEL_IDENTIFIER: 'device.model.identifier',\n\n /**\n * The marketing name for the device model.\n *\n * Note: It's recommended this value represents a human readable version of the device model rather than a machine readable alternative.\n */\n DEVICE_MODEL_NAME: 'device.model.name',\n\n /**\n * The name of the single function that this runtime instance executes.\n *\n * Note: This is the name of the function as configured/deployed on the FaaS platform and is usually different from the name of the callback function (which may be stored in the [`code.namespace`/`code.function`](../../trace/semantic_conventions/span-general.md#source-code-attributes) span attributes).\n */\n FAAS_NAME: 'faas.name',\n\n /**\n * The unique ID of the single function that this runtime instance executes.\n *\n * Note: Depending on the cloud provider, use:\n\n* **AWS Lambda:** The function [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html).\nTake care not to use the "invoked ARN" directly but replace any\n[alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) with the resolved function version, as the same runtime instance may be invokable with multiple\ndifferent aliases.\n* **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full-resource-names)\n* **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id).\n\nOn some providers, it may not be possible to determine the full ID at startup,\nwhich is why this field cannot be made required. For example, on AWS the account ID\npart of the ARN is not available without calling another AWS API\nwhich may be deemed too slow for a short-running lambda function.\nAs an alternative, consider setting `faas.id` as a span attribute instead.\n */\n FAAS_ID: 'faas.id',\n\n /**\n * The immutable version of the function being executed.\n *\n * Note: Depending on the cloud provider and platform, use:\n\n* **AWS Lambda:** The [function version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html)\n (an integer represented as a decimal string).\n* **Google Cloud Run:** The [revision](https://cloud.google.com/run/docs/managing/revisions)\n (i.e., the function name plus the revision suffix).\n* **Google Cloud Functions:** The value of the\n [`K_REVISION` environment variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically).\n* **Azure Functions:** Not applicable. Do not set this attribute.\n */\n FAAS_VERSION: 'faas.version',\n\n /**\n * The execution environment ID as a string, that will be potentially reused for other invocations to the same function/function version.\n *\n * Note: * **AWS Lambda:** Use the (full) log stream name.\n */\n FAAS_INSTANCE: 'faas.instance',\n\n /**\n * The amount of memory available to the serverless function in MiB.\n *\n * Note: It's recommended to set this attribute since e.g. too little memory can easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information.\n */\n FAAS_MAX_MEMORY: 'faas.max_memory',\n\n /**\n * Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider.\n */\n HOST_ID: 'host.id',\n\n /**\n * Name of the host. On Unix systems, it may contain what the hostname command returns, or the fully qualified hostname, or another name specified by the user.\n */\n HOST_NAME: 'host.name',\n\n /**\n * Type of host. For Cloud, this must be the machine type.\n */\n HOST_TYPE: 'host.type',\n\n /**\n * The CPU architecture the host system is running on.\n */\n HOST_ARCH: 'host.arch',\n\n /**\n * Name of the VM image or OS install the host was instantiated from.\n */\n HOST_IMAGE_NAME: 'host.image.name',\n\n /**\n * VM image ID. For Cloud, this value is from the provider.\n */\n HOST_IMAGE_ID: 'host.image.id',\n\n /**\n * The version string of the VM image as defined in [Version SpanAttributes](README.md#version-attributes).\n */\n HOST_IMAGE_VERSION: 'host.image.version',\n\n /**\n * The name of the cluster.\n */\n K8S_CLUSTER_NAME: 'k8s.cluster.name',\n\n /**\n * The name of the Node.\n */\n K8S_NODE_NAME: 'k8s.node.name',\n\n /**\n * The UID of the Node.\n */\n K8S_NODE_UID: 'k8s.node.uid',\n\n /**\n * The name of the namespace that the pod is running in.\n */\n K8S_NAMESPACE_NAME: 'k8s.namespace.name',\n\n /**\n * The UID of the Pod.\n */\n K8S_POD_UID: 'k8s.pod.uid',\n\n /**\n * The name of the Pod.\n */\n K8S_POD_NAME: 'k8s.pod.name',\n\n /**\n * The name of the Container in a Pod template.\n */\n K8S_CONTAINER_NAME: 'k8s.container.name',\n\n /**\n * The UID of the ReplicaSet.\n */\n K8S_REPLICASET_UID: 'k8s.replicaset.uid',\n\n /**\n * The name of the ReplicaSet.\n */\n K8S_REPLICASET_NAME: 'k8s.replicaset.name',\n\n /**\n * The UID of the Deployment.\n */\n K8S_DEPLOYMENT_UID: 'k8s.deployment.uid',\n\n /**\n * The name of the Deployment.\n */\n K8S_DEPLOYMENT_NAME: 'k8s.deployment.name',\n\n /**\n * The UID of the StatefulSet.\n */\n K8S_STATEFULSET_UID: 'k8s.statefulset.uid',\n\n /**\n * The name of the StatefulSet.\n */\n K8S_STATEFULSET_NAME: 'k8s.statefulset.name',\n\n /**\n * The UID of the DaemonSet.\n */\n K8S_DAEMONSET_UID: 'k8s.daemonset.uid',\n\n /**\n * The name of the DaemonSet.\n */\n K8S_DAEMONSET_NAME: 'k8s.daemonset.name',\n\n /**\n * The UID of the Job.\n */\n K8S_JOB_UID: 'k8s.job.uid',\n\n /**\n * The name of the Job.\n */\n K8S_JOB_NAME: 'k8s.job.name',\n\n /**\n * The UID of the CronJob.\n */\n K8S_CRONJOB_UID: 'k8s.cronjob.uid',\n\n /**\n * The name of the CronJob.\n */\n K8S_CRONJOB_NAME: 'k8s.cronjob.name',\n\n /**\n * The operating system type.\n */\n OS_TYPE: 'os.type',\n\n /**\n * Human readable (not intended to be parsed) OS version information, like e.g. reported by `ver` or `lsb_release -a` commands.\n */\n OS_DESCRIPTION: 'os.description',\n\n /**\n * Human readable operating system name.\n */\n OS_NAME: 'os.name',\n\n /**\n * The version string of the operating system as defined in [Version SpanAttributes](../../resource/semantic_conventions/README.md#version-attributes).\n */\n OS_VERSION: 'os.version',\n\n /**\n * Process identifier (PID).\n */\n PROCESS_PID: 'process.pid',\n\n /**\n * The name of the process executable. On Linux based systems, can be set to the `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of `GetProcessImageFileNameW`.\n */\n PROCESS_EXECUTABLE_NAME: 'process.executable.name',\n\n /**\n * The full path to the process executable. On Linux based systems, can be set to the target of `proc/[pid]/exe`. On Windows, can be set to the result of `GetProcessImageFileNameW`.\n */\n PROCESS_EXECUTABLE_PATH: 'process.executable.path',\n\n /**\n * The command used to launch the process (i.e. the command name). On Linux based systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to the first parameter extracted from `GetCommandLineW`.\n */\n PROCESS_COMMAND: 'process.command',\n\n /**\n * The full command used to launch the process as a single string representing the full command. On Windows, can be set to the result of `GetCommandLineW`. Do not set this if you have to assemble it just for monitoring; use `process.command_args` instead.\n */\n PROCESS_COMMAND_LINE: 'process.command_line',\n\n /**\n * All the command arguments (including the command/executable itself) as received by the process. On Linux-based systems (and some other Unixoid systems supporting procfs), can be set according to the list of null-delimited strings extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be the full argv vector passed to `main`.\n */\n PROCESS_COMMAND_ARGS: 'process.command_args',\n\n /**\n * The username of the user that owns the process.\n */\n PROCESS_OWNER: 'process.owner',\n\n /**\n * The name of the runtime of this process. For compiled native binaries, this SHOULD be the name of the compiler.\n */\n PROCESS_RUNTIME_NAME: 'process.runtime.name',\n\n /**\n * The version of the runtime of this process, as returned by the runtime without modification.\n */\n PROCESS_RUNTIME_VERSION: 'process.runtime.version',\n\n /**\n * An additional description about the runtime of the process, for example a specific vendor customization of the runtime environment.\n */\n PROCESS_RUNTIME_DESCRIPTION: 'process.runtime.description',\n\n /**\n * Logical name of the service.\n *\n * Note: MUST be the same for all instances of horizontally scaled services. If the value was not specified, SDKs MUST fallback to `unknown_service:` concatenated with [`process.executable.name`](process.md#process), e.g. `unknown_service:bash`. If `process.executable.name` is not available, the value MUST be set to `unknown_service`.\n */\n SERVICE_NAME: 'service.name',\n\n /**\n * A namespace for `service.name`.\n *\n * Note: A string value having a meaning that helps to distinguish a group of services, for example the team name that owns a group of services. `service.name` is expected to be unique within the same namespace. If `service.namespace` is not specified in the Resource then `service.name` is expected to be unique for all services that have no explicit namespace defined (so the empty/unspecified namespace is simply one more valid namespace). Zero-length namespace string is assumed equal to unspecified namespace.\n */\n SERVICE_NAMESPACE: 'service.namespace',\n\n /**\n * The string ID of the service instance.\n *\n * Note: MUST be unique for each instance of the same `service.namespace,service.name` pair (in other words `service.namespace,service.name,service.instance.id` triplet MUST be globally unique). The ID helps to distinguish instances of the same service that exist at the same time (e.g. instances of a horizontally scaled service). It is preferable for the ID to be persistent and stay the same for the lifetime of the service instance, however it is acceptable that the ID is ephemeral and changes during important lifetime events for the service (e.g. service restarts). If the service has no inherent unique ID that can be used as the value of this attribute it is recommended to generate a random Version 1 or Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use Version 5, see RFC 4122 for more recommendations).\n */\n SERVICE_INSTANCE_ID: 'service.instance.id',\n\n /**\n * The version string of the service API or implementation.\n */\n SERVICE_VERSION: 'service.version',\n\n /**\n * The name of the telemetry SDK as defined above.\n */\n TELEMETRY_SDK_NAME: 'telemetry.sdk.name',\n\n /**\n * The language of the telemetry SDK.\n */\n TELEMETRY_SDK_LANGUAGE: 'telemetry.sdk.language',\n\n /**\n * The version string of the telemetry SDK.\n */\n TELEMETRY_SDK_VERSION: 'telemetry.sdk.version',\n\n /**\n * The version string of the auto instrumentation agent, if used.\n */\n TELEMETRY_AUTO_VERSION: 'telemetry.auto.version',\n\n /**\n * The name of the web engine.\n */\n WEBENGINE_NAME: 'webengine.name',\n\n /**\n * The version of the web engine.\n */\n WEBENGINE_VERSION: 'webengine.version',\n\n /**\n * Additional description of the web engine (e.g. detailed version and edition information).\n */\n WEBENGINE_DESCRIPTION: 'webengine.description',\n};\n\nexport const CloudProviderValues = {\n /** Alibaba Cloud. */\n ALIBABA_CLOUD: 'alibaba_cloud',\n /** Amazon Web Services. */\n AWS: 'aws',\n /** Microsoft Azure. */\n AZURE: 'azure',\n /** Google Cloud Platform. */\n GCP: 'gcp',\n} as const;\nexport type CloudProviderValues =\n (typeof CloudProviderValues)[keyof typeof CloudProviderValues];\n\nexport const CloudPlatformValues = {\n /** Alibaba Cloud Elastic Compute Service. */\n ALIBABA_CLOUD_ECS: 'alibaba_cloud_ecs',\n /** Alibaba Cloud Function Compute. */\n ALIBABA_CLOUD_FC: 'alibaba_cloud_fc',\n /** AWS Elastic Compute Cloud. */\n AWS_EC2: 'aws_ec2',\n /** AWS Elastic Container Service. */\n AWS_ECS: 'aws_ecs',\n /** AWS Elastic Kubernetes Service. */\n AWS_EKS: 'aws_eks',\n /** AWS Lambda. */\n AWS_LAMBDA: 'aws_lambda',\n /** AWS Elastic Beanstalk. */\n AWS_ELASTIC_BEANSTALK: 'aws_elastic_beanstalk',\n /** Azure Virtual Machines. */\n AZURE_VM: 'azure_vm',\n /** Azure Container Instances. */\n AZURE_CONTAINER_INSTANCES: 'azure_container_instances',\n /** Azure Kubernetes Service. */\n AZURE_AKS: 'azure_aks',\n /** Azure Functions. */\n AZURE_FUNCTIONS: 'azure_functions',\n /** Azure App Service. */\n AZURE_APP_SERVICE: 'azure_app_service',\n /** Google Cloud Compute Engine (GCE). */\n GCP_COMPUTE_ENGINE: 'gcp_compute_engine',\n /** Google Cloud Run. */\n GCP_CLOUD_RUN: 'gcp_cloud_run',\n /** Google Cloud Kubernetes Engine (GKE). */\n GCP_KUBERNETES_ENGINE: 'gcp_kubernetes_engine',\n /** Google Cloud Functions (GCF). */\n GCP_CLOUD_FUNCTIONS: 'gcp_cloud_functions',\n /** Google Cloud App Engine (GAE). */\n GCP_APP_ENGINE: 'gcp_app_engine',\n} as const;\nexport type CloudPlatformValues =\n (typeof CloudPlatformValues)[keyof typeof CloudPlatformValues];\n\nexport const AwsEcsLaunchtypeValues = {\n /** ec2. */\n EC2: 'ec2',\n /** fargate. */\n FARGATE: 'fargate',\n} as const;\nexport type AwsEcsLaunchtypeValues =\n (typeof AwsEcsLaunchtypeValues)[keyof typeof AwsEcsLaunchtypeValues];\n\nexport const HostArchValues = {\n /** AMD64. */\n AMD64: 'amd64',\n /** ARM32. */\n ARM32: 'arm32',\n /** ARM64. */\n ARM64: 'arm64',\n /** Itanium. */\n IA64: 'ia64',\n /** 32-bit PowerPC. */\n PPC32: 'ppc32',\n /** 64-bit PowerPC. */\n PPC64: 'ppc64',\n /** 32-bit x86. */\n X86: 'x86',\n} as const;\nexport type HostArchValues =\n (typeof HostArchValues)[keyof typeof HostArchValues];\n\nexport const OsTypeValues = {\n /** Microsoft Windows. */\n WINDOWS: 'windows',\n /** Linux. */\n LINUX: 'linux',\n /** Apple Darwin. */\n DARWIN: 'darwin',\n /** FreeBSD. */\n FREEBSD: 'freebsd',\n /** NetBSD. */\n NETBSD: 'netbsd',\n /** OpenBSD. */\n OPENBSD: 'openbsd',\n /** DragonFly BSD. */\n DRAGONFLYBSD: 'dragonflybsd',\n /** HP-UX (Hewlett Packard Unix). */\n HPUX: 'hpux',\n /** AIX (Advanced Interactive eXecutive). */\n AIX: 'aix',\n /** Oracle Solaris. */\n SOLARIS: 'solaris',\n /** IBM z/OS. */\n Z_OS: 'z_os',\n} as const;\nexport type OsTypeValues = (typeof OsTypeValues)[keyof typeof OsTypeValues];\n\nexport const TelemetrySdkLanguageValues = {\n /** cpp. */\n CPP: 'cpp',\n /** dotnet. */\n DOTNET: 'dotnet',\n /** erlang. */\n ERLANG: 'erlang',\n /** go. */\n GO: 'go',\n /** java. */\n JAVA: 'java',\n /** nodejs. */\n NODEJS: 'nodejs',\n /** php. */\n PHP: 'php',\n /** python. */\n PYTHON: 'python',\n /** ruby. */\n RUBY: 'ruby',\n /** webjs. */\n WEBJS: 'webjs',\n} as const;\nexport type TelemetrySdkLanguageValues =\n (typeof TelemetrySdkLanguageValues)[keyof typeof TelemetrySdkLanguageValues];\n", "/*\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 */\nexport * from './SemanticResourceAttributes';\n", "/*\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\nexport * from './trace';\nexport * from './resource';\n", "/*\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 { VERSION } from '../../version';\nimport {\n TelemetrySdkLanguageValues,\n SemanticResourceAttributes,\n} from '@opentelemetry/semantic-conventions';\n\n/** Constants describing the SDK in use */\nexport const SDK_INFO = {\n [SemanticResourceAttributes.TELEMETRY_SDK_NAME]: 'opentelemetry',\n [SemanticResourceAttributes.PROCESS_RUNTIME_NAME]: 'browser',\n [SemanticResourceAttributes.TELEMETRY_SDK_LANGUAGE]:\n TelemetrySdkLanguageValues.WEBJS,\n [SemanticResourceAttributes.TELEMETRY_SDK_VERSION]: VERSION,\n};\n", "/*\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 */\nexport function unrefTimer(_timer: number): void {}\n", "/*\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\nexport * from './environment';\nexport * from './globalThis';\nexport * from './hex-to-base64';\nexport * from './RandomIdGenerator';\nexport * from './performance';\nexport * from './sdk-info';\nexport * from './timer-util';\n", "/*\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 * as api from '@opentelemetry/api';\nimport { otperformance as performance } from '../platform';\nimport { TimeOriginLegacy } from './types';\n\nconst NANOSECOND_DIGITS = 9;\nconst NANOSECOND_DIGITS_IN_MILLIS = 6;\nconst MILLISECONDS_TO_NANOSECONDS = Math.pow(10, NANOSECOND_DIGITS_IN_MILLIS);\nconst SECOND_TO_NANOSECONDS = Math.pow(10, NANOSECOND_DIGITS);\n\n/**\n * Converts a number of milliseconds from epoch to HrTime([seconds, remainder in nanoseconds]).\n * @param epochMillis\n */\nexport function millisToHrTime(epochMillis: number): api.HrTime {\n const epochSeconds = epochMillis / 1000;\n // Decimals only.\n const seconds = Math.trunc(epochSeconds);\n // Round sub-nanosecond accuracy to nanosecond.\n const nanos = Math.round((epochMillis % 1000) * MILLISECONDS_TO_NANOSECONDS);\n return [seconds, nanos];\n}\n\nexport function getTimeOrigin(): number {\n let timeOrigin = performance.timeOrigin;\n if (typeof timeOrigin !== 'number') {\n const perf: TimeOriginLegacy = performance as unknown as TimeOriginLegacy;\n timeOrigin = perf.timing && perf.timing.fetchStart;\n }\n return timeOrigin;\n}\n\n/**\n * Returns an hrtime calculated via performance component.\n * @param performanceNow\n */\nexport function hrTime(performanceNow?: number): api.HrTime {\n const timeOrigin = millisToHrTime(getTimeOrigin());\n const now = millisToHrTime(\n typeof performanceNow === 'number' ? performanceNow : performance.now()\n );\n\n return addHrTimes(timeOrigin, now);\n}\n\n/**\n *\n * Converts a TimeInput to an HrTime, defaults to _hrtime().\n * @param time\n */\nexport function timeInputToHrTime(time: api.TimeInput): api.HrTime {\n // process.hrtime\n if (isTimeInputHrTime(time)) {\n return time as api.HrTime;\n } else if (typeof time === 'number') {\n // Must be a performance.now() if it's smaller than process start time.\n if (time < getTimeOrigin()) {\n return hrTime(time);\n } else {\n // epoch milliseconds or performance.timeOrigin\n return millisToHrTime(time);\n }\n } else if (time instanceof Date) {\n return millisToHrTime(time.getTime());\n } else {\n throw TypeError('Invalid input type');\n }\n}\n\n/**\n * Returns a duration of two hrTime.\n * @param startTime\n * @param endTime\n */\nexport function hrTimeDuration(\n startTime: api.HrTime,\n endTime: api.HrTime\n): api.HrTime {\n let seconds = endTime[0] - startTime[0];\n let nanos = endTime[1] - startTime[1];\n\n // overflow\n if (nanos < 0) {\n seconds -= 1;\n // negate\n nanos += SECOND_TO_NANOSECONDS;\n }\n\n return [seconds, nanos];\n}\n\n/**\n * Convert hrTime to timestamp, for example \"2019-05-14T17:00:00.000123456Z\"\n * @param time\n */\nexport function hrTimeToTimeStamp(time: api.HrTime): string {\n const precision = NANOSECOND_DIGITS;\n const tmp = `${'0'.repeat(precision)}${time[1]}Z`;\n const nanoString = tmp.substr(tmp.length - precision - 1);\n const date = new Date(time[0] * 1000).toISOString();\n return date.replace('000Z', nanoString);\n}\n\n/**\n * Convert hrTime to nanoseconds.\n * @param time\n */\nexport function hrTimeToNanoseconds(time: api.HrTime): number {\n return time[0] * SECOND_TO_NANOSECONDS + time[1];\n}\n\n/**\n * Convert hrTime to milliseconds.\n * @param time\n */\nexport function hrTimeToMilliseconds(time: api.HrTime): number {\n return time[0] * 1e3 + time[1] / 1e6;\n}\n\n/**\n * Convert hrTime to microseconds.\n * @param time\n */\nexport function hrTimeToMicroseconds(time: api.HrTime): number {\n return time[0] * 1e6 + time[1] / 1e3;\n}\n\n/**\n * check if time is HrTime\n * @param value\n */\nexport function isTimeInputHrTime(value: unknown): value is api.HrTime {\n return (\n Array.isArray(value) &&\n value.length === 2 &&\n typeof value[0] === 'number' &&\n typeof value[1] === 'number'\n );\n}\n\n/**\n * check if input value is a correct types.TimeInput\n * @param value\n */\nexport function isTimeInput(\n value: unknown\n): value is api.HrTime | number | Date {\n return (\n isTimeInputHrTime(value) ||\n typeof value === 'number' ||\n value instanceof Date\n );\n}\n\n/**\n * Given 2 HrTime formatted times, return their sum as an HrTime.\n */\nexport function addHrTimes(time1: api.HrTime, time2: api.HrTime): api.HrTime {\n const out = [time1[0] + time2[0], time1[1] + time2[1]] as api.HrTime;\n\n // Nanoseconds\n if (out[1] >= SECOND_TO_NANOSECONDS) {\n out[1] -= SECOND_TO_NANOSECONDS;\n out[0] += 1;\n }\n\n return out;\n}\n", "/*\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\nexport interface ExportResult {\n code: ExportResultCode;\n error?: Error;\n}\n\nexport enum ExportResultCode {\n SUCCESS,\n FAILED,\n}\n", "/*\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 {\n Context,\n TextMapGetter,\n TextMapPropagator,\n diag,\n TextMapSetter,\n} from '@opentelemetry/api';\n\n/** Configuration object for composite propagator */\nexport interface CompositePropagatorConfig {\n /**\n * List of propagators to run. Propagators run in the\n * list order. If a propagator later in the list writes the same context\n * key as a propagator earlier in the list, the later on will \"win\".\n */\n propagators?: TextMapPropagator[];\n}\n\n/** Combines multiple propagators into a single propagator. */\nexport class CompositePropagator implements TextMapPropagator {\n private readonly _propagators: TextMapPropagator[];\n private readonly _fields: string[];\n\n /**\n * Construct a composite propagator from a list of propagators.\n *\n * @param [config] Configuration object for composite propagator\n */\n constructor(config: CompositePropagatorConfig = {}) {\n this._propagators = config.propagators ?? [];\n\n this._fields = Array.from(\n new Set(\n this._propagators\n // older propagators may not have fields function, null check to be sure\n .map(p => (typeof p.fields === 'function' ? p.fields() : []))\n .reduce((x, y) => x.concat(y), [])\n )\n );\n }\n\n /**\n * Run each of the configured propagators with the given context and carrier.\n * Propagators are run in the order they are configured, so if multiple\n * propagators write the same carrier key, the propagator later in the list\n * will \"win\".\n *\n * @param context Context to inject\n * @param carrier Carrier into which context will be injected\n */\n inject(context: Context, carrier: unknown, setter: TextMapSetter): void {\n for (const propagator of this._propagators) {\n try {\n propagator.inject(context, carrier, setter);\n } catch (err) {\n diag.warn(\n `Failed to inject with ${propagator.constructor.name}. Err: ${err.message}`\n );\n }\n }\n }\n\n /**\n * Run each of the configured propagators with the given context and carrier.\n * Propagators are run in the order they are configured, so if multiple\n * propagators write the same context key, the propagator later in the list\n * will \"win\".\n *\n * @param context Context to add values to\n * @param carrier Carrier from which to extract context\n */\n extract(context: Context, carrier: unknown, getter: TextMapGetter): Context {\n return this._propagators.reduce((ctx, propagator) => {\n try {\n return propagator.extract(ctx, carrier, getter);\n } catch (err) {\n diag.warn(\n `Failed to inject with ${propagator.constructor.name}. Err: ${err.message}`\n );\n }\n return ctx;\n }, context);\n }\n\n fields(): string[] {\n // return a new array so our fields cannot be modified\n return this._fields.slice();\n }\n}\n", "/*\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\nconst VALID_KEY_CHAR_RANGE = '[_0-9a-z-*/]';\nconst VALID_KEY = `[a-z]${VALID_KEY_CHAR_RANGE}{0,255}`;\nconst VALID_VENDOR_KEY = `[a-z0-9]${VALID_KEY_CHAR_RANGE}{0,240}@[a-z]${VALID_KEY_CHAR_RANGE}{0,13}`;\nconst VALID_KEY_REGEX = new RegExp(`^(?:${VALID_KEY}|${VALID_VENDOR_KEY})$`);\nconst VALID_VALUE_BASE_REGEX = /^[ -~]{0,255}[!-~]$/;\nconst INVALID_VALUE_COMMA_EQUAL_REGEX = /,|=/;\n\n/**\n * Key is opaque string up to 256 characters printable. It MUST begin with a\n * lowercase letter, and can only contain lowercase letters a-z, digits 0-9,\n * underscores _, dashes -, asterisks *, and forward slashes /.\n * For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the\n * vendor name. Vendors SHOULD set the tenant ID at the beginning of the key.\n * see https://www.w3.org/TR/trace-context/#key\n */\nexport function validateKey(key: string): boolean {\n return VALID_KEY_REGEX.test(key);\n}\n\n/**\n * Value is opaque string up to 256 characters printable ASCII RFC0020\n * characters (i.e., the range 0x20 to 0x7E) except comma , and =.\n */\nexport function validateValue(value: string): boolean {\n return (\n VALID_VALUE_BASE_REGEX.test(value) &&\n !INVALID_VALUE_COMMA_EQUAL_REGEX.test(value)\n );\n}\n", "/*\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 * as api from '@opentelemetry/api';\nimport { validateKey, validateValue } from '../internal/validators';\n\nconst MAX_TRACE_STATE_ITEMS = 32;\nconst MAX_TRACE_STATE_LEN = 512;\nconst LIST_MEMBERS_SEPARATOR = ',';\nconst LIST_MEMBER_KEY_VALUE_SPLITTER = '=';\n\n/**\n * TraceState must be a class and not a simple object type because of the spec\n * requirement (https://www.w3.org/TR/trace-context/#tracestate-field).\n *\n * Here is the list of allowed mutations:\n * - New key-value pair should be added into the beginning of the list\n * - The value of any key can be updated. Modified keys MUST be moved to the\n * beginning of the list.\n */\nexport class TraceState implements api.TraceState {\n private _internalState: Map<string, string> = new Map();\n\n constructor(rawTraceState?: string) {\n if (rawTraceState) this._parse(rawTraceState);\n }\n\n set(key: string, value: string): TraceState {\n // TODO: Benchmark the different approaches(map vs list) and\n // use the faster one.\n const traceState = this._clone();\n if (traceState._internalState.has(key)) {\n traceState._internalState.delete(key);\n }\n traceState._internalState.set(key, value);\n return traceState;\n }\n\n unset(key: string): TraceState {\n const traceState = this._clone();\n traceState._internalState.delete(key);\n return traceState;\n }\n\n get(key: string): string | undefined {\n return this._internalState.get(key);\n }\n\n serialize(): string {\n return this._keys()\n .reduce((agg: string[], key) => {\n agg.push(key + LIST_MEMBER_KEY_VALUE_SPLITTER + this.get(key));\n return agg;\n }, [])\n .join(LIST_MEMBERS_SEPARATOR);\n }\n\n private _parse(rawTraceState: string) {\n if (rawTraceState.length > MAX_TRACE_STATE_LEN) return;\n this._internalState = rawTraceState\n .split(LIST_MEMBERS_SEPARATOR)\n .reverse() // Store in reverse so new keys (.set(...)) will be placed at the beginning\n .reduce((agg: Map<string, string>, part: string) => {\n const listMember = part.trim(); // Optional Whitespace (OWS) handling\n const i = listMember.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER);\n if (i !== -1) {\n const key = listMember.slice(0, i);\n const value = listMember.slice(i + 1, part.length);\n if (validateKey(key) && validateValue(value)) {\n agg.set(key, value);\n } else {\n // TODO: Consider to add warning log\n }\n }\n return agg;\n }, new Map());\n\n // Because of the reverse() requirement, trunc must be done after map is created\n if (this._internalState.size > MAX_TRACE_STATE_ITEMS) {\n this._internalState = new Map(\n Array.from(this._internalState.entries())\n .reverse() // Use reverse same as original tracestate parse chain\n .slice(0, MAX_TRACE_STATE_ITEMS)\n );\n }\n }\n\n private _keys(): string[] {\n return Array.from(this._internalState.keys()).reverse();\n }\n\n private _clone(): TraceState {\n const traceState = new TraceState();\n traceState._internalState = new Map(this._internalState);\n return traceState;\n }\n}\n", "/*\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 {\n Context,\n isSpanContextValid,\n SpanContext,\n TextMapGetter,\n TextMapPropagator,\n TextMapSetter,\n trace,\n TraceFlags,\n} from '@opentelemetry/api';\nimport { isTracingSuppressed } from './suppress-tracing';\nimport { TraceState } from './TraceState';\n\nexport const TRACE_PARENT_HEADER = 'traceparent';\nexport const TRACE_STATE_HEADER = 'tracestate';\n\nconst VERSION = '00';\nconst VERSION_PART = '(?!ff)[\\\\da-f]{2}';\nconst TRACE_ID_PART = '(?![0]{32})[\\\\da-f]{32}';\nconst PARENT_ID_PART = '(?![0]{16})[\\\\da-f]{16}';\nconst FLAGS_PART = '[\\\\da-f]{2}';\nconst TRACE_PARENT_REGEX = new RegExp(\n `^\\\\s?(${VERSION_PART})-(${TRACE_ID_PART})-(${PARENT_ID_PART})-(${FLAGS_PART})(-.*)?\\\\s?$`\n);\n\n/**\n * Parses information from the [traceparent] span tag and converts it into {@link SpanContext}\n * @param traceParent - A meta property that comes from server.\n * It should be dynamically generated server side to have the server's request trace Id,\n * a parent span Id that was set on the server's request span,\n * and the trace flags to indicate the server's sampling decision\n * (01 = sampled, 00 = not sampled).\n * for example: '{version}-{traceId}-{spanId}-{sampleDecision}'\n * For more information see {@link https://www.w3.org/TR/trace-context/}\n */\nexport function parseTraceParent(traceParent: string): SpanContext | null {\n const match = TRACE_PARENT_REGEX.exec(traceParent);\n if (!match) return null;\n\n // According to the specification the implementation should be compatible\n // with future versions. If there are more parts, we only reject it if it's using version 00\n // See https://www.w3.org/TR/trace-context/#versioning-of-traceparent\n if (match[1] === '00' && match[5]) return null;\n\n return {\n traceId: match[2],\n spanId: match[3],\n traceFlags: parseInt(match[4], 16),\n };\n}\n\n/**\n * Propagates {@link SpanContext} through Trace Context format propagation.\n *\n * Based on the Trace Context specification:\n * https://www.w3.org/TR/trace-context/\n */\nexport class W3CTraceContextPropagator implements TextMapPropagator {\n inject(context: Context, carrier: unknown, setter: TextMapSetter): void {\n const spanContext = trace.getSpanContext(context);\n if (\n !spanContext ||\n isTracingSuppressed(context) ||\n !isSpanContextValid(spanContext)\n )\n return;\n\n const traceParent = `${VERSION}-${spanContext.traceId}-${\n spanContext.spanId\n }-0${Number(spanContext.traceFlags || TraceFlags.NONE).toString(16)}`;\n\n setter.set(carrier, TRACE_PARENT_HEADER, traceParent);\n if (spanContext.traceState) {\n setter.set(\n carrier,\n TRACE_STATE_HEADER,\n spanContext.traceState.serialize()\n );\n }\n }\n\n extract(context: Context, carrier: unknown, getter: TextMapGetter): Context {\n const traceParentHeader = getter.get(carrier, TRACE_PARENT_HEADER);\n if (!traceParentHeader) return context;\n const traceParent = Array.isArray(traceParentHeader)\n ? traceParentHeader[0]\n : traceParentHeader;\n if (typeof traceParent !== 'string') return context;\n const spanContext = parseTraceParent(traceParent);\n if (!spanContext) return context;\n\n spanContext.isRemote = true;\n\n const traceStateHeader = getter.get(carrier, TRACE_STATE_HEADER);\n if (traceStateHeader) {\n // If more than one `tracestate` header is found, we merge them into a\n // single header.\n const state = Array.isArray(traceStateHeader)\n ? traceStateHeader.join(',')\n : traceStateHeader;\n spanContext.traceState = new TraceState(\n typeof state === 'string' ? state : undefined\n );\n }\n return trace.setSpanContext(context, spanContext);\n }\n\n fields(): string[] {\n return [TRACE_PARENT_HEADER, TRACE_STATE_HEADER];\n }\n}\n", "/*\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 { Context, createContextKey, Span } from '@opentelemetry/api';\n\nconst RPC_METADATA_KEY = createContextKey(\n 'OpenTelemetry SDK Context Key RPC_METADATA'\n);\n\nexport enum RPCType {\n HTTP = 'http',\n}\n\ntype HTTPMetadata = {\n type: RPCType.HTTP;\n route?: string;\n span: Span;\n};\n\n/**\n * Allows for future rpc metadata to be used with this mechanism\n */\nexport type RPCMetadata = HTTPMetadata;\n\nexport function setRPCMetadata(context: Context, meta: RPCMetadata): Context {\n return context.setValue(RPC_METADATA_KEY, meta);\n}\n\nexport function deleteRPCMetadata(context: Context): Context {\n return context.deleteValue(RPC_METADATA_KEY);\n}\n\nexport function getRPCMetadata(context: Context): RPCMetadata | undefined {\n return context.getValue(RPC_METADATA_KEY) as RPCMetadata | undefined;\n}\n", "/*\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 { Sampler, SamplingDecision, SamplingResult } from '@opentelemetry/api';\n\n/**\n * @deprecated Use the one defined in @opentelemetry/sdk-trace-base instead.\n * Sampler that samples no traces.\n */\nexport class AlwaysOffSampler implements Sampler {\n shouldSample(): SamplingResult {\n return {\n decision: SamplingDecision.NOT_RECORD,\n };\n }\n\n toString(): string {\n return 'AlwaysOffSampler';\n }\n}\n", "/*\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 { Sampler, SamplingDecision, SamplingResult } from '@opentelemetry/api';\n\n/**\n * @deprecated Use the one defined in @opentelemetry/sdk-trace-base instead.\n * Sampler that samples all traces.\n */\nexport class AlwaysOnSampler implements Sampler {\n shouldSample(): SamplingResult {\n return {\n decision: SamplingDecision.RECORD_AND_SAMPLED,\n };\n }\n\n toString(): string {\n return 'AlwaysOnSampler';\n }\n}\n", "/*\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 {\n Context,\n isSpanContextValid,\n Link,\n Sampler,\n SamplingResult,\n SpanAttributes,\n SpanKind,\n TraceFlags,\n trace,\n} from '@opentelemetry/api';\nimport { globalErrorHandler } from '../../common/global-error-handler';\nimport { AlwaysOffSampler } from './AlwaysOffSampler';\nimport { AlwaysOnSampler } from './AlwaysOnSampler';\n\n/**\n * @deprecated Use the one defined in @opentelemetry/sdk-trace-base instead.\n * A composite sampler that either respects the parent span's sampling decision\n * or delegates to `delegateSampler` for root spans.\n */\nexport class ParentBasedSampler implements Sampler {\n private _root: Sampler;\n private _remoteParentSampled: Sampler;\n private _remoteParentNotSampled: Sampler;\n private _localParentSampled: Sampler;\n private _localParentNotSampled: Sampler;\n\n constructor(config: ParentBasedSamplerConfig) {\n this._root = config.root;\n\n if (!this._root) {\n globalErrorHandler(\n new Error('ParentBasedSampler must have a root sampler configured')\n );\n this._root = new AlwaysOnSampler();\n }\n\n this._remoteParentSampled =\n config.remoteParentSampled ?? new AlwaysOnSampler();\n this._remoteParentNotSampled =\n config.remoteParentNotSampled ?? new AlwaysOffSampler();\n this._localParentSampled =\n config.localParentSampled ?? new AlwaysOnSampler();\n this._localParentNotSampled =\n config.localParentNotSampled ?? new AlwaysOffSampler();\n }\n\n shouldSample(\n context: Context,\n traceId: string,\n spanName: string,\n spanKind: SpanKind,\n attributes: SpanAttributes,\n links: Link[]\n ): SamplingResult {\n const parentContext = trace.getSpanContext(context);\n\n if (!parentContext || !isSpanContextValid(parentContext)) {\n return this._root.shouldSample(\n context,\n traceId,\n spanName,\n spanKind,\n attributes,\n links\n );\n }\n\n if (parentContext.isRemote) {\n if (parentContext.traceFlags & TraceFlags.SAMPLED) {\n return this._remoteParentSampled.shouldSample(\n context,\n traceId,\n spanName,\n spanKind,\n attributes,\n links\n );\n }\n return this._remoteParentNotSampled.shouldSample(\n context,\n traceId,\n spanName,\n spanKind,\n attributes,\n links\n );\n }\n\n if (parentContext.traceFlags & TraceFlags.SAMPLED) {\n return this._localParentSampled.shouldSample(\n context,\n traceId,\n spanName,\n spanKind,\n attributes,\n links\n );\n }\n\n return this._localParentNotSampled.shouldSample(\n context,\n traceId,\n spanName,\n spanKind,\n attributes,\n links\n );\n }\n\n toString(): string {\n return `ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`;\n }\n}\n\ninterface ParentBasedSamplerConfig {\n /** Sampler called for spans with no parent */\n root: Sampler;\n /** Sampler called for spans with a remote parent which was sampled. Default AlwaysOn */\n remoteParentSampled?: Sampler;\n /** Sampler called for spans with a remote parent which was not sampled. Default AlwaysOff */\n remoteParentNotSampled?: Sampler;\n /** Sampler called for spans with a local parent which was sampled. Default AlwaysOn */\n localParentSampled?: Sampler;\n /** Sampler called for spans with a local parent which was not sampled. Default AlwaysOff */\n localParentNotSampled?: Sampler;\n}\n", "/*\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 {\n Sampler,\n SamplingDecision,\n SamplingResult,\n isValidTraceId,\n} from '@opentelemetry/api';\n\n/**\n * @deprecated Use the one defined in @opentelemetry/sdk-trace-base instead.\n * Sampler that samples a given fraction of traces based of trace id deterministically.\n */\nexport class TraceIdRatioBasedSampler implements Sampler {\n private _upperBound: number;\n\n constructor(private readonly _ratio: number = 0) {\n this._ratio = this._normalize(_ratio);\n this._upperBound = Math.floor(this._ratio * 0xffffffff);\n }\n\n shouldSample(context: unknown, traceId: string): SamplingResult {\n return {\n decision:\n isValidTraceId(traceId) && this._accumulate(traceId) < this._upperBound\n ? SamplingDecision.RECORD_AND_SAMPLED\n : SamplingDecision.NOT_RECORD,\n };\n }\n\n toString(): string {\n return `TraceIdRatioBased{${this._ratio}}`;\n }\n\n private _normalize(ratio: number): number {\n if (typeof ratio !== 'number' || isNaN(ratio)) return 0;\n return ratio >= 1 ? 1 : ratio <= 0 ? 0 : ratio;\n }\n\n private _accumulate(traceId: string): number {\n let accumulation = 0;\n for (let i = 0; i < traceId.length / 8; i++) {\n const pos = i * 8;\n const part = parseInt(traceId.slice(pos, pos + 8), 16);\n accumulation = (accumulation ^ part) >>> 0;\n }\n return accumulation;\n }\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * based on lodash in order to support esm builds without esModuleInterop.\n * lodash is using MIT License.\n **/\n\nconst objectTag = '[object Object]';\nconst nullTag = '[object Null]';\nconst undefinedTag = '[object Undefined]';\nconst funcProto = Function.prototype;\nconst funcToString = funcProto.toString;\nconst objectCtorString = funcToString.call(Object);\nconst getPrototype = overArg(Object.getPrototypeOf, Object);\nconst objectProto = Object.prototype;\nconst hasOwnProperty = objectProto.hasOwnProperty;\nconst symToStringTag = Symbol ? Symbol.toStringTag : undefined;\nconst nativeObjectToString = objectProto.toString;\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func: Function, transform: any): any {\n return function (arg: any) {\n return func(transform(arg));\n };\n}\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nexport function isPlainObject(value: any) {\n if (!isObjectLike(value) || baseGetTag(value) !== objectTag) {\n return false;\n }\n const proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n const Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return (\n typeof Ctor == 'function' &&\n Ctor instanceof Ctor &&\n funcToString.call(Ctor) === objectCtorString\n );\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value: any) {\n return value != null && typeof value == 'object';\n}\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value: any) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return symToStringTag && symToStringTag in Object(value)\n ? getRawTag(value)\n : objectToString(value);\n}\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value: any) {\n const isOwn = hasOwnProperty.call(value, symToStringTag as any),\n tag = value[symToStringTag as any];\n let unmasked = false;\n\n try {\n value[symToStringTag as any] = undefined;\n unmasked = true;\n } catch (e) {\n // silence\n }\n\n const result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag as any] = tag;\n } else {\n delete value[symToStringTag as any];\n }\n }\n return result;\n}\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value: any) {\n return nativeObjectToString.call(value);\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { isPlainObject } from './lodash.merge';\n\nconst MAX_LEVEL = 20;\n\ninterface ObjectInto {\n obj: any;\n key: string;\n}\n\n/**\n * Merges objects together\n * @param args - objects / values to be merged\n */\nexport function merge(...args: any[]): any {\n let result: any = args.shift();\n const objects: WeakMap<any, ObjectInto[]> | undefined = new WeakMap<\n any,\n ObjectInto[]\n >();\n while (args.length > 0) {\n result = mergeTwoObjects(result, args.shift(), 0, objects);\n }\n\n return result;\n}\n\nfunction takeValue(value: any): any {\n if (isArray(value)) {\n return value.slice();\n }\n return value;\n}\n\n/**\n * Merges two objects\n * @param one - first object\n * @param two - second object\n * @param level - current deep level\n * @param objects - objects holder that has been already referenced - to prevent\n * cyclic dependency\n */\nfunction mergeTwoObjects(\n one: any,\n two: any,\n level = 0,\n objects: WeakMap<any, ObjectInto[]>\n): any {\n let result: any;\n if (level > MAX_LEVEL) {\n return undefined;\n }\n level++;\n if (isPrimitive(one) || isPrimitive(two) || isFunction(two)) {\n result = takeValue(two);\n } else if (isArray(one)) {\n result = one.slice();\n if (isArray(two)) {\n for (let i = 0, j = two.length; i < j; i++) {\n result.push(takeValue(two[i]));\n }\n } else if (isObject(two)) {\n const keys = Object.keys(two);\n for (let i = 0, j = keys.length; i < j; i++) {\n const key = keys[i];\n result[key] = takeValue(two[key]);\n }\n }\n } else if (isObject(one)) {\n if (isObject(two)) {\n if (!shouldMerge(one, two)) {\n return two;\n }\n result = Object.assign({}, one);\n const keys = Object.keys(two);\n\n for (let i = 0, j = keys.length; i < j; i++) {\n const key = keys[i];\n const twoValue = two[key];\n\n if (isPrimitive(twoValue)) {\n if (typeof twoValue === 'undefined') {\n delete result[key];\n } else {\n // result[key] = takeValue(twoValue);\n result[key] = twoValue;\n }\n } else {\n const obj1 = result[key];\n const obj2 = twoValue;\n\n if (\n wasObjectReferenced(one, key, objects) ||\n wasObjectReferenced(two, key, objects)\n ) {\n delete result[key];\n } else {\n if (isObject(obj1) && isObject(obj2)) {\n const arr1 = objects.get(obj1) || [];\n const arr2 = objects.get(obj2) || [];\n arr1.push({ obj: one, key });\n arr2.push({ obj: two, key });\n objects.set(obj1, arr1);\n objects.set(obj2, arr2);\n }\n\n result[key] = mergeTwoObjects(\n result[key],\n twoValue,\n level,\n objects\n );\n }\n }\n }\n } else {\n result = two;\n }\n }\n\n return result;\n}\n\n/**\n * Function to check if object has been already reference\n * @param obj\n * @param key\n * @param objects\n */\nfunction wasObjectReferenced(\n obj: any,\n key: string,\n objects: WeakMap<any, ObjectInto[]>\n): boolean {\n const arr = objects.get(obj[key]) || [];\n for (let i = 0, j = arr.length; i < j; i++) {\n const info = arr[i];\n if (info.key === key && info.obj === obj) {\n return true;\n }\n }\n return false;\n}\n\nfunction isArray(value: any): boolean {\n return Array.isArray(value);\n}\n\nfunction isFunction(value: any): boolean {\n return typeof value === 'function';\n}\n\nfunction isObject(value: any): boolean {\n return (\n !isPrimitive(value) &&\n !isArray(value) &&\n !isFunction(value) &&\n typeof value === 'object'\n );\n}\n\nfunction isPrimitive(value: any): boolean {\n return (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n typeof value === 'undefined' ||\n value instanceof Date ||\n value instanceof RegExp ||\n value === null\n );\n}\n\nfunction shouldMerge(one: any, two: any): boolean {\n if (!isPlainObject(one) || !isPlainObject(two)) {\n return false;\n }\n\n return true;\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Error that is thrown on timeouts.\n */\nexport class TimeoutError extends Error {\n constructor(message?: string) {\n super(message);\n\n // manually adjust prototype to retain `instanceof` functionality when targeting ES5, see:\n // https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(this, TimeoutError.prototype);\n }\n}\n\n/**\n * Adds a timeout to a promise and rejects if the specified timeout has elapsed. Also rejects if the specified promise\n * rejects, and resolves if the specified promise resolves.\n *\n * <p> NOTE: this operation will continue even after it throws a {@link TimeoutError}.\n *\n * @param promise promise to use with timeout.\n * @param timeout the timeout in milliseconds until the returned promise is rejected.\n */\nexport function callWithTimeout<T>(\n promise: Promise<T>,\n timeout: number\n): Promise<T> {\n let timeoutHandle: ReturnType<typeof setTimeout>;\n\n const timeoutPromise = new Promise<never>(function timeoutFunction(\n _resolve,\n reject\n ) {\n timeoutHandle = setTimeout(function timeoutHandler() {\n reject(new TimeoutError('Operation timed out.'));\n }, timeout);\n });\n\n return Promise.race([promise, timeoutPromise]).then(\n result => {\n clearTimeout(timeoutHandle);\n return result;\n },\n reason => {\n clearTimeout(timeoutHandle);\n throw reason;\n }\n );\n}\n", "/*\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 */\nexport function urlMatches(url: string, urlToMatch: string | RegExp): boolean {\n if (typeof urlToMatch === 'string') {\n return url === urlToMatch;\n } else {\n return !!url.match(urlToMatch);\n }\n}\n/**\n * Check if {@param url} should be ignored when comparing against {@param ignoredUrls}\n * @param url\n * @param ignoredUrls\n */\nexport function isUrlIgnored(\n url: string,\n ignoredUrls?: Array<string | RegExp>\n): boolean {\n if (!ignoredUrls) {\n return false;\n }\n\n for (const ignoreUrl of ignoredUrls) {\n if (urlMatches(url, ignoreUrl)) {\n return true;\n }\n }\n return false;\n}\n", "/*\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 { ShimWrapped } from '../common/types';\n\n/**\n * Checks if certain function has been already wrapped\n * @param func\n */\nexport function isWrapped(func: unknown): func is ShimWrapped {\n return (\n typeof func === 'function' &&\n typeof (func as ShimWrapped).__original === 'function' &&\n typeof (func as ShimWrapped).__unwrap === 'function' &&\n (func as ShimWrapped).__wrapped === true\n );\n}\n", "/*\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\nexport class Deferred<T> {\n private _promise: Promise<T>;\n private _resolve!: (val: T) => void;\n private _reject!: (error: unknown) => void;\n constructor() {\n this._promise = new Promise((resolve, reject) => {\n this._resolve = resolve;\n this._reject = reject;\n });\n }\n\n get promise() {\n return this._promise;\n }\n\n resolve(val: T) {\n this._resolve(val);\n }\n\n reject(err: unknown) {\n this._reject(err);\n }\n}\n", "/*\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 { Deferred } from './promise';\n\n/**\n * Bind the callback and only invoke the callback once regardless how many times `BindOnceFuture.call` is invoked.\n */\nexport class BindOnceFuture<\n R,\n This = unknown,\n T extends (this: This, ...args: unknown[]) => R = () => R,\n> {\n private _isCalled = false;\n private _deferred = new Deferred<R>();\n constructor(\n private _callback: T,\n private _that: This\n ) {}\n\n get isCalled() {\n return this._isCalled;\n }\n\n get promise() {\n return this._deferred.promise;\n }\n\n call(...args: Parameters<T>): Promise<R> {\n if (!this._isCalled) {\n this._isCalled = true;\n try {\n Promise.resolve(this._callback.call(this._that, ...args)).then(\n val => this._deferred.resolve(val),\n err => this._deferred.reject(err)\n );\n } catch (err) {\n this._deferred.reject(err);\n }\n }\n return this._deferred.promise;\n }\n}\n", "/*\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 { context } from '@opentelemetry/api';\nimport { ExportResult } from '../ExportResult';\nimport { suppressTracing } from '../trace/suppress-tracing';\n\nexport interface Exporter<T> {\n export(arg: T, resultCallback: (result: ExportResult) => void): void;\n}\n\n/**\n * @internal\n * Shared functionality used by Exporters while exporting data, including suppresion of Traces.\n */\nexport function _export<T>(\n exporter: Exporter<T>,\n arg: T\n): Promise<ExportResult> {\n return new Promise(resolve => {\n // prevent downstream exporter calls from generating spans\n context.with(suppressTracing(context.active()), () => {\n exporter.export(arg, (result: ExportResult) => {\n resolve(result);\n });\n });\n });\n}\n", "/*\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\nexport * from './baggage/propagation/W3CBaggagePropagator';\nexport * from './common/anchored-clock';\nexport * from './common/attributes';\nexport * from './common/global-error-handler';\nexport * from './common/logging-error-handler';\nexport * from './common/time';\nexport * from './common/types';\nexport * from './ExportResult';\nexport * as baggageUtils from './baggage/utils';\nexport * from './platform';\nexport * from './propagation/composite';\nexport * from './trace/W3CTraceContextPropagator';\nexport * from './trace/IdGenerator';\nexport * from './trace/rpc-metadata';\nexport * from './trace/sampler/AlwaysOffSampler';\nexport * from './trace/sampler/AlwaysOnSampler';\nexport * from './trace/sampler/ParentBasedSampler';\nexport * from './trace/sampler/TraceIdRatioBasedSampler';\nexport * from './trace/suppress-tracing';\nexport * from './trace/TraceState';\nexport * from './utils/environment';\nexport * from './utils/merge';\nexport * from './utils/sampling';\nexport * from './utils/timeout';\nexport * from './utils/url';\nexport * from './utils/wrap';\nexport * from './utils/callback';\nexport * from './version';\nimport { _export } from './internal/exporter';\nexport const internal = {\n _export,\n};\n", "/*\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 { TracerProvider, MeterProvider } from '@opentelemetry/api';\nimport { Instrumentation } from './types';\nimport { AutoLoaderResult, InstrumentationOption } from './types_internal';\n\n/**\n * Parses the options and returns instrumentations, node plugins and\n * web plugins\n * @param options\n */\nexport function parseInstrumentationOptions(\n options: InstrumentationOption[] = []\n): AutoLoaderResult {\n let instrumentations: Instrumentation[] = [];\n for (let i = 0, j = options.length; i < j; i++) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const option = options[i] as any;\n if (Array.isArray(option)) {\n const results = parseInstrumentationOptions(option);\n instrumentations = instrumentations.concat(results.instrumentations);\n } else if (typeof option === 'function') {\n instrumentations.push(new option());\n } else if ((option as Instrumentation).instrumentationName) {\n instrumentations.push(option);\n }\n }\n\n return { instrumentations };\n}\n\n/**\n * Enable instrumentations\n * @param instrumentations\n * @param tracerProvider\n * @param meterProvider\n */\nexport function enableInstrumentations(\n instrumentations: Instrumentation[],\n tracerProvider?: TracerProvider,\n meterProvider?: MeterProvider\n): void {\n for (let i = 0, j = instrumentations.length; i < j; i++) {\n const instrumentation = instrumentations[i];\n if (tracerProvider) {\n instrumentation.setTracerProvider(tracerProvider);\n }\n if (meterProvider) {\n instrumentation.setMeterProvider(meterProvider);\n }\n // instrumentations have been already enabled during creation\n // so enable only if user prevented that by setting enabled to false\n // this is to prevent double enabling but when calling register all\n // instrumentations should be now enabled\n if (!instrumentation.getConfig().enabled) {\n instrumentation.enable();\n }\n }\n}\n\n/**\n * Disable instrumentations\n * @param instrumentations\n */\nexport function disableInstrumentations(\n instrumentations: Instrumentation[]\n): void {\n instrumentations.forEach(instrumentation => instrumentation.disable());\n}\n", "/*\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 { trace, metrics } from '@opentelemetry/api';\nimport {\n disableInstrumentations,\n enableInstrumentations,\n parseInstrumentationOptions,\n} from './autoLoaderUtils';\nimport { AutoLoaderOptions } from './types_internal';\n\n/**\n * It will register instrumentations and plugins\n * @param options\n * @return returns function to unload instrumentation and plugins that were\n * registered\n */\nexport function registerInstrumentations(\n options: AutoLoaderOptions\n): () => void {\n const { instrumentations } = parseInstrumentationOptions(\n options.instrumentations\n );\n const tracerProvider = options.tracerProvider || trace.getTracerProvider();\n const meterProvider = options.meterProvider || metrics.getMeterProvider();\n\n enableInstrumentations(instrumentations, tracerProvider, meterProvider);\n\n return () => {\n disableInstrumentations(instrumentations);\n };\n}\n", "export * from \"async_hooks\"", "export * from \"events\"", "/*\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 { ContextManager, Context } from '@opentelemetry/api';\nimport { EventEmitter } from 'events';\n\ntype Func<T> = (...args: unknown[]) => T;\n\n/**\n * Store a map for each event of all original listeners and their \"patched\"\n * version. So when a listener is removed by the user, the corresponding\n * patched function will be also removed.\n */\ninterface PatchMap {\n [name: string]: WeakMap<Func<void>, Func<void>>;\n}\n\nconst ADD_LISTENER_METHODS = [\n 'addListener' as const,\n 'on' as const,\n 'once' as const,\n 'prependListener' as const,\n 'prependOnceListener' as const,\n];\n\nexport abstract class AbstractAsyncHooksContextManager\n implements ContextManager\n{\n abstract active(): Context;\n\n abstract with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(\n context: Context,\n fn: F,\n thisArg?: ThisParameterType<F>,\n ...args: A\n ): ReturnType<F>;\n\n abstract enable(): this;\n\n abstract disable(): this;\n\n /**\n * Binds a the certain context or the active one to the target function and then returns the target\n * @param context A context (span) to be bind to target\n * @param target a function or event emitter. When target or one of its callbacks is called,\n * the provided context will be used as the active context for the duration of the call.\n */\n bind<T>(context: Context, target: T): T {\n if (target instanceof EventEmitter) {\n return this._bindEventEmitter(context, target);\n }\n\n if (typeof target === 'function') {\n return this._bindFunction(context, target);\n }\n return target;\n }\n\n private _bindFunction<T extends Function>(context: Context, target: T): T {\n const manager = this;\n const contextWrapper = function (this: never, ...args: unknown[]) {\n return manager.with(context, () => target.apply(this, args));\n };\n Object.defineProperty(contextWrapper, 'length', {\n enumerable: false,\n configurable: true,\n writable: false,\n value: target.length,\n });\n /**\n * It isn't possible to tell Typescript that contextWrapper is the same as T\n * so we forced to cast as any here.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return contextWrapper as any;\n }\n\n /**\n * By default, EventEmitter call their callback with their context, which we do\n * not want, instead we will bind a specific context to all callbacks that\n * go through it.\n * @param context the context we want to bind\n * @param ee EventEmitter an instance of EventEmitter to patch\n */\n private _bindEventEmitter<T extends EventEmitter>(\n context: Context,\n ee: T\n ): T {\n const map = this._getPatchMap(ee);\n if (map !== undefined) return ee;\n this._createPatchMap(ee);\n\n // patch methods that add a listener to propagate context\n ADD_LISTENER_METHODS.forEach(methodName => {\n if (ee[methodName] === undefined) return;\n ee[methodName] = this._patchAddListener(ee, ee[methodName], context);\n });\n // patch methods that remove a listener\n if (typeof ee.removeListener === 'function') {\n ee.removeListener = this._patchRemoveListener(ee, ee.removeListener);\n }\n if (typeof ee.off === 'function') {\n ee.off = this._patchRemoveListener(ee, ee.off);\n }\n // patch method that remove all listeners\n if (typeof ee.removeAllListeners === 'function') {\n ee.removeAllListeners = this._patchRemoveAllListeners(\n ee,\n ee.removeAllListeners\n );\n }\n return ee;\n }\n\n /**\n * Patch methods that remove a given listener so that we match the \"patched\"\n * version of that listener (the one that propagate context).\n * @param ee EventEmitter instance\n * @param original reference to the patched method\n */\n private _patchRemoveListener(ee: EventEmitter, original: Function) {\n const contextManager = this;\n return function (this: never, event: string, listener: Func<void>) {\n const events = contextManager._getPatchMap(ee)?.[event];\n if (events === undefined) {\n return original.call(this, event, listener);\n }\n const patchedListener = events.get(listener);\n return original.call(this, event, patchedListener || listener);\n };\n }\n\n /**\n * Patch methods that remove all listeners so we remove our\n * internal references for a given event.\n * @param ee EventEmitter instance\n * @param original reference to the patched method\n */\n private _patchRemoveAllListeners(ee: EventEmitter, original: Function) {\n const contextManager = this;\n return function (this: never, event: string) {\n const map = contextManager._getPatchMap(ee);\n if (map !== undefined) {\n if (arguments.length === 0) {\n contextManager._createPatchMap(ee);\n } else if (map[event] !== undefined) {\n delete map[event];\n }\n }\n return original.apply(this, arguments);\n };\n }\n\n /**\n * Patch methods on an event emitter instance that can add listeners so we\n * can force them to propagate a given context.\n * @param ee EventEmitter instance\n * @param original reference to the patched method\n * @param [context] context to propagate when calling listeners\n */\n private _patchAddListener(\n ee: EventEmitter,\n original: Function,\n context: Context\n ) {\n const contextManager = this;\n return function (this: never, event: string, listener: Func<void>) {\n /**\n * This check is required to prevent double-wrapping the listener.\n * The implementation for ee.once wraps the listener and calls ee.on.\n * Without this check, we would wrap that wrapped listener.\n * This causes an issue because ee.removeListener depends on the onceWrapper\n * to properly remove the listener. If we wrap their wrapper, we break\n * that detection.\n */\n if (contextManager._wrapped) {\n return original.call(this, event, listener);\n }\n let map = contextManager._getPatchMap(ee);\n if (map === undefined) {\n map = contextManager._createPatchMap(ee);\n }\n let listeners = map[event];\n if (listeners === undefined) {\n listeners = new WeakMap();\n map[event] = listeners;\n }\n const patchedListener = contextManager.bind(context, listener);\n // store a weak reference of the user listener to ours\n listeners.set(listener, patchedListener);\n\n /**\n * See comment at the start of this function for the explanation of this property.\n */\n contextManager._wrapped = true;\n try {\n return original.call(this, event, patchedListener);\n } finally {\n contextManager._wrapped = false;\n }\n };\n }\n\n private _createPatchMap(ee: EventEmitter): PatchMap {\n const map = Object.create(null);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (ee as any)[this._kOtListeners] = map;\n return map;\n }\n private _getPatchMap(ee: EventEmitter): PatchMap | undefined {\n return (ee as never)[this._kOtListeners];\n }\n\n private readonly _kOtListeners = Symbol('OtListeners');\n private _wrapped = false;\n}\n", "/*\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 { Context, ROOT_CONTEXT } from '@opentelemetry/api';\nimport { AsyncLocalStorage } from 'async_hooks';\nimport { AbstractAsyncHooksContextManager } from './AbstractAsyncHooksContextManager';\n\nexport class AsyncLocalStorageContextManager extends AbstractAsyncHooksContextManager {\n private _asyncLocalStorage: AsyncLocalStorage<Context>;\n\n constructor() {\n super();\n this._asyncLocalStorage = new AsyncLocalStorage();\n }\n\n active(): Context {\n return this._asyncLocalStorage.getStore() ?? ROOT_CONTEXT;\n }\n\n with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(\n context: Context,\n fn: F,\n thisArg?: ThisParameterType<F>,\n ...args: A\n ): ReturnType<F> {\n const cb = thisArg == null ? fn : fn.bind(thisArg);\n return this._asyncLocalStorage.run(context, cb as never, ...args);\n }\n\n enable(): this {\n return this;\n }\n\n disable(): this {\n this._asyncLocalStorage.disable();\n return this;\n }\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport type { IAnyValue, IKeyValue } from './types';\nimport { Attributes } from '@opentelemetry/api';\n\nexport function toAttributes(attributes: Attributes): IKeyValue[] {\n return Object.keys(attributes).map(key => toKeyValue(key, attributes[key]));\n}\n\nexport function toKeyValue(key: string, value: unknown): IKeyValue {\n return {\n key: key,\n value: toAnyValue(value),\n };\n}\n\nexport function toAnyValue(value: unknown): IAnyValue {\n const t = typeof value;\n if (t === 'string') return { stringValue: value as string };\n if (t === 'number') {\n if (!Number.isInteger(value)) return { doubleValue: value as number };\n return { intValue: value as number };\n }\n if (t === 'boolean') return { boolValue: value as boolean };\n if (value instanceof Uint8Array) return { bytesValue: value };\n if (Array.isArray(value))\n return { arrayValue: { values: value.map(toAnyValue) } };\n if (t === 'object' && value != null)\n return {\n kvlistValue: {\n values: Object.entries(value as object).map(([k, v]) =>\n toKeyValue(k, v)\n ),\n },\n };\n\n return {};\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport type { Link } from '@opentelemetry/api';\nimport type { ReadableSpan, TimedEvent } from '@opentelemetry/sdk-trace-base';\nimport type { Encoder } from '../common';\nimport { toAttributes } from '../common/internal';\nimport { EStatusCode, IEvent, ILink, ISpan } from './types';\n\nexport function sdkSpanToOtlpSpan(span: ReadableSpan, encoder: Encoder): ISpan {\n const ctx = span.spanContext();\n const status = span.status;\n return {\n traceId: encoder.encodeSpanContext(ctx.traceId),\n spanId: encoder.encodeSpanContext(ctx.spanId),\n parentSpanId: encoder.encodeOptionalSpanContext(span.parentSpanId),\n traceState: ctx.traceState?.serialize(),\n name: span.name,\n // Span kind is offset by 1 because the API does not define a value for unset\n kind: span.kind == null ? 0 : span.kind + 1,\n startTimeUnixNano: encoder.encodeHrTime(span.startTime),\n endTimeUnixNano: encoder.encodeHrTime(span.endTime),\n attributes: toAttributes(span.attributes),\n droppedAttributesCount: span.droppedAttributesCount,\n events: span.events.map(event => toOtlpSpanEvent(event, encoder)),\n droppedEventsCount: span.droppedEventsCount,\n status: {\n // API and proto enums share the same values\n code: status.code as unknown as EStatusCode,\n message: status.message,\n },\n links: span.links.map(link => toOtlpLink(link, encoder)),\n droppedLinksCount: span.droppedLinksCount,\n };\n}\n\nexport function toOtlpLink(link: Link, encoder: Encoder): ILink {\n return {\n attributes: link.attributes ? toAttributes(link.attributes) : [],\n spanId: encoder.encodeSpanContext(link.context.spanId),\n traceId: encoder.encodeSpanContext(link.context.traceId),\n traceState: link.context.traceState?.serialize(),\n droppedAttributesCount: link.droppedAttributesCount || 0,\n };\n}\n\nexport function toOtlpSpanEvent(\n timedEvent: TimedEvent,\n encoder: Encoder\n): IEvent {\n return {\n attributes: timedEvent.attributes\n ? toAttributes(timedEvent.attributes)\n : [],\n name: timedEvent.name,\n timeUnixNano: encoder.encodeHrTime(timedEvent.time),\n droppedAttributesCount: timedEvent.droppedAttributesCount || 0,\n };\n}\n", "/*\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 type { OtlpEncodingOptions, Fixed64, LongBits } from './types';\nimport { HrTime } from '@opentelemetry/api';\nimport { hexToBase64, hrTimeToNanoseconds } from '@opentelemetry/core';\n\nconst NANOSECONDS = BigInt(1_000_000_000);\n\nexport function hrTimeToNanos(hrTime: HrTime): bigint {\n return BigInt(hrTime[0]) * NANOSECONDS + BigInt(hrTime[1]);\n}\n\nexport function toLongBits(value: bigint): LongBits {\n const low = Number(BigInt.asUintN(32, value));\n const high = Number(BigInt.asUintN(32, value >> BigInt(32)));\n return { low, high };\n}\n\nexport function encodeAsLongBits(hrTime: HrTime): LongBits {\n const nanos = hrTimeToNanos(hrTime);\n return toLongBits(nanos);\n}\n\nexport function encodeAsString(hrTime: HrTime): string {\n const nanos = hrTimeToNanos(hrTime);\n return nanos.toString();\n}\n\nconst encodeTimestamp =\n typeof BigInt !== 'undefined' ? encodeAsString : hrTimeToNanoseconds;\n\nexport type HrTimeEncodeFunction = (hrTime: HrTime) => Fixed64;\nexport type SpanContextEncodeFunction = (spanContext: string) => string;\nexport type OptionalSpanContextEncodeFunction = (\n spanContext: string | undefined\n) => string | undefined;\n\nexport interface Encoder {\n encodeHrTime: HrTimeEncodeFunction;\n encodeSpanContext: SpanContextEncodeFunction;\n encodeOptionalSpanContext: OptionalSpanContextEncodeFunction;\n}\n\nfunction identity<T>(value: T): T {\n return value;\n}\n\nfunction optionalHexToBase64(str: string | undefined): string | undefined {\n if (str === undefined) return undefined;\n return hexToBase64(str);\n}\n\nconst DEFAULT_ENCODER: Encoder = {\n encodeHrTime: encodeAsLongBits,\n encodeSpanContext: hexToBase64,\n encodeOptionalSpanContext: optionalHexToBase64,\n};\n\nexport function getOtlpEncoder(options?: OtlpEncodingOptions): Encoder {\n if (options === undefined) {\n return DEFAULT_ENCODER;\n }\n\n const useLongBits = options.useLongBits ?? true;\n const useHex = options.useHex ?? false;\n return {\n encodeHrTime: useLongBits ? encodeAsLongBits : encodeTimestamp,\n encodeSpanContext: useHex ? identity : hexToBase64,\n encodeOptionalSpanContext: useHex ? identity : optionalHexToBase64,\n };\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport type { IResource } from '@opentelemetry/resources';\nimport type { ReadableSpan } from '@opentelemetry/sdk-trace-base';\nimport type { OtlpEncodingOptions } from '../common/types';\nimport { toAttributes } from '../common/internal';\nimport { sdkSpanToOtlpSpan } from './internal';\nimport {\n IExportTraceServiceRequest,\n IResourceSpans,\n IScopeSpans,\n} from './types';\nimport { Encoder, getOtlpEncoder } from '../common';\n\nexport function createExportTraceServiceRequest(\n spans: ReadableSpan[],\n options?: OtlpEncodingOptions\n): IExportTraceServiceRequest {\n const encoder = getOtlpEncoder(options);\n return {\n resourceSpans: spanRecordsToResourceSpans(spans, encoder),\n };\n}\n\nfunction createResourceMap(readableSpans: ReadableSpan[]) {\n const resourceMap: Map<IResource, Map<string, ReadableSpan[]>> = new Map();\n for (const record of readableSpans) {\n let ilmMap = resourceMap.get(record.resource);\n\n if (!ilmMap) {\n ilmMap = new Map();\n resourceMap.set(record.resource, ilmMap);\n }\n\n // TODO this is duplicated in basic tracer. Consolidate on a common helper in core\n const instrumentationLibraryKey = `${record.instrumentationLibrary.name}@${\n record.instrumentationLibrary.version || ''\n }:${record.instrumentationLibrary.schemaUrl || ''}`;\n let records = ilmMap.get(instrumentationLibraryKey);\n\n if (!records) {\n records = [];\n ilmMap.set(instrumentationLibraryKey, records);\n }\n\n records.push(record);\n }\n\n return resourceMap;\n}\n\nfunction spanRecordsToResourceSpans(\n readableSpans: ReadableSpan[],\n encoder: Encoder\n): IResourceSpans[] {\n const resourceMap = createResourceMap(readableSpans);\n const out: IResourceSpans[] = [];\n\n const entryIterator = resourceMap.entries();\n let entry = entryIterator.next();\n while (!entry.done) {\n const [resource, ilmMap] = entry.value;\n const scopeResourceSpans: IScopeSpans[] = [];\n const ilmIterator = ilmMap.values();\n let ilmEntry = ilmIterator.next();\n while (!ilmEntry.done) {\n const scopeSpans = ilmEntry.value;\n if (scopeSpans.length > 0) {\n const { name, version, schemaUrl } =\n scopeSpans[0].instrumentationLibrary;\n const spans = scopeSpans.map(readableSpan =>\n sdkSpanToOtlpSpan(readableSpan, encoder)\n );\n\n scopeResourceSpans.push({\n scope: { name, version },\n spans: spans,\n schemaUrl: schemaUrl,\n });\n }\n ilmEntry = ilmIterator.next();\n }\n // TODO SDK types don't provide resource schema URL at this time\n const transformedSpans: IResourceSpans = {\n resource: {\n attributes: toAttributes(resource.attributes),\n droppedAttributesCount: 0,\n },\n scopeSpans: scopeResourceSpans,\n schemaUrl: undefined,\n };\n\n out.push(transformedSpans);\n entry = entryIterator.next();\n }\n\n return out;\n}\n", "/*\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 { diag } from '@opentelemetry/api';\nimport { getEnv } from '@opentelemetry/core';\n\nconst DEFAULT_TRACE_TIMEOUT = 10000;\nexport const DEFAULT_EXPORT_MAX_ATTEMPTS = 5;\nexport const DEFAULT_EXPORT_INITIAL_BACKOFF = 1000;\nexport const DEFAULT_EXPORT_MAX_BACKOFF = 5000;\nexport const DEFAULT_EXPORT_BACKOFF_MULTIPLIER = 1.5;\n\n/**\n * Parses headers from config leaving only those that have defined values\n * @param partialHeaders\n */\nexport function parseHeaders(\n partialHeaders: Partial<Record<string, unknown>> = {}\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(`Header \"${key}\" has wrong value and will be ignored`);\n }\n });\n return headers;\n}\n\n/**\n * Adds path (version + signal) to a no per-signal endpoint\n * @param url\n * @param path\n * @returns url + path\n */\nexport function appendResourcePathToUrl(url: string, path: string): string {\n if (!url.endsWith('/')) {\n url = url + '/';\n }\n return url + path;\n}\n\n/**\n * Adds root path to signal specific endpoint when endpoint contains no path part and no root path\n * @param url\n * @returns url\n */\nexport function appendRootPathToUrlIfNeeded(url: string): string {\n try {\n const parsedUrl = new URL(url);\n if (parsedUrl.pathname === '') {\n parsedUrl.pathname = parsedUrl.pathname + '/';\n }\n return parsedUrl.toString();\n } catch {\n diag.warn(`Could not parse export URL: '${url}'`);\n return url;\n }\n}\n\n/**\n * Configure exporter trace timeout value from passed in value or environment variables\n * @param timeoutMillis\n * @returns timeout value in milliseconds\n */\nexport function configureExporterTimeout(\n timeoutMillis: number | undefined\n): number {\n if (typeof timeoutMillis === 'number') {\n if (timeoutMillis <= 0) {\n // OTLP exporter configured timeout - using default value of 10000ms\n return invalidTimeout(timeoutMillis, DEFAULT_TRACE_TIMEOUT);\n }\n return timeoutMillis;\n } else {\n return getExporterTimeoutFromEnv();\n }\n}\n\nfunction getExporterTimeoutFromEnv(): number {\n const definedTimeout = Number(\n getEnv().OTEL_EXPORTER_OTLP_TRACES_TIMEOUT ??\n getEnv().OTEL_EXPORTER_OTLP_TIMEOUT\n );\n\n if (definedTimeout <= 0) {\n // OTLP exporter configured timeout - using default value of 10000ms\n return invalidTimeout(definedTimeout, DEFAULT_TRACE_TIMEOUT);\n } else {\n return definedTimeout;\n }\n}\n\n// OTLP exporter configured timeout - using default value of 10000ms\nexport function invalidTimeout(\n timeout: number,\n defaultTimeout: number\n): number {\n diag.warn('Timeout must be greater than 0', timeout);\n\n return defaultTimeout;\n}\n\nexport function isExportRetryable(statusCode: number): boolean {\n const retryCodes = [429, 502, 503, 504];\n\n return retryCodes.includes(statusCode);\n}\n\nexport function parseRetryAfterToMills(retryAfter?: string | null): number {\n if (retryAfter == null) {\n return -1;\n }\n const seconds = Number.parseInt(retryAfter, 10);\n if (Number.isInteger(seconds)) {\n return seconds > 0 ? seconds * 1000 : -1;\n }\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After#directives\n const delay = new Date(retryAfter).getTime() - Date.now();\n\n if (delay >= 0) {\n return delay;\n }\n return 0;\n}\n", "/*\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 { diag } from '@opentelemetry/api';\nimport {\n ExportResult,\n ExportResultCode,\n BindOnceFuture,\n} from '@opentelemetry/core';\nimport {\n OTLPExporterError,\n OTLPExporterConfigBase,\n ExportServiceError,\n} from './types';\nimport { configureExporterTimeout } from './util';\n\n/**\n * Collector Exporter abstract base class\n */\nexport abstract class OTLPExporterBase<\n T extends OTLPExporterConfigBase,\n ExportItem,\n ServiceRequest,\n> {\n public readonly url: string;\n public readonly hostname: string | undefined;\n public readonly timeoutMillis: number;\n protected _concurrencyLimit: number;\n protected _sendingPromises: Promise<unknown>[] = [];\n protected _shutdownOnce: BindOnceFuture<void>;\n\n /**\n * @param config\n */\n constructor(config: T = {} as T) {\n this.url = this.getDefaultUrl(config);\n if (typeof config.hostname === 'string') {\n this.hostname = config.hostname;\n }\n\n this.shutdown = this.shutdown.bind(this);\n this._shutdownOnce = new BindOnceFuture(this._shutdown, this);\n\n this._concurrencyLimit =\n typeof config.concurrencyLimit === 'number'\n ? config.concurrencyLimit\n : 30;\n\n this.timeoutMillis = configureExporterTimeout(config.timeoutMillis);\n\n // platform dependent\n this.onInit(config);\n }\n\n /**\n * Export items.\n * @param items\n * @param resultCallback\n */\n export(\n items: ExportItem[],\n resultCallback: (result: ExportResult) => void\n ): void {\n if (this._shutdownOnce.isCalled) {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Exporter has been shutdown'),\n });\n return;\n }\n\n if (this._sendingPromises.length >= this._concurrencyLimit) {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Concurrent export limit reached'),\n });\n return;\n }\n\n this._export(items)\n .then(() => {\n resultCallback({ code: ExportResultCode.SUCCESS });\n })\n .catch((error: ExportServiceError) => {\n resultCallback({ code: ExportResultCode.FAILED, error });\n });\n }\n\n private _export(items: ExportItem[]): Promise<unknown> {\n return new Promise<void>((resolve, reject) => {\n try {\n diag.debug('items to be sent', items);\n this.send(items, resolve, reject);\n } catch (e) {\n reject(e);\n }\n });\n }\n\n /**\n * Shutdown the exporter.\n */\n shutdown(): Promise<void> {\n return this._shutdownOnce.call();\n }\n\n /**\n * Exports any pending spans in the exporter\n */\n forceFlush(): Promise<void> {\n return Promise.all(this._sendingPromises).then(() => {\n /** ignore resolved values */\n });\n }\n\n /**\n * Called by _shutdownOnce with BindOnceFuture\n */\n private _shutdown(): Promise<void> {\n diag.debug('shutdown started');\n this.onShutdown();\n return this.forceFlush();\n }\n\n abstract onShutdown(): void;\n abstract onInit(config: T): void;\n abstract send(\n items: ExportItem[],\n onSuccess: () => void,\n onError: (error: OTLPExporterError) => void\n ): void;\n abstract getDefaultUrl(config: T): string;\n abstract convert(objects: ExportItem[]): ServiceRequest;\n}\n", "\"use strict\";\r\nmodule.exports = asPromise;\r\n\r\n/**\r\n * Callback as used by {@link util.asPromise}.\r\n * @typedef asPromiseCallback\r\n * @type {function}\r\n * @param {Error|null} error Error, if any\r\n * @param {...*} params Additional arguments\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Returns a promise from a node-style callback function.\r\n * @memberof util\r\n * @param {asPromiseCallback} fn Function to call\r\n * @param {*} ctx Function context\r\n * @param {...*} params Function arguments\r\n * @returns {Promise<*>} Promisified function\r\n */\r\nfunction asPromise(fn, ctx/*, varargs */) {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0,\r\n index = 2,\r\n pending = true;\r\n while (index < arguments.length)\r\n params[offset++] = arguments[index++];\r\n return new Promise(function executor(resolve, reject) {\r\n params[offset] = function callback(err/*, varargs */) {\r\n if (pending) {\r\n pending = false;\r\n if (err)\r\n reject(err);\r\n else {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0;\r\n while (offset < params.length)\r\n params[offset++] = arguments[offset];\r\n resolve.apply(null, params);\r\n }\r\n }\r\n };\r\n try {\r\n fn.apply(ctx || null, params);\r\n } catch (err) {\r\n if (pending) {\r\n pending = false;\r\n reject(err);\r\n }\r\n }\r\n });\r\n}\r\n", "\"use strict\";\r\n\r\n/**\r\n * A minimal base64 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar base64 = exports;\r\n\r\n/**\r\n * Calculates the byte length of a base64 encoded string.\r\n * @param {string} string Base64 encoded string\r\n * @returns {number} Byte length\r\n */\r\nbase64.length = function length(string) {\r\n var p = string.length;\r\n if (!p)\r\n return 0;\r\n var n = 0;\r\n while (--p % 4 > 1 && string.charAt(p) === \"=\")\r\n ++n;\r\n return Math.ceil(string.length * 3) / 4 - n;\r\n};\r\n\r\n// Base64 encoding table\r\nvar b64 = new Array(64);\r\n\r\n// Base64 decoding table\r\nvar s64 = new Array(123);\r\n\r\n// 65..90, 97..122, 48..57, 43, 47\r\nfor (var i = 0; i < 64;)\r\n s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;\r\n\r\n/**\r\n * Encodes a buffer to a base64 encoded string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} Base64 encoded string\r\n */\r\nbase64.encode = function encode(buffer, start, end) {\r\n var parts = null,\r\n chunk = [];\r\n var i = 0, // output index\r\n j = 0, // goto index\r\n t; // temporary\r\n while (start < end) {\r\n var b = buffer[start++];\r\n switch (j) {\r\n case 0:\r\n chunk[i++] = b64[b >> 2];\r\n t = (b & 3) << 4;\r\n j = 1;\r\n break;\r\n case 1:\r\n chunk[i++] = b64[t | b >> 4];\r\n t = (b & 15) << 2;\r\n j = 2;\r\n break;\r\n case 2:\r\n chunk[i++] = b64[t | b >> 6];\r\n chunk[i++] = b64[b & 63];\r\n j = 0;\r\n break;\r\n }\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (j) {\r\n chunk[i++] = b64[t];\r\n chunk[i++] = 61;\r\n if (j === 1)\r\n chunk[i++] = 61;\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\nvar invalidEncoding = \"invalid encoding\";\r\n\r\n/**\r\n * Decodes a base64 encoded string to a buffer.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Number of bytes written\r\n * @throws {Error} If encoding is invalid\r\n */\r\nbase64.decode = function decode(string, buffer, offset) {\r\n var start = offset;\r\n var j = 0, // goto index\r\n t; // temporary\r\n for (var i = 0; i < string.length;) {\r\n var c = string.charCodeAt(i++);\r\n if (c === 61 && j > 1)\r\n break;\r\n if ((c = s64[c]) === undefined)\r\n throw Error(invalidEncoding);\r\n switch (j) {\r\n case 0:\r\n t = c;\r\n j = 1;\r\n break;\r\n case 1:\r\n buffer[offset++] = t << 2 | (c & 48) >> 4;\r\n t = c;\r\n j = 2;\r\n break;\r\n case 2:\r\n buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;\r\n t = c;\r\n j = 3;\r\n break;\r\n case 3:\r\n buffer[offset++] = (t & 3) << 6 | c;\r\n j = 0;\r\n break;\r\n }\r\n }\r\n if (j === 1)\r\n throw Error(invalidEncoding);\r\n return offset - start;\r\n};\r\n\r\n/**\r\n * Tests if the specified string appears to be base64 encoded.\r\n * @param {string} string String to test\r\n * @returns {boolean} `true` if probably base64 encoded, otherwise false\r\n */\r\nbase64.test = function test(string) {\r\n return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);\r\n};\r\n", "\"use strict\";\r\nmodule.exports = EventEmitter;\r\n\r\n/**\r\n * Constructs a new event emitter instance.\r\n * @classdesc A minimal event emitter.\r\n * @memberof util\r\n * @constructor\r\n */\r\nfunction EventEmitter() {\r\n\r\n /**\r\n * Registered listeners.\r\n * @type {Object.<string,*>}\r\n * @private\r\n */\r\n this._listeners = {};\r\n}\r\n\r\n/**\r\n * Registers an event listener.\r\n * @param {string} evt Event name\r\n * @param {function} fn Listener\r\n * @param {*} [ctx] Listener context\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.on = function on(evt, fn, ctx) {\r\n (this._listeners[evt] || (this._listeners[evt] = [])).push({\r\n fn : fn,\r\n ctx : ctx || this\r\n });\r\n return this;\r\n};\r\n\r\n/**\r\n * Removes an event listener or any matching listeners if arguments are omitted.\r\n * @param {string} [evt] Event name. Removes all listeners if omitted.\r\n * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.off = function off(evt, fn) {\r\n if (evt === undefined)\r\n this._listeners = {};\r\n else {\r\n if (fn === undefined)\r\n this._listeners[evt] = [];\r\n else {\r\n var listeners = this._listeners[evt];\r\n for (var i = 0; i < listeners.length;)\r\n if (listeners[i].fn === fn)\r\n listeners.splice(i, 1);\r\n else\r\n ++i;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emits an event by calling its listeners with the specified arguments.\r\n * @param {string} evt Event name\r\n * @param {...*} args Arguments\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.emit = function emit(evt) {\r\n var listeners = this._listeners[evt];\r\n if (listeners) {\r\n var args = [],\r\n i = 1;\r\n for (; i < arguments.length;)\r\n args.push(arguments[i++]);\r\n for (i = 0; i < listeners.length;)\r\n listeners[i].fn.apply(listeners[i++].ctx, args);\r\n }\r\n return this;\r\n};\r\n", "\"use strict\";\r\n\r\nmodule.exports = factory(factory);\r\n\r\n/**\r\n * Reads / writes floats / doubles from / to buffers.\r\n * @name util.float\r\n * @namespace\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using little endian byte order.\r\n * @name util.float.writeFloatLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using big endian byte order.\r\n * @name util.float.writeFloatBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using little endian byte order.\r\n * @name util.float.readFloatLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using big endian byte order.\r\n * @name util.float.readFloatBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using little endian byte order.\r\n * @name util.float.writeDoubleLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using big endian byte order.\r\n * @name util.float.writeDoubleBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using little endian byte order.\r\n * @name util.float.readDoubleLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using big endian byte order.\r\n * @name util.float.readDoubleBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n// Factory function for the purpose of node-based testing in modified global environments\r\nfunction factory(exports) {\r\n\r\n // float: typed array\r\n if (typeof Float32Array !== \"undefined\") (function() {\r\n\r\n var f32 = new Float32Array([ -0 ]),\r\n f8b = new Uint8Array(f32.buffer),\r\n le = f8b[3] === 128;\r\n\r\n function writeFloat_f32_cpy(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n }\r\n\r\n function writeFloat_f32_rev(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[3];\r\n buf[pos + 1] = f8b[2];\r\n buf[pos + 2] = f8b[1];\r\n buf[pos + 3] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;\r\n\r\n function readFloat_f32_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n function readFloat_f32_rev(buf, pos) {\r\n f8b[3] = buf[pos ];\r\n f8b[2] = buf[pos + 1];\r\n f8b[1] = buf[pos + 2];\r\n f8b[0] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;\r\n\r\n // float: ieee754\r\n })(); else (function() {\r\n\r\n function writeFloat_ieee754(writeUint, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0)\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos);\r\n else if (isNaN(val))\r\n writeUint(2143289344, buf, pos);\r\n else if (val > 3.4028234663852886e+38) // +-Infinity\r\n writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);\r\n else if (val < 1.1754943508222875e-38) // denormal\r\n writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);\r\n else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2),\r\n mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;\r\n writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);\r\n }\r\n }\r\n\r\n exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);\r\n exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);\r\n\r\n function readFloat_ieee754(readUint, buf, pos) {\r\n var uint = readUint(buf, pos),\r\n sign = (uint >> 31) * 2 + 1,\r\n exponent = uint >>> 23 & 255,\r\n mantissa = uint & 8388607;\r\n return exponent === 255\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 1.401298464324817e-45 * mantissa\r\n : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);\r\n }\r\n\r\n exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE);\r\n exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE);\r\n\r\n })();\r\n\r\n // double: typed array\r\n if (typeof Float64Array !== \"undefined\") (function() {\r\n\r\n var f64 = new Float64Array([-0]),\r\n f8b = new Uint8Array(f64.buffer),\r\n le = f8b[7] === 128;\r\n\r\n function writeDouble_f64_cpy(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n buf[pos + 4] = f8b[4];\r\n buf[pos + 5] = f8b[5];\r\n buf[pos + 6] = f8b[6];\r\n buf[pos + 7] = f8b[7];\r\n }\r\n\r\n function writeDouble_f64_rev(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[7];\r\n buf[pos + 1] = f8b[6];\r\n buf[pos + 2] = f8b[5];\r\n buf[pos + 3] = f8b[4];\r\n buf[pos + 4] = f8b[3];\r\n buf[pos + 5] = f8b[2];\r\n buf[pos + 6] = f8b[1];\r\n buf[pos + 7] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;\r\n\r\n function readDouble_f64_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n f8b[4] = buf[pos + 4];\r\n f8b[5] = buf[pos + 5];\r\n f8b[6] = buf[pos + 6];\r\n f8b[7] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n function readDouble_f64_rev(buf, pos) {\r\n f8b[7] = buf[pos ];\r\n f8b[6] = buf[pos + 1];\r\n f8b[5] = buf[pos + 2];\r\n f8b[4] = buf[pos + 3];\r\n f8b[3] = buf[pos + 4];\r\n f8b[2] = buf[pos + 5];\r\n f8b[1] = buf[pos + 6];\r\n f8b[0] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;\r\n\r\n // double: ieee754\r\n })(); else (function() {\r\n\r\n function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1);\r\n } else if (isNaN(val)) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(2146959360, buf, pos + off1);\r\n } else if (val > 1.7976931348623157e+308) { // +-Infinity\r\n writeUint(0, buf, pos + off0);\r\n writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);\r\n } else {\r\n var mantissa;\r\n if (val < 2.2250738585072014e-308) { // denormal\r\n mantissa = val / 5e-324;\r\n writeUint(mantissa >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);\r\n } else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2);\r\n if (exponent === 1024)\r\n exponent = 1023;\r\n mantissa = val * Math.pow(2, -exponent);\r\n writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);\r\n }\r\n }\r\n }\r\n\r\n exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);\r\n exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);\r\n\r\n function readDouble_ieee754(readUint, off0, off1, buf, pos) {\r\n var lo = readUint(buf, pos + off0),\r\n hi = readUint(buf, pos + off1);\r\n var sign = (hi >> 31) * 2 + 1,\r\n exponent = hi >>> 20 & 2047,\r\n mantissa = 4294967296 * (hi & 1048575) + lo;\r\n return exponent === 2047\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 5e-324 * mantissa\r\n : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);\r\n }\r\n\r\n exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);\r\n exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);\r\n\r\n })();\r\n\r\n return exports;\r\n}\r\n\r\n// uint helpers\r\n\r\nfunction writeUintLE(val, buf, pos) {\r\n buf[pos ] = val & 255;\r\n buf[pos + 1] = val >>> 8 & 255;\r\n buf[pos + 2] = val >>> 16 & 255;\r\n buf[pos + 3] = val >>> 24;\r\n}\r\n\r\nfunction writeUintBE(val, buf, pos) {\r\n buf[pos ] = val >>> 24;\r\n buf[pos + 1] = val >>> 16 & 255;\r\n buf[pos + 2] = val >>> 8 & 255;\r\n buf[pos + 3] = val & 255;\r\n}\r\n\r\nfunction readUintLE(buf, pos) {\r\n return (buf[pos ]\r\n | buf[pos + 1] << 8\r\n | buf[pos + 2] << 16\r\n | buf[pos + 3] << 24) >>> 0;\r\n}\r\n\r\nfunction readUintBE(buf, pos) {\r\n return (buf[pos ] << 24\r\n | buf[pos + 1] << 16\r\n | buf[pos + 2] << 8\r\n | buf[pos + 3]) >>> 0;\r\n}\r\n", "\n \"use strict\";\n module.exports = inquire;\n function inquire(moduleName) {\n return null;\n }\n ", "\"use strict\";\r\n\r\n/**\r\n * A minimal UTF8 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar utf8 = exports;\r\n\r\n/**\r\n * Calculates the UTF8 byte length of a string.\r\n * @param {string} string String\r\n * @returns {number} Byte length\r\n */\r\nutf8.length = function utf8_length(string) {\r\n var len = 0,\r\n c = 0;\r\n for (var i = 0; i < string.length; ++i) {\r\n c = string.charCodeAt(i);\r\n if (c < 128)\r\n len += 1;\r\n else if (c < 2048)\r\n len += 2;\r\n else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {\r\n ++i;\r\n len += 4;\r\n } else\r\n len += 3;\r\n }\r\n return len;\r\n};\r\n\r\n/**\r\n * Reads UTF8 bytes as a string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} String read\r\n */\r\nutf8.read = function utf8_read(buffer, start, end) {\r\n var len = end - start;\r\n if (len < 1)\r\n return \"\";\r\n var parts = null,\r\n chunk = [],\r\n i = 0, // char offset\r\n t; // temporary\r\n while (start < end) {\r\n t = buffer[start++];\r\n if (t < 128)\r\n chunk[i++] = t;\r\n else if (t > 191 && t < 224)\r\n chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\r\n else if (t > 239 && t < 365) {\r\n t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\r\n chunk[i++] = 0xD800 + (t >> 10);\r\n chunk[i++] = 0xDC00 + (t & 1023);\r\n } else\r\n chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\n/**\r\n * Writes a string as UTF8 bytes.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Bytes written\r\n */\r\nutf8.write = function utf8_write(string, buffer, offset) {\r\n var start = offset,\r\n c1, // character 1\r\n c2; // character 2\r\n for (var i = 0; i < string.length; ++i) {\r\n c1 = string.charCodeAt(i);\r\n if (c1 < 128) {\r\n buffer[offset++] = c1;\r\n } else if (c1 < 2048) {\r\n buffer[offset++] = c1 >> 6 | 192;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {\r\n c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);\r\n ++i;\r\n buffer[offset++] = c1 >> 18 | 240;\r\n buffer[offset++] = c1 >> 12 & 63 | 128;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else {\r\n buffer[offset++] = c1 >> 12 | 224;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n }\r\n }\r\n return offset - start;\r\n};\r\n", "\"use strict\";\r\nmodule.exports = pool;\r\n\r\n/**\r\n * An allocator as used by {@link util.pool}.\r\n * @typedef PoolAllocator\r\n * @type {function}\r\n * @param {number} size Buffer size\r\n * @returns {Uint8Array} Buffer\r\n */\r\n\r\n/**\r\n * A slicer as used by {@link util.pool}.\r\n * @typedef PoolSlicer\r\n * @type {function}\r\n * @param {number} start Start offset\r\n * @param {number} end End offset\r\n * @returns {Uint8Array} Buffer slice\r\n * @this {Uint8Array}\r\n */\r\n\r\n/**\r\n * A general purpose buffer pool.\r\n * @memberof util\r\n * @function\r\n * @param {PoolAllocator} alloc Allocator\r\n * @param {PoolSlicer} slice Slicer\r\n * @param {number} [size=8192] Slab size\r\n * @returns {PoolAllocator} Pooled allocator\r\n */\r\nfunction pool(alloc, slice, size) {\r\n var SIZE = size || 8192;\r\n var MAX = SIZE >>> 1;\r\n var slab = null;\r\n var offset = SIZE;\r\n return function pool_alloc(size) {\r\n if (size < 1 || size > MAX)\r\n return alloc(size);\r\n if (offset + size > SIZE) {\r\n slab = alloc(SIZE);\r\n offset = 0;\r\n }\r\n var buf = slice.call(slab, offset, offset += size);\r\n if (offset & 7) // align to 32 bit\r\n offset = (offset | 7) + 1;\r\n return buf;\r\n };\r\n}\r\n", "\"use strict\";\nmodule.exports = LongBits;\n\nvar util = require(\"../util/minimal\");\n\n/**\n * Constructs new long bits.\n * @classdesc Helper class for working with the low and high bits of a 64 bit value.\n * @memberof util\n * @constructor\n * @param {number} lo Low 32 bits, unsigned\n * @param {number} hi High 32 bits, unsigned\n */\nfunction LongBits(lo, hi) {\n\n // note that the casts below are theoretically unnecessary as of today, but older statically\n // generated converter code might still call the ctor with signed 32bits. kept for compat.\n\n /**\n * Low bits.\n * @type {number}\n */\n this.lo = lo >>> 0;\n\n /**\n * High bits.\n * @type {number}\n */\n this.hi = hi >>> 0;\n}\n\n/**\n * Zero bits.\n * @memberof util.LongBits\n * @type {util.LongBits}\n */\nvar zero = LongBits.zero = new LongBits(0, 0);\n\nzero.toNumber = function() { return 0; };\nzero.zzEncode = zero.zzDecode = function() { return this; };\nzero.length = function() { return 1; };\n\n/**\n * Zero hash.\n * @memberof util.LongBits\n * @type {string}\n */\nvar zeroHash = LongBits.zeroHash = \"\\0\\0\\0\\0\\0\\0\\0\\0\";\n\n/**\n * Constructs new long bits from the specified number.\n * @param {number} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.fromNumber = function fromNumber(value) {\n if (value === 0)\n return zero;\n var sign = value < 0;\n if (sign)\n value = -value;\n var lo = value >>> 0,\n hi = (value - lo) / 4294967296 >>> 0;\n if (sign) {\n hi = ~hi >>> 0;\n lo = ~lo >>> 0;\n if (++lo > 4294967295) {\n lo = 0;\n if (++hi > 4294967295)\n hi = 0;\n }\n }\n return new LongBits(lo, hi);\n};\n\n/**\n * Constructs new long bits from a number, long or string.\n * @param {Long|number|string} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.from = function from(value) {\n if (typeof value === \"number\")\n return LongBits.fromNumber(value);\n if (util.isString(value)) {\n /* istanbul ignore else */\n if (util.Long)\n value = util.Long.fromString(value);\n else\n return LongBits.fromNumber(parseInt(value, 10));\n }\n return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;\n};\n\n/**\n * Converts this long bits to a possibly unsafe JavaScript number.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {number} Possibly unsafe number\n */\nLongBits.prototype.toNumber = function toNumber(unsigned) {\n if (!unsigned && this.hi >>> 31) {\n var lo = ~this.lo + 1 >>> 0,\n hi = ~this.hi >>> 0;\n if (!lo)\n hi = hi + 1 >>> 0;\n return -(lo + hi * 4294967296);\n }\n return this.lo + this.hi * 4294967296;\n};\n\n/**\n * Converts this long bits to a long.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long} Long\n */\nLongBits.prototype.toLong = function toLong(unsigned) {\n return util.Long\n ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))\n /* istanbul ignore next */\n : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };\n};\n\nvar charCodeAt = String.prototype.charCodeAt;\n\n/**\n * Constructs new long bits from the specified 8 characters long hash.\n * @param {string} hash Hash\n * @returns {util.LongBits} Bits\n */\nLongBits.fromHash = function fromHash(hash) {\n if (hash === zeroHash)\n return zero;\n return new LongBits(\n ( charCodeAt.call(hash, 0)\n | charCodeAt.call(hash, 1) << 8\n | charCodeAt.call(hash, 2) << 16\n | charCodeAt.call(hash, 3) << 24) >>> 0\n ,\n ( charCodeAt.call(hash, 4)\n | charCodeAt.call(hash, 5) << 8\n | charCodeAt.call(hash, 6) << 16\n | charCodeAt.call(hash, 7) << 24) >>> 0\n );\n};\n\n/**\n * Converts this long bits to a 8 characters long hash.\n * @returns {string} Hash\n */\nLongBits.prototype.toHash = function toHash() {\n return String.fromCharCode(\n this.lo & 255,\n this.lo >>> 8 & 255,\n this.lo >>> 16 & 255,\n this.lo >>> 24 ,\n this.hi & 255,\n this.hi >>> 8 & 255,\n this.hi >>> 16 & 255,\n this.hi >>> 24\n );\n};\n\n/**\n * Zig-zag encodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzEncode = function zzEncode() {\n var mask = this.hi >> 31;\n this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;\n this.lo = ( this.lo << 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Zig-zag decodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzDecode = function zzDecode() {\n var mask = -(this.lo & 1);\n this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;\n this.hi = ( this.hi >>> 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Calculates the length of this longbits when encoded as a varint.\n * @returns {number} Length\n */\nLongBits.prototype.length = function length() {\n var part0 = this.lo,\n part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,\n part2 = this.hi >>> 24;\n return part2 === 0\n ? part1 === 0\n ? part0 < 16384\n ? part0 < 128 ? 1 : 2\n : part0 < 2097152 ? 3 : 4\n : part1 < 16384\n ? part1 < 128 ? 5 : 6\n : part1 < 2097152 ? 7 : 8\n : part2 < 128 ? 9 : 10;\n};\n", "\"use strict\";\nvar util = exports;\n\n// used to return a Promise where callback is omitted\nutil.asPromise = require(\"@protobufjs/aspromise\");\n\n// converts to / from base64 encoded strings\nutil.base64 = require(\"@protobufjs/base64\");\n\n// base class of rpc.Service\nutil.EventEmitter = require(\"@protobufjs/eventemitter\");\n\n// float handling accross browsers\nutil.float = require(\"@protobufjs/float\");\n\n// requires modules optionally and hides the call from bundlers\nutil.inquire = require(\"@protobufjs/inquire\");\n\n// converts to / from utf8 encoded strings\nutil.utf8 = require(\"@protobufjs/utf8\");\n\n// provides a node-like buffer pool in the browser\nutil.pool = require(\"@protobufjs/pool\");\n\n// utility to work with the low and high bits of a 64 bit value\nutil.LongBits = require(\"./longbits\");\n\n/**\n * Whether running within node or not.\n * @memberof util\n * @type {boolean}\n */\nutil.isNode = Boolean(typeof global !== \"undefined\"\n && global\n && global.process\n && global.process.versions\n && global.process.versions.node);\n\n/**\n * Global object reference.\n * @memberof util\n * @type {Object}\n */\nutil.global = util.isNode && global\n || typeof window !== \"undefined\" && window\n || typeof self !== \"undefined\" && self\n || this; // eslint-disable-line no-invalid-this\n\n/**\n * An immuable empty array.\n * @memberof util\n * @type {Array.<*>}\n * @const\n */\nutil.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes\n\n/**\n * An immutable empty object.\n * @type {Object}\n * @const\n */\nutil.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes\n\n/**\n * Tests if the specified value is an integer.\n * @function\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is an integer\n */\nutil.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) {\n return typeof value === \"number\" && isFinite(value) && Math.floor(value) === value;\n};\n\n/**\n * Tests if the specified value is a string.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a string\n */\nutil.isString = function isString(value) {\n return typeof value === \"string\" || value instanceof String;\n};\n\n/**\n * Tests if the specified value is a non-null object.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a non-null object\n */\nutil.isObject = function isObject(value) {\n return value && typeof value === \"object\";\n};\n\n/**\n * Checks if a property on a message is considered to be present.\n * This is an alias of {@link util.isSet}.\n * @function\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isset =\n\n/**\n * Checks if a property on a message is considered to be present.\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isSet = function isSet(obj, prop) {\n var value = obj[prop];\n if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins\n return typeof value !== \"object\" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;\n return false;\n};\n\n/**\n * Any compatible Buffer instance.\n * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.\n * @interface Buffer\n * @extends Uint8Array\n */\n\n/**\n * Node's Buffer class if available.\n * @type {Constructor<Buffer>}\n */\nutil.Buffer = (function() {\n try {\n var Buffer = util.inquire(\"buffer\").Buffer;\n // refuse to use non-node buffers if not explicitly assigned (perf reasons):\n return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null;\n } catch (e) {\n /* istanbul ignore next */\n return null;\n }\n})();\n\n// Internal alias of or polyfull for Buffer.from.\nutil._Buffer_from = null;\n\n// Internal alias of or polyfill for Buffer.allocUnsafe.\nutil._Buffer_allocUnsafe = null;\n\n/**\n * Creates a new buffer of whatever type supported by the environment.\n * @param {number|number[]} [sizeOrArray=0] Buffer size or number array\n * @returns {Uint8Array|Buffer} Buffer\n */\nutil.newBuffer = function newBuffer(sizeOrArray) {\n /* istanbul ignore next */\n return typeof sizeOrArray === \"number\"\n ? util.Buffer\n ? util._Buffer_allocUnsafe(sizeOrArray)\n : new util.Array(sizeOrArray)\n : util.Buffer\n ? util._Buffer_from(sizeOrArray)\n : typeof Uint8Array === \"undefined\"\n ? sizeOrArray\n : new Uint8Array(sizeOrArray);\n};\n\n/**\n * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.\n * @type {Constructor<Uint8Array>}\n */\nutil.Array = typeof Uint8Array !== \"undefined\" ? Uint8Array /* istanbul ignore next */ : Array;\n\n/**\n * Any compatible Long instance.\n * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js.\n * @interface Long\n * @property {number} low Low bits\n * @property {number} high High bits\n * @property {boolean} unsigned Whether unsigned or not\n */\n\n/**\n * Long.js's Long class if available.\n * @type {Constructor<Long>}\n */\nutil.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long\n || /* istanbul ignore next */ util.global.Long\n || util.inquire(\"long\");\n\n/**\n * Regular expression used to verify 2 bit (`bool`) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key2Re = /^true|false|0|1$/;\n\n/**\n * Regular expression used to verify 32 bit (`int32` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key32Re = /^-?(?:0|[1-9][0-9]*)$/;\n\n/**\n * Regular expression used to verify 64 bit (`int64` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key64Re = /^(?:[\\\\x00-\\\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;\n\n/**\n * Converts a number or long to an 8 characters long hash string.\n * @param {Long|number} value Value to convert\n * @returns {string} Hash\n */\nutil.longToHash = function longToHash(value) {\n return value\n ? util.LongBits.from(value).toHash()\n : util.LongBits.zeroHash;\n};\n\n/**\n * Converts an 8 characters long hash string to a long or number.\n * @param {string} hash Hash\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long|number} Original value\n */\nutil.longFromHash = function longFromHash(hash, unsigned) {\n var bits = util.LongBits.fromHash(hash);\n if (util.Long)\n return util.Long.fromBits(bits.lo, bits.hi, unsigned);\n return bits.toNumber(Boolean(unsigned));\n};\n\n/**\n * Merges the properties of the source object into the destination object.\n * @memberof util\n * @param {Object.<string,*>} dst Destination object\n * @param {Object.<string,*>} src Source object\n * @param {boolean} [ifNotSet=false] Merges only if the key is not already set\n * @returns {Object.<string,*>} Destination object\n */\nfunction merge(dst, src, ifNotSet) { // used by converters\n for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)\n if (dst[keys[i]] === undefined || !ifNotSet)\n dst[keys[i]] = src[keys[i]];\n return dst;\n}\n\nutil.merge = merge;\n\n/**\n * Converts the first character of a string to lower case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.lcFirst = function lcFirst(str) {\n return str.charAt(0).toLowerCase() + str.substring(1);\n};\n\n/**\n * Creates a custom error constructor.\n * @memberof util\n * @param {string} name Error name\n * @returns {Constructor<Error>} Custom error constructor\n */\nfunction newError(name) {\n\n function CustomError(message, properties) {\n\n if (!(this instanceof CustomError))\n return new CustomError(message, properties);\n\n // Error.call(this, message);\n // ^ just returns a new error instance because the ctor can be called as a function\n\n Object.defineProperty(this, \"message\", { get: function() { return message; } });\n\n /* istanbul ignore next */\n if (Error.captureStackTrace) // node\n Error.captureStackTrace(this, CustomError);\n else\n Object.defineProperty(this, \"stack\", { value: new Error().stack || \"\" });\n\n if (properties)\n merge(this, properties);\n }\n\n CustomError.prototype = Object.create(Error.prototype, {\n constructor: {\n value: CustomError,\n writable: true,\n enumerable: false,\n configurable: true,\n },\n name: {\n get: function get() { return name; },\n set: undefined,\n enumerable: false,\n // configurable: false would accurately preserve the behavior of\n // the original, but I'm guessing that was not intentional.\n // For an actual error subclass, this property would\n // be configurable.\n configurable: true,\n },\n toString: {\n value: function value() { return this.name + \": \" + this.message; },\n writable: true,\n enumerable: false,\n configurable: true,\n },\n });\n\n return CustomError;\n}\n\nutil.newError = newError;\n\n/**\n * Constructs a new protocol error.\n * @classdesc Error subclass indicating a protocol specifc error.\n * @memberof util\n * @extends Error\n * @template T extends Message<T>\n * @constructor\n * @param {string} message Error message\n * @param {Object.<string,*>} [properties] Additional properties\n * @example\n * try {\n * MyMessage.decode(someBuffer); // throws if required fields are missing\n * } catch (e) {\n * if (e instanceof ProtocolError && e.instance)\n * console.log(\"decoded so far: \" + JSON.stringify(e.instance));\n * }\n */\nutil.ProtocolError = newError(\"ProtocolError\");\n\n/**\n * So far decoded message instance.\n * @name util.ProtocolError#instance\n * @type {Message<T>}\n */\n\n/**\n * A OneOf getter as returned by {@link util.oneOfGetter}.\n * @typedef OneOfGetter\n * @type {function}\n * @returns {string|undefined} Set field name, if any\n */\n\n/**\n * Builds a getter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfGetter} Unbound getter\n */\nutil.oneOfGetter = function getOneOf(fieldNames) {\n var fieldMap = {};\n for (var i = 0; i < fieldNames.length; ++i)\n fieldMap[fieldNames[i]] = 1;\n\n /**\n * @returns {string|undefined} Set field name, if any\n * @this Object\n * @ignore\n */\n return function() { // eslint-disable-line consistent-return\n for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)\n if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)\n return keys[i];\n };\n};\n\n/**\n * A OneOf setter as returned by {@link util.oneOfSetter}.\n * @typedef OneOfSetter\n * @type {function}\n * @param {string|undefined} value Field name\n * @returns {undefined}\n */\n\n/**\n * Builds a setter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfSetter} Unbound setter\n */\nutil.oneOfSetter = function setOneOf(fieldNames) {\n\n /**\n * @param {string} name Field name\n * @returns {undefined}\n * @this Object\n * @ignore\n */\n return function(name) {\n for (var i = 0; i < fieldNames.length; ++i)\n if (fieldNames[i] !== name)\n delete this[fieldNames[i]];\n };\n};\n\n/**\n * Default conversion options used for {@link Message#toJSON} implementations.\n *\n * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:\n *\n * - Longs become strings\n * - Enums become string keys\n * - Bytes become base64 encoded strings\n * - (Sub-)Messages become plain objects\n * - Maps become plain objects with all string keys\n * - Repeated fields become arrays\n * - NaN and Infinity for float and double fields become strings\n *\n * @type {IConversionOptions}\n * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json\n */\nutil.toJSONOptions = {\n longs: String,\n enums: String,\n bytes: String,\n json: true\n};\n\n// Sets up buffer utility according to the environment (called in index-minimal)\nutil._configure = function() {\n var Buffer = util.Buffer;\n /* istanbul ignore if */\n if (!Buffer) {\n util._Buffer_from = util._Buffer_allocUnsafe = null;\n return;\n }\n // because node 4.x buffers are incompatible & immutable\n // see: https://github.com/dcodeIO/protobuf.js/pull/665\n util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||\n /* istanbul ignore next */\n function Buffer_from(value, encoding) {\n return new Buffer(value, encoding);\n };\n util._Buffer_allocUnsafe = Buffer.allocUnsafe ||\n /* istanbul ignore next */\n function Buffer_allocUnsafe(size) {\n return new Buffer(size);\n };\n};\n", "\"use strict\";\nmodule.exports = Writer;\n\nvar util = require(\"./util/minimal\");\n\nvar BufferWriter; // cyclic\n\nvar LongBits = util.LongBits,\n base64 = util.base64,\n utf8 = util.utf8;\n\n/**\n * Constructs a new writer operation instance.\n * @classdesc Scheduled writer operation.\n * @constructor\n * @param {function(*, Uint8Array, number)} fn Function to call\n * @param {number} len Value byte length\n * @param {*} val Value to write\n * @ignore\n */\nfunction Op(fn, len, val) {\n\n /**\n * Function to call.\n * @type {function(Uint8Array, number, *)}\n */\n this.fn = fn;\n\n /**\n * Value byte length.\n * @type {number}\n */\n this.len = len;\n\n /**\n * Next operation.\n * @type {Writer.Op|undefined}\n */\n this.next = undefined;\n\n /**\n * Value to write.\n * @type {*}\n */\n this.val = val; // type varies\n}\n\n/* istanbul ignore next */\nfunction noop() {} // eslint-disable-line no-empty-function\n\n/**\n * Constructs a new writer state instance.\n * @classdesc Copied writer state.\n * @memberof Writer\n * @constructor\n * @param {Writer} writer Writer to copy state from\n * @ignore\n */\nfunction State(writer) {\n\n /**\n * Current head.\n * @type {Writer.Op}\n */\n this.head = writer.head;\n\n /**\n * Current tail.\n * @type {Writer.Op}\n */\n this.tail = writer.tail;\n\n /**\n * Current buffer length.\n * @type {number}\n */\n this.len = writer.len;\n\n /**\n * Next state.\n * @type {State|null}\n */\n this.next = writer.states;\n}\n\n/**\n * Constructs a new writer instance.\n * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n */\nfunction Writer() {\n\n /**\n * Current length.\n * @type {number}\n */\n this.len = 0;\n\n /**\n * Operations head.\n * @type {Object}\n */\n this.head = new Op(noop, 0, 0);\n\n /**\n * Operations tail\n * @type {Object}\n */\n this.tail = this.head;\n\n /**\n * Linked forked states.\n * @type {Object|null}\n */\n this.states = null;\n\n // When a value is written, the writer calculates its byte length and puts it into a linked\n // list of operations to perform when finish() is called. This both allows us to allocate\n // buffers of the exact required size and reduces the amount of work we have to do compared\n // to first calculating over objects and then encoding over objects. In our case, the encoding\n // part is just a linked list walk calling operations with already prepared values.\n}\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup() {\n return (Writer.create = function create_buffer() {\n return new BufferWriter();\n })();\n }\n /* istanbul ignore next */\n : function create_array() {\n return new Writer();\n };\n};\n\n/**\n * Creates a new writer.\n * @function\n * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer}\n */\nWriter.create = create();\n\n/**\n * Allocates a buffer of the specified size.\n * @param {number} size Buffer size\n * @returns {Uint8Array} Buffer\n */\nWriter.alloc = function alloc(size) {\n return new util.Array(size);\n};\n\n// Use Uint8Array buffer pool in the browser, just like node does with buffers\n/* istanbul ignore else */\nif (util.Array !== Array)\n Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);\n\n/**\n * Pushes a new operation to the queue.\n * @param {function(Uint8Array, number, *)} fn Function to call\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @returns {Writer} `this`\n * @private\n */\nWriter.prototype._push = function push(fn, len, val) {\n this.tail = this.tail.next = new Op(fn, len, val);\n this.len += len;\n return this;\n};\n\nfunction writeByte(val, buf, pos) {\n buf[pos] = val & 255;\n}\n\nfunction writeVarint32(val, buf, pos) {\n while (val > 127) {\n buf[pos++] = val & 127 | 128;\n val >>>= 7;\n }\n buf[pos] = val;\n}\n\n/**\n * Constructs a new varint writer operation instance.\n * @classdesc Scheduled varint writer operation.\n * @extends Op\n * @constructor\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @ignore\n */\nfunction VarintOp(len, val) {\n this.len = len;\n this.next = undefined;\n this.val = val;\n}\n\nVarintOp.prototype = Object.create(Op.prototype);\nVarintOp.prototype.fn = writeVarint32;\n\n/**\n * Writes an unsigned 32 bit value as a varint.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.uint32 = function write_uint32(value) {\n // here, the call to this.push has been inlined and a varint specific Op subclass is used.\n // uint32 is by far the most frequently used operation and benefits significantly from this.\n this.len += (this.tail = this.tail.next = new VarintOp(\n (value = value >>> 0)\n < 128 ? 1\n : value < 16384 ? 2\n : value < 2097152 ? 3\n : value < 268435456 ? 4\n : 5,\n value)).len;\n return this;\n};\n\n/**\n * Writes a signed 32 bit value as a varint.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.int32 = function write_int32(value) {\n return value < 0\n ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec\n : this.uint32(value);\n};\n\n/**\n * Writes a 32 bit value as a varint, zig-zag encoded.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sint32 = function write_sint32(value) {\n return this.uint32((value << 1 ^ value >> 31) >>> 0);\n};\n\nfunction writeVarint64(val, buf, pos) {\n while (val.hi) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;\n val.hi >>>= 7;\n }\n while (val.lo > 127) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = val.lo >>> 7;\n }\n buf[pos++] = val.lo;\n}\n\n/**\n * Writes an unsigned 64 bit value as a varint.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.uint64 = function write_uint64(value) {\n var bits = LongBits.from(value);\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a signed 64 bit value as a varint.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.int64 = Writer.prototype.uint64;\n\n/**\n * Writes a signed 64 bit value as a varint, zig-zag encoded.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sint64 = function write_sint64(value) {\n var bits = LongBits.from(value).zzEncode();\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a boolish value as a varint.\n * @param {boolean} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bool = function write_bool(value) {\n return this._push(writeByte, 1, value ? 1 : 0);\n};\n\nfunction writeFixed32(val, buf, pos) {\n buf[pos ] = val & 255;\n buf[pos + 1] = val >>> 8 & 255;\n buf[pos + 2] = val >>> 16 & 255;\n buf[pos + 3] = val >>> 24;\n}\n\n/**\n * Writes an unsigned 32 bit value as fixed 32 bits.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.fixed32 = function write_fixed32(value) {\n return this._push(writeFixed32, 4, value >>> 0);\n};\n\n/**\n * Writes a signed 32 bit value as fixed 32 bits.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sfixed32 = Writer.prototype.fixed32;\n\n/**\n * Writes an unsigned 64 bit value as fixed 64 bits.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.fixed64 = function write_fixed64(value) {\n var bits = LongBits.from(value);\n return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);\n};\n\n/**\n * Writes a signed 64 bit value as fixed 64 bits.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sfixed64 = Writer.prototype.fixed64;\n\n/**\n * Writes a float (32 bit).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.float = function write_float(value) {\n return this._push(util.float.writeFloatLE, 4, value);\n};\n\n/**\n * Writes a double (64 bit float).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.double = function write_double(value) {\n return this._push(util.float.writeDoubleLE, 8, value);\n};\n\nvar writeBytes = util.Array.prototype.set\n ? function writeBytes_set(val, buf, pos) {\n buf.set(val, pos); // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytes_for(val, buf, pos) {\n for (var i = 0; i < val.length; ++i)\n buf[pos + i] = val[i];\n };\n\n/**\n * Writes a sequence of bytes.\n * @param {Uint8Array|string} value Buffer or base64 encoded string to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bytes = function write_bytes(value) {\n var len = value.length >>> 0;\n if (!len)\n return this._push(writeByte, 1, 0);\n if (util.isString(value)) {\n var buf = Writer.alloc(len = base64.length(value));\n base64.decode(value, buf, 0);\n value = buf;\n }\n return this.uint32(len)._push(writeBytes, len, value);\n};\n\n/**\n * Writes a string.\n * @param {string} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.string = function write_string(value) {\n var len = utf8.length(value);\n return len\n ? this.uint32(len)._push(utf8.write, len, value)\n : this._push(writeByte, 1, 0);\n};\n\n/**\n * Forks this writer's state by pushing it to a stack.\n * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.\n * @returns {Writer} `this`\n */\nWriter.prototype.fork = function fork() {\n this.states = new State(this);\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n return this;\n};\n\n/**\n * Resets this instance to the last state.\n * @returns {Writer} `this`\n */\nWriter.prototype.reset = function reset() {\n if (this.states) {\n this.head = this.states.head;\n this.tail = this.states.tail;\n this.len = this.states.len;\n this.states = this.states.next;\n } else {\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n }\n return this;\n};\n\n/**\n * Resets to the last state and appends the fork state's current write length as a varint followed by its operations.\n * @returns {Writer} `this`\n */\nWriter.prototype.ldelim = function ldelim() {\n var head = this.head,\n tail = this.tail,\n len = this.len;\n this.reset().uint32(len);\n if (len) {\n this.tail.next = head.next; // skip noop\n this.tail = tail;\n this.len += len;\n }\n return this;\n};\n\n/**\n * Finishes the write operation.\n * @returns {Uint8Array} Finished buffer\n */\nWriter.prototype.finish = function finish() {\n var head = this.head.next, // skip noop\n buf = this.constructor.alloc(this.len),\n pos = 0;\n while (head) {\n head.fn(head.val, buf, pos);\n pos += head.len;\n head = head.next;\n }\n // this.head = this.tail = null;\n return buf;\n};\n\nWriter._configure = function(BufferWriter_) {\n BufferWriter = BufferWriter_;\n Writer.create = create();\n BufferWriter._configure();\n};\n", "\"use strict\";\nmodule.exports = BufferWriter;\n\n// extends Writer\nvar Writer = require(\"./writer\");\n(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;\n\nvar util = require(\"./util/minimal\");\n\n/**\n * Constructs a new buffer writer instance.\n * @classdesc Wire format writer using node buffers.\n * @extends Writer\n * @constructor\n */\nfunction BufferWriter() {\n Writer.call(this);\n}\n\nBufferWriter._configure = function () {\n /**\n * Allocates a buffer of the specified size.\n * @function\n * @param {number} size Buffer size\n * @returns {Buffer} Buffer\n */\n BufferWriter.alloc = util._Buffer_allocUnsafe;\n\n BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === \"set\"\n ? function writeBytesBuffer_set(val, buf, pos) {\n buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited)\n // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytesBuffer_copy(val, buf, pos) {\n if (val.copy) // Buffer values\n val.copy(buf, pos, 0, val.length);\n else for (var i = 0; i < val.length;) // plain array values\n buf[pos++] = val[i++];\n };\n};\n\n\n/**\n * @override\n */\nBufferWriter.prototype.bytes = function write_bytes_buffer(value) {\n if (util.isString(value))\n value = util._Buffer_from(value, \"base64\");\n var len = value.length >>> 0;\n this.uint32(len);\n if (len)\n this._push(BufferWriter.writeBytesBuffer, len, value);\n return this;\n};\n\nfunction writeStringBuffer(val, buf, pos) {\n if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions)\n util.utf8.write(val, buf, pos);\n else if (buf.utf8Write)\n buf.utf8Write(val, pos);\n else\n buf.write(val, pos);\n}\n\n/**\n * @override\n */\nBufferWriter.prototype.string = function write_string_buffer(value) {\n var len = util.Buffer.byteLength(value);\n this.uint32(len);\n if (len)\n this._push(writeStringBuffer, len, value);\n return this;\n};\n\n\n/**\n * Finishes the write operation.\n * @name BufferWriter#finish\n * @function\n * @returns {Buffer} Finished buffer\n */\n\nBufferWriter._configure();\n", "\"use strict\";\nmodule.exports = Reader;\n\nvar util = require(\"./util/minimal\");\n\nvar BufferReader; // cyclic\n\nvar LongBits = util.LongBits,\n utf8 = util.utf8;\n\n/* istanbul ignore next */\nfunction indexOutOfRange(reader, writeLength) {\n return RangeError(\"index out of range: \" + reader.pos + \" + \" + (writeLength || 1) + \" > \" + reader.len);\n}\n\n/**\n * Constructs a new reader instance using the specified buffer.\n * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n * @param {Uint8Array} buffer Buffer to read from\n */\nfunction Reader(buffer) {\n\n /**\n * Read buffer.\n * @type {Uint8Array}\n */\n this.buf = buffer;\n\n /**\n * Read buffer position.\n * @type {number}\n */\n this.pos = 0;\n\n /**\n * Read buffer length.\n * @type {number}\n */\n this.len = buffer.length;\n}\n\nvar create_array = typeof Uint8Array !== \"undefined\"\n ? function create_typed_array(buffer) {\n if (buffer instanceof Uint8Array || Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n }\n /* istanbul ignore next */\n : function create_array(buffer) {\n if (Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n };\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup(buffer) {\n return (Reader.create = function create_buffer(buffer) {\n return util.Buffer.isBuffer(buffer)\n ? new BufferReader(buffer)\n /* istanbul ignore next */\n : create_array(buffer);\n })(buffer);\n }\n /* istanbul ignore next */\n : create_array;\n};\n\n/**\n * Creates a new reader using the specified buffer.\n * @function\n * @param {Uint8Array|Buffer} buffer Buffer to read from\n * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader}\n * @throws {Error} If `buffer` is not a valid buffer\n */\nReader.create = create();\n\nReader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice;\n\n/**\n * Reads a varint as an unsigned 32 bit value.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.uint32 = (function read_uint32_setup() {\n var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!)\n return function read_uint32() {\n value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;\n\n /* istanbul ignore if */\n if ((this.pos += 5) > this.len) {\n this.pos = this.len;\n throw indexOutOfRange(this, 10);\n }\n return value;\n };\n})();\n\n/**\n * Reads a varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.int32 = function read_int32() {\n return this.uint32() | 0;\n};\n\n/**\n * Reads a zig-zag encoded varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.sint32 = function read_sint32() {\n var value = this.uint32();\n return value >>> 1 ^ -(value & 1) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readLongVarint() {\n // tends to deopt with local vars for octet etc.\n var bits = new LongBits(0, 0);\n var i = 0;\n if (this.len - this.pos > 4) { // fast route (lo)\n for (; i < 4; ++i) {\n // 1st..4th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 5th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n i = 0;\n } else {\n for (; i < 3; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 1st..3th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 4th\n bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;\n return bits;\n }\n if (this.len - this.pos > 4) { // fast route (hi)\n for (; i < 5; ++i) {\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n } else {\n for (; i < 5; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n }\n /* istanbul ignore next */\n throw Error(\"invalid varint encoding\");\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads a varint as a signed 64 bit value.\n * @name Reader#int64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as an unsigned 64 bit value.\n * @name Reader#uint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a zig-zag encoded varint as a signed 64 bit value.\n * @name Reader#sint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as a boolean.\n * @returns {boolean} Value read\n */\nReader.prototype.bool = function read_bool() {\n return this.uint32() !== 0;\n};\n\nfunction readFixed32_end(buf, end) { // note that this uses `end`, not `pos`\n return (buf[end - 4]\n | buf[end - 3] << 8\n | buf[end - 2] << 16\n | buf[end - 1] << 24) >>> 0;\n}\n\n/**\n * Reads fixed 32 bits as an unsigned 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.fixed32 = function read_fixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4);\n};\n\n/**\n * Reads fixed 32 bits as a signed 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.sfixed32 = function read_sfixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readFixed64(/* this: Reader */) {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 8);\n\n return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads fixed 64 bits.\n * @name Reader#fixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads zig-zag encoded fixed 64 bits.\n * @name Reader#sfixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a float (32 bit) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.float = function read_float() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readFloatLE(this.buf, this.pos);\n this.pos += 4;\n return value;\n};\n\n/**\n * Reads a double (64 bit float) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.double = function read_double() {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readDoubleLE(this.buf, this.pos);\n this.pos += 8;\n return value;\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @returns {Uint8Array} Value read\n */\nReader.prototype.bytes = function read_bytes() {\n var length = this.uint32(),\n start = this.pos,\n end = this.pos + length;\n\n /* istanbul ignore if */\n if (end > this.len)\n throw indexOutOfRange(this, length);\n\n this.pos += length;\n if (Array.isArray(this.buf)) // plain array\n return this.buf.slice(start, end);\n\n if (start === end) { // fix for IE 10/Win8 and others' subarray returning array of size 1\n var nativeBuffer = util.Buffer;\n return nativeBuffer\n ? nativeBuffer.alloc(0)\n : new this.buf.constructor(0);\n }\n return this._slice.call(this.buf, start, end);\n};\n\n/**\n * Reads a string preceeded by its byte length as a varint.\n * @returns {string} Value read\n */\nReader.prototype.string = function read_string() {\n var bytes = this.bytes();\n return utf8.read(bytes, 0, bytes.length);\n};\n\n/**\n * Skips the specified number of bytes if specified, otherwise skips a varint.\n * @param {number} [length] Length if known, otherwise a varint is assumed\n * @returns {Reader} `this`\n */\nReader.prototype.skip = function skip(length) {\n if (typeof length === \"number\") {\n /* istanbul ignore if */\n if (this.pos + length > this.len)\n throw indexOutOfRange(this, length);\n this.pos += length;\n } else {\n do {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n } while (this.buf[this.pos++] & 128);\n }\n return this;\n};\n\n/**\n * Skips the next element of the specified wire type.\n * @param {number} wireType Wire type received\n * @returns {Reader} `this`\n */\nReader.prototype.skipType = function(wireType) {\n switch (wireType) {\n case 0:\n this.skip();\n break;\n case 1:\n this.skip(8);\n break;\n case 2:\n this.skip(this.uint32());\n break;\n case 3:\n while ((wireType = this.uint32() & 7) !== 4) {\n this.skipType(wireType);\n }\n break;\n case 5:\n this.skip(4);\n break;\n\n /* istanbul ignore next */\n default:\n throw Error(\"invalid wire type \" + wireType + \" at offset \" + this.pos);\n }\n return this;\n};\n\nReader._configure = function(BufferReader_) {\n BufferReader = BufferReader_;\n Reader.create = create();\n BufferReader._configure();\n\n var fn = util.Long ? \"toLong\" : /* istanbul ignore next */ \"toNumber\";\n util.merge(Reader.prototype, {\n\n int64: function read_int64() {\n return readLongVarint.call(this)[fn](false);\n },\n\n uint64: function read_uint64() {\n return readLongVarint.call(this)[fn](true);\n },\n\n sint64: function read_sint64() {\n return readLongVarint.call(this).zzDecode()[fn](false);\n },\n\n fixed64: function read_fixed64() {\n return readFixed64.call(this)[fn](true);\n },\n\n sfixed64: function read_sfixed64() {\n return readFixed64.call(this)[fn](false);\n }\n\n });\n};\n", "\"use strict\";\nmodule.exports = BufferReader;\n\n// extends Reader\nvar Reader = require(\"./reader\");\n(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;\n\nvar util = require(\"./util/minimal\");\n\n/**\n * Constructs a new buffer reader instance.\n * @classdesc Wire format reader using node buffers.\n * @extends Reader\n * @constructor\n * @param {Buffer} buffer Buffer to read from\n */\nfunction BufferReader(buffer) {\n Reader.call(this, buffer);\n\n /**\n * Read buffer.\n * @name BufferReader#buf\n * @type {Buffer}\n */\n}\n\nBufferReader._configure = function () {\n /* istanbul ignore else */\n if (util.Buffer)\n BufferReader.prototype._slice = util.Buffer.prototype.slice;\n};\n\n\n/**\n * @override\n */\nBufferReader.prototype.string = function read_string_buffer() {\n var len = this.uint32(); // modifies pos\n return this.buf.utf8Slice\n ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len))\n : this.buf.toString(\"utf-8\", this.pos, this.pos = Math.min(this.pos + len, this.len));\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @name BufferReader#bytes\n * @function\n * @returns {Buffer} Value read\n */\n\nBufferReader._configure();\n", "\"use strict\";\nmodule.exports = Service;\n\nvar util = require(\"../util/minimal\");\n\n// Extends EventEmitter\n(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;\n\n/**\n * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}.\n *\n * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`.\n * @typedef rpc.ServiceMethodCallback\n * @template TRes extends Message<TRes>\n * @type {function}\n * @param {Error|null} error Error, if any\n * @param {TRes} [response] Response message\n * @returns {undefined}\n */\n\n/**\n * A service method part of a {@link rpc.Service} as created by {@link Service.create}.\n * @typedef rpc.ServiceMethod\n * @template TReq extends Message<TReq>\n * @template TRes extends Message<TRes>\n * @type {function}\n * @param {TReq|Properties<TReq>} request Request message or plain object\n * @param {rpc.ServiceMethodCallback<TRes>} [callback] Node-style callback called with the error, if any, and the response message\n * @returns {Promise<Message<TRes>>} Promise if `callback` has been omitted, otherwise `undefined`\n */\n\n/**\n * Constructs a new RPC service instance.\n * @classdesc An RPC service as returned by {@link Service#create}.\n * @exports rpc.Service\n * @extends util.EventEmitter\n * @constructor\n * @param {RPCImpl} rpcImpl RPC implementation\n * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\n * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\n */\nfunction Service(rpcImpl, requestDelimited, responseDelimited) {\n\n if (typeof rpcImpl !== \"function\")\n throw TypeError(\"rpcImpl must be a function\");\n\n util.EventEmitter.call(this);\n\n /**\n * RPC implementation. Becomes `null` once the service is ended.\n * @type {RPCImpl|null}\n */\n this.rpcImpl = rpcImpl;\n\n /**\n * Whether requests are length-delimited.\n * @type {boolean}\n */\n this.requestDelimited = Boolean(requestDelimited);\n\n /**\n * Whether responses are length-delimited.\n * @type {boolean}\n */\n this.responseDelimited = Boolean(responseDelimited);\n}\n\n/**\n * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}.\n * @param {Method|rpc.ServiceMethod<TReq,TRes>} method Reflected or static method\n * @param {Constructor<TReq>} requestCtor Request constructor\n * @param {Constructor<TRes>} responseCtor Response constructor\n * @param {TReq|Properties<TReq>} request Request message or plain object\n * @param {rpc.ServiceMethodCallback<TRes>} callback Service callback\n * @returns {undefined}\n * @template TReq extends Message<TReq>\n * @template TRes extends Message<TRes>\n */\nService.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) {\n\n if (!request)\n throw TypeError(\"request must be specified\");\n\n var self = this;\n if (!callback)\n return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request);\n\n if (!self.rpcImpl) {\n setTimeout(function() { callback(Error(\"already ended\")); }, 0);\n return undefined;\n }\n\n try {\n return self.rpcImpl(\n method,\n requestCtor[self.requestDelimited ? \"encodeDelimited\" : \"encode\"](request).finish(),\n function rpcCallback(err, response) {\n\n if (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n\n if (response === null) {\n self.end(/* endedByRPC */ true);\n return undefined;\n }\n\n if (!(response instanceof responseCtor)) {\n try {\n response = responseCtor[self.responseDelimited ? \"decodeDelimited\" : \"decode\"](response);\n } catch (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n }\n\n self.emit(\"data\", response, method);\n return callback(null, response);\n }\n );\n } catch (err) {\n self.emit(\"error\", err, method);\n setTimeout(function() { callback(err); }, 0);\n return undefined;\n }\n};\n\n/**\n * Ends this service and emits the `end` event.\n * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation.\n * @returns {rpc.Service} `this`\n */\nService.prototype.end = function end(endedByRPC) {\n if (this.rpcImpl) {\n if (!endedByRPC) // signal end to rpcImpl\n this.rpcImpl(null, null, null);\n this.rpcImpl = null;\n this.emit(\"end\").off();\n }\n return this;\n};\n", "\"use strict\";\n\n/**\n * Streaming RPC helpers.\n * @namespace\n */\nvar rpc = exports;\n\n/**\n * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets.\n * @typedef RPCImpl\n * @type {function}\n * @param {Method|rpc.ServiceMethod<Message<{}>,Message<{}>>} method Reflected or static method being called\n * @param {Uint8Array} requestData Request data\n * @param {RPCImplCallback} callback Callback function\n * @returns {undefined}\n * @example\n * function rpcImpl(method, requestData, callback) {\n * if (protobuf.util.lcFirst(method.name) !== \"myMethod\") // compatible with static code\n * throw Error(\"no such method\");\n * asynchronouslyObtainAResponse(requestData, function(err, responseData) {\n * callback(err, responseData);\n * });\n * }\n */\n\n/**\n * Node-style callback as used by {@link RPCImpl}.\n * @typedef RPCImplCallback\n * @type {function}\n * @param {Error|null} error Error, if any, otherwise `null`\n * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error\n * @returns {undefined}\n */\n\nrpc.Service = require(\"./rpc/service\");\n", "\"use strict\";\nmodule.exports = {};\n\n/**\n * Named roots.\n * This is where pbjs stores generated structures (the option `-r, --root` specifies a name).\n * Can also be used manually to make roots available across modules.\n * @name roots\n * @type {Object.<string,Root>}\n * @example\n * // pbjs -r myroot -o compiled.js ...\n *\n * // in another module:\n * require(\"./compiled.js\");\n *\n * // in any subsequent module:\n * var root = protobuf.roots[\"myroot\"];\n */\n", "\"use strict\";\nvar protobuf = exports;\n\n/**\n * Build type, one of `\"full\"`, `\"light\"` or `\"minimal\"`.\n * @name build\n * @type {string}\n * @const\n */\nprotobuf.build = \"minimal\";\n\n// Serialization\nprotobuf.Writer = require(\"./writer\");\nprotobuf.BufferWriter = require(\"./writer_buffer\");\nprotobuf.Reader = require(\"./reader\");\nprotobuf.BufferReader = require(\"./reader_buffer\");\n\n// Utility\nprotobuf.util = require(\"./util/minimal\");\nprotobuf.rpc = require(\"./rpc\");\nprotobuf.roots = require(\"./roots\");\nprotobuf.configure = configure;\n\n/* istanbul ignore next */\n/**\n * Reconfigures the library according to the environment.\n * @returns {undefined}\n */\nfunction configure() {\n protobuf.util._configure();\n protobuf.Writer._configure(protobuf.BufferWriter);\n protobuf.Reader._configure(protobuf.BufferReader);\n}\n\n// Set up buffer utility according to the environment\nconfigure();\n", "// minimal library entry point.\n\n\"use strict\";\nmodule.exports = require(\"./src/index-minimal\");\n", "/*\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 * as api from '@opentelemetry/api';\nimport {\n InstrumentationLibrary,\n sanitizeAttributes,\n isTracingSuppressed,\n} from '@opentelemetry/core';\nimport { IResource } from '@opentelemetry/resources';\nimport { BasicTracerProvider } from './BasicTracerProvider';\nimport { Span } from './Span';\nimport { GeneralLimits, SpanLimits, TracerConfig } from './types';\nimport { mergeConfig } from './utility';\nimport { SpanProcessor } from './SpanProcessor';\nimport { Sampler } from './Sampler';\nimport { IdGenerator } from './IdGenerator';\nimport { RandomIdGenerator } from './platform';\n\n/**\n * This class represents a basic tracer.\n */\nexport class Tracer implements api.Tracer {\n private readonly _sampler: Sampler;\n private readonly _generalLimits: GeneralLimits;\n private readonly _spanLimits: SpanLimits;\n private readonly _idGenerator: IdGenerator;\n readonly resource: IResource;\n readonly instrumentationLibrary: InstrumentationLibrary;\n\n /**\n * Constructs a new Tracer instance.\n */\n constructor(\n instrumentationLibrary: InstrumentationLibrary,\n config: TracerConfig,\n private _tracerProvider: BasicTracerProvider\n ) {\n const localConfig = mergeConfig(config);\n this._sampler = localConfig.sampler;\n this._generalLimits = localConfig.generalLimits;\n this._spanLimits = localConfig.spanLimits;\n this._idGenerator = config.idGenerator || new RandomIdGenerator();\n this.resource = _tracerProvider.resource;\n this.instrumentationLibrary = instrumentationLibrary;\n }\n\n /**\n * Starts a new Span or returns the default NoopSpan based on the sampling\n * decision.\n */\n startSpan(\n name: string,\n options: api.SpanOptions = {},\n context = api.context.active()\n ): api.Span {\n // remove span from context in case a root span is requested via options\n if (options.root) {\n context = api.trace.deleteSpan(context);\n }\n const parentSpan = api.trace.getSpan(context);\n\n if (isTracingSuppressed(context)) {\n api.diag.debug('Instrumentation suppressed, returning Noop Span');\n const nonRecordingSpan = api.trace.wrapSpanContext(\n api.INVALID_SPAN_CONTEXT\n );\n return nonRecordingSpan;\n }\n\n const parentSpanContext = parentSpan?.spanContext();\n const spanId = this._idGenerator.generateSpanId();\n let traceId;\n let traceState;\n let parentSpanId;\n if (\n !parentSpanContext ||\n !api.trace.isSpanContextValid(parentSpanContext)\n ) {\n // New root span.\n traceId = this._idGenerator.generateTraceId();\n } else {\n // New child span.\n traceId = parentSpanContext.traceId;\n traceState = parentSpanContext.traceState;\n parentSpanId = parentSpanContext.spanId;\n }\n\n const spanKind = options.kind ?? api.SpanKind.INTERNAL;\n const links = (options.links ?? []).map(link => {\n return {\n context: link.context,\n attributes: sanitizeAttributes(link.attributes),\n };\n });\n const attributes = sanitizeAttributes(options.attributes);\n // make sampling decision\n const samplingResult = this._sampler.shouldSample(\n context,\n traceId,\n name,\n spanKind,\n attributes,\n links\n );\n\n traceState = samplingResult.traceState ?? traceState;\n\n const traceFlags =\n samplingResult.decision === api.SamplingDecision.RECORD_AND_SAMPLED\n ? api.TraceFlags.SAMPLED\n : api.TraceFlags.NONE;\n const spanContext = { traceId, spanId, traceFlags, traceState };\n if (samplingResult.decision === api.SamplingDecision.NOT_RECORD) {\n api.diag.debug(\n 'Recording is off, propagating context in a non-recording span'\n );\n const nonRecordingSpan = api.trace.wrapSpanContext(spanContext);\n return nonRecordingSpan;\n }\n\n // Set initial span attributes. The attributes object may have been mutated\n // by the sampler, so we sanitize the merged attributes before setting them.\n const initAttributes = sanitizeAttributes(\n Object.assign(attributes, samplingResult.attributes)\n );\n\n const span = new Span(\n this,\n context,\n name,\n spanContext,\n spanKind,\n parentSpanId,\n links,\n options.startTime,\n undefined,\n initAttributes\n );\n return span;\n }\n\n /**\n * Starts a new {@link Span} and calls the given function passing it the\n * created span as first argument.\n * Additionally the new span gets set in context and this context is activated\n * for the duration of the function call.\n *\n * @param name The name of the span\n * @param [options] SpanOptions used for span creation\n * @param [context] Context to use to extract parent\n * @param fn function called in the context of the span and receives the newly created span as an argument\n * @returns return value of fn\n * @example\n * const something = tracer.startActiveSpan('op', span => {\n * try {\n * do some work\n * span.setStatus({code: SpanStatusCode.OK});\n * return something;\n * } catch (err) {\n * span.setStatus({\n * code: SpanStatusCode.ERROR,\n * message: err.message,\n * });\n * throw err;\n * } finally {\n * span.end();\n * }\n * });\n * @example\n * const span = tracer.startActiveSpan('op', span => {\n * try {\n * do some work\n * return span;\n * } catch (err) {\n * span.setStatus({\n * code: SpanStatusCode.ERROR,\n * message: err.message,\n * });\n * throw err;\n * }\n * });\n * do some more work\n * span.end();\n */\n startActiveSpan<F extends (span: api.Span) => ReturnType<F>>(\n name: string,\n fn: F\n ): ReturnType<F>;\n startActiveSpan<F extends (span: api.Span) => ReturnType<F>>(\n name: string,\n opts: api.SpanOptions,\n fn: F\n ): ReturnType<F>;\n startActiveSpan<F extends (span: api.Span) => ReturnType<F>>(\n name: string,\n opts: api.SpanOptions,\n ctx: api.Context,\n fn: F\n ): ReturnType<F>;\n startActiveSpan<F extends (span: api.Span) => ReturnType<F>>(\n name: string,\n arg2?: F | api.SpanOptions,\n arg3?: F | api.Context,\n arg4?: F\n ): ReturnType<F> | undefined {\n let opts: api.SpanOptions | undefined;\n let ctx: api.Context | undefined;\n let fn: F;\n\n if (arguments.length < 2) {\n return;\n } else if (arguments.length === 2) {\n fn = arg2 as F;\n } else if (arguments.length === 3) {\n opts = arg2 as api.SpanOptions | undefined;\n fn = arg3 as F;\n } else {\n opts = arg2 as api.SpanOptions | undefined;\n ctx = arg3 as api.Context | undefined;\n fn = arg4 as F;\n }\n\n const parentContext = ctx ?? api.context.active();\n const span = this.startSpan(name, opts, parentContext);\n const contextWithSpanSet = api.trace.setSpan(parentContext, span);\n\n return api.context.with(contextWithSpanSet, fn, undefined, span);\n }\n\n /** Returns the active {@link GeneralLimits}. */\n getGeneralLimits(): GeneralLimits {\n return this._generalLimits;\n }\n\n /** Returns the active {@link SpanLimits}. */\n getSpanLimits(): SpanLimits {\n return this._spanLimits;\n }\n\n getActiveSpanProcessor(): SpanProcessor {\n return this._tracerProvider.getActiveSpanProcessor();\n }\n}\n", "/*\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 {\n Context,\n diag,\n Exception,\n HrTime,\n Link,\n Span as APISpan,\n SpanAttributes,\n SpanAttributeValue,\n SpanContext,\n SpanKind,\n SpanStatus,\n SpanStatusCode,\n TimeInput,\n} from '@opentelemetry/api';\nimport {\n addHrTimes,\n millisToHrTime,\n getTimeOrigin,\n hrTime,\n hrTimeDuration,\n InstrumentationLibrary,\n isAttributeValue,\n isTimeInput,\n isTimeInputHrTime,\n otperformance,\n sanitizeAttributes,\n} from '@opentelemetry/core';\nimport { IResource } from '@opentelemetry/resources';\nimport { SemanticAttributes } from '@opentelemetry/semantic-conventions';\nimport { ExceptionEventName } from './enums';\nimport { ReadableSpan } from './export/ReadableSpan';\nimport { SpanProcessor } from './SpanProcessor';\nimport { TimedEvent } from './TimedEvent';\nimport { Tracer } from './Tracer';\nimport { SpanLimits } from './types';\n\n/**\n * This class represents a span.\n */\nexport class Span implements APISpan, ReadableSpan {\n // Below properties are included to implement ReadableSpan for export\n // purposes but are not intended to be written-to directly.\n private readonly _spanContext: SpanContext;\n readonly kind: SpanKind;\n readonly parentSpanId?: string;\n readonly attributes: SpanAttributes = {};\n readonly links: Link[] = [];\n readonly events: TimedEvent[] = [];\n readonly startTime: HrTime;\n readonly resource: IResource;\n readonly instrumentationLibrary: InstrumentationLibrary;\n\n private _droppedAttributesCount = 0;\n private _droppedEventsCount: number = 0;\n private _droppedLinksCount: number = 0;\n\n name: string;\n status: SpanStatus = {\n code: SpanStatusCode.UNSET,\n };\n endTime: HrTime = [0, 0];\n private _ended = false;\n private _duration: HrTime = [-1, -1];\n private readonly _spanProcessor: SpanProcessor;\n private readonly _spanLimits: SpanLimits;\n private readonly _attributeValueLengthLimit: number;\n\n private readonly _performanceStartTime: number;\n private readonly _performanceOffset: number;\n private readonly _startTimeProvided: boolean;\n\n /**\n * Constructs a new Span instance.\n *\n * @deprecated calling Span constructor directly is not supported. Please use tracer.startSpan.\n * */\n constructor(\n parentTracer: Tracer,\n context: Context,\n spanName: string,\n spanContext: SpanContext,\n kind: SpanKind,\n parentSpanId?: string,\n links: Link[] = [],\n startTime?: TimeInput,\n _deprecatedClock?: unknown, // keeping this argument even though it is unused to ensure backwards compatibility\n attributes?: SpanAttributes\n ) {\n this.name = spanName;\n this._spanContext = spanContext;\n this.parentSpanId = parentSpanId;\n this.kind = kind;\n this.links = links;\n\n const now = Date.now();\n this._performanceStartTime = otperformance.now();\n this._performanceOffset =\n now - (this._performanceStartTime + getTimeOrigin());\n this._startTimeProvided = startTime != null;\n\n this.startTime = this._getTime(startTime ?? now);\n\n this.resource = parentTracer.resource;\n this.instrumentationLibrary = parentTracer.instrumentationLibrary;\n this._spanLimits = parentTracer.getSpanLimits();\n\n if (attributes != null) {\n this.setAttributes(attributes);\n }\n\n this._spanProcessor = parentTracer.getActiveSpanProcessor();\n this._spanProcessor.onStart(this, context);\n this._attributeValueLengthLimit =\n this._spanLimits.attributeValueLengthLimit || 0;\n }\n\n spanContext(): SpanContext {\n return this._spanContext;\n }\n\n setAttribute(key: string, value?: SpanAttributeValue): this;\n setAttribute(key: string, value: unknown): this {\n if (value == null || this._isSpanEnded()) return this;\n if (key.length === 0) {\n diag.warn(`Invalid attribute key: ${key}`);\n return this;\n }\n if (!isAttributeValue(value)) {\n diag.warn(`Invalid attribute value set for key: ${key}`);\n return this;\n }\n\n if (\n Object.keys(this.attributes).length >=\n this._spanLimits.attributeCountLimit! &&\n !Object.prototype.hasOwnProperty.call(this.attributes, key)\n ) {\n this._droppedAttributesCount++;\n return this;\n }\n this.attributes[key] = this._truncateToSize(value);\n return this;\n }\n\n setAttributes(attributes: SpanAttributes): this {\n for (const [k, v] of Object.entries(attributes)) {\n this.setAttribute(k, v);\n }\n return this;\n }\n\n /**\n *\n * @param name Span Name\n * @param [attributesOrStartTime] Span attributes or start time\n * if type is {@type TimeInput} and 3rd param is undefined\n * @param [timeStamp] Specified time stamp for the event\n */\n addEvent(\n name: string,\n attributesOrStartTime?: SpanAttributes | TimeInput,\n timeStamp?: TimeInput\n ): this {\n if (this._isSpanEnded()) return this;\n if (this._spanLimits.eventCountLimit === 0) {\n diag.warn('No events allowed.');\n this._droppedEventsCount++;\n return this;\n }\n if (this.events.length >= this._spanLimits.eventCountLimit!) {\n diag.warn('Dropping extra events.');\n this.events.shift();\n this._droppedEventsCount++;\n }\n\n if (isTimeInput(attributesOrStartTime)) {\n if (!isTimeInput(timeStamp)) {\n timeStamp = attributesOrStartTime;\n }\n attributesOrStartTime = undefined;\n }\n\n const attributes = sanitizeAttributes(attributesOrStartTime);\n\n this.events.push({\n name,\n attributes,\n time: this._getTime(timeStamp),\n droppedAttributesCount: 0,\n });\n return this;\n }\n\n setStatus(status: SpanStatus): this {\n if (this._isSpanEnded()) return this;\n this.status = status;\n return this;\n }\n\n updateName(name: string): this {\n if (this._isSpanEnded()) return this;\n this.name = name;\n return this;\n }\n\n end(endTime?: TimeInput): void {\n if (this._isSpanEnded()) {\n diag.error(\n `${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`\n );\n return;\n }\n this._ended = true;\n\n this.endTime = this._getTime(endTime);\n this._duration = hrTimeDuration(this.startTime, this.endTime);\n\n if (this._duration[0] < 0) {\n diag.warn(\n 'Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.',\n this.startTime,\n this.endTime\n );\n this.endTime = this.startTime.slice() as HrTime;\n this._duration = [0, 0];\n }\n\n this._spanProcessor.onEnd(this);\n }\n\n private _getTime(inp?: TimeInput): HrTime {\n if (typeof inp === 'number' && inp < otperformance.now()) {\n // must be a performance timestamp\n // apply correction and convert to hrtime\n return hrTime(inp + this._performanceOffset);\n }\n\n if (typeof inp === 'number') {\n return millisToHrTime(inp);\n }\n\n if (inp instanceof Date) {\n return millisToHrTime(inp.getTime());\n }\n\n if (isTimeInputHrTime(inp)) {\n return inp;\n }\n\n if (this._startTimeProvided) {\n // if user provided a time for the start manually\n // we can't use duration to calculate event/end times\n return millisToHrTime(Date.now());\n }\n\n const msDuration = otperformance.now() - this._performanceStartTime;\n return addHrTimes(this.startTime, millisToHrTime(msDuration));\n }\n\n isRecording(): boolean {\n return this._ended === false;\n }\n\n recordException(exception: Exception, time?: TimeInput): void {\n const attributes: SpanAttributes = {};\n if (typeof exception === 'string') {\n attributes[SemanticAttributes.EXCEPTION_MESSAGE] = exception;\n } else if (exception) {\n if (exception.code) {\n attributes[SemanticAttributes.EXCEPTION_TYPE] =\n exception.code.toString();\n } else if (exception.name) {\n attributes[SemanticAttributes.EXCEPTION_TYPE] = exception.name;\n }\n if (exception.message) {\n attributes[SemanticAttributes.EXCEPTION_MESSAGE] = exception.message;\n }\n if (exception.stack) {\n attributes[SemanticAttributes.EXCEPTION_STACKTRACE] = exception.stack;\n }\n }\n\n // these are minimum requirements from spec\n if (\n attributes[SemanticAttributes.EXCEPTION_TYPE] ||\n attributes[SemanticAttributes.EXCEPTION_MESSAGE]\n ) {\n this.addEvent(ExceptionEventName, attributes, time);\n } else {\n diag.warn(`Failed to record an exception ${exception}`);\n }\n }\n\n get duration(): HrTime {\n return this._duration;\n }\n\n get ended(): boolean {\n return this._ended;\n }\n\n get droppedAttributesCount(): number {\n return this._droppedAttributesCount;\n }\n\n get droppedEventsCount(): number {\n return this._droppedEventsCount;\n }\n\n get droppedLinksCount(): number {\n return this._droppedLinksCount;\n }\n\n private _isSpanEnded(): boolean {\n if (this._ended) {\n diag.warn(\n `Can not execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`\n );\n }\n return this._ended;\n }\n\n // Utility function to truncate given value within size\n // for value type of string, will truncate to given limit\n // for type of non-string, will return same value\n private _truncateToLimitUtil(value: string, limit: number): string {\n if (value.length <= limit) {\n return value;\n }\n return value.substr(0, limit);\n }\n\n /**\n * If the given attribute value is of type string and has more characters than given {@code attributeValueLengthLimit} then\n * return string with trucated to {@code attributeValueLengthLimit} characters\n *\n * If the given attribute value is array of strings then\n * return new array of strings with each element truncated to {@code attributeValueLengthLimit} characters\n *\n * Otherwise return same Attribute {@code value}\n *\n * @param value Attribute value\n * @returns truncated attribute value if required, otherwise same value\n */\n private _truncateToSize(value: SpanAttributeValue): SpanAttributeValue {\n const limit = this._attributeValueLengthLimit;\n // Check limit\n if (limit <= 0) {\n // Negative values are invalid, so do not truncate\n diag.warn(`Attribute value limit must be positive, got ${limit}`);\n return value;\n }\n\n // String\n if (typeof value === 'string') {\n return this._truncateToLimitUtil(value, limit);\n }\n\n // Array of strings\n if (Array.isArray(value)) {\n return (value as []).map(val =>\n typeof val === 'string' ? this._truncateToLimitUtil(val, limit) : val\n );\n }\n\n // Other types, no need to apply value length limit\n return value;\n }\n}\n", "/*\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// Event name definitions\nexport const ExceptionEventName = 'exception';\n", "/*\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 { diag } from '@opentelemetry/api';\nimport { getEnv, TracesSamplerValues, ENVIRONMENT } from '@opentelemetry/core';\nimport { Sampler } from './Sampler';\nimport { AlwaysOffSampler } from './sampler/AlwaysOffSampler';\nimport { AlwaysOnSampler } from './sampler/AlwaysOnSampler';\nimport { ParentBasedSampler } from './sampler/ParentBasedSampler';\nimport { TraceIdRatioBasedSampler } from './sampler/TraceIdRatioBasedSampler';\n\nconst env = getEnv();\nconst FALLBACK_OTEL_TRACES_SAMPLER = TracesSamplerValues.AlwaysOn;\nconst DEFAULT_RATIO = 1;\n\n/**\n * Load default configuration. For fields with primitive values, any user-provided\n * value will override the corresponding default value. For fields with\n * non-primitive values (like `spanLimits`), the user-provided value will be\n * used to extend the default value.\n */\n\n// object needs to be wrapped in this function and called when needed otherwise\n// envs are parsed before tests are ran - causes tests using these envs to fail\nexport function loadDefaultConfig() {\n return {\n sampler: buildSamplerFromEnv(env),\n forceFlushTimeoutMillis: 30000,\n generalLimits: {\n attributeValueLengthLimit: getEnv().OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT,\n attributeCountLimit: getEnv().OTEL_ATTRIBUTE_COUNT_LIMIT,\n },\n spanLimits: {\n attributeValueLengthLimit:\n getEnv().OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT,\n attributeCountLimit: getEnv().OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT,\n linkCountLimit: getEnv().OTEL_SPAN_LINK_COUNT_LIMIT,\n eventCountLimit: getEnv().OTEL_SPAN_EVENT_COUNT_LIMIT,\n attributePerEventCountLimit:\n getEnv().OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT,\n attributePerLinkCountLimit:\n getEnv().OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT,\n },\n };\n}\n\n/**\n * Based on environment, builds a sampler, complies with specification.\n * @param environment optional, by default uses getEnv(), but allows passing a value to reuse parsed environment\n */\nexport function buildSamplerFromEnv(\n environment: Required<ENVIRONMENT> = getEnv()\n): Sampler {\n switch (environment.OTEL_TRACES_SAMPLER) {\n case TracesSamplerValues.AlwaysOn:\n return new AlwaysOnSampler();\n case TracesSamplerValues.AlwaysOff:\n return new AlwaysOffSampler();\n case TracesSamplerValues.ParentBasedAlwaysOn:\n return new ParentBasedSampler({\n root: new AlwaysOnSampler(),\n });\n case TracesSamplerValues.ParentBasedAlwaysOff:\n return new ParentBasedSampler({\n root: new AlwaysOffSampler(),\n });\n case TracesSamplerValues.TraceIdRatio:\n return new TraceIdRatioBasedSampler(\n getSamplerProbabilityFromEnv(environment)\n );\n case TracesSamplerValues.ParentBasedTraceIdRatio:\n return new ParentBasedSampler({\n root: new TraceIdRatioBasedSampler(\n getSamplerProbabilityFromEnv(environment)\n ),\n });\n default:\n diag.error(\n `OTEL_TRACES_SAMPLER value \"${environment.OTEL_TRACES_SAMPLER} invalid, defaulting to ${FALLBACK_OTEL_TRACES_SAMPLER}\".`\n );\n return new AlwaysOnSampler();\n }\n}\n\nfunction getSamplerProbabilityFromEnv(\n environment: Required<ENVIRONMENT>\n): number | undefined {\n if (\n environment.OTEL_TRACES_SAMPLER_ARG === undefined ||\n environment.OTEL_TRACES_SAMPLER_ARG === ''\n ) {\n diag.error(\n `OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${DEFAULT_RATIO}.`\n );\n return DEFAULT_RATIO;\n }\n\n const probability = Number(environment.OTEL_TRACES_SAMPLER_ARG);\n\n if (isNaN(probability)) {\n diag.error(\n `OTEL_TRACES_SAMPLER_ARG=${environment.OTEL_TRACES_SAMPLER_ARG} was given, but it is invalid, defaulting to ${DEFAULT_RATIO}.`\n );\n return DEFAULT_RATIO;\n }\n\n if (probability < 0 || probability > 1) {\n diag.error(\n `OTEL_TRACES_SAMPLER_ARG=${environment.OTEL_TRACES_SAMPLER_ARG} was given, but it is out of range ([0..1]), defaulting to ${DEFAULT_RATIO}.`\n );\n return DEFAULT_RATIO;\n }\n\n return probability;\n}\n", "/*\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 {\n Context,\n Link,\n SpanAttributes,\n SpanKind,\n TraceState,\n} from '@opentelemetry/api';\n\n/**\n * A sampling decision that determines how a {@link Span} will be recorded\n * and collected.\n */\nexport enum SamplingDecision {\n /**\n * `Span.isRecording() === false`, span will not be recorded and all events\n * and attributes will be dropped.\n */\n NOT_RECORD,\n /**\n * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags}\n * MUST NOT be set.\n */\n RECORD,\n /**\n * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags}\n * MUST be set.\n */\n RECORD_AND_SAMPLED,\n}\n\n/**\n * A sampling result contains a decision for a {@link Span} and additional\n * attributes the sampler would like to added to the Span.\n */\nexport interface SamplingResult {\n /**\n * A sampling decision, refer to {@link SamplingDecision} for details.\n */\n decision: SamplingDecision;\n /**\n * The list of attributes returned by SamplingResult MUST be immutable.\n * Caller may call {@link Sampler}.shouldSample any number of times and\n * can safely cache the returned value.\n */\n attributes?: Readonly<SpanAttributes>;\n /**\n * A {@link TraceState} that will be associated with the {@link Span} through\n * the new {@link SpanContext}. Samplers SHOULD return the TraceState from\n * the passed-in {@link Context} if they do not intend to change it. Leaving\n * the value undefined will also leave the TraceState unchanged.\n */\n traceState?: TraceState;\n}\n\n/**\n * This interface represent a sampler. Sampling is a mechanism to control the\n * noise and overhead introduced by OpenTelemetry by reducing the number of\n * samples of traces collected and sent to the backend.\n */\nexport interface Sampler {\n /**\n * Checks whether span needs to be created and tracked.\n *\n * @param context Parent Context which may contain a span.\n * @param traceId of the span to be created. It can be different from the\n * traceId in the {@link SpanContext}. Typically in situations when the\n * span to be created starts a new trace.\n * @param spanName of the span to be created.\n * @param spanKind of the span to be created.\n * @param attributes Initial set of SpanAttributes for the Span being constructed.\n * @param links Collection of links that will be associated with the Span to\n * be created. Typically useful for batch operations.\n * @returns a {@link SamplingResult}.\n */\n shouldSample(\n context: Context,\n traceId: string,\n spanName: string,\n spanKind: SpanKind,\n attributes: SpanAttributes,\n links: Link[]\n ): SamplingResult;\n\n /** Returns the sampler name or short description with the configuration. */\n toString(): string;\n}\n", "/*\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 { Sampler, SamplingDecision, SamplingResult } from '../Sampler';\n\n/** Sampler that samples no traces. */\nexport class AlwaysOffSampler implements Sampler {\n shouldSample(): SamplingResult {\n return {\n decision: SamplingDecision.NOT_RECORD,\n };\n }\n\n toString(): string {\n return 'AlwaysOffSampler';\n }\n}\n", "/*\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 { Sampler, SamplingDecision, SamplingResult } from '../Sampler';\n\n/** Sampler that samples all traces. */\nexport class AlwaysOnSampler implements Sampler {\n shouldSample(): SamplingResult {\n return {\n decision: SamplingDecision.RECORD_AND_SAMPLED,\n };\n }\n\n toString(): string {\n return 'AlwaysOnSampler';\n }\n}\n", "/*\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 {\n Context,\n isSpanContextValid,\n Link,\n SpanAttributes,\n SpanKind,\n TraceFlags,\n trace,\n} from '@opentelemetry/api';\nimport { globalErrorHandler } from '@opentelemetry/core';\nimport { AlwaysOffSampler } from './AlwaysOffSampler';\nimport { AlwaysOnSampler } from './AlwaysOnSampler';\nimport { Sampler, SamplingResult } from '../Sampler';\n\n/**\n * A composite sampler that either respects the parent span's sampling decision\n * or delegates to `delegateSampler` for root spans.\n */\nexport class ParentBasedSampler implements Sampler {\n private _root: Sampler;\n private _remoteParentSampled: Sampler;\n private _remoteParentNotSampled: Sampler;\n private _localParentSampled: Sampler;\n private _localParentNotSampled: Sampler;\n\n constructor(config: ParentBasedSamplerConfig) {\n this._root = config.root;\n\n if (!this._root) {\n globalErrorHandler(\n new Error('ParentBasedSampler must have a root sampler configured')\n );\n this._root = new AlwaysOnSampler();\n }\n\n this._remoteParentSampled =\n config.remoteParentSampled ?? new AlwaysOnSampler();\n this._remoteParentNotSampled =\n config.remoteParentNotSampled ?? new AlwaysOffSampler();\n this._localParentSampled =\n config.localParentSampled ?? new AlwaysOnSampler();\n this._localParentNotSampled =\n config.localParentNotSampled ?? new AlwaysOffSampler();\n }\n\n shouldSample(\n context: Context,\n traceId: string,\n spanName: string,\n spanKind: SpanKind,\n attributes: SpanAttributes,\n links: Link[]\n ): SamplingResult {\n const parentContext = trace.getSpanContext(context);\n\n if (!parentContext || !isSpanContextValid(parentContext)) {\n return this._root.shouldSample(\n context,\n traceId,\n spanName,\n spanKind,\n attributes,\n links\n );\n }\n\n if (parentContext.isRemote) {\n if (parentContext.traceFlags & TraceFlags.SAMPLED) {\n return this._remoteParentSampled.shouldSample(\n context,\n traceId,\n spanName,\n spanKind,\n attributes,\n links\n );\n }\n return this._remoteParentNotSampled.shouldSample(\n context,\n traceId,\n spanName,\n spanKind,\n attributes,\n links\n );\n }\n\n if (parentContext.traceFlags & TraceFlags.SAMPLED) {\n return this._localParentSampled.shouldSample(\n context,\n traceId,\n spanName,\n spanKind,\n attributes,\n links\n );\n }\n\n return this._localParentNotSampled.shouldSample(\n context,\n traceId,\n spanName,\n spanKind,\n attributes,\n links\n );\n }\n\n toString(): string {\n return `ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`;\n }\n}\n\ninterface ParentBasedSamplerConfig {\n /** Sampler called for spans with no parent */\n root: Sampler;\n /** Sampler called for spans with a remote parent which was sampled. Default AlwaysOn */\n remoteParentSampled?: Sampler;\n /** Sampler called for spans with a remote parent which was not sampled. Default AlwaysOff */\n remoteParentNotSampled?: Sampler;\n /** Sampler called for spans with a local parent which was sampled. Default AlwaysOn */\n localParentSampled?: Sampler;\n /** Sampler called for spans with a local parent which was not sampled. Default AlwaysOff */\n localParentNotSampled?: Sampler;\n}\n", "/*\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 { isValidTraceId } from '@opentelemetry/api';\nimport { Sampler, SamplingDecision, SamplingResult } from '../Sampler';\n\n/** Sampler that samples a given fraction of traces based of trace id deterministically. */\nexport class TraceIdRatioBasedSampler implements Sampler {\n private _upperBound: number;\n\n constructor(private readonly _ratio: number = 0) {\n this._ratio = this._normalize(_ratio);\n this._upperBound = Math.floor(this._ratio * 0xffffffff);\n }\n\n shouldSample(context: unknown, traceId: string): SamplingResult {\n return {\n decision:\n isValidTraceId(traceId) && this._accumulate(traceId) < this._upperBound\n ? SamplingDecision.RECORD_AND_SAMPLED\n : SamplingDecision.NOT_RECORD,\n };\n }\n\n toString(): string {\n return `TraceIdRatioBased{${this._ratio}}`;\n }\n\n private _normalize(ratio: number): number {\n if (typeof ratio !== 'number' || isNaN(ratio)) return 0;\n return ratio >= 1 ? 1 : ratio <= 0 ? 0 : ratio;\n }\n\n private _accumulate(traceId: string): number {\n let accumulation = 0;\n for (let i = 0; i < traceId.length / 8; i++) {\n const pos = i * 8;\n const part = parseInt(traceId.slice(pos, pos + 8), 16);\n accumulation = (accumulation ^ part) >>> 0;\n }\n return accumulation;\n }\n}\n", "/*\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 { buildSamplerFromEnv, loadDefaultConfig } from './config';\nimport { Sampler } from './Sampler';\nimport { SpanLimits, TracerConfig, GeneralLimits } from './types';\nimport {\n DEFAULT_ATTRIBUTE_COUNT_LIMIT,\n DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,\n getEnvWithoutDefaults,\n} from '@opentelemetry/core';\n\n/**\n * Function to merge Default configuration (as specified in './config') with\n * user provided configurations.\n */\nexport function mergeConfig(userConfig: TracerConfig): TracerConfig & {\n sampler: Sampler;\n spanLimits: SpanLimits;\n generalLimits: GeneralLimits;\n} {\n const perInstanceDefaults: Partial<TracerConfig> = {\n sampler: buildSamplerFromEnv(),\n };\n\n const DEFAULT_CONFIG = loadDefaultConfig();\n\n const target = Object.assign(\n {},\n DEFAULT_CONFIG,\n perInstanceDefaults,\n userConfig\n );\n\n target.generalLimits = Object.assign(\n {},\n DEFAULT_CONFIG.generalLimits,\n userConfig.generalLimits || {}\n );\n\n target.spanLimits = Object.assign(\n {},\n DEFAULT_CONFIG.spanLimits,\n userConfig.spanLimits || {}\n );\n\n return target;\n}\n\n/**\n * When general limits are provided and model specific limits are not,\n * configures the model specific limits by using the values from the general ones.\n * @param userConfig User provided tracer configuration\n */\nexport function reconfigureLimits(userConfig: TracerConfig): TracerConfig {\n const spanLimits = Object.assign({}, userConfig.spanLimits);\n\n const parsedEnvConfig = getEnvWithoutDefaults();\n\n /**\n * Reassign span attribute count limit to use first non null value defined by user or use default value\n */\n spanLimits.attributeCountLimit =\n userConfig.spanLimits?.attributeCountLimit ??\n userConfig.generalLimits?.attributeCountLimit ??\n parsedEnvConfig.OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT ??\n parsedEnvConfig.OTEL_ATTRIBUTE_COUNT_LIMIT ??\n DEFAULT_ATTRIBUTE_COUNT_LIMIT;\n\n /**\n * Reassign span attribute value length limit to use first non null value defined by user or use default value\n */\n spanLimits.attributeValueLengthLimit =\n userConfig.spanLimits?.attributeValueLengthLimit ??\n userConfig.generalLimits?.attributeValueLengthLimit ??\n parsedEnvConfig.OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT ??\n parsedEnvConfig.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT ??\n DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT;\n\n return Object.assign({}, userConfig, { spanLimits });\n}\n", "/*\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 { context, Context, diag, TraceFlags } from '@opentelemetry/api';\nimport {\n BindOnceFuture,\n ExportResultCode,\n getEnv,\n globalErrorHandler,\n suppressTracing,\n unrefTimer,\n} from '@opentelemetry/core';\nimport { Span } from '../Span';\nimport { SpanProcessor } from '../SpanProcessor';\nimport { BufferConfig } from '../types';\nimport { ReadableSpan } from './ReadableSpan';\nimport { SpanExporter } from './SpanExporter';\n\n/**\n * Implementation of the {@link SpanProcessor} that batches spans exported by\n * the SDK then pushes them to the exporter pipeline.\n */\nexport abstract class BatchSpanProcessorBase<T extends BufferConfig>\n implements SpanProcessor\n{\n private readonly _maxExportBatchSize: number;\n private readonly _maxQueueSize: number;\n private readonly _scheduledDelayMillis: number;\n private readonly _exportTimeoutMillis: number;\n\n private _isExporting = false;\n private _finishedSpans: ReadableSpan[] = [];\n private _timer: NodeJS.Timeout | undefined;\n private _shutdownOnce: BindOnceFuture<void>;\n private _droppedSpansCount: number = 0;\n\n constructor(\n private readonly _exporter: SpanExporter,\n config?: T\n ) {\n const env = getEnv();\n this._maxExportBatchSize =\n typeof config?.maxExportBatchSize === 'number'\n ? config.maxExportBatchSize\n : env.OTEL_BSP_MAX_EXPORT_BATCH_SIZE;\n this._maxQueueSize =\n typeof config?.maxQueueSize === 'number'\n ? config.maxQueueSize\n : env.OTEL_BSP_MAX_QUEUE_SIZE;\n this._scheduledDelayMillis =\n typeof config?.scheduledDelayMillis === 'number'\n ? config.scheduledDelayMillis\n : env.OTEL_BSP_SCHEDULE_DELAY;\n this._exportTimeoutMillis =\n typeof config?.exportTimeoutMillis === 'number'\n ? config.exportTimeoutMillis\n : env.OTEL_BSP_EXPORT_TIMEOUT;\n\n this._shutdownOnce = new BindOnceFuture(this._shutdown, this);\n\n if (this._maxExportBatchSize > this._maxQueueSize) {\n diag.warn(\n 'BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize'\n );\n this._maxExportBatchSize = this._maxQueueSize;\n }\n }\n\n forceFlush(): Promise<void> {\n if (this._shutdownOnce.isCalled) {\n return this._shutdownOnce.promise;\n }\n return this._flushAll();\n }\n\n // does nothing.\n onStart(_span: Span, _parentContext: Context): void {}\n\n onEnd(span: ReadableSpan): void {\n if (this._shutdownOnce.isCalled) {\n return;\n }\n\n if ((span.spanContext().traceFlags & TraceFlags.SAMPLED) === 0) {\n return;\n }\n\n this._addToBuffer(span);\n }\n\n shutdown(): Promise<void> {\n return this._shutdownOnce.call();\n }\n\n private _shutdown() {\n return Promise.resolve()\n .then(() => {\n return this.onShutdown();\n })\n .then(() => {\n return this._flushAll();\n })\n .then(() => {\n return this._exporter.shutdown();\n });\n }\n\n /** Add a span in the buffer. */\n private _addToBuffer(span: ReadableSpan) {\n if (this._finishedSpans.length >= this._maxQueueSize) {\n // limit reached, drop span\n\n if (this._droppedSpansCount === 0) {\n diag.debug('maxQueueSize reached, dropping spans');\n }\n this._droppedSpansCount++;\n\n return;\n }\n\n if (this._droppedSpansCount > 0) {\n // some spans were dropped, log once with count of spans dropped\n diag.warn(\n `Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`\n );\n this._droppedSpansCount = 0;\n }\n\n this._finishedSpans.push(span);\n this._maybeStartTimer();\n }\n\n /**\n * Send all spans to the exporter respecting the batch size limit\n * This function is used only on forceFlush or shutdown,\n * for all other cases _flush should be used\n * */\n private _flushAll(): Promise<void> {\n return new Promise((resolve, reject) => {\n const promises = [];\n // calculate number of batches\n const count = Math.ceil(\n this._finishedSpans.length / this._maxExportBatchSize\n );\n for (let i = 0, j = count; i < j; i++) {\n promises.push(this._flushOneBatch());\n }\n Promise.all(promises)\n .then(() => {\n resolve();\n })\n .catch(reject);\n });\n }\n\n private _flushOneBatch(): Promise<void> {\n this._clearTimer();\n if (this._finishedSpans.length === 0) {\n return Promise.resolve();\n }\n return new Promise((resolve, reject) => {\n const timer = setTimeout(() => {\n // don't wait anymore for export, this way the next batch can start\n reject(new Error('Timeout'));\n }, this._exportTimeoutMillis);\n // prevent downstream exporter calls from generating spans\n context.with(suppressTracing(context.active()), () => {\n // Reset the finished spans buffer here because the next invocations of the _flush method\n // could pass the same finished spans to the exporter if the buffer is cleared\n // outside the execution of this callback.\n const spans = this._finishedSpans.splice(0, this._maxExportBatchSize);\n\n const doExport = () =>\n this._exporter.export(spans, result => {\n clearTimeout(timer);\n if (result.code === ExportResultCode.SUCCESS) {\n resolve();\n } else {\n reject(\n result.error ??\n new Error('BatchSpanProcessor: span export failed')\n );\n }\n });\n const pendingResources = spans\n .map(span => span.resource)\n .filter(resource => resource.asyncAttributesPending);\n\n // Avoid scheduling a promise to make the behavior more predictable and easier to test\n if (pendingResources.length === 0) {\n doExport();\n } else {\n Promise.all(\n pendingResources.map(\n resource => resource.waitForAsyncAttributes?.()\n )\n ).then(doExport, err => {\n globalErrorHandler(err);\n reject(err);\n });\n }\n });\n });\n }\n\n private _maybeStartTimer() {\n if (this._isExporting) return;\n const flush = () => {\n this._isExporting = true;\n this._flushOneBatch()\n .then(() => {\n this._isExporting = false;\n if (this._finishedSpans.length > 0) {\n this._clearTimer();\n this._maybeStartTimer();\n }\n })\n .catch(e => {\n this._isExporting = false;\n globalErrorHandler(e);\n });\n };\n // we only wait if the queue doesn't have enough elements yet\n if (this._finishedSpans.length >= this._maxExportBatchSize) {\n return flush();\n }\n if (this._timer !== undefined) return;\n this._timer = setTimeout(() => flush(), this._scheduledDelayMillis);\n unrefTimer(this._timer);\n }\n\n private _clearTimer() {\n if (this._timer !== undefined) {\n clearTimeout(this._timer);\n this._timer = undefined;\n }\n }\n\n protected abstract onShutdown(): void;\n}\n", "/*\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 { BatchSpanProcessorBase } from '../../../export/BatchSpanProcessorBase';\nimport { SpanExporter } from '../../../export/SpanExporter';\nimport { BatchSpanProcessorBrowserConfig } from '../../../types';\n\nexport class BatchSpanProcessor extends BatchSpanProcessorBase<BatchSpanProcessorBrowserConfig> {\n private _visibilityChangeListener?: () => void;\n private _pageHideListener?: () => void;\n\n constructor(\n _exporter: SpanExporter,\n config?: BatchSpanProcessorBrowserConfig\n ) {\n super(_exporter, config);\n this.onInit(config);\n }\n\n private onInit(config?: BatchSpanProcessorBrowserConfig): void {\n if (\n config?.disableAutoFlushOnDocumentHide !== true &&\n typeof document !== 'undefined'\n ) {\n this._visibilityChangeListener = () => {\n if (document.visibilityState === 'hidden') {\n void this.forceFlush();\n }\n };\n this._pageHideListener = () => {\n void this.forceFlush();\n };\n document.addEventListener(\n 'visibilitychange',\n this._visibilityChangeListener\n );\n\n // use 'pagehide' event as a fallback for Safari; see https://bugs.webkit.org/show_bug.cgi?id=116769\n document.addEventListener('pagehide', this._pageHideListener);\n }\n }\n\n protected onShutdown(): void {\n if (typeof document !== 'undefined') {\n if (this._visibilityChangeListener) {\n document.removeEventListener(\n 'visibilitychange',\n this._visibilityChangeListener\n );\n }\n if (this._pageHideListener) {\n document.removeEventListener('pagehide', this._pageHideListener);\n }\n }\n }\n}\n", "/*\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 { IdGenerator } from '../../IdGenerator';\n\nconst SPAN_ID_BYTES = 8;\nconst TRACE_ID_BYTES = 16;\n\nexport class RandomIdGenerator implements IdGenerator {\n /**\n * Returns a random 16-byte trace ID formatted/encoded as a 32 lowercase hex\n * characters corresponding to 128 bits.\n */\n generateTraceId = getIdGenerator(TRACE_ID_BYTES);\n\n /**\n * Returns a random 8-byte span ID formatted/encoded as a 16 lowercase hex\n * characters corresponding to 64 bits.\n */\n generateSpanId = getIdGenerator(SPAN_ID_BYTES);\n}\n\nconst SHARED_CHAR_CODES_ARRAY = Array(32);\nfunction getIdGenerator(bytes: number): () => string {\n return function generateId() {\n for (let i = 0; i < bytes * 2; i++) {\n SHARED_CHAR_CODES_ARRAY[i] = Math.floor(Math.random() * 16) + 48;\n // valid hex characters in the range 48-57 and 97-102\n if (SHARED_CHAR_CODES_ARRAY[i] >= 58) {\n SHARED_CHAR_CODES_ARRAY[i] += 39;\n }\n }\n return String.fromCharCode.apply(\n null,\n SHARED_CHAR_CODES_ARRAY.slice(0, bytes * 2)\n );\n };\n}\n", "/*\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 {\n context,\n diag,\n propagation,\n TextMapPropagator,\n trace,\n TracerProvider,\n} from '@opentelemetry/api';\nimport {\n CompositePropagator,\n W3CBaggagePropagator,\n W3CTraceContextPropagator,\n getEnv,\n merge,\n} from '@opentelemetry/core';\nimport { IResource, Resource } from '@opentelemetry/resources';\nimport { SpanProcessor, Tracer } from '.';\nimport { loadDefaultConfig } from './config';\nimport { MultiSpanProcessor } from './MultiSpanProcessor';\nimport { NoopSpanProcessor } from './export/NoopSpanProcessor';\nimport { SDKRegistrationConfig, TracerConfig } from './types';\nimport { SpanExporter } from './export/SpanExporter';\nimport { BatchSpanProcessor } from './platform';\nimport { reconfigureLimits } from './utility';\n\nexport type PROPAGATOR_FACTORY = () => TextMapPropagator;\nexport type EXPORTER_FACTORY = () => SpanExporter;\n\nexport enum ForceFlushState {\n 'resolved',\n 'timeout',\n 'error',\n 'unresolved',\n}\n\n/**\n * This class represents a basic tracer provider which platform libraries can extend\n */\nexport class BasicTracerProvider implements TracerProvider {\n protected static readonly _registeredPropagators = new Map<\n string,\n PROPAGATOR_FACTORY\n >([\n ['tracecontext', () => new W3CTraceContextPropagator()],\n ['baggage', () => new W3CBaggagePropagator()],\n ]);\n\n protected static readonly _registeredExporters = new Map<\n string,\n EXPORTER_FACTORY\n >();\n\n private readonly _config: TracerConfig;\n private readonly _registeredSpanProcessors: SpanProcessor[] = [];\n private readonly _tracers: Map<string, Tracer> = new Map();\n\n activeSpanProcessor: SpanProcessor;\n readonly resource: IResource;\n\n constructor(config: TracerConfig = {}) {\n const mergedConfig = merge(\n {},\n loadDefaultConfig(),\n reconfigureLimits(config)\n );\n this.resource = mergedConfig.resource ?? Resource.empty();\n this.resource = Resource.default().merge(this.resource);\n this._config = Object.assign({}, mergedConfig, {\n resource: this.resource,\n });\n\n const defaultExporter = this._buildExporterFromEnv();\n if (defaultExporter !== undefined) {\n const batchProcessor = new BatchSpanProcessor(defaultExporter);\n this.activeSpanProcessor = batchProcessor;\n } else {\n this.activeSpanProcessor = new NoopSpanProcessor();\n }\n }\n\n getTracer(\n name: string,\n version?: string,\n options?: { schemaUrl?: string }\n ): Tracer {\n const key = `${name}@${version || ''}:${options?.schemaUrl || ''}`;\n if (!this._tracers.has(key)) {\n this._tracers.set(\n key,\n new Tracer(\n { name, version, schemaUrl: options?.schemaUrl },\n this._config,\n this\n )\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this._tracers.get(key)!;\n }\n\n /**\n * Adds a new {@link SpanProcessor} to this tracer.\n * @param spanProcessor the new SpanProcessor to be added.\n */\n addSpanProcessor(spanProcessor: SpanProcessor): void {\n if (this._registeredSpanProcessors.length === 0) {\n // since we might have enabled by default a batchProcessor, we disable it\n // before adding the new one\n this.activeSpanProcessor\n .shutdown()\n .catch(err =>\n diag.error(\n 'Error while trying to shutdown current span processor',\n err\n )\n );\n }\n this._registeredSpanProcessors.push(spanProcessor);\n this.activeSpanProcessor = new MultiSpanProcessor(\n this._registeredSpanProcessors\n );\n }\n\n getActiveSpanProcessor(): SpanProcessor {\n return this.activeSpanProcessor;\n }\n\n /**\n * Register this TracerProvider for use with the OpenTelemetry API.\n * Undefined values may be replaced with defaults, and\n * null values will be skipped.\n *\n * @param config Configuration object for SDK registration\n */\n register(config: SDKRegistrationConfig = {}): void {\n trace.setGlobalTracerProvider(this);\n if (config.propagator === undefined) {\n config.propagator = this._buildPropagatorFromEnv();\n }\n\n if (config.contextManager) {\n context.setGlobalContextManager(config.contextManager);\n }\n\n if (config.propagator) {\n propagation.setGlobalPropagator(config.propagator);\n }\n }\n\n forceFlush(): Promise<void> {\n const timeout = this._config.forceFlushTimeoutMillis;\n const promises = this._registeredSpanProcessors.map(\n (spanProcessor: SpanProcessor) => {\n return new Promise(resolve => {\n let state: ForceFlushState;\n const timeoutInterval = setTimeout(() => {\n resolve(\n new Error(\n `Span processor did not completed within timeout period of ${timeout} ms`\n )\n );\n state = ForceFlushState.timeout;\n }, timeout);\n\n spanProcessor\n .forceFlush()\n .then(() => {\n clearTimeout(timeoutInterval);\n if (state !== ForceFlushState.timeout) {\n state = ForceFlushState.resolved;\n resolve(state);\n }\n })\n .catch(error => {\n clearTimeout(timeoutInterval);\n state = ForceFlushState.error;\n resolve(error);\n });\n });\n }\n );\n\n return new Promise<void>((resolve, reject) => {\n Promise.all(promises)\n .then(results => {\n const errors = results.filter(\n result => result !== ForceFlushState.resolved\n );\n if (errors.length > 0) {\n reject(errors);\n } else {\n resolve();\n }\n })\n .catch(error => reject([error]));\n });\n }\n\n shutdown(): Promise<void> {\n return this.activeSpanProcessor.shutdown();\n }\n\n /**\n * TS cannot yet infer the type of this.constructor:\n * https://github.com/Microsoft/TypeScript/issues/3841#issuecomment-337560146\n * There is no need to override either of the getters in your child class.\n * The type of the registered component maps should be the same across all\n * classes in the inheritance tree.\n */\n protected _getPropagator(name: string): TextMapPropagator | undefined {\n return (\n this.constructor as typeof BasicTracerProvider\n )._registeredPropagators.get(name)?.();\n }\n\n protected _getSpanExporter(name: string): SpanExporter | undefined {\n return (\n this.constructor as typeof BasicTracerProvider\n )._registeredExporters.get(name)?.();\n }\n\n protected _buildPropagatorFromEnv(): TextMapPropagator | undefined {\n // per spec, propagators from env must be deduplicated\n const uniquePropagatorNames = Array.from(\n new Set(getEnv().OTEL_PROPAGATORS)\n );\n\n const propagators = uniquePropagatorNames.map(name => {\n const propagator = this._getPropagator(name);\n if (!propagator) {\n diag.warn(\n `Propagator \"${name}\" requested through environment variable is unavailable.`\n );\n }\n\n return propagator;\n });\n const validPropagators = propagators.reduce<TextMapPropagator[]>(\n (list, item) => {\n if (item) {\n list.push(item);\n }\n return list;\n },\n []\n );\n\n if (validPropagators.length === 0) {\n return;\n } else if (uniquePropagatorNames.length === 1) {\n return validPropagators[0];\n } else {\n return new CompositePropagator({\n propagators: validPropagators,\n });\n }\n }\n\n protected _buildExporterFromEnv(): SpanExporter | undefined {\n const exporterName = getEnv().OTEL_TRACES_EXPORTER;\n if (exporterName === 'none' || exporterName === '') return;\n const exporter = this._getSpanExporter(exporterName);\n if (!exporter) {\n diag.error(\n `Exporter \"${exporterName}\" requested through environment variable is unavailable.`\n );\n }\n return exporter;\n }\n}\n", "/*\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 { diag } from '@opentelemetry/api';\nimport { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';\nimport { SDK_INFO } from '@opentelemetry/core';\nimport { ResourceAttributes } from './types';\nimport { defaultServiceName } from './platform';\nimport { IResource } from './IResource';\n\n/**\n * A Resource describes the entity for which a signals (metrics or trace) are\n * collected.\n */\nexport class Resource implements IResource {\n static readonly EMPTY = new Resource({});\n private _syncAttributes?: ResourceAttributes;\n private _asyncAttributesPromise?: Promise<ResourceAttributes>;\n private _attributes?: ResourceAttributes;\n\n /**\n * Check if async attributes have resolved. This is useful to avoid awaiting\n * waitForAsyncAttributes (which will introduce asynchronous behavior) when not necessary.\n *\n * @returns true if the resource \"attributes\" property is not yet settled to its final value\n */\n public asyncAttributesPending?: boolean;\n\n /**\n * Returns an empty Resource\n */\n static empty(): IResource {\n return Resource.EMPTY;\n }\n\n /**\n * Returns a Resource that identifies the SDK in use.\n */\n static default(): IResource {\n return new Resource({\n [SemanticResourceAttributes.SERVICE_NAME]: defaultServiceName(),\n [SemanticResourceAttributes.TELEMETRY_SDK_LANGUAGE]:\n SDK_INFO[SemanticResourceAttributes.TELEMETRY_SDK_LANGUAGE],\n [SemanticResourceAttributes.TELEMETRY_SDK_NAME]:\n SDK_INFO[SemanticResourceAttributes.TELEMETRY_SDK_NAME],\n [SemanticResourceAttributes.TELEMETRY_SDK_VERSION]:\n SDK_INFO[SemanticResourceAttributes.TELEMETRY_SDK_VERSION],\n });\n }\n\n constructor(\n /**\n * A dictionary of attributes with string keys and values that provide\n * information about the entity as numbers, strings or booleans\n * TODO: Consider to add check/validation on attributes.\n */\n attributes: ResourceAttributes,\n asyncAttributesPromise?: Promise<ResourceAttributes>\n ) {\n this._attributes = attributes;\n this.asyncAttributesPending = asyncAttributesPromise != null;\n this._syncAttributes = this._attributes ?? {};\n this._asyncAttributesPromise = asyncAttributesPromise?.then(\n asyncAttributes => {\n this._attributes = Object.assign({}, this._attributes, asyncAttributes);\n this.asyncAttributesPending = false;\n return asyncAttributes;\n },\n err => {\n diag.debug(\"a resource's async attributes promise rejected: %s\", err);\n this.asyncAttributesPending = false;\n return {};\n }\n );\n }\n\n get attributes(): ResourceAttributes {\n if (this.asyncAttributesPending) {\n diag.error(\n 'Accessing resource attributes before async attributes settled'\n );\n }\n\n return this._attributes ?? {};\n }\n\n /**\n * Returns a promise that will never be rejected. Resolves when all async attributes have finished being added to\n * this Resource's attributes. This is useful in exporters to block until resource detection\n * has finished.\n */\n async waitForAsyncAttributes?(): Promise<void> {\n if (this.asyncAttributesPending) {\n await this._asyncAttributesPromise;\n }\n }\n\n /**\n * Returns a new, merged {@link Resource} by merging the current Resource\n * with the other Resource. In case of a collision, other Resource takes\n * precedence.\n *\n * @param other the Resource that will be merged with this.\n * @returns the newly merged Resource.\n */\n merge(other: IResource | null): IResource {\n if (!other) return this;\n\n // SpanAttributes from other resource overwrite attributes from this resource.\n const mergedSyncAttributes = {\n ...this._syncAttributes,\n //Support for old resource implementation where _syncAttributes is not defined\n ...((other as Resource)._syncAttributes ?? other.attributes),\n };\n\n if (\n !this._asyncAttributesPromise &&\n !(other as Resource)._asyncAttributesPromise\n ) {\n return new Resource(mergedSyncAttributes);\n }\n\n const mergedAttributesPromise = Promise.all([\n this._asyncAttributesPromise,\n (other as Resource)._asyncAttributesPromise,\n ]).then(([thisAsyncAttributes, otherAsyncAttributes]) => {\n return {\n ...this._syncAttributes,\n ...thisAsyncAttributes,\n //Support for old resource implementation where _syncAttributes is not defined\n ...((other as Resource)._syncAttributes ?? other.attributes),\n ...otherAsyncAttributes,\n };\n });\n\n return new Resource(mergedSyncAttributes, mergedAttributesPromise);\n }\n}\n", "/*\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\nexport function defaultServiceName(): string {\n return 'unknown_service';\n}\n", "/*\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 { diag } from '@opentelemetry/api';\nimport { getEnv } from '@opentelemetry/core';\nimport { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';\nimport { Resource } from '../Resource';\nimport { DetectorSync, ResourceAttributes } from '../types';\nimport { ResourceDetectionConfig } from '../config';\nimport { IResource } from '../IResource';\n\n/**\n * EnvDetectorSync can be used to detect the presence of and create a Resource\n * from the OTEL_RESOURCE_ATTRIBUTES environment variable.\n */\nclass EnvDetectorSync implements DetectorSync {\n // Type, attribute keys, and attribute values should not exceed 256 characters.\n private readonly _MAX_LENGTH = 255;\n\n // OTEL_RESOURCE_ATTRIBUTES is a comma-separated list of attributes.\n private readonly _COMMA_SEPARATOR = ',';\n\n // OTEL_RESOURCE_ATTRIBUTES contains key value pair separated by '='.\n private readonly _LABEL_KEY_VALUE_SPLITTER = '=';\n\n private readonly _ERROR_MESSAGE_INVALID_CHARS =\n 'should be a ASCII string with a length greater than 0 and not exceed ' +\n this._MAX_LENGTH +\n ' characters.';\n\n private readonly _ERROR_MESSAGE_INVALID_VALUE =\n 'should be a ASCII string with a length not exceed ' +\n this._MAX_LENGTH +\n ' characters.';\n\n /**\n * Returns a {@link Resource} populated with attributes from the\n * OTEL_RESOURCE_ATTRIBUTES environment variable. Note this is an async\n * function to conform to the Detector interface.\n *\n * @param config The resource detection config\n */\n detect(_config?: ResourceDetectionConfig): IResource {\n const attributes: ResourceAttributes = {};\n const env = getEnv();\n\n const rawAttributes = env.OTEL_RESOURCE_ATTRIBUTES;\n const serviceName = env.OTEL_SERVICE_NAME;\n\n if (rawAttributes) {\n try {\n const parsedAttributes = this._parseResourceAttributes(rawAttributes);\n Object.assign(attributes, parsedAttributes);\n } catch (e) {\n diag.debug(`EnvDetector failed: ${e.message}`);\n }\n }\n\n if (serviceName) {\n attributes[SemanticResourceAttributes.SERVICE_NAME] = serviceName;\n }\n\n return new Resource(attributes);\n }\n\n /**\n * Creates an attribute map from the OTEL_RESOURCE_ATTRIBUTES environment\n * variable.\n *\n * OTEL_RESOURCE_ATTRIBUTES: A comma-separated list of attributes describing\n * the source in more detail, e.g. “key1=val1,key2=val2”. Domain names and\n * paths are accepted as attribute keys. Values may be quoted or unquoted in\n * general. If a value contains whitespaces, =, or \" characters, it must\n * always be quoted.\n *\n * @param rawEnvAttributes The resource attributes as a comma-seperated list\n * of key/value pairs.\n * @returns The sanitized resource attributes.\n */\n private _parseResourceAttributes(\n rawEnvAttributes?: string\n ): ResourceAttributes {\n if (!rawEnvAttributes) return {};\n\n const attributes: ResourceAttributes = {};\n const rawAttributes: string[] = rawEnvAttributes.split(\n this._COMMA_SEPARATOR,\n -1\n );\n for (const rawAttribute of rawAttributes) {\n const keyValuePair: string[] = rawAttribute.split(\n this._LABEL_KEY_VALUE_SPLITTER,\n -1\n );\n if (keyValuePair.length !== 2) {\n continue;\n }\n let [key, value] = keyValuePair;\n // Leading and trailing whitespaces are trimmed.\n key = key.trim();\n value = value.trim().split(/^\"|\"$/).join('');\n if (!this._isValidAndNotEmpty(key)) {\n throw new Error(`Attribute key ${this._ERROR_MESSAGE_INVALID_CHARS}`);\n }\n if (!this._isValid(value)) {\n throw new Error(`Attribute value ${this._ERROR_MESSAGE_INVALID_VALUE}`);\n }\n attributes[key] = decodeURIComponent(value);\n }\n return attributes;\n }\n\n /**\n * Determines whether the given String is a valid printable ASCII string with\n * a length not exceed _MAX_LENGTH characters.\n *\n * @param str The String to be validated.\n * @returns Whether the String is valid.\n */\n private _isValid(name: string): boolean {\n return name.length <= this._MAX_LENGTH && this._isBaggageOctetString(name);\n }\n\n // https://www.w3.org/TR/baggage/#definition\n private _isBaggageOctetString(str: string): boolean {\n for (let i = 0; i < str.length; i++) {\n const ch = str.charCodeAt(i);\n if (ch < 0x21 || ch === 0x2c || ch === 0x3b || ch === 0x5c || ch > 0x7e) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Determines whether the given String is a valid printable ASCII string with\n * a length greater than 0 and not exceed _MAX_LENGTH characters.\n *\n * @param str The String to be validated.\n * @returns Whether the String is valid and not empty.\n */\n private _isValidAndNotEmpty(str: string): boolean {\n return str.length > 0 && this._isValid(str);\n }\n}\n\nexport const envDetectorSync = new EnvDetectorSync();\n", "/*\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 { Resource } from './Resource';\nimport { ResourceDetectionConfig } from './config';\nimport { diag } from '@opentelemetry/api';\nimport { isPromiseLike } from './utils';\nimport { Detector, DetectorSync } from './types';\nimport { IResource } from './IResource';\n\n/**\n * Runs all resource detectors and returns the results merged into a single Resource. Promise\n * does not resolve until all the underlying detectors have resolved, unlike\n * detectResourcesSync.\n *\n * @deprecated use detectResourcesSync() instead.\n * @param config Configuration for resource detection\n */\nexport const detectResources = async (\n config: ResourceDetectionConfig = {}\n): Promise<IResource> => {\n const resources: IResource[] = await Promise.all(\n (config.detectors || []).map(async d => {\n try {\n const resource = await d.detect(config);\n diag.debug(`${d.constructor.name} found resource.`, resource);\n return resource;\n } catch (e) {\n diag.debug(`${d.constructor.name} failed: ${e.message}`);\n return Resource.empty();\n }\n })\n );\n\n // Future check if verbose logging is enabled issue #1903\n logResources(resources);\n\n return resources.reduce(\n (acc, resource) => acc.merge(resource),\n Resource.empty()\n );\n};\n\n/**\n * Runs all resource detectors synchronously, merging their results. In case of attribute collision later resources will take precedence.\n *\n * @param config Configuration for resource detection\n */\nexport const detectResourcesSync = (\n config: ResourceDetectionConfig = {}\n): IResource => {\n const resources: IResource[] = (config.detectors ?? []).map(\n (d: Detector | DetectorSync) => {\n try {\n const resourceOrPromise = d.detect(config);\n let resource: IResource;\n if (isPromiseLike<Resource>(resourceOrPromise)) {\n const createPromise = async () => {\n const resolvedResource = await resourceOrPromise;\n return resolvedResource.attributes;\n };\n resource = new Resource({}, createPromise());\n } else {\n resource = resourceOrPromise as IResource;\n }\n\n if (resource.waitForAsyncAttributes) {\n void resource\n .waitForAsyncAttributes()\n .then(() =>\n diag.debug(`${d.constructor.name} found resource.`, resource)\n );\n } else {\n diag.debug(`${d.constructor.name} found resource.`, resource);\n }\n\n return resource;\n } catch (e) {\n diag.error(`${d.constructor.name} failed: ${e.message}`);\n return Resource.empty();\n }\n }\n );\n\n const mergedResources = resources.reduce(\n (acc, resource) => acc.merge(resource),\n Resource.empty()\n );\n\n if (mergedResources.waitForAsyncAttributes) {\n void mergedResources.waitForAsyncAttributes().then(() => {\n // Future check if verbose logging is enabled issue #1903\n logResources(resources);\n });\n }\n\n return mergedResources;\n};\n\n/**\n * Writes debug information about the detected resources to the logger defined in the resource detection config, if one is provided.\n *\n * @param resources The array of {@link Resource} that should be logged. Empty entries will be ignored.\n */\nconst logResources = (resources: Array<IResource>) => {\n resources.forEach(resource => {\n // Print only populated resources\n if (Object.keys(resource.attributes).length > 0) {\n const resourceDebugString = JSON.stringify(resource.attributes, null, 4);\n diag.verbose(resourceDebugString);\n }\n });\n};\n", "/*\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\nexport const isPromiseLike = <R>(val: any): val is PromiseLike<R> => {\n return (\n val !== null && typeof val === 'object' && typeof val.then === 'function'\n );\n};\n", "/*\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 { Context } from '@opentelemetry/api';\nimport { globalErrorHandler } from '@opentelemetry/core';\nimport { ReadableSpan } from './export/ReadableSpan';\nimport { Span } from './Span';\nimport { SpanProcessor } from './SpanProcessor';\n\n/**\n * Implementation of the {@link SpanProcessor} that simply forwards all\n * received events to a list of {@link SpanProcessor}s.\n */\nexport class MultiSpanProcessor implements SpanProcessor {\n constructor(private readonly _spanProcessors: SpanProcessor[]) {}\n\n forceFlush(): Promise<void> {\n const promises: Promise<void>[] = [];\n\n for (const spanProcessor of this._spanProcessors) {\n promises.push(spanProcessor.forceFlush());\n }\n return new Promise(resolve => {\n Promise.all(promises)\n .then(() => {\n resolve();\n })\n .catch(error => {\n globalErrorHandler(\n error || new Error('MultiSpanProcessor: forceFlush failed')\n );\n resolve();\n });\n });\n }\n\n onStart(span: Span, context: Context): void {\n for (const spanProcessor of this._spanProcessors) {\n spanProcessor.onStart(span, context);\n }\n }\n\n onEnd(span: ReadableSpan): void {\n for (const spanProcessor of this._spanProcessors) {\n spanProcessor.onEnd(span);\n }\n }\n\n shutdown(): Promise<void> {\n const promises: Promise<void>[] = [];\n\n for (const spanProcessor of this._spanProcessors) {\n promises.push(spanProcessor.shutdown());\n }\n return new Promise((resolve, reject) => {\n Promise.all(promises).then(() => {\n resolve();\n }, reject);\n });\n }\n}\n", "/*\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 { Context } from '@opentelemetry/api';\nimport { ReadableSpan } from './ReadableSpan';\nimport { Span } from '../Span';\nimport { SpanProcessor } from '../SpanProcessor';\n\n/** No-op implementation of SpanProcessor */\nexport class NoopSpanProcessor implements SpanProcessor {\n onStart(_span: Span, _context: Context): void {}\n onEnd(_span: ReadableSpan): void {}\n shutdown(): Promise<void> {\n return Promise.resolve();\n }\n forceFlush(): Promise<void> {\n return Promise.resolve();\n }\n}\n", "import type { ContextManager, TextMapPropagator } from \"@opentelemetry/api\";\nimport type { InstrumentationOption } from \"@opentelemetry/instrumentation\";\nimport type { ResourceDetectionConfig } from \"@opentelemetry/resources\";\nimport type {\n Sampler,\n SpanExporter,\n SpanProcessor,\n} from \"@opentelemetry/sdk-trace-base\";\nimport {\n AlwaysOffSampler,\n AlwaysOnSampler,\n ParentBasedSampler,\n TraceIdRatioBasedSampler,\n BasicTracerProvider,\n BatchSpanProcessor,\n RandomIdGenerator,\n} from \"@opentelemetry/sdk-trace-base\";\nimport {\n metrics,\n diag,\n DiagConsoleLogger,\n DiagLogLevel,\n} from \"@opentelemetry/api\";\nimport { logs } from \"@opentelemetry/api-logs\";\nimport { registerInstrumentations } from \"@opentelemetry/instrumentation/build/src/autoLoader\";\nimport {\n detectResourcesSync,\n envDetectorSync,\n Resource,\n} from \"@opentelemetry/resources\";\nimport { LoggerProvider } from \"@opentelemetry/sdk-logs\";\nimport { MeterProvider } from \"@opentelemetry/sdk-metrics\";\nimport { SemanticResourceAttributes } from \"@opentelemetry/semantic-conventions\";\nimport {\n parseEnvironment,\n DEFAULT_ENVIRONMENT,\n} from \"@opentelemetry/core/build/src/utils/environment\";\nimport { AsyncLocalStorageContextManager } from \"@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager\";\nimport {\n CompositePropagator,\n W3CBaggagePropagator,\n baggageUtils,\n} from \"@opentelemetry/core\";\nimport { CompositeSpanProcessor } from \"./processor/composite-span-processor\";\nimport { OTLPHttpJsonTraceExporter } from \"./exporters/exporter-trace-otlp-http-fetch\";\nimport { OTLPHttpProtoTraceExporter } from \"./exporters/exporter-trace-otlp-proto-fetch\";\nimport { omitUndefinedAttributes } from \"./util/attributes\";\nimport type {\n Configuration,\n InstrumentationConfiguration,\n InstrumentationOptionOrName,\n PropagatorOrName,\n SampleOrName,\n SpanProcessorOrName,\n} from \"./types\";\nimport { FetchInstrumentation } from \"./instrumentations/fetch\";\nimport { W3CTraceContextPropagator } from \"./propagators/w3c-tracecontext-propagator\";\nimport { VercelRuntimePropagator } from \"./vercel-request-context/propagator\";\nimport { VercelRuntimeSpanExporter } from \"./vercel-request-context/exporter\";\n\ntype Env = ReturnType<typeof parseEnvironment>;\n\nconst logLevelMap: Record<string, DiagLogLevel> = {\n ALL: DiagLogLevel.ALL,\n VERBOSE: DiagLogLevel.VERBOSE,\n DEBUG: DiagLogLevel.DEBUG,\n INFO: DiagLogLevel.INFO,\n WARN: DiagLogLevel.WARN,\n ERROR: DiagLogLevel.ERROR,\n NONE: DiagLogLevel.NONE,\n};\n\nexport class Sdk {\n private contextManager: ContextManager | undefined;\n private tracerProvider: BasicTracerProvider | undefined;\n private loggerProvider: LoggerProvider | undefined;\n private meterProvider: MeterProvider | undefined;\n private disableInstrumentations: (() => void) | undefined;\n\n public constructor(private configuration: Configuration = {}) {}\n\n public start(): void {\n const env = getEnv();\n const configuration = this.configuration;\n const runtime = process.env.NEXT_RUNTIME || \"nodejs\";\n\n const disabled = Boolean(env.OTEL_SDK_DISABLED);\n\n // Default is INFO, use environment without defaults to check\n // if the user originally set the environment variable.\n if (process.env.OTEL_LOG_LEVEL) {\n diag.setLogger(new DiagConsoleLogger(), {\n logLevel: logLevelMap[process.env.OTEL_LOG_LEVEL.toUpperCase()],\n });\n }\n\n if (disabled) {\n return;\n }\n\n const idGenerator = configuration.idGenerator ?? new RandomIdGenerator();\n\n const contextManager =\n configuration.contextManager ?? new AsyncLocalStorageContextManager();\n contextManager.enable();\n this.contextManager = contextManager;\n\n const serviceName =\n env.OTEL_SERVICE_NAME || configuration.serviceName || \"app\";\n let resource = new Resource(\n omitUndefinedAttributes({\n [SemanticResourceAttributes.SERVICE_NAME]: serviceName,\n\n // Node.\n \"node.ci\": process.env.CI ? true : undefined,\n \"node.env\": process.env.NODE_ENV,\n\n // Vercel.\n // https://vercel.com/docs/projects/environment-variables/system-environment-variables\n // Vercel Env set as top level attribute for simplicity. One of 'production', 'preview' or 'development'.\n env: process.env.VERCEL_ENV || process.env.NEXT_PUBLIC_VERCEL_ENV,\n \"vercel.region\": process.env.VERCEL_REGION,\n \"vercel.runtime\": runtime,\n \"vercel.sha\":\n process.env.VERCEL_GIT_COMMIT_SHA ||\n process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA,\n \"vercel.host\":\n process.env.VERCEL_URL ||\n process.env.NEXT_PUBLIC_VERCEL_URL ||\n undefined,\n \"vercel.branch_host\":\n process.env.VERCEL_BRANCH_URL ||\n process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL ||\n undefined,\n \"vercel.deployment_id\": process.env.VERCEL_DEPLOYMENT_ID || undefined,\n [SemanticResourceAttributes.SERVICE_VERSION]:\n process.env.VERCEL_DEPLOYMENT_ID,\n\n ...configuration.attributes,\n })\n );\n const resourceDetectors = configuration.resourceDetectors ?? [\n envDetectorSync,\n ];\n const autoDetectResources = configuration.autoDetectResources ?? true;\n if (autoDetectResources) {\n const internalConfig: ResourceDetectionConfig = {\n detectors: resourceDetectors,\n };\n resource = resource.merge(detectResourcesSync(internalConfig));\n }\n\n const propagators = parsePropagators(\n configuration.propagators,\n configuration,\n env\n );\n const traceSampler = parseSampler(configuration.traceSampler, env);\n const spanProcessors = parseSpanProcessor(\n configuration.spanProcessors,\n configuration,\n env\n );\n if (spanProcessors.length === 0) {\n diag.warn(\n \"@vercel/otel: No span processors configured. No spans will be exported.\"\n );\n }\n const spanLimits = configuration.spanLimits;\n const tracerProvider = new BasicTracerProvider({\n resource,\n idGenerator,\n sampler: traceSampler,\n spanLimits,\n });\n tracerProvider.addSpanProcessor(\n new CompositeSpanProcessor(\n spanProcessors,\n configuration.attributesFromHeaders\n )\n );\n tracerProvider.register({\n contextManager,\n propagator: new CompositePropagator({ propagators }),\n });\n this.tracerProvider = tracerProvider;\n\n if (configuration.logRecordProcessor) {\n const loggerProvider = new LoggerProvider({ resource });\n this.loggerProvider = loggerProvider;\n loggerProvider.addLogRecordProcessor(configuration.logRecordProcessor);\n logs.setGlobalLoggerProvider(loggerProvider);\n }\n\n if (configuration.metricReader || configuration.views) {\n const meterProvider = new MeterProvider({\n resource,\n views: configuration.views ?? [],\n });\n if (configuration.metricReader) {\n meterProvider.addMetricReader(configuration.metricReader);\n }\n metrics.setGlobalMeterProvider(meterProvider);\n this.meterProvider = meterProvider;\n }\n\n const instrumentations = parseInstrumentations(\n configuration.instrumentations,\n configuration.instrumentationConfig\n );\n this.disableInstrumentations = registerInstrumentations({\n instrumentations,\n });\n\n diag.info(\"@vercel/otel: started\", serviceName, runtime);\n }\n\n public async shutdown(): Promise<void> {\n const promises: Promise<unknown>[] = [];\n\n if (this.tracerProvider) {\n promises.push(this.tracerProvider.shutdown());\n }\n if (this.loggerProvider) {\n promises.push(this.loggerProvider.shutdown());\n }\n if (this.meterProvider) {\n promises.push(this.meterProvider.shutdown());\n }\n\n diag.info(\n \"@vercel/otel: shutting down\",\n promises.length,\n process.env.NEXT_RUNTIME\n );\n\n await Promise.all(promises);\n\n if (this.contextManager) {\n this.contextManager.disable();\n }\n const { disableInstrumentations } = this;\n if (disableInstrumentations) {\n disableInstrumentations();\n }\n }\n}\n\nfunction getEnv(): Env {\n const processEnv = parseEnvironment(process.env);\n return { ...DEFAULT_ENVIRONMENT, ...processEnv };\n}\n\nfunction parseInstrumentations(\n arg: InstrumentationOptionOrName[] | undefined,\n instrumentationConfig: InstrumentationConfiguration | undefined\n): InstrumentationOption[] {\n return (arg ?? [\"auto\"])\n .map((instrumentationOrName) => {\n if (instrumentationOrName === \"auto\") {\n diag.debug(\n \"@vercel/otel: Configure instrumentations: fetch\",\n instrumentationConfig?.fetch\n );\n return [new FetchInstrumentation(instrumentationConfig?.fetch)];\n }\n if (instrumentationOrName === \"fetch\") {\n diag.debug(\n \"@vercel/otel: Configure instrumentations: fetch\",\n instrumentationConfig?.fetch\n );\n return new FetchInstrumentation(instrumentationConfig?.fetch);\n }\n return instrumentationOrName;\n })\n .flat();\n}\n\nfunction parsePropagators(\n arg: PropagatorOrName[] | undefined,\n configuration: Configuration,\n env: Env\n): TextMapPropagator[] {\n const envPropagators =\n process.env.OTEL_PROPAGATORS &&\n env.OTEL_PROPAGATORS &&\n env.OTEL_PROPAGATORS.length > 0\n ? env.OTEL_PROPAGATORS\n : undefined;\n return (arg ?? envPropagators ?? [\"auto\"])\n .map((propagatorOrName) => {\n if (propagatorOrName === \"none\") {\n return [];\n }\n if (propagatorOrName === \"auto\") {\n const autoList: { name: string; propagator: TextMapPropagator }[] = [];\n autoList.push({\n name: \"tracecontext\",\n propagator: new W3CTraceContextPropagator(),\n });\n autoList.push({\n name: \"baggage\",\n propagator: new W3CBaggagePropagator(),\n });\n autoList.push({\n name: \"vercel-runtime\",\n propagator: new VercelRuntimePropagator(),\n });\n\n diag.debug(\n `@vercel/otel: Configure propagators: ${autoList\n .map((i) => i.name)\n .join(\", \")}`\n );\n return autoList.map((i) => i.propagator);\n }\n if (propagatorOrName === \"tracecontext\") {\n diag.debug(\"@vercel/otel: Configure propagator: tracecontext\");\n return new W3CTraceContextPropagator();\n }\n if (propagatorOrName === \"baggage\") {\n diag.debug(\"@vercel/otel: Configure propagator: baggage\");\n return new W3CBaggagePropagator();\n }\n if (typeof propagatorOrName === \"string\") {\n throw new Error(`Unknown propagator: \"${propagatorOrName}\"`);\n }\n return propagatorOrName;\n })\n .flat();\n}\n\nconst FALLBACK_OTEL_TRACES_SAMPLER = \"always_on\";\nconst DEFAULT_RATIO = 1;\n\n/**\n * The code below is borrowed from the https://github.com/open-telemetry/opentelemetry-js/blob/b6e532bf52c9553e51aa6d3375e85f0dd9bd67c1/packages/opentelemetry-sdk-trace-base/src/config.ts#L64\n * bacause, unfortunately, OpenTelemetry API doesn't export it directly.\n */\nfunction parseSampler(arg: SampleOrName | undefined, env: Env): Sampler {\n if (arg && typeof arg !== \"string\") {\n return arg;\n }\n\n const name =\n arg && arg !== \"auto\"\n ? arg\n : env.OTEL_TRACES_SAMPLER || FALLBACK_OTEL_TRACES_SAMPLER;\n diag.debug(\"@vercel/otel: Configure sampler: \", name);\n switch (name) {\n case \"always_on\":\n return new AlwaysOnSampler();\n case \"always_off\":\n return new AlwaysOffSampler();\n case \"parentbased_always_on\":\n return new ParentBasedSampler({\n root: new AlwaysOnSampler(),\n });\n case \"parentbased_always_off\":\n return new ParentBasedSampler({\n root: new AlwaysOffSampler(),\n });\n case \"traceidratio\":\n return new TraceIdRatioBasedSampler(getSamplerProbabilityFromEnv(env));\n case \"parentbased_traceidratio\":\n return new ParentBasedSampler({\n root: new TraceIdRatioBasedSampler(getSamplerProbabilityFromEnv(env)),\n });\n default:\n diag.error(\n `@vercel/otel: OTEL_TRACES_SAMPLER value \"${String(\n env.OTEL_TRACES_SAMPLER\n )} invalid, defaulting to ${FALLBACK_OTEL_TRACES_SAMPLER}\".`\n );\n return new AlwaysOnSampler();\n }\n}\n\nfunction getSamplerProbabilityFromEnv(env: Env): number {\n if (\n env.OTEL_TRACES_SAMPLER_ARG === undefined ||\n env.OTEL_TRACES_SAMPLER_ARG === \"\"\n ) {\n diag.error(\n `@vercel/otel: OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${DEFAULT_RATIO}.`\n );\n return DEFAULT_RATIO;\n }\n\n diag.debug(\n \"@vercel/otel: Configure sampler probability: \",\n env.OTEL_TRACES_SAMPLER_ARG\n );\n const probability = Number(env.OTEL_TRACES_SAMPLER_ARG);\n\n if (isNaN(probability)) {\n diag.error(\n `@vercel/otel: OTEL_TRACES_SAMPLER_ARG=${env.OTEL_TRACES_SAMPLER_ARG} was given, but it is invalid, defaulting to ${DEFAULT_RATIO}.`\n );\n return DEFAULT_RATIO;\n }\n\n if (probability < 0 || probability > 1) {\n diag.error(\n `@vercel/otel: OTEL_TRACES_SAMPLER_ARG=${env.OTEL_TRACES_SAMPLER_ARG} was given, but it is out of range ([0..1]), defaulting to ${DEFAULT_RATIO}.`\n );\n return DEFAULT_RATIO;\n }\n\n return probability;\n}\n\nfunction parseSpanProcessor(\n arg: SpanProcessorOrName[] | undefined,\n configuration: Configuration,\n env: Env\n): SpanProcessor[] {\n return [\n ...(arg ?? [\"auto\"])\n .flatMap((spanProcessorOrName) => {\n if (spanProcessorOrName === \"auto\") {\n const processors: SpanProcessor[] = [\n new BatchSpanProcessor(new VercelRuntimeSpanExporter()),\n ];\n\n if (process.env.VERCEL_OTEL_ENDPOINTS) {\n // OTEL collector is configured on 4318 port.\n const port = process.env.VERCEL_OTEL_ENDPOINTS_PORT || \"4318\";\n // It's important to use x-protobuf here because the Vercel collector\n // doesn't correctly process `TimeUnixNano{low, high}` encoding.\n const protocol =\n process.env.VERCEL_OTEL_ENDPOINTS_PROTOCOL || \"http/protobuf\";\n diag.debug(\n \"@vercel/otel: Configure vercel otel collector on port: \",\n port,\n protocol\n );\n const config = {\n url: `http://localhost:${port}/v1/traces`,\n headers: {},\n };\n const exporter =\n protocol === \"http/protobuf\"\n ? new OTLPHttpProtoTraceExporter(config)\n : new OTLPHttpJsonTraceExporter(config);\n\n processors.push(new BatchSpanProcessor(exporter));\n }\n\n // Consider going throw `VERCEL_OTEL_ENDPOINTS` (otel collector) for OTLP.\n else if (\n !configuration.traceExporter ||\n configuration.traceExporter === \"auto\" ||\n env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT ||\n env.OTEL_EXPORTER_OTLP_ENDPOINT\n ) {\n return new BatchSpanProcessor(parseTraceExporter(env));\n }\n\n return processors;\n }\n return spanProcessorOrName;\n })\n .filter(isNotNull),\n ...(configuration.traceExporter && configuration.traceExporter !== \"auto\"\n ? [new BatchSpanProcessor(configuration.traceExporter)]\n : []),\n ];\n}\n\n/**\n * This code is moved from the https://github.com/open-telemetry/opentelemetry-js/blob/00e78efd840d3f49d9d4b025a9965e8d3f2913ad/experimental/packages/opentelemetry-sdk-node/src/TracerProviderWithEnvExporter.ts#L41\n * due to the https://github.com/open-telemetry/opentelemetry-js/issues/4212\n */\nfunction parseTraceExporter(env: Env): SpanExporter {\n const protocol =\n process.env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL ??\n process.env.OTEL_EXPORTER_OTLP_PROTOCOL ??\n \"http/protobuf\";\n const url = buildExporterUrlFromEnv(env);\n const headers = {\n ...baggageUtils.parseKeyPairsIntoRecord(env.OTEL_EXPORTER_OTLP_HEADERS),\n ...baggageUtils.parseKeyPairsIntoRecord(\n env.OTEL_EXPORTER_OTLP_TRACES_HEADERS\n ),\n };\n diag.debug(\n \"@vercel/otel: Configure trace exporter: \",\n protocol,\n url,\n `headers: ${Object.keys(headers).join(\",\") || \"<none>\"}`\n );\n switch (protocol) {\n case \"http/json\":\n return new OTLPHttpJsonTraceExporter({ url, headers });\n case \"http/protobuf\":\n return new OTLPHttpProtoTraceExporter({ url, headers });\n default:\n // \"grpc\" protocol is not supported in Edge.\n diag.warn(\n `@vercel/otel: Unsupported OTLP traces protocol: ${protocol}. Using http/protobuf.`\n );\n return new OTLPHttpProtoTraceExporter();\n }\n}\n\nconst DEFAULT_COLLECTOR_RESOURCE_PATH = \"v1/traces\";\nconst DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;\n\nfunction buildExporterUrlFromEnv(env: Env): string {\n const defaultUrlFromEnv = env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT;\n if (defaultUrlFromEnv && typeof defaultUrlFromEnv === \"string\") {\n return defaultUrlFromEnv;\n }\n\n const defaultUrlFromEnvAll = env.OTEL_EXPORTER_OTLP_ENDPOINT;\n if (defaultUrlFromEnvAll && typeof defaultUrlFromEnvAll === \"string\") {\n return `${defaultUrlFromEnvAll}/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;\n }\n\n return DEFAULT_COLLECTOR_URL;\n}\n\nfunction isNotNull<T>(x: T | null | undefined): x is T {\n return x !== null && x !== undefined;\n}\n", "export * from \"@opentelemetry/api-logs\"", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { diag } from '@opentelemetry/api';\nimport type * as logsAPI from '@opentelemetry/api-logs';\nimport { NOOP_LOGGER } from '@opentelemetry/api-logs';\nimport { Resource } from '@opentelemetry/resources';\nimport { BindOnceFuture, merge } from '@opentelemetry/core';\n\nimport type { LoggerProviderConfig } from './types';\nimport type { LogRecordProcessor } from './LogRecordProcessor';\nimport { Logger } from './Logger';\nimport { loadDefaultConfig, reconfigureLimits } from './config';\nimport { MultiLogRecordProcessor } from './MultiLogRecordProcessor';\nimport { LoggerProviderSharedState } from './internal/LoggerProviderSharedState';\n\nexport const DEFAULT_LOGGER_NAME = 'unknown';\n\nexport class LoggerProvider implements logsAPI.LoggerProvider {\n private _shutdownOnce: BindOnceFuture<void>;\n private readonly _sharedState: LoggerProviderSharedState;\n\n constructor(config: LoggerProviderConfig = {}) {\n const {\n resource = Resource.default(),\n logRecordLimits,\n forceFlushTimeoutMillis,\n } = merge({}, loadDefaultConfig(), config);\n this._sharedState = new LoggerProviderSharedState(\n resource,\n forceFlushTimeoutMillis,\n reconfigureLimits(logRecordLimits)\n );\n this._shutdownOnce = new BindOnceFuture(this._shutdown, this);\n }\n\n /**\n * Get a logger with the configuration of the LoggerProvider.\n */\n public getLogger(\n name: string,\n version?: string,\n options?: logsAPI.LoggerOptions\n ): logsAPI.Logger {\n if (this._shutdownOnce.isCalled) {\n diag.warn('A shutdown LoggerProvider cannot provide a Logger');\n return NOOP_LOGGER;\n }\n\n if (!name) {\n diag.warn('Logger requested without instrumentation scope name.');\n }\n const loggerName = name || DEFAULT_LOGGER_NAME;\n const key = `${loggerName}@${version || ''}:${options?.schemaUrl || ''}`;\n if (!this._sharedState.loggers.has(key)) {\n this._sharedState.loggers.set(\n key,\n new Logger(\n { name: loggerName, version, schemaUrl: options?.schemaUrl },\n this._sharedState\n )\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this._sharedState.loggers.get(key)!;\n }\n\n /**\n * Adds a new {@link LogRecordProcessor} to this logger.\n * @param processor the new LogRecordProcessor to be added.\n */\n public addLogRecordProcessor(processor: LogRecordProcessor) {\n if (this._sharedState.registeredLogRecordProcessors.length === 0) {\n // since we might have enabled by default a batchProcessor, we disable it\n // before adding the new one\n this._sharedState.activeProcessor\n .shutdown()\n .catch(err =>\n diag.error(\n 'Error while trying to shutdown current log record processor',\n err\n )\n );\n }\n this._sharedState.registeredLogRecordProcessors.push(processor);\n this._sharedState.activeProcessor = new MultiLogRecordProcessor(\n this._sharedState.registeredLogRecordProcessors,\n this._sharedState.forceFlushTimeoutMillis\n );\n }\n\n /**\n * Notifies all registered LogRecordProcessor to flush any buffered data.\n *\n * Returns a promise which is resolved when all flushes are complete.\n */\n public forceFlush(): Promise<void> {\n // do not flush after shutdown\n if (this._shutdownOnce.isCalled) {\n diag.warn('invalid attempt to force flush after LoggerProvider shutdown');\n return this._shutdownOnce.promise;\n }\n return this._sharedState.activeProcessor.forceFlush();\n }\n\n /**\n * Flush all buffered data and shut down the LoggerProvider and all registered\n * LogRecordProcessor.\n *\n * Returns a promise which is resolved when all flushes are complete.\n */\n public shutdown(): Promise<void> {\n if (this._shutdownOnce.isCalled) {\n diag.warn('shutdown may only be called once per LoggerProvider');\n return this._shutdownOnce.promise;\n }\n return this._shutdownOnce.call();\n }\n\n private _shutdown(): Promise<void> {\n return this._sharedState.activeProcessor.shutdown();\n }\n}\n", "/*\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 type * as logsAPI from '@opentelemetry/api-logs';\nimport type { InstrumentationScope } from '@opentelemetry/core';\nimport { context } from '@opentelemetry/api';\n\nimport { LogRecord } from './LogRecord';\nimport { LoggerProviderSharedState } from './internal/LoggerProviderSharedState';\n\nexport class Logger implements logsAPI.Logger {\n constructor(\n public readonly instrumentationScope: InstrumentationScope,\n private _sharedState: LoggerProviderSharedState\n ) {}\n\n public emit(logRecord: logsAPI.LogRecord): void {\n const currentContext = logRecord.context || context.active();\n /**\n * If a Logger was obtained with include_trace_context=true,\n * the LogRecords it emits MUST automatically include the Trace Context from the active Context,\n * if Context has not been explicitly set.\n */\n const logRecordInstance = new LogRecord(\n this._sharedState,\n this.instrumentationScope,\n {\n context: currentContext,\n ...logRecord,\n }\n );\n /**\n * the explicitly passed Context,\n * the current Context, or an empty Context if the Logger was obtained with include_trace_context=false\n */\n this._sharedState.activeProcessor.onEmit(logRecordInstance, currentContext);\n /**\n * A LogRecordProcessor may freely modify logRecord for the duration of the OnEmit call.\n * If logRecord is needed after OnEmit returns (i.e. for asynchronous processing) only reads are permitted.\n */\n logRecordInstance._makeReadonly();\n }\n}\n", "/*\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 { AttributeValue, diag } from '@opentelemetry/api';\nimport type * as logsAPI from '@opentelemetry/api-logs';\nimport * as api from '@opentelemetry/api';\nimport {\n timeInputToHrTime,\n isAttributeValue,\n InstrumentationScope,\n} from '@opentelemetry/core';\nimport type { IResource } from '@opentelemetry/resources';\n\nimport type { ReadableLogRecord } from './export/ReadableLogRecord';\nimport type { LogRecordLimits } from './types';\nimport { LogAttributes } from '@opentelemetry/api-logs';\nimport { LoggerProviderSharedState } from './internal/LoggerProviderSharedState';\n\nexport class LogRecord implements ReadableLogRecord {\n readonly hrTime: api.HrTime;\n readonly hrTimeObserved: api.HrTime;\n readonly spanContext?: api.SpanContext;\n readonly resource: IResource;\n readonly instrumentationScope: InstrumentationScope;\n readonly attributes: logsAPI.LogAttributes = {};\n private _severityText?: string;\n private _severityNumber?: logsAPI.SeverityNumber;\n private _body?: string;\n private totalAttributesCount: number = 0;\n\n private _isReadonly: boolean = false;\n private readonly _logRecordLimits: Required<LogRecordLimits>;\n\n set severityText(severityText: string | undefined) {\n if (this._isLogRecordReadonly()) {\n return;\n }\n this._severityText = severityText;\n }\n get severityText(): string | undefined {\n return this._severityText;\n }\n\n set severityNumber(severityNumber: logsAPI.SeverityNumber | undefined) {\n if (this._isLogRecordReadonly()) {\n return;\n }\n this._severityNumber = severityNumber;\n }\n get severityNumber(): logsAPI.SeverityNumber | undefined {\n return this._severityNumber;\n }\n\n set body(body: string | undefined) {\n if (this._isLogRecordReadonly()) {\n return;\n }\n this._body = body;\n }\n get body(): string | undefined {\n return this._body;\n }\n\n get droppedAttributesCount(): number {\n return this.totalAttributesCount - Object.keys(this.attributes).length;\n }\n\n constructor(\n _sharedState: LoggerProviderSharedState,\n instrumentationScope: InstrumentationScope,\n logRecord: logsAPI.LogRecord\n ) {\n const {\n timestamp,\n observedTimestamp,\n severityNumber,\n severityText,\n body,\n attributes = {},\n context,\n } = logRecord;\n\n const now = Date.now();\n this.hrTime = timeInputToHrTime(timestamp ?? now);\n this.hrTimeObserved = timeInputToHrTime(observedTimestamp ?? now);\n\n if (context) {\n const spanContext = api.trace.getSpanContext(context);\n if (spanContext && api.isSpanContextValid(spanContext)) {\n this.spanContext = spanContext;\n }\n }\n this.severityNumber = severityNumber;\n this.severityText = severityText;\n this.body = body;\n this.resource = _sharedState.resource;\n this.instrumentationScope = instrumentationScope;\n this._logRecordLimits = _sharedState.logRecordLimits;\n this.setAttributes(attributes);\n }\n\n public setAttribute(key: string, value?: LogAttributes | AttributeValue) {\n if (this._isLogRecordReadonly()) {\n return this;\n }\n if (value === null) {\n return this;\n }\n if (key.length === 0) {\n api.diag.warn(`Invalid attribute key: ${key}`);\n return this;\n }\n if (\n !isAttributeValue(value) &&\n !(\n typeof value === 'object' &&\n !Array.isArray(value) &&\n Object.keys(value).length > 0\n )\n ) {\n api.diag.warn(`Invalid attribute value set for key: ${key}`);\n return this;\n }\n this.totalAttributesCount += 1;\n if (\n Object.keys(this.attributes).length >=\n this._logRecordLimits.attributeCountLimit &&\n !Object.prototype.hasOwnProperty.call(this.attributes, key)\n ) {\n return this;\n }\n if (isAttributeValue(value)) {\n this.attributes[key] = this._truncateToSize(value);\n } else {\n this.attributes[key] = value;\n }\n return this;\n }\n\n public setAttributes(attributes: LogAttributes) {\n for (const [k, v] of Object.entries(attributes)) {\n this.setAttribute(k, v);\n }\n return this;\n }\n\n public setBody(body: string) {\n this.body = body;\n return this;\n }\n\n public setSeverityNumber(severityNumber: logsAPI.SeverityNumber) {\n this.severityNumber = severityNumber;\n return this;\n }\n\n public setSeverityText(severityText: string) {\n this.severityText = severityText;\n return this;\n }\n\n /**\n * @internal\n * A LogRecordProcessor may freely modify logRecord for the duration of the OnEmit call.\n * If logRecord is needed after OnEmit returns (i.e. for asynchronous processing) only reads are permitted.\n */\n _makeReadonly() {\n this._isReadonly = true;\n }\n\n private _truncateToSize(value: AttributeValue): AttributeValue {\n const limit = this._logRecordLimits.attributeValueLengthLimit;\n // Check limit\n if (limit <= 0) {\n // Negative values are invalid, so do not truncate\n api.diag.warn(`Attribute value limit must be positive, got ${limit}`);\n return value;\n }\n\n // String\n if (typeof value === 'string') {\n return this._truncateToLimitUtil(value, limit);\n }\n\n // Array of strings\n if (Array.isArray(value)) {\n return (value as []).map(val =>\n typeof val === 'string' ? this._truncateToLimitUtil(val, limit) : val\n );\n }\n\n // Other types, no need to apply value length limit\n return value;\n }\n\n private _truncateToLimitUtil(value: string, limit: number): string {\n if (value.length <= limit) {\n return value;\n }\n return value.substring(0, limit);\n }\n\n private _isLogRecordReadonly(): boolean {\n if (this._isReadonly) {\n diag.warn('Can not execute the operation on emitted log record');\n }\n return this._isReadonly;\n }\n}\n", "/*\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 {\n DEFAULT_ATTRIBUTE_COUNT_LIMIT,\n DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,\n getEnv,\n getEnvWithoutDefaults,\n} from '@opentelemetry/core';\nimport { LogRecordLimits } from './types';\n\nexport function loadDefaultConfig() {\n return {\n forceFlushTimeoutMillis: 30000,\n logRecordLimits: {\n attributeValueLengthLimit:\n getEnv().OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT,\n attributeCountLimit: getEnv().OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT,\n },\n includeTraceContext: true,\n };\n}\n\n/**\n * When general limits are provided and model specific limits are not,\n * configures the model specific limits by using the values from the general ones.\n * @param logRecordLimits User provided limits configuration\n */\nexport function reconfigureLimits(\n logRecordLimits: LogRecordLimits\n): Required<LogRecordLimits> {\n const parsedEnvConfig = getEnvWithoutDefaults();\n\n return {\n /**\n * Reassign log record attribute count limit to use first non null value defined by user or use default value\n */\n attributeCountLimit:\n logRecordLimits.attributeCountLimit ??\n parsedEnvConfig.OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT ??\n parsedEnvConfig.OTEL_ATTRIBUTE_COUNT_LIMIT ??\n DEFAULT_ATTRIBUTE_COUNT_LIMIT,\n /**\n * Reassign log record attribute value length limit to use first non null value defined by user or use default value\n */\n attributeValueLengthLimit:\n logRecordLimits.attributeValueLengthLimit ??\n parsedEnvConfig.OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT ??\n parsedEnvConfig.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT ??\n DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,\n };\n}\n", "/*\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 { callWithTimeout } from '@opentelemetry/core';\nimport type { Context } from '@opentelemetry/api';\nimport type { LogRecordProcessor } from './LogRecordProcessor';\nimport type { LogRecord } from './LogRecord';\n\n/**\n * Implementation of the {@link LogRecordProcessor} that simply forwards all\n * received events to a list of {@link LogRecordProcessor}s.\n */\nexport class MultiLogRecordProcessor implements LogRecordProcessor {\n constructor(\n public readonly processors: LogRecordProcessor[],\n public readonly forceFlushTimeoutMillis: number\n ) {}\n\n public async forceFlush(): Promise<void> {\n const timeout = this.forceFlushTimeoutMillis;\n await Promise.all(\n this.processors.map(processor =>\n callWithTimeout(processor.forceFlush(), timeout)\n )\n );\n }\n\n public onEmit(logRecord: LogRecord, context?: Context): void {\n this.processors.forEach(processors =>\n processors.onEmit(logRecord, context)\n );\n }\n\n public async shutdown(): Promise<void> {\n await Promise.all(this.processors.map(processor => processor.shutdown()));\n }\n}\n", "/*\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 { Context } from '@opentelemetry/api';\nimport { LogRecordProcessor } from '../LogRecordProcessor';\nimport { ReadableLogRecord } from './ReadableLogRecord';\n\nexport class NoopLogRecordProcessor implements LogRecordProcessor {\n forceFlush(): Promise<void> {\n return Promise.resolve();\n }\n\n onEmit(_logRecord: ReadableLogRecord, _context: Context): void {}\n\n shutdown(): Promise<void> {\n return Promise.resolve();\n }\n}\n", "/*\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 { Logger } from '@opentelemetry/api-logs';\nimport { IResource } from '@opentelemetry/resources';\nimport { LogRecordProcessor } from '../LogRecordProcessor';\nimport { LogRecordLimits } from '../types';\nimport { NoopLogRecordProcessor } from '../export/NoopLogRecordProcessor';\n\nexport class LoggerProviderSharedState {\n readonly loggers: Map<string, Logger> = new Map();\n activeProcessor: LogRecordProcessor;\n readonly registeredLogRecordProcessors: LogRecordProcessor[] = [];\n\n constructor(\n readonly resource: IResource,\n readonly forceFlushTimeoutMillis: number,\n readonly logRecordLimits: Required<LogRecordLimits>\n ) {\n this.activeProcessor = new NoopLogRecordProcessor();\n }\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * AggregationTemporality indicates the way additive quantities are expressed.\n */\nexport enum AggregationTemporality {\n DELTA,\n CUMULATIVE,\n}\n", "/*\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 { MetricAttributes } from '@opentelemetry/api';\nimport { InstrumentationScope } from '@opentelemetry/core';\n\nexport type Maybe<T> = T | undefined;\n\nexport function isNotNullish<T>(item: Maybe<T>): item is T {\n return item !== undefined && item !== null;\n}\n\n/**\n * Converting the unordered attributes into unique identifier string.\n * @param attributes user provided unordered MetricAttributes.\n */\nexport function hashAttributes(attributes: MetricAttributes): string {\n let keys = Object.keys(attributes);\n if (keys.length === 0) return '';\n\n // Return a string that is stable on key orders.\n keys = keys.sort();\n return JSON.stringify(keys.map(key => [key, attributes[key]]));\n}\n\n/**\n * Converting the instrumentation scope object to a unique identifier string.\n * @param instrumentationScope\n */\nexport function instrumentationScopeId(\n instrumentationScope: InstrumentationScope\n): string {\n return `${instrumentationScope.name}:${instrumentationScope.version ?? ''}:${\n instrumentationScope.schemaUrl ?? ''\n }`;\n}\n\n/**\n * Error that is thrown on timeouts.\n */\nexport class TimeoutError extends Error {\n constructor(message?: string) {\n super(message);\n\n // manually adjust prototype to retain `instanceof` functionality when targeting ES5, see:\n // https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(this, TimeoutError.prototype);\n }\n}\n\n/**\n * Adds a timeout to a promise and rejects if the specified timeout has elapsed. Also rejects if the specified promise\n * rejects, and resolves if the specified promise resolves.\n *\n * <p> NOTE: this operation will continue even after it throws a {@link TimeoutError}.\n *\n * @param promise promise to use with timeout.\n * @param timeout the timeout in milliseconds until the returned promise is rejected.\n */\nexport function callWithTimeout<T>(\n promise: Promise<T>,\n timeout: number\n): Promise<T> {\n let timeoutHandle: ReturnType<typeof setTimeout>;\n\n const timeoutPromise = new Promise<never>(function timeoutFunction(\n _resolve,\n reject\n ) {\n timeoutHandle = setTimeout(function timeoutHandler() {\n reject(new TimeoutError('Operation timed out.'));\n }, timeout);\n });\n\n return Promise.race([promise, timeoutPromise]).then(\n result => {\n clearTimeout(timeoutHandle);\n return result;\n },\n reason => {\n clearTimeout(timeoutHandle);\n throw reason;\n }\n );\n}\n\nexport interface PromiseAllSettledFulfillResult<T> {\n status: 'fulfilled';\n value: T;\n}\n\nexport interface PromiseAllSettledRejectionResult {\n status: 'rejected';\n reason: unknown;\n}\n\nexport type PromiseAllSettledResult<T> =\n | PromiseAllSettledFulfillResult<T>\n | PromiseAllSettledRejectionResult;\n\n/**\n * Node.js v12.9 lower and browser compatible `Promise.allSettled`.\n */\nexport async function PromiseAllSettled<T>(\n promises: Promise<T>[]\n): Promise<PromiseAllSettledResult<T>[]> {\n return Promise.all(\n promises.map<Promise<PromiseAllSettledResult<T>>>(async p => {\n try {\n const ret = await p;\n return {\n status: 'fulfilled',\n value: ret,\n };\n } catch (e) {\n return {\n status: 'rejected',\n reason: e,\n };\n }\n })\n );\n}\n\nexport function isPromiseAllSettledRejectionResult(\n it: PromiseAllSettledResult<unknown>\n): it is PromiseAllSettledRejectionResult {\n return it.status === 'rejected';\n}\n\n/**\n * Node.js v11.0 lower and browser compatible `Array.prototype.flatMap`.\n */\nexport function FlatMap<T, R>(arr: T[], fn: (it: T) => R[]): R[] {\n const result: R[] = [];\n arr.forEach(it => {\n result.push(...fn(it));\n });\n return result;\n}\n\nexport function setEquals(lhs: Set<unknown>, rhs: Set<unknown>): boolean {\n if (lhs.size !== rhs.size) {\n return false;\n }\n for (const item of lhs) {\n if (!rhs.has(item)) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Binary search the sorted array to the find lower bound for the value.\n * @param arr\n * @param value\n * @returns\n */\nexport function binarySearchLB(arr: number[], value: number): number {\n let lo = 0;\n let hi = arr.length - 1;\n\n while (hi - lo > 1) {\n const mid = Math.trunc((hi + lo) / 2);\n if (arr[mid] <= value) {\n lo = mid;\n } else {\n hi = mid - 1;\n }\n }\n\n if (arr[hi] <= value) {\n return hi;\n } else if (arr[lo] <= value) {\n return lo;\n }\n return -1;\n}\n\nexport function equalsCaseInsensitive(lhs: string, rhs: string): boolean {\n return lhs.toLowerCase() === rhs.toLowerCase();\n}\n", "/*\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 { MetricOptions, ValueType, diag } from '@opentelemetry/api';\nimport { View } from './view/View';\nimport { equalsCaseInsensitive } from './utils';\n\n/**\n * Supported types of metric instruments.\n */\nexport enum InstrumentType {\n COUNTER = 'COUNTER',\n HISTOGRAM = 'HISTOGRAM',\n UP_DOWN_COUNTER = 'UP_DOWN_COUNTER',\n OBSERVABLE_COUNTER = 'OBSERVABLE_COUNTER',\n OBSERVABLE_GAUGE = 'OBSERVABLE_GAUGE',\n OBSERVABLE_UP_DOWN_COUNTER = 'OBSERVABLE_UP_DOWN_COUNTER',\n}\n\n/**\n * An internal interface describing the instrument.\n *\n * This is intentionally distinguished from the public MetricDescriptor (a.k.a. InstrumentDescriptor)\n * which may not contains internal fields like metric advice.\n */\nexport interface InstrumentDescriptor {\n readonly name: string;\n readonly description: string;\n readonly unit: string;\n readonly type: InstrumentType;\n readonly valueType: ValueType;\n /**\n * @experimental\n *\n * This is intentionally not using the API's type as it's only available from @opentelemetry/api 1.7.0 and up.\n * In SDK 2.0 we'll be able to bump the minimum API version and remove this workaround.\n */\n readonly advice: {\n /**\n * Hint the explicit bucket boundaries for SDK if the metric has been\n * aggregated with a HistogramAggregator.\n */\n explicitBucketBoundaries?: number[];\n };\n}\n\nexport function createInstrumentDescriptor(\n name: string,\n type: InstrumentType,\n options?: MetricOptions\n): InstrumentDescriptor {\n if (!isValidName(name)) {\n diag.warn(\n `Invalid metric name: \"${name}\". The metric name should be a ASCII string with a length no greater than 255 characters.`\n );\n }\n return {\n name,\n type,\n description: options?.description ?? '',\n unit: options?.unit ?? '',\n valueType: options?.valueType ?? ValueType.DOUBLE,\n advice: options?.advice ?? {},\n };\n}\n\nexport function createInstrumentDescriptorWithView(\n view: View,\n instrument: InstrumentDescriptor\n): InstrumentDescriptor {\n return {\n name: view.name ?? instrument.name,\n description: view.description ?? instrument.description,\n type: instrument.type,\n unit: instrument.unit,\n valueType: instrument.valueType,\n advice: instrument.advice,\n };\n}\n\nexport function isDescriptorCompatibleWith(\n descriptor: InstrumentDescriptor,\n otherDescriptor: InstrumentDescriptor\n) {\n // Names are case-insensitive strings.\n return (\n equalsCaseInsensitive(descriptor.name, otherDescriptor.name) &&\n descriptor.unit === otherDescriptor.unit &&\n descriptor.type === otherDescriptor.type &&\n descriptor.valueType === otherDescriptor.valueType\n );\n}\n\n// ASCII string with a length no greater than 255 characters.\n// NB: the first character counted separately from the rest.\nconst NAME_REGEXP = /^[a-z][a-z0-9_.\\-/]{0,254}$/i;\nexport function isValidName(name: string): boolean {\n return name.match(NAME_REGEXP) != null;\n}\n", "/*\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 {\n diag,\n MeterProvider as IMeterProvider,\n Meter as IMeter,\n MeterOptions,\n createNoopMeter,\n} from '@opentelemetry/api';\nimport { IResource, Resource } from '@opentelemetry/resources';\nimport { MetricReader } from './export/MetricReader';\nimport { MeterProviderSharedState } from './state/MeterProviderSharedState';\nimport { MetricCollector } from './state/MetricCollector';\nimport { ForceFlushOptions, ShutdownOptions } from './types';\nimport { View } from './view/View';\n\n/**\n * MeterProviderOptions provides an interface for configuring a MeterProvider.\n */\nexport interface MeterProviderOptions {\n /** Resource associated with metric telemetry */\n resource?: IResource;\n views?: View[];\n}\n\n/**\n * This class implements the {@link MeterProvider} interface.\n */\nexport class MeterProvider implements IMeterProvider {\n private _sharedState: MeterProviderSharedState;\n private _shutdown = false;\n\n constructor(options?: MeterProviderOptions) {\n const resource = Resource.default().merge(\n options?.resource ?? Resource.empty()\n );\n this._sharedState = new MeterProviderSharedState(resource);\n if (options?.views != null && options.views.length > 0) {\n for (const view of options.views) {\n this._sharedState.viewRegistry.addView(view);\n }\n }\n }\n\n /**\n * Get a meter with the configuration of the MeterProvider.\n */\n getMeter(name: string, version = '', options: MeterOptions = {}): IMeter {\n // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#meter-creation\n if (this._shutdown) {\n diag.warn('A shutdown MeterProvider cannot provide a Meter');\n return createNoopMeter();\n }\n\n return this._sharedState.getMeterSharedState({\n name,\n version,\n schemaUrl: options.schemaUrl,\n }).meter;\n }\n\n /**\n * Register a {@link MetricReader} to the meter provider. After the\n * registration, the MetricReader can start metrics collection.\n *\n * @param metricReader the metric reader to be registered.\n */\n addMetricReader(metricReader: MetricReader) {\n const collector = new MetricCollector(this._sharedState, metricReader);\n metricReader.setMetricProducer(collector);\n this._sharedState.metricCollectors.push(collector);\n }\n\n /**\n * Flush all buffered data and shut down the MeterProvider and all registered\n * MetricReaders.\n *\n * Returns a promise which is resolved when all flushes are complete.\n */\n async shutdown(options?: ShutdownOptions): Promise<void> {\n if (this._shutdown) {\n diag.warn('shutdown may only be called once per MeterProvider');\n return;\n }\n\n this._shutdown = true;\n\n await Promise.all(\n this._sharedState.metricCollectors.map(collector => {\n return collector.shutdown(options);\n })\n );\n }\n\n /**\n * Notifies all registered MetricReaders to flush any buffered data.\n *\n * Returns a promise which is resolved when all flushes are complete.\n */\n async forceFlush(options?: ForceFlushOptions): Promise<void> {\n // do not flush after shutdown\n if (this._shutdown) {\n diag.warn('invalid attempt to force flush after MeterProvider shutdown');\n return;\n }\n\n await Promise.all(\n this._sharedState.metricCollectors.map(collector => {\n return collector.forceFlush(options);\n })\n );\n }\n}\n", "/*\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 { InstrumentationScope } from '@opentelemetry/core';\nimport { InstrumentDescriptor } from '../InstrumentDescriptor';\nimport { InstrumentSelector } from './InstrumentSelector';\nimport { MeterSelector } from './MeterSelector';\nimport { View } from './View';\n\nexport class ViewRegistry {\n private _registeredViews: View[] = [];\n\n addView(view: View) {\n this._registeredViews.push(view);\n }\n\n findViews(\n instrument: InstrumentDescriptor,\n meter: InstrumentationScope\n ): View[] {\n const views = this._registeredViews.filter(registeredView => {\n return (\n this._matchInstrument(registeredView.instrumentSelector, instrument) &&\n this._matchMeter(registeredView.meterSelector, meter)\n );\n });\n\n return views;\n }\n\n private _matchInstrument(\n selector: InstrumentSelector,\n instrument: InstrumentDescriptor\n ): boolean {\n return (\n (selector.getType() === undefined ||\n instrument.type === selector.getType()) &&\n selector.getNameFilter().match(instrument.name) &&\n selector.getUnitFilter().match(instrument.unit)\n );\n }\n\n private _matchMeter(\n selector: MeterSelector,\n meter: InstrumentationScope\n ): boolean {\n return (\n selector.getNameFilter().match(meter.name) &&\n (meter.version === undefined ||\n selector.getVersionFilter().match(meter.version)) &&\n (meter.schemaUrl === undefined ||\n selector.getSchemaUrlFilter().match(meter.schemaUrl))\n );\n }\n}\n", "/*\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 {\n context as contextApi,\n diag,\n Context,\n MetricAttributes,\n ValueType,\n UpDownCounter,\n Counter,\n Histogram,\n Observable,\n ObservableCallback,\n ObservableCounter,\n ObservableGauge,\n ObservableUpDownCounter,\n} from '@opentelemetry/api';\nimport { millisToHrTime } from '@opentelemetry/core';\nimport { InstrumentDescriptor } from './InstrumentDescriptor';\nimport { ObservableRegistry } from './state/ObservableRegistry';\nimport {\n AsyncWritableMetricStorage,\n WritableMetricStorage,\n} from './state/WritableMetricStorage';\n\nexport class SyncInstrument {\n constructor(\n private _writableMetricStorage: WritableMetricStorage,\n protected _descriptor: InstrumentDescriptor\n ) {}\n\n protected _record(\n value: number,\n attributes: MetricAttributes = {},\n context: Context = contextApi.active()\n ) {\n if (typeof value !== 'number') {\n diag.warn(\n `non-number value provided to metric ${this._descriptor.name}: ${value}`\n );\n return;\n }\n if (\n this._descriptor.valueType === ValueType.INT &&\n !Number.isInteger(value)\n ) {\n diag.warn(\n `INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`\n );\n value = Math.trunc(value);\n // ignore non-finite values.\n if (!Number.isInteger(value)) {\n return;\n }\n }\n this._writableMetricStorage.record(\n value,\n attributes,\n context,\n millisToHrTime(Date.now())\n );\n }\n}\n\n/**\n * The class implements {@link UpDownCounter} interface.\n */\nexport class UpDownCounterInstrument\n extends SyncInstrument\n implements UpDownCounter\n{\n /**\n * Increment value of counter by the input. Inputs may be negative.\n */\n add(value: number, attributes?: MetricAttributes, ctx?: Context): void {\n this._record(value, attributes, ctx);\n }\n}\n\n/**\n * The class implements {@link Counter} interface.\n */\nexport class CounterInstrument extends SyncInstrument implements Counter {\n /**\n * Increment value of counter by the input. Inputs may not be negative.\n */\n add(value: number, attributes?: MetricAttributes, ctx?: Context): void {\n if (value < 0) {\n diag.warn(\n `negative value provided to counter ${this._descriptor.name}: ${value}`\n );\n return;\n }\n\n this._record(value, attributes, ctx);\n }\n}\n\n/**\n * The class implements {@link Histogram} interface.\n */\nexport class HistogramInstrument extends SyncInstrument implements Histogram {\n /**\n * Records a measurement. Value of the measurement must not be negative.\n */\n record(value: number, attributes?: MetricAttributes, ctx?: Context): void {\n if (value < 0) {\n diag.warn(\n `negative value provided to histogram ${this._descriptor.name}: ${value}`\n );\n return;\n }\n this._record(value, attributes, ctx);\n }\n}\n\nexport class ObservableInstrument implements Observable {\n /** @internal */\n _metricStorages: AsyncWritableMetricStorage[];\n /** @internal */\n _descriptor: InstrumentDescriptor;\n\n constructor(\n descriptor: InstrumentDescriptor,\n metricStorages: AsyncWritableMetricStorage[],\n private _observableRegistry: ObservableRegistry\n ) {\n this._descriptor = descriptor;\n this._metricStorages = metricStorages;\n }\n\n /**\n * @see {Observable.addCallback}\n */\n addCallback(callback: ObservableCallback) {\n this._observableRegistry.addCallback(callback, this);\n }\n\n /**\n * @see {Observable.removeCallback}\n */\n removeCallback(callback: ObservableCallback) {\n this._observableRegistry.removeCallback(callback, this);\n }\n}\n\nexport class ObservableCounterInstrument\n extends ObservableInstrument\n implements ObservableCounter {}\nexport class ObservableGaugeInstrument\n extends ObservableInstrument\n implements ObservableGauge {}\nexport class ObservableUpDownCounterInstrument\n extends ObservableInstrument\n implements ObservableUpDownCounter {}\n\nexport function isObservableInstrument(\n it: unknown\n): it is ObservableInstrument {\n return it instanceof ObservableInstrument;\n}\n", "/*\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 {\n Meter as IMeter,\n MetricOptions,\n Histogram,\n Counter,\n UpDownCounter,\n ObservableGauge,\n ObservableCounter,\n ObservableUpDownCounter,\n BatchObservableCallback,\n Observable,\n} from '@opentelemetry/api';\nimport {\n createInstrumentDescriptor,\n InstrumentType,\n} from './InstrumentDescriptor';\nimport {\n CounterInstrument,\n HistogramInstrument,\n ObservableCounterInstrument,\n ObservableGaugeInstrument,\n ObservableUpDownCounterInstrument,\n UpDownCounterInstrument,\n} from './Instruments';\nimport { MeterSharedState } from './state/MeterSharedState';\n\n/**\n * This class implements the {@link IMeter} interface.\n */\nexport class Meter implements IMeter {\n constructor(private _meterSharedState: MeterSharedState) {}\n\n /**\n * Create a {@link Histogram} instrument.\n */\n createHistogram(name: string, options?: MetricOptions): Histogram {\n const descriptor = createInstrumentDescriptor(\n name,\n InstrumentType.HISTOGRAM,\n options\n );\n const storage = this._meterSharedState.registerMetricStorage(descriptor);\n return new HistogramInstrument(storage, descriptor);\n }\n\n /**\n * Create a {@link Counter} instrument.\n */\n createCounter(name: string, options?: MetricOptions): Counter {\n const descriptor = createInstrumentDescriptor(\n name,\n InstrumentType.COUNTER,\n options\n );\n const storage = this._meterSharedState.registerMetricStorage(descriptor);\n return new CounterInstrument(storage, descriptor);\n }\n\n /**\n * Create a {@link UpDownCounter} instrument.\n */\n createUpDownCounter(name: string, options?: MetricOptions): UpDownCounter {\n const descriptor = createInstrumentDescriptor(\n name,\n InstrumentType.UP_DOWN_COUNTER,\n options\n );\n const storage = this._meterSharedState.registerMetricStorage(descriptor);\n return new UpDownCounterInstrument(storage, descriptor);\n }\n\n /**\n * Create a {@link ObservableGauge} instrument.\n */\n createObservableGauge(\n name: string,\n options?: MetricOptions\n ): ObservableGauge {\n const descriptor = createInstrumentDescriptor(\n name,\n InstrumentType.OBSERVABLE_GAUGE,\n options\n );\n const storages =\n this._meterSharedState.registerAsyncMetricStorage(descriptor);\n return new ObservableGaugeInstrument(\n descriptor,\n storages,\n this._meterSharedState.observableRegistry\n );\n }\n\n /**\n * Create a {@link ObservableCounter} instrument.\n */\n createObservableCounter(\n name: string,\n options?: MetricOptions\n ): ObservableCounter {\n const descriptor = createInstrumentDescriptor(\n name,\n InstrumentType.OBSERVABLE_COUNTER,\n options\n );\n const storages =\n this._meterSharedState.registerAsyncMetricStorage(descriptor);\n return new ObservableCounterInstrument(\n descriptor,\n storages,\n this._meterSharedState.observableRegistry\n );\n }\n\n /**\n * Create a {@link ObservableUpDownCounter} instrument.\n */\n createObservableUpDownCounter(\n name: string,\n options?: MetricOptions\n ): ObservableUpDownCounter {\n const descriptor = createInstrumentDescriptor(\n name,\n InstrumentType.OBSERVABLE_UP_DOWN_COUNTER,\n options\n );\n const storages =\n this._meterSharedState.registerAsyncMetricStorage(descriptor);\n return new ObservableUpDownCounterInstrument(\n descriptor,\n storages,\n this._meterSharedState.observableRegistry\n );\n }\n\n /**\n * @see {@link Meter.addBatchObservableCallback}\n */\n addBatchObservableCallback(\n callback: BatchObservableCallback,\n observables: Observable[]\n ) {\n this._meterSharedState.observableRegistry.addBatchCallback(\n callback,\n observables\n );\n }\n\n /**\n * @see {@link Meter.removeBatchObservableCallback}\n */\n removeBatchObservableCallback(\n callback: BatchObservableCallback,\n observables: Observable[]\n ) {\n this._meterSharedState.observableRegistry.removeBatchCallback(\n callback,\n observables\n );\n }\n}\n", "/*\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 { HrTime } from '@opentelemetry/api';\nimport { MetricData } from '../export/MetricData';\nimport { Maybe } from '../utils';\nimport { MetricCollectorHandle } from './MetricCollector';\nimport {\n createInstrumentDescriptor,\n InstrumentDescriptor,\n} from '../InstrumentDescriptor';\n\n/**\n * Internal interface.\n *\n * Represents a storage from which we can collect metrics.\n */\nexport abstract class MetricStorage {\n constructor(protected _instrumentDescriptor: InstrumentDescriptor) {}\n\n /**\n * Collects the metrics from this storage.\n *\n * Note: This is a stateful operation and may reset any interval-related\n * state for the MetricCollector.\n */\n abstract collect(\n collector: MetricCollectorHandle,\n collectionTime: HrTime\n ): Maybe<MetricData>;\n\n getInstrumentDescriptor(): Readonly<InstrumentDescriptor> {\n return this._instrumentDescriptor;\n }\n\n updateDescription(description: string): void {\n this._instrumentDescriptor = createInstrumentDescriptor(\n this._instrumentDescriptor.name,\n this._instrumentDescriptor.type,\n {\n description: description,\n valueType: this._instrumentDescriptor.valueType,\n unit: this._instrumentDescriptor.unit,\n advice: this._instrumentDescriptor.advice,\n }\n );\n }\n}\n", "/*\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 { MetricAttributes } from '@opentelemetry/api';\nimport { hashAttributes } from '../utils';\n\nexport interface Hash<ValueType, HashCodeType> {\n (value: ValueType): HashCodeType;\n}\n\nexport class HashMap<KeyType, ValueType, HashCodeType> {\n private _valueMap = new Map<HashCodeType, ValueType>();\n private _keyMap = new Map<HashCodeType, KeyType>();\n\n constructor(private _hash: Hash<KeyType, HashCodeType>) {}\n\n get(key: KeyType, hashCode?: HashCodeType) {\n hashCode ??= this._hash(key);\n return this._valueMap.get(hashCode);\n }\n\n getOrDefault(key: KeyType, defaultFactory: () => ValueType) {\n const hash = this._hash(key);\n if (this._valueMap.has(hash)) {\n return this._valueMap.get(hash);\n }\n const val = defaultFactory();\n if (!this._keyMap.has(hash)) {\n this._keyMap.set(hash, key);\n }\n this._valueMap.set(hash, val);\n return val;\n }\n\n set(key: KeyType, value: ValueType, hashCode?: HashCodeType) {\n hashCode ??= this._hash(key);\n if (!this._keyMap.has(hashCode)) {\n this._keyMap.set(hashCode, key);\n }\n this._valueMap.set(hashCode, value);\n }\n\n has(key: KeyType, hashCode?: HashCodeType) {\n hashCode ??= this._hash(key);\n return this._valueMap.has(hashCode);\n }\n\n *keys(): IterableIterator<[KeyType, HashCodeType]> {\n const keyIterator = this._keyMap.entries();\n let next = keyIterator.next();\n while (next.done !== true) {\n yield [next.value[1], next.value[0]];\n next = keyIterator.next();\n }\n }\n\n *entries(): IterableIterator<[KeyType, ValueType, HashCodeType]> {\n const valueIterator = this._valueMap.entries();\n let next = valueIterator.next();\n while (next.done !== true) {\n // next.value[0] here can not be undefined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n yield [this._keyMap.get(next.value[0])!, next.value[1], next.value[0]];\n next = valueIterator.next();\n }\n }\n\n get size() {\n return this._valueMap.size;\n }\n}\n\nexport class AttributeHashMap<ValueType> extends HashMap<\n MetricAttributes,\n ValueType,\n string\n> {\n constructor() {\n super(hashAttributes);\n }\n}\n", "/*\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 { Context, HrTime, MetricAttributes } from '@opentelemetry/api';\nimport { Maybe } from '../utils';\nimport { Accumulation, Aggregator } from '../aggregator/types';\nimport { AttributeHashMap } from './HashMap';\n\n/**\n * Internal interface.\n *\n * Allows synchronous collection of metrics. This processor should allow\n * allocation of new aggregation cells for metrics and convert cumulative\n * recording to delta data points.\n */\nexport class DeltaMetricProcessor<T extends Maybe<Accumulation>> {\n private _activeCollectionStorage = new AttributeHashMap<T>();\n // TODO: find a reasonable mean to clean the memo;\n // https://github.com/open-telemetry/opentelemetry-specification/pull/2208\n private _cumulativeMemoStorage = new AttributeHashMap<T>();\n\n constructor(private _aggregator: Aggregator<T>) {}\n\n record(\n value: number,\n attributes: MetricAttributes,\n _context: Context,\n collectionTime: HrTime\n ) {\n const accumulation = this._activeCollectionStorage.getOrDefault(\n attributes,\n () => this._aggregator.createAccumulation(collectionTime)\n );\n accumulation?.record(value);\n }\n\n batchCumulate(\n measurements: AttributeHashMap<number>,\n collectionTime: HrTime\n ) {\n Array.from(measurements.entries()).forEach(\n ([attributes, value, hashCode]) => {\n const accumulation =\n this._aggregator.createAccumulation(collectionTime);\n accumulation?.record(value);\n let delta = accumulation;\n // Diff with recorded cumulative memo.\n if (this._cumulativeMemoStorage.has(attributes, hashCode)) {\n // has() returned true, previous is present.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const previous = this._cumulativeMemoStorage.get(\n attributes,\n hashCode\n )!;\n delta = this._aggregator.diff(previous, accumulation);\n }\n // Merge with uncollected active delta.\n if (this._activeCollectionStorage.has(attributes, hashCode)) {\n // has() returned true, previous is present.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const active = this._activeCollectionStorage.get(\n attributes,\n hashCode\n )!;\n delta = this._aggregator.merge(active, delta);\n }\n\n // Save the current record and the delta record.\n this._cumulativeMemoStorage.set(attributes, accumulation, hashCode);\n this._activeCollectionStorage.set(attributes, delta, hashCode);\n }\n );\n }\n\n /**\n * Returns a collection of delta metrics. Start time is the when first\n * time event collected.\n */\n collect() {\n const unreportedDelta = this._activeCollectionStorage;\n this._activeCollectionStorage = new AttributeHashMap();\n return unreportedDelta;\n }\n}\n", "/*\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 { HrTime } from '@opentelemetry/api';\nimport {\n Accumulation,\n AccumulationRecord,\n Aggregator,\n} from '../aggregator/types';\nimport { MetricData } from '../export/MetricData';\nimport { InstrumentDescriptor } from '../InstrumentDescriptor';\nimport { AggregationTemporality } from '../export/AggregationTemporality';\nimport { Maybe } from '../utils';\nimport { MetricCollectorHandle } from './MetricCollector';\nimport { AttributeHashMap } from './HashMap';\n\n/**\n * Remembers what was presented to a specific exporter.\n */\ninterface LastReportedHistory<T extends Maybe<Accumulation>> {\n /**\n * The last accumulation of metric data.\n */\n accumulations: AttributeHashMap<T>;\n /**\n * The timestamp the data was reported.\n */\n collectionTime: HrTime;\n /**\n * The AggregationTemporality used to aggregate reports.\n */\n aggregationTemporality: AggregationTemporality;\n}\n\n/**\n * Internal interface.\n *\n * Provides unique reporting for each collector. Allows synchronous collection\n * of metrics and reports given temporality values.\n */\nexport class TemporalMetricProcessor<T extends Maybe<Accumulation>> {\n private _unreportedAccumulations = new Map<\n MetricCollectorHandle,\n AttributeHashMap<T>[]\n >();\n private _reportHistory = new Map<\n MetricCollectorHandle,\n LastReportedHistory<T>\n >();\n\n constructor(\n private _aggregator: Aggregator<T>,\n collectorHandles: MetricCollectorHandle[]\n ) {\n collectorHandles.forEach(handle => {\n this._unreportedAccumulations.set(handle, []);\n });\n }\n\n /**\n * Builds the {@link MetricData} streams to report against a specific MetricCollector.\n * @param collector The information of the MetricCollector.\n * @param collectors The registered collectors.\n * @param instrumentDescriptor The instrumentation descriptor that these metrics generated with.\n * @param currentAccumulations The current accumulation of metric data from instruments.\n * @param collectionTime The current collection timestamp.\n * @returns The {@link MetricData} points or `null`.\n */\n buildMetrics(\n collector: MetricCollectorHandle,\n instrumentDescriptor: InstrumentDescriptor,\n currentAccumulations: AttributeHashMap<T>,\n collectionTime: HrTime\n ): Maybe<MetricData> {\n this._stashAccumulations(currentAccumulations);\n const unreportedAccumulations =\n this._getMergedUnreportedAccumulations(collector);\n\n let result = unreportedAccumulations;\n let aggregationTemporality: AggregationTemporality;\n // Check our last report time.\n if (this._reportHistory.has(collector)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const last = this._reportHistory.get(collector)!;\n const lastCollectionTime = last.collectionTime;\n aggregationTemporality = last.aggregationTemporality;\n\n // Use aggregation temporality + instrument to determine if we do a merge or a diff of\n // previous. We have the following four scenarios:\n // 1. Cumulative Aggregation (temporality) + Delta recording (sync instrument).\n // Here we merge with our last record to get a cumulative aggregation.\n // 2. Cumulative Aggregation + Cumulative recording (async instrument).\n // Cumulative records are converted to delta recording with DeltaMetricProcessor.\n // Here we merge with our last record to get a cumulative aggregation.\n // 3. Delta Aggregation + Delta recording\n // Calibrate the startTime of metric streams to be the reader's lastCollectionTime.\n // 4. Delta Aggregation + Cumulative recording.\n // Cumulative records are converted to delta recording with DeltaMetricProcessor.\n // Calibrate the startTime of metric streams to be the reader's lastCollectionTime.\n if (aggregationTemporality === AggregationTemporality.CUMULATIVE) {\n // We need to make sure the current delta recording gets merged into the previous cumulative\n // for the next cumulative recording.\n result = TemporalMetricProcessor.merge(\n last.accumulations,\n unreportedAccumulations,\n this._aggregator\n );\n } else {\n result = TemporalMetricProcessor.calibrateStartTime(\n last.accumulations,\n unreportedAccumulations,\n lastCollectionTime\n );\n }\n } else {\n // Call into user code to select aggregation temporality for the instrument.\n aggregationTemporality = collector.selectAggregationTemporality(\n instrumentDescriptor.type\n );\n }\n\n // Update last reported (cumulative) accumulation.\n this._reportHistory.set(collector, {\n accumulations: result,\n collectionTime,\n aggregationTemporality,\n });\n\n const accumulationRecords = AttributesMapToAccumulationRecords(result);\n\n // do not convert to metric data if there is nothing to convert.\n if (accumulationRecords.length === 0) {\n return undefined;\n }\n\n return this._aggregator.toMetricData(\n instrumentDescriptor,\n aggregationTemporality,\n accumulationRecords,\n /* endTime */ collectionTime\n );\n }\n\n private _stashAccumulations(currentAccumulation: AttributeHashMap<T>) {\n const registeredCollectors = this._unreportedAccumulations.keys();\n for (const collector of registeredCollectors) {\n let stash = this._unreportedAccumulations.get(collector);\n if (stash === undefined) {\n stash = [];\n this._unreportedAccumulations.set(collector, stash);\n }\n stash.push(currentAccumulation);\n }\n }\n\n private _getMergedUnreportedAccumulations(collector: MetricCollectorHandle) {\n let result = new AttributeHashMap<T>();\n const unreportedList = this._unreportedAccumulations.get(collector);\n this._unreportedAccumulations.set(collector, []);\n if (unreportedList === undefined) {\n return result;\n }\n for (const it of unreportedList) {\n result = TemporalMetricProcessor.merge(result, it, this._aggregator);\n }\n return result;\n }\n\n static merge<T extends Maybe<Accumulation>>(\n last: AttributeHashMap<T>,\n current: AttributeHashMap<T>,\n aggregator: Aggregator<T>\n ) {\n const result = last;\n const iterator = current.entries();\n let next = iterator.next();\n while (next.done !== true) {\n const [key, record, hash] = next.value;\n if (last.has(key, hash)) {\n const lastAccumulation = last.get(key, hash);\n // last.has() returned true, lastAccumulation is present.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const accumulation = aggregator.merge(lastAccumulation!, record);\n result.set(key, accumulation, hash);\n } else {\n result.set(key, record, hash);\n }\n\n next = iterator.next();\n }\n return result;\n }\n\n /**\n * Calibrate the reported metric streams' startTime to lastCollectionTime. Leaves\n * the new stream to be the initial observation time unchanged.\n */\n static calibrateStartTime<T extends Maybe<Accumulation>>(\n last: AttributeHashMap<T>,\n current: AttributeHashMap<T>,\n lastCollectionTime: HrTime\n ) {\n for (const [key, hash] of last.keys()) {\n const currentAccumulation = current.get(key, hash);\n currentAccumulation?.setStartTime(lastCollectionTime);\n }\n return current;\n }\n}\n\n// TypeScript complains about converting 3 elements tuple to AccumulationRecord<T>.\nfunction AttributesMapToAccumulationRecords<T>(\n map: AttributeHashMap<T>\n): AccumulationRecord<T>[] {\n return Array.from(map.entries()) as unknown as AccumulationRecord<T>[];\n}\n", "/*\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 { HrTime } from '@opentelemetry/api';\nimport { Accumulation, Aggregator } from '../aggregator/types';\nimport { InstrumentDescriptor } from '../InstrumentDescriptor';\nimport { AttributesProcessor } from '../view/AttributesProcessor';\nimport { MetricStorage } from './MetricStorage';\nimport { MetricData } from '../export/MetricData';\nimport { DeltaMetricProcessor } from './DeltaMetricProcessor';\nimport { TemporalMetricProcessor } from './TemporalMetricProcessor';\nimport { Maybe } from '../utils';\nimport { MetricCollectorHandle } from './MetricCollector';\nimport { AttributeHashMap } from './HashMap';\nimport { AsyncWritableMetricStorage } from './WritableMetricStorage';\n\n/**\n * Internal interface.\n *\n * Stores and aggregates {@link MetricData} for asynchronous instruments.\n */\nexport class AsyncMetricStorage<T extends Maybe<Accumulation>>\n extends MetricStorage\n implements AsyncWritableMetricStorage\n{\n private _deltaMetricStorage: DeltaMetricProcessor<T>;\n private _temporalMetricStorage: TemporalMetricProcessor<T>;\n\n constructor(\n _instrumentDescriptor: InstrumentDescriptor,\n aggregator: Aggregator<T>,\n private _attributesProcessor: AttributesProcessor,\n collectorHandles: MetricCollectorHandle[]\n ) {\n super(_instrumentDescriptor);\n this._deltaMetricStorage = new DeltaMetricProcessor(aggregator);\n this._temporalMetricStorage = new TemporalMetricProcessor(\n aggregator,\n collectorHandles\n );\n }\n\n record(measurements: AttributeHashMap<number>, observationTime: HrTime) {\n const processed = new AttributeHashMap<number>();\n Array.from(measurements.entries()).forEach(([attributes, value]) => {\n processed.set(this._attributesProcessor.process(attributes), value);\n });\n this._deltaMetricStorage.batchCumulate(processed, observationTime);\n }\n\n /**\n * Collects the metrics from this storage. The ObservableCallback is invoked\n * during the collection.\n *\n * Note: This is a stateful operation and may reset any interval-related\n * state for the MetricCollector.\n */\n collect(\n collector: MetricCollectorHandle,\n collectionTime: HrTime\n ): Maybe<MetricData> {\n const accumulations = this._deltaMetricStorage.collect();\n\n return this._temporalMetricStorage.buildMetrics(\n collector,\n this._instrumentDescriptor,\n accumulations,\n collectionTime\n );\n }\n}\n", "/*\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 { MetricStorage } from './MetricStorage';\nimport {\n InstrumentDescriptor,\n isDescriptorCompatibleWith,\n} from '../InstrumentDescriptor';\nimport * as api from '@opentelemetry/api';\nimport {\n getConflictResolutionRecipe,\n getIncompatibilityDetails,\n} from '../view/RegistrationConflicts';\nimport { MetricCollectorHandle } from './MetricCollector';\n\ntype StorageMap = Map<string, MetricStorage[]>;\n\n/**\n * Internal class for storing {@link MetricStorage}\n */\nexport class MetricStorageRegistry {\n private readonly _sharedRegistry: StorageMap = new Map();\n private readonly _perCollectorRegistry = new Map<\n MetricCollectorHandle,\n StorageMap\n >();\n\n static create() {\n return new MetricStorageRegistry();\n }\n\n getStorages(collector: MetricCollectorHandle): MetricStorage[] {\n let storages: MetricStorage[] = [];\n for (const metricStorages of this._sharedRegistry.values()) {\n storages = storages.concat(metricStorages);\n }\n\n const perCollectorStorages = this._perCollectorRegistry.get(collector);\n if (perCollectorStorages != null) {\n for (const metricStorages of perCollectorStorages.values()) {\n storages = storages.concat(metricStorages);\n }\n }\n\n return storages;\n }\n\n register(storage: MetricStorage) {\n this._registerStorage(storage, this._sharedRegistry);\n }\n\n registerForCollector(\n collector: MetricCollectorHandle,\n storage: MetricStorage\n ) {\n let storageMap = this._perCollectorRegistry.get(collector);\n if (storageMap == null) {\n storageMap = new Map();\n this._perCollectorRegistry.set(collector, storageMap);\n }\n this._registerStorage(storage, storageMap);\n }\n\n findOrUpdateCompatibleStorage<T extends MetricStorage>(\n expectedDescriptor: InstrumentDescriptor\n ): T | null {\n const storages = this._sharedRegistry.get(expectedDescriptor.name);\n if (storages === undefined) {\n return null;\n }\n\n // If the descriptor is compatible, the type of their metric storage\n // (either SyncMetricStorage or AsyncMetricStorage) must be compatible.\n return this._findOrUpdateCompatibleStorage<T>(expectedDescriptor, storages);\n }\n\n findOrUpdateCompatibleCollectorStorage<T extends MetricStorage>(\n collector: MetricCollectorHandle,\n expectedDescriptor: InstrumentDescriptor\n ): T | null {\n const storageMap = this._perCollectorRegistry.get(collector);\n if (storageMap === undefined) {\n return null;\n }\n\n const storages = storageMap.get(expectedDescriptor.name);\n if (storages === undefined) {\n return null;\n }\n\n // If the descriptor is compatible, the type of their metric storage\n // (either SyncMetricStorage or AsyncMetricStorage) must be compatible.\n return this._findOrUpdateCompatibleStorage<T>(expectedDescriptor, storages);\n }\n\n private _registerStorage(storage: MetricStorage, storageMap: StorageMap) {\n const descriptor = storage.getInstrumentDescriptor();\n const storages = storageMap.get(descriptor.name);\n\n if (storages === undefined) {\n storageMap.set(descriptor.name, [storage]);\n return;\n }\n\n storages.push(storage);\n }\n\n private _findOrUpdateCompatibleStorage<T extends MetricStorage>(\n expectedDescriptor: InstrumentDescriptor,\n existingStorages: MetricStorage[]\n ): T | null {\n let compatibleStorage = null;\n\n for (const existingStorage of existingStorages) {\n const existingDescriptor = existingStorage.getInstrumentDescriptor();\n\n if (isDescriptorCompatibleWith(existingDescriptor, expectedDescriptor)) {\n // Use the longer description if it does not match.\n if (existingDescriptor.description !== expectedDescriptor.description) {\n if (\n expectedDescriptor.description.length >\n existingDescriptor.description.length\n ) {\n existingStorage.updateDescription(expectedDescriptor.description);\n }\n\n api.diag.warn(\n 'A view or instrument with the name ',\n expectedDescriptor.name,\n ' has already been registered, but has a different description and is incompatible with another registered view.\\n',\n 'Details:\\n',\n getIncompatibilityDetails(existingDescriptor, expectedDescriptor),\n 'The longer description will be used.\\nTo resolve the conflict:',\n getConflictResolutionRecipe(existingDescriptor, expectedDescriptor)\n );\n }\n // Storage is fully compatible. There will never be more than one pre-existing fully compatible storage.\n compatibleStorage = existingStorage as T;\n } else {\n // The implementation SHOULD warn about duplicate instrument registration\n // conflicts after applying View configuration.\n api.diag.warn(\n 'A view or instrument with the name ',\n expectedDescriptor.name,\n ' has already been registered and is incompatible with another registered view.\\n',\n 'Details:\\n',\n getIncompatibilityDetails(existingDescriptor, expectedDescriptor),\n 'To resolve the conflict:\\n',\n getConflictResolutionRecipe(existingDescriptor, expectedDescriptor)\n );\n }\n }\n\n return compatibleStorage;\n }\n}\n", "/*\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 { InstrumentSelectorCriteria } from './InstrumentSelector';\nimport { InstrumentDescriptor } from '../InstrumentDescriptor';\n\nexport function getIncompatibilityDetails(\n existing: InstrumentDescriptor,\n otherDescriptor: InstrumentDescriptor\n) {\n let incompatibility = '';\n if (existing.unit !== otherDescriptor.unit) {\n incompatibility += `\\t- Unit '${existing.unit}' does not match '${otherDescriptor.unit}'\\n`;\n }\n if (existing.type !== otherDescriptor.type) {\n incompatibility += `\\t- Type '${existing.type}' does not match '${otherDescriptor.type}'\\n`;\n }\n if (existing.valueType !== otherDescriptor.valueType) {\n incompatibility += `\\t- Value Type '${existing.valueType}' does not match '${otherDescriptor.valueType}'\\n`;\n }\n if (existing.description !== otherDescriptor.description) {\n incompatibility += `\\t- Description '${existing.description}' does not match '${otherDescriptor.description}'\\n`;\n }\n\n return incompatibility;\n}\n\nexport function getValueTypeConflictResolutionRecipe(\n existing: InstrumentDescriptor,\n otherDescriptor: InstrumentDescriptor\n) {\n return `\\t- use valueType '${existing.valueType}' on instrument creation or use an instrument name other than '${otherDescriptor.name}'`;\n}\n\nexport function getUnitConflictResolutionRecipe(\n existing: InstrumentDescriptor,\n otherDescriptor: InstrumentDescriptor\n) {\n return `\\t- use unit '${existing.unit}' on instrument creation or use an instrument name other than '${otherDescriptor.name}'`;\n}\n\nexport function getTypeConflictResolutionRecipe(\n existing: InstrumentDescriptor,\n otherDescriptor: InstrumentDescriptor\n) {\n const selector: InstrumentSelectorCriteria = {\n name: otherDescriptor.name,\n type: otherDescriptor.type,\n unit: otherDescriptor.unit,\n };\n\n const selectorString = JSON.stringify(selector);\n\n return `\\t- create a new view with a name other than '${existing.name}' and InstrumentSelector '${selectorString}'`;\n}\n\nexport function getDescriptionResolutionRecipe(\n existing: InstrumentDescriptor,\n otherDescriptor: InstrumentDescriptor\n): string {\n const selector: InstrumentSelectorCriteria = {\n name: otherDescriptor.name,\n type: otherDescriptor.type,\n unit: otherDescriptor.unit,\n };\n\n const selectorString = JSON.stringify(selector);\n\n return `\\t- create a new view with a name other than '${existing.name}' and InstrumentSelector '${selectorString}'\n \\t- OR - create a new view with the name ${existing.name} and description '${existing.description}' and InstrumentSelector ${selectorString}\n \\t- OR - create a new view with the name ${otherDescriptor.name} and description '${existing.description}' and InstrumentSelector ${selectorString}`;\n}\n\nexport function getConflictResolutionRecipe(\n existing: InstrumentDescriptor,\n otherDescriptor: InstrumentDescriptor\n): string {\n // Conflicts that cannot be solved via views.\n if (existing.valueType !== otherDescriptor.valueType) {\n return getValueTypeConflictResolutionRecipe(existing, otherDescriptor);\n }\n\n if (existing.unit !== otherDescriptor.unit) {\n return getUnitConflictResolutionRecipe(existing, otherDescriptor);\n }\n\n // Conflicts that can be solved via views.\n if (existing.type !== otherDescriptor.type) {\n // this will automatically solve possible description conflicts.\n return getTypeConflictResolutionRecipe(existing, otherDescriptor);\n }\n\n if (existing.description !== otherDescriptor.description) {\n return getDescriptionResolutionRecipe(existing, otherDescriptor);\n }\n\n return '';\n}\n", "/*\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 { Context, HrTime, MetricAttributes } from '@opentelemetry/api';\nimport { WritableMetricStorage } from './WritableMetricStorage';\n\n/**\n * Internal interface.\n */\nexport class MultiMetricStorage implements WritableMetricStorage {\n constructor(private readonly _backingStorages: WritableMetricStorage[]) {}\n\n record(\n value: number,\n attributes: MetricAttributes,\n context: Context,\n recordTime: HrTime\n ) {\n this._backingStorages.forEach(it => {\n it.record(value, attributes, context, recordTime);\n });\n }\n}\n", "/*\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 {\n diag,\n HrTime,\n BatchObservableCallback,\n Observable,\n ObservableCallback,\n} from '@opentelemetry/api';\nimport { isObservableInstrument, ObservableInstrument } from '../Instruments';\nimport {\n BatchObservableResultImpl,\n ObservableResultImpl,\n} from '../ObservableResult';\nimport {\n callWithTimeout,\n PromiseAllSettled,\n isPromiseAllSettledRejectionResult,\n setEquals,\n} from '../utils';\n\n/**\n * Records for single instrument observable callback.\n */\ninterface ObservableCallbackRecord {\n callback: ObservableCallback;\n instrument: ObservableInstrument;\n}\n\n/**\n * Records for multiple instruments observable callback.\n */\ninterface BatchObservableCallbackRecord {\n callback: BatchObservableCallback;\n instruments: Set<ObservableInstrument>;\n}\n\n/**\n * An internal interface for managing ObservableCallbacks.\n *\n * Every registered callback associated with a set of instruments are be evaluated\n * exactly once during collection prior to reading data for that instrument.\n */\nexport class ObservableRegistry {\n private _callbacks: ObservableCallbackRecord[] = [];\n private _batchCallbacks: BatchObservableCallbackRecord[] = [];\n\n addCallback(callback: ObservableCallback, instrument: ObservableInstrument) {\n const idx = this._findCallback(callback, instrument);\n if (idx >= 0) {\n return;\n }\n this._callbacks.push({ callback, instrument });\n }\n\n removeCallback(\n callback: ObservableCallback,\n instrument: ObservableInstrument\n ) {\n const idx = this._findCallback(callback, instrument);\n if (idx < 0) {\n return;\n }\n this._callbacks.splice(idx, 1);\n }\n\n addBatchCallback(\n callback: BatchObservableCallback,\n instruments: Observable[]\n ) {\n // Create a set of unique instruments.\n const observableInstruments = new Set(\n instruments.filter(isObservableInstrument)\n );\n if (observableInstruments.size === 0) {\n diag.error(\n 'BatchObservableCallback is not associated with valid instruments',\n instruments\n );\n return;\n }\n const idx = this._findBatchCallback(callback, observableInstruments);\n if (idx >= 0) {\n return;\n }\n this._batchCallbacks.push({ callback, instruments: observableInstruments });\n }\n\n removeBatchCallback(\n callback: BatchObservableCallback,\n instruments: Observable[]\n ) {\n // Create a set of unique instruments.\n const observableInstruments = new Set(\n instruments.filter(isObservableInstrument)\n );\n const idx = this._findBatchCallback(callback, observableInstruments);\n if (idx < 0) {\n return;\n }\n this._batchCallbacks.splice(idx, 1);\n }\n\n /**\n * @returns a promise of rejected reasons for invoking callbacks.\n */\n async observe(\n collectionTime: HrTime,\n timeoutMillis?: number\n ): Promise<unknown[]> {\n const callbackFutures = this._observeCallbacks(\n collectionTime,\n timeoutMillis\n );\n const batchCallbackFutures = this._observeBatchCallbacks(\n collectionTime,\n timeoutMillis\n );\n\n const results = await PromiseAllSettled([\n ...callbackFutures,\n ...batchCallbackFutures,\n ]);\n\n const rejections = results\n .filter(isPromiseAllSettledRejectionResult)\n .map(it => it.reason);\n return rejections;\n }\n\n private _observeCallbacks(observationTime: HrTime, timeoutMillis?: number) {\n return this._callbacks.map(async ({ callback, instrument }) => {\n const observableResult = new ObservableResultImpl(\n instrument._descriptor.name,\n instrument._descriptor.valueType\n );\n let callPromise: Promise<void> = Promise.resolve(\n callback(observableResult)\n );\n if (timeoutMillis != null) {\n callPromise = callWithTimeout(callPromise, timeoutMillis);\n }\n await callPromise;\n instrument._metricStorages.forEach(metricStorage => {\n metricStorage.record(observableResult._buffer, observationTime);\n });\n });\n }\n\n private _observeBatchCallbacks(\n observationTime: HrTime,\n timeoutMillis?: number\n ) {\n return this._batchCallbacks.map(async ({ callback, instruments }) => {\n const observableResult = new BatchObservableResultImpl();\n let callPromise: Promise<void> = Promise.resolve(\n callback(observableResult)\n );\n if (timeoutMillis != null) {\n callPromise = callWithTimeout(callPromise, timeoutMillis);\n }\n await callPromise;\n instruments.forEach(instrument => {\n const buffer = observableResult._buffer.get(instrument);\n if (buffer == null) {\n return;\n }\n instrument._metricStorages.forEach(metricStorage => {\n metricStorage.record(buffer, observationTime);\n });\n });\n });\n }\n\n private _findCallback(\n callback: ObservableCallback,\n instrument: ObservableInstrument\n ) {\n return this._callbacks.findIndex(record => {\n return record.callback === callback && record.instrument === instrument;\n });\n }\n\n private _findBatchCallback(\n callback: BatchObservableCallback,\n instruments: Set<ObservableInstrument>\n ) {\n return this._batchCallbacks.findIndex(record => {\n return (\n record.callback === callback &&\n setEquals(record.instruments, instruments)\n );\n });\n }\n}\n", "/*\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 {\n diag,\n ObservableResult,\n MetricAttributes,\n ValueType,\n BatchObservableResult,\n Observable,\n} from '@opentelemetry/api';\nimport { AttributeHashMap } from './state/HashMap';\nimport { isObservableInstrument, ObservableInstrument } from './Instruments';\n\n/**\n * The class implements {@link ObservableResult} interface.\n */\nexport class ObservableResultImpl implements ObservableResult {\n /**\n * @internal\n */\n _buffer = new AttributeHashMap<number>();\n\n constructor(\n private _instrumentName: string,\n private _valueType: ValueType\n ) {}\n\n /**\n * Observe a measurement of the value associated with the given attributes.\n */\n observe(value: number, attributes: MetricAttributes = {}): void {\n if (typeof value !== 'number') {\n diag.warn(\n `non-number value provided to metric ${this._instrumentName}: ${value}`\n );\n return;\n }\n if (this._valueType === ValueType.INT && !Number.isInteger(value)) {\n diag.warn(\n `INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`\n );\n value = Math.trunc(value);\n // ignore non-finite values.\n if (!Number.isInteger(value)) {\n return;\n }\n }\n this._buffer.set(attributes, value);\n }\n}\n\n/**\n * The class implements {@link BatchObservableCallback} interface.\n */\nexport class BatchObservableResultImpl implements BatchObservableResult {\n /**\n * @internal\n */\n _buffer: Map<ObservableInstrument, AttributeHashMap<number>> = new Map();\n\n /**\n * Observe a measurement of the value associated with the given attributes.\n */\n observe(\n metric: Observable,\n value: number,\n attributes: MetricAttributes = {}\n ): void {\n if (!isObservableInstrument(metric)) {\n return;\n }\n let map = this._buffer.get(metric);\n if (map == null) {\n map = new AttributeHashMap();\n this._buffer.set(metric, map);\n }\n if (typeof value !== 'number') {\n diag.warn(\n `non-number value provided to metric ${metric._descriptor.name}: ${value}`\n );\n return;\n }\n if (\n metric._descriptor.valueType === ValueType.INT &&\n !Number.isInteger(value)\n ) {\n diag.warn(\n `INT value type cannot accept a floating-point value for ${metric._descriptor.name}, ignoring the fractional digits.`\n );\n value = Math.trunc(value);\n // ignore non-finite values.\n if (!Number.isInteger(value)) {\n return;\n }\n }\n map.set(attributes, value);\n }\n}\n", "/*\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 { Context, HrTime, MetricAttributes } from '@opentelemetry/api';\nimport { WritableMetricStorage } from './WritableMetricStorage';\nimport { Accumulation, Aggregator } from '../aggregator/types';\nimport { InstrumentDescriptor } from '../InstrumentDescriptor';\nimport { AttributesProcessor } from '../view/AttributesProcessor';\nimport { MetricStorage } from './MetricStorage';\nimport { MetricData } from '../export/MetricData';\nimport { DeltaMetricProcessor } from './DeltaMetricProcessor';\nimport { TemporalMetricProcessor } from './TemporalMetricProcessor';\nimport { Maybe } from '../utils';\nimport { MetricCollectorHandle } from './MetricCollector';\n\n/**\n * Internal interface.\n *\n * Stores and aggregates {@link MetricData} for synchronous instruments.\n */\nexport class SyncMetricStorage<T extends Maybe<Accumulation>>\n extends MetricStorage\n implements WritableMetricStorage\n{\n private _deltaMetricStorage: DeltaMetricProcessor<T>;\n private _temporalMetricStorage: TemporalMetricProcessor<T>;\n\n constructor(\n instrumentDescriptor: InstrumentDescriptor,\n aggregator: Aggregator<T>,\n private _attributesProcessor: AttributesProcessor,\n collectorHandles: MetricCollectorHandle[]\n ) {\n super(instrumentDescriptor);\n this._deltaMetricStorage = new DeltaMetricProcessor(aggregator);\n this._temporalMetricStorage = new TemporalMetricProcessor(\n aggregator,\n collectorHandles\n );\n }\n\n record(\n value: number,\n attributes: MetricAttributes,\n context: Context,\n recordTime: HrTime\n ) {\n attributes = this._attributesProcessor.process(attributes, context);\n this._deltaMetricStorage.record(value, attributes, context, recordTime);\n }\n\n /**\n * Collects the metrics from this storage.\n *\n * Note: This is a stateful operation and may reset any interval-related\n * state for the MetricCollector.\n */\n collect(\n collector: MetricCollectorHandle,\n collectionTime: HrTime\n ): Maybe<MetricData> {\n const accumulations = this._deltaMetricStorage.collect();\n\n return this._temporalMetricStorage.buildMetrics(\n collector,\n this._instrumentDescriptor,\n accumulations,\n collectionTime\n );\n }\n}\n", "/*\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 { Context, MetricAttributes } from '@opentelemetry/api';\n\n/**\n * The {@link AttributesProcessor} is responsible for customizing which\n * attribute(s) are to be reported as metrics dimension(s) and adding\n * additional dimension(s) from the {@link Context}.\n */\nexport abstract class AttributesProcessor {\n /**\n * Process the metric instrument attributes.\n *\n * @param incoming The metric instrument attributes.\n * @param context The active context when the instrument is synchronous.\n * `undefined` otherwise.\n */\n abstract process(\n incoming: MetricAttributes,\n context?: Context\n ): MetricAttributes;\n\n static Noop() {\n return NOOP;\n }\n}\n\nexport class NoopAttributesProcessor extends AttributesProcessor {\n process(incoming: MetricAttributes, _context?: Context) {\n return incoming;\n }\n}\n\n/**\n * {@link AttributesProcessor} that filters by allowed attribute names and drops any names that are not in the\n * allow list.\n */\nexport class FilteringAttributesProcessor extends AttributesProcessor {\n constructor(private _allowedAttributeNames: string[]) {\n super();\n }\n\n process(incoming: MetricAttributes, _context: Context): MetricAttributes {\n const filteredAttributes: MetricAttributes = {};\n Object.keys(incoming)\n .filter(attributeName =>\n this._allowedAttributeNames.includes(attributeName)\n )\n .forEach(\n attributeName =>\n (filteredAttributes[attributeName] = incoming[attributeName])\n );\n return filteredAttributes;\n }\n}\n\nconst NOOP = new NoopAttributesProcessor();\n", "/*\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 { HrTime } from '@opentelemetry/api';\nimport { InstrumentationScope } from '@opentelemetry/core';\nimport { MetricCollectOptions } from '../export/MetricProducer';\nimport { ScopeMetrics } from '../export/MetricData';\nimport {\n createInstrumentDescriptorWithView,\n InstrumentDescriptor,\n} from '../InstrumentDescriptor';\nimport { Meter } from '../Meter';\nimport { isNotNullish, Maybe } from '../utils';\nimport { AsyncMetricStorage } from './AsyncMetricStorage';\nimport { MeterProviderSharedState } from './MeterProviderSharedState';\nimport { MetricCollectorHandle } from './MetricCollector';\nimport { MetricStorageRegistry } from './MetricStorageRegistry';\nimport { MultiMetricStorage } from './MultiWritableMetricStorage';\nimport { ObservableRegistry } from './ObservableRegistry';\nimport { SyncMetricStorage } from './SyncMetricStorage';\nimport { Accumulation, Aggregator } from '../aggregator/types';\nimport { AttributesProcessor } from '../view/AttributesProcessor';\nimport { MetricStorage } from './MetricStorage';\n\n/**\n * An internal record for shared meter provider states.\n */\nexport class MeterSharedState {\n metricStorageRegistry = new MetricStorageRegistry();\n observableRegistry = new ObservableRegistry();\n meter: Meter;\n\n constructor(\n private _meterProviderSharedState: MeterProviderSharedState,\n private _instrumentationScope: InstrumentationScope\n ) {\n this.meter = new Meter(this);\n }\n\n registerMetricStorage(descriptor: InstrumentDescriptor) {\n const storages = this._registerMetricStorage(descriptor, SyncMetricStorage);\n\n if (storages.length === 1) {\n return storages[0];\n }\n return new MultiMetricStorage(storages);\n }\n\n registerAsyncMetricStorage(descriptor: InstrumentDescriptor) {\n const storages = this._registerMetricStorage(\n descriptor,\n AsyncMetricStorage\n );\n\n return storages;\n }\n\n /**\n * @param collector opaque handle of {@link MetricCollector} which initiated the collection.\n * @param collectionTime the HrTime at which the collection was initiated.\n * @param options options for collection.\n * @returns the list of metric data collected.\n */\n async collect(\n collector: MetricCollectorHandle,\n collectionTime: HrTime,\n options?: MetricCollectOptions\n ): Promise<ScopeMetricsResult | null> {\n /**\n * 1. Call all observable callbacks first.\n * 2. Collect metric result for the collector.\n */\n const errors = await this.observableRegistry.observe(\n collectionTime,\n options?.timeoutMillis\n );\n const storages = this.metricStorageRegistry.getStorages(collector);\n\n // prevent more allocations if there are no storages.\n if (storages.length === 0) {\n return null;\n }\n\n const metricDataList = storages\n .map(metricStorage => {\n return metricStorage.collect(collector, collectionTime);\n })\n .filter(isNotNullish);\n\n // skip this scope if no data was collected (storage created, but no data observed)\n if (metricDataList.length === 0) {\n return { errors };\n }\n\n return {\n scopeMetrics: {\n scope: this._instrumentationScope,\n metrics: metricDataList,\n },\n errors,\n };\n }\n\n private _registerMetricStorage<\n MetricStorageType extends MetricStorageConstructor,\n R extends InstanceType<MetricStorageType>,\n >(\n descriptor: InstrumentDescriptor,\n MetricStorageType: MetricStorageType\n ): R[] {\n const views = this._meterProviderSharedState.viewRegistry.findViews(\n descriptor,\n this._instrumentationScope\n );\n let storages = views.map(view => {\n const viewDescriptor = createInstrumentDescriptorWithView(\n view,\n descriptor\n );\n const compatibleStorage =\n this.metricStorageRegistry.findOrUpdateCompatibleStorage<R>(\n viewDescriptor\n );\n if (compatibleStorage != null) {\n return compatibleStorage;\n }\n const aggregator = view.aggregation.createAggregator(viewDescriptor);\n const viewStorage = new MetricStorageType(\n viewDescriptor,\n aggregator,\n view.attributesProcessor,\n this._meterProviderSharedState.metricCollectors\n ) as R;\n this.metricStorageRegistry.register(viewStorage);\n return viewStorage;\n });\n\n // Fallback to the per-collector aggregations if no view is configured for the instrument.\n if (storages.length === 0) {\n const perCollectorAggregations =\n this._meterProviderSharedState.selectAggregations(descriptor.type);\n const collectorStorages = perCollectorAggregations.map(\n ([collector, aggregation]) => {\n const compatibleStorage =\n this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage<R>(\n collector,\n descriptor\n );\n if (compatibleStorage != null) {\n return compatibleStorage;\n }\n const aggregator = aggregation.createAggregator(descriptor);\n const storage = new MetricStorageType(\n descriptor,\n aggregator,\n AttributesProcessor.Noop(),\n [collector]\n ) as R;\n this.metricStorageRegistry.registerForCollector(collector, storage);\n return storage;\n }\n );\n storages = storages.concat(collectorStorages);\n }\n\n return storages;\n }\n}\n\ninterface ScopeMetricsResult {\n scopeMetrics?: ScopeMetrics;\n errors: unknown[];\n}\n\ninterface MetricStorageConstructor {\n new (\n instrumentDescriptor: InstrumentDescriptor,\n aggregator: Aggregator<Maybe<Accumulation>>,\n attributesProcessor: AttributesProcessor,\n collectors: MetricCollectorHandle[]\n ): MetricStorage;\n}\n", "/*\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 { InstrumentationScope } from '@opentelemetry/core';\nimport { IResource } from '@opentelemetry/resources';\nimport { Aggregation, InstrumentType } from '..';\nimport { instrumentationScopeId } from '../utils';\nimport { ViewRegistry } from '../view/ViewRegistry';\nimport { MeterSharedState } from './MeterSharedState';\nimport { MetricCollector, MetricCollectorHandle } from './MetricCollector';\n\n/**\n * An internal record for shared meter provider states.\n */\nexport class MeterProviderSharedState {\n viewRegistry = new ViewRegistry();\n\n metricCollectors: MetricCollector[] = [];\n\n meterSharedStates: Map<string, MeterSharedState> = new Map();\n\n constructor(public resource: IResource) {}\n\n getMeterSharedState(instrumentationScope: InstrumentationScope) {\n const id = instrumentationScopeId(instrumentationScope);\n let meterSharedState = this.meterSharedStates.get(id);\n if (meterSharedState == null) {\n meterSharedState = new MeterSharedState(this, instrumentationScope);\n this.meterSharedStates.set(id, meterSharedState);\n }\n return meterSharedState;\n }\n\n selectAggregations(instrumentType: InstrumentType) {\n const result: [MetricCollectorHandle, Aggregation][] = [];\n for (const collector of this.metricCollectors) {\n result.push([collector, collector.selectAggregation(instrumentType)]);\n }\n return result;\n }\n}\n", "/*\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 { millisToHrTime } from '@opentelemetry/core';\nimport { AggregationTemporalitySelector } from '../export/AggregationSelector';\nimport { CollectionResult, ScopeMetrics } from '../export/MetricData';\nimport { MetricProducer, MetricCollectOptions } from '../export/MetricProducer';\nimport { MetricReader } from '../export/MetricReader';\nimport { InstrumentType } from '../InstrumentDescriptor';\nimport { ForceFlushOptions, ShutdownOptions } from '../types';\nimport { MeterProviderSharedState } from './MeterProviderSharedState';\n\n/**\n * An internal opaque interface that the MetricReader receives as\n * MetricProducer. It acts as the storage key to the internal metric stream\n * state for each MetricReader.\n */\nexport class MetricCollector implements MetricProducer {\n constructor(\n private _sharedState: MeterProviderSharedState,\n private _metricReader: MetricReader\n ) {}\n\n async collect(options?: MetricCollectOptions): Promise<CollectionResult> {\n const collectionTime = millisToHrTime(Date.now());\n const scopeMetrics: ScopeMetrics[] = [];\n const errors: unknown[] = [];\n\n const meterCollectionPromises = Array.from(\n this._sharedState.meterSharedStates.values()\n ).map(async meterSharedState => {\n const current = await meterSharedState.collect(\n this,\n collectionTime,\n options\n );\n\n // only add scope metrics if available\n if (current?.scopeMetrics != null) {\n scopeMetrics.push(current.scopeMetrics);\n }\n\n // only add errors if available\n if (current?.errors != null) {\n errors.push(...current.errors);\n }\n });\n await Promise.all(meterCollectionPromises);\n\n return {\n resourceMetrics: {\n resource: this._sharedState.resource,\n scopeMetrics: scopeMetrics,\n },\n errors: errors,\n };\n }\n\n /**\n * Delegates for MetricReader.forceFlush.\n */\n async forceFlush(options?: ForceFlushOptions): Promise<void> {\n await this._metricReader.forceFlush(options);\n }\n\n /**\n * Delegates for MetricReader.shutdown.\n */\n async shutdown(options?: ShutdownOptions): Promise<void> {\n await this._metricReader.shutdown(options);\n }\n\n selectAggregationTemporality(instrumentType: InstrumentType) {\n return this._metricReader.selectAggregationTemporality(instrumentType);\n }\n\n selectAggregation(instrumentType: InstrumentType) {\n return this._metricReader.selectAggregation(instrumentType);\n }\n}\n\n/**\n * An internal interface for MetricCollector. Exposes the necessary\n * information for metric collection.\n */\nexport interface MetricCollectorHandle {\n selectAggregationTemporality: AggregationTemporalitySelector;\n}\n", "import type { Attributes, Context } from \"@opentelemetry/api\";\nimport { diag, SpanKind } from \"@opentelemetry/api\";\nimport type {\n Span,\n ReadableSpan,\n SpanProcessor,\n} from \"@opentelemetry/sdk-trace-base\";\nimport { getVercelRequestContext } from \"../vercel-request-context/api\";\nimport { getVercelRequestContextAttributes } from \"../vercel-request-context/attributes\";\nimport { isSampled } from \"../util/sampled\";\nimport type { AttributesFromHeaders } from \"../types\";\n\n/** @internal */\nexport class CompositeSpanProcessor implements SpanProcessor {\n private readonly rootSpanIds = new Map<\n string,\n { rootSpanId: string; open: Span[] }\n >();\n private readonly waitSpanEnd = new Map<string, () => void>();\n\n constructor(\n private processors: SpanProcessor[],\n private attributesFromHeaders: AttributesFromHeaders | undefined\n ) {}\n\n forceFlush(): Promise<void> {\n return Promise.all(\n this.processors.map((p) =>\n p.forceFlush().catch((e) => {\n diag.error(\"@vercel/otel: forceFlush failed:\", e);\n })\n )\n ).then(() => undefined);\n }\n\n shutdown(): Promise<void> {\n return Promise.all(\n this.processors.map((p) => p.shutdown().catch(() => undefined))\n ).then(() => undefined);\n }\n\n onStart(span: Span, parentContext: Context): void {\n const { traceId, spanId, traceFlags } = span.spanContext();\n const isRoot = !span.parentSpanId || !this.rootSpanIds.has(traceId);\n if (isRoot) {\n this.rootSpanIds.set(traceId, { rootSpanId: spanId, open: [] });\n } else {\n this.rootSpanIds.get(traceId)?.open.push(span);\n }\n if (isRoot && isSampled(traceFlags)) {\n const vrc = getVercelRequestContext();\n const vercelRequestContextAttrs = getVercelRequestContextAttributes(\n vrc,\n this.attributesFromHeaders\n );\n if (vercelRequestContextAttrs) {\n span.setAttributes(vercelRequestContextAttrs);\n }\n\n // Flush the streams to avoid data loss.\n if (vrc) {\n vrc.waitUntil(async () => {\n if (this.rootSpanIds.has(traceId)) {\n // Not root has not completed yet, so no point in flushing.\n // Need to wait for onEnd.\n const promise = new Promise<void>((resolve) => {\n this.waitSpanEnd.set(traceId, resolve);\n });\n let timer: NodeJS.Timeout | undefined;\n await Promise.race([\n promise,\n new Promise((resolve) => {\n timer = setTimeout(() => {\n this.waitSpanEnd.delete(traceId);\n resolve(undefined);\n }, 50);\n }),\n ]);\n if (timer) {\n clearTimeout(timer);\n }\n }\n return this.forceFlush();\n });\n }\n }\n\n for (const spanProcessor of this.processors) {\n spanProcessor.onStart(span, parentContext);\n }\n }\n\n onEnd(span: ReadableSpan): void {\n const { traceId, spanId, traceFlags } = span.spanContext();\n const sampled = isSampled(traceFlags);\n const rootObj = this.rootSpanIds.get(traceId);\n const isRoot = rootObj?.rootSpanId === spanId;\n\n if (sampled) {\n const resourceAttributes = getResourceAttributes(span);\n if (resourceAttributes) {\n Object.assign(span.attributes, resourceAttributes);\n }\n }\n\n if (isRoot) {\n this.rootSpanIds.delete(traceId);\n if (rootObj.open.length > 0) {\n for (const openSpan of rootObj.open) {\n if (!openSpan.ended && openSpan.spanContext().spanId !== spanId) {\n try {\n openSpan.end();\n } catch (e) {\n diag.error(\"@vercel/otel: onEnd failed:\", e);\n }\n }\n }\n }\n } else if (rootObj) {\n for (let i = 0; i < rootObj.open.length; i++) {\n if (rootObj.open[i]?.spanContext().spanId === spanId) {\n rootObj.open.splice(i, 1);\n }\n }\n }\n\n for (const spanProcessor of this.processors) {\n spanProcessor.onEnd(span);\n }\n\n if (isRoot) {\n const pending = this.waitSpanEnd.get(traceId);\n if (pending) {\n this.waitSpanEnd.delete(traceId);\n pending();\n }\n }\n }\n}\n\nconst SPAN_KIND_NAME: { [key in SpanKind]: string } = {\n [SpanKind.INTERNAL]: \"internal\",\n [SpanKind.SERVER]: \"server\",\n [SpanKind.CLIENT]: \"client\",\n [SpanKind.PRODUCER]: \"producer\",\n [SpanKind.CONSUMER]: \"consumer\",\n};\n\nfunction getResourceAttributes(span: ReadableSpan): Attributes | undefined {\n const { kind, attributes } = span;\n const {\n \"operation.name\": operationName,\n \"resource.name\": resourceName,\n \"span.type\": spanTypeAttr,\n \"next.span_type\": nextSpanType,\n \"http.method\": httpMethod,\n \"http.route\": httpRoute,\n } = attributes;\n if (operationName) {\n return undefined;\n }\n\n const resourceNameResolved =\n resourceName ??\n (httpMethod &&\n typeof httpMethod === \"string\" &&\n httpRoute &&\n typeof httpRoute === \"string\"\n ? `${httpMethod} ${httpRoute}`\n : httpRoute);\n\n if (\n span.kind === SpanKind.SERVER &&\n httpMethod &&\n httpRoute &&\n typeof httpMethod === \"string\" &&\n typeof httpRoute === \"string\"\n ) {\n return {\n \"operation.name\": \"web.request\",\n \"resource.name\": resourceNameResolved,\n };\n }\n\n // Per https://github.com/DataDog/datadog-agent/blob/main/pkg/config/config_template.yaml,\n // the default operation.name is \"library name + span kind\".\n const libraryName = span.instrumentationLibrary.name;\n const spanType = nextSpanType ?? spanTypeAttr;\n if (spanType && typeof spanType === \"string\") {\n const nextOperationName = toOperationName(libraryName, spanType);\n if (httpRoute) {\n return {\n \"operation.name\": nextOperationName,\n \"resource.name\": resourceNameResolved,\n };\n }\n return { \"operation.name\": nextOperationName };\n }\n\n return {\n \"operation.name\": toOperationName(\n libraryName,\n kind === SpanKind.INTERNAL ? \"\" : SPAN_KIND_NAME[kind]\n ),\n };\n}\n\nfunction toOperationName(libraryName: string, name: string): string {\n if (!libraryName) {\n return name;\n }\n let cleanLibraryName = libraryName.replace(/[ @./]/g, \"_\");\n if (cleanLibraryName.startsWith(\"_\")) {\n cleanLibraryName = cleanLibraryName.slice(1);\n }\n return name ? `${cleanLibraryName}.${name}` : cleanLibraryName;\n}\n", "/**\n * TODO: Placeholder for the `@vercel/request-context-storage` package.\n * Replace with the real package once it's published.\n */\n\nimport type { SpanContext } from \"@opentelemetry/api\";\n\n/** @internal */\nexport interface VercelRequestContext {\n waitUntil: (\n promiseOrFunc: Promise<unknown> | (() => Promise<unknown>)\n ) => void;\n headers: Record<string, string | undefined>;\n url: string;\n telemetry?: {\n reportSpans: (data: unknown) => void;\n rootSpanContext?: SpanContext;\n };\n [key: symbol]: unknown;\n}\n\ninterface Reader {\n get: () => VercelRequestContext | undefined;\n}\n\nconst symbol = Symbol.for(\"@vercel/request-context\");\n\ninterface GlobalWithReader {\n [symbol]?: Reader;\n}\n\n/** @internal */\nexport function getVercelRequestContext(): VercelRequestContext | undefined {\n const reader = (globalThis as GlobalWithReader)[symbol];\n return reader?.get();\n}\n", "import type { Attributes, TextMapGetter } from \"@opentelemetry/api\";\nimport { SemanticAttributes } from \"@opentelemetry/semantic-conventions\";\nimport { omitUndefinedAttributes } from \"../util/attributes\";\nimport { parseRequestId } from \"../util/request-id\";\nimport type { AttributesFromHeaders } from \"../types\";\nimport type { VercelRequestContext } from \"./api\";\nimport { getVercelRequestContext } from \"./api\";\n\n/** @internal */\nexport function getVercelRequestContextAttributes(\n context: VercelRequestContext | undefined = getVercelRequestContext(),\n attributesFromHeaders?: AttributesFromHeaders\n): Attributes | undefined {\n if (!context) {\n return undefined;\n }\n\n const rootAttrs = attributesFromHeaders\n ? resolveAttributesFromHeaders(attributesFromHeaders, context.headers)\n : undefined;\n\n return omitUndefinedAttributes({\n [SemanticAttributes.HTTP_HOST]: context.headers.host,\n [SemanticAttributes.HTTP_USER_AGENT]: context.headers[\"user-agent\"],\n \"http.referer\": context.headers.referer,\n\n \"vercel.request_id\": parseRequestId(context.headers[\"x-vercel-id\"]),\n \"vercel.matched_path\": context.headers[\"x-matched-path\"],\n \"vercel.edge_region\": process.env.VERCEL_REGION,\n\n ...rootAttrs,\n });\n}\n\ntype VercelRequestContextHeaders = VercelRequestContext[\"headers\"];\n\nconst getter: TextMapGetter<VercelRequestContextHeaders> = {\n keys(_carrier: VercelRequestContextHeaders): string[] {\n return [];\n },\n get(\n carrier: VercelRequestContextHeaders,\n key: string\n ): string | string[] | undefined {\n return carrier[key.toLocaleLowerCase()];\n },\n};\n\nfunction resolveAttributesFromHeaders(\n attributesFromHeaders: AttributesFromHeaders,\n headers: VercelRequestContextHeaders\n): Attributes | undefined {\n if (typeof attributesFromHeaders === \"function\") {\n return attributesFromHeaders(headers, getter);\n }\n\n const attrs: Attributes = {};\n for (const [attrName, headerName] of Object.entries(attributesFromHeaders)) {\n const headerValue = headers[headerName.toLocaleLowerCase()];\n if (headerValue !== undefined) {\n attrs[attrName] = headerValue;\n }\n }\n return attrs;\n}\n", "import type { Attributes } from \"@opentelemetry/api\";\n\n/** @internal */\nexport function omitUndefinedAttributes<T extends Attributes = Attributes>(\n obj: T\n): T {\n return Object.fromEntries(\n Object.entries(obj).filter(([_, value]) => value !== undefined)\n ) as T;\n}\n", "/** @internal */\nexport function parseRequestId(header: string | undefined): string | undefined {\n if (!header) {\n return undefined;\n }\n const parts = header.split(\"::\");\n return parts.at(-1);\n}\n", "import { TraceFlags } from \"@opentelemetry/api\";\n\nexport function isSampled(traceFlags: number): boolean {\n // eslint-disable-next-line no-bitwise\n return (traceFlags & TraceFlags.SAMPLED) !== 0;\n}\n", "import type { ReadableSpan, SpanExporter } from \"@opentelemetry/sdk-trace-base\";\nimport type { IExportTraceServiceRequest } from \"@opentelemetry/otlp-transformer\";\nimport { createExportTraceServiceRequest } from \"@opentelemetry/otlp-transformer/build/src/trace\";\nimport type { ExportResult } from \"@opentelemetry/core\";\nimport { OTLPExporterEdgeBase } from \"./otlp-exporter-base\";\nimport { getDefaultUrl } from \"./trace-config\";\nimport type { OTLPExporterConfig } from \"./config\";\n\n/**\n * OTLP exporter for the `http/json` protocol. Compatible with the \"edge\" runtime.\n */\nexport class OTLPHttpJsonTraceExporter implements SpanExporter {\n /** @internal */\n private readonly impl: Impl;\n\n constructor(config: OTLPExporterConfig = {}) {\n this.impl = new Impl(config);\n }\n\n /** See `SpanExporter#export()` */\n export(\n spans: ReadableSpan[],\n resultCallback: (result: ExportResult) => void\n ): void {\n this.impl.export(spans, resultCallback);\n }\n\n /** See `SpanExporter#shutdown()` */\n shutdown(): Promise<void> {\n return this.impl.shutdown();\n }\n\n /** See `SpanExporter#forceFlush()` */\n forceFlush(): Promise<void> {\n return this.impl.forceFlush();\n }\n}\n\n/** @internal */\nclass Impl extends OTLPExporterEdgeBase<\n ReadableSpan,\n IExportTraceServiceRequest\n> {\n convert(spans: ReadableSpan[]): IExportTraceServiceRequest {\n return createExportTraceServiceRequest(spans, {\n useHex: true,\n useLongBits: false,\n });\n }\n\n override toMessage(serviceRequest: IExportTraceServiceRequest): {\n body: string | Uint8Array | Blob;\n contentType: string;\n headers?: Record<string, string> | undefined;\n } {\n return {\n body: JSON.stringify(serviceRequest),\n contentType: \"application/json\",\n };\n }\n\n getDefaultUrl(config: OTLPExporterConfig): string {\n return getDefaultUrl(config);\n }\n}\n", "import type { OTLPExporterError } from \"@opentelemetry/otlp-exporter-base\";\nimport { OTLPExporterBase } from \"@opentelemetry/otlp-exporter-base/build/src/OTLPExporterBase\";\nimport { diag } from \"@opentelemetry/api\";\nimport type { OTLPExporterConfig } from \"./config\";\n\n/** @internal */\nexport abstract class OTLPExporterEdgeBase<\n ExportItem,\n ServiceRequest,\n> extends OTLPExporterBase<OTLPExporterConfig, ExportItem, ServiceRequest> {\n /** @internal */\n private _headers: Record<string, unknown> | undefined;\n\n constructor(config: OTLPExporterConfig = {}) {\n super(config);\n if (config.headers) {\n this._headers = config.headers;\n }\n }\n\n onShutdown(): void {\n diag.debug(\"@vercel/otel/otlp: onShutdown\");\n }\n\n onInit(): void {\n diag.debug(\"@vercel/otel/otlp: onInit\");\n }\n\n send(\n items: ExportItem[],\n onSuccess: () => void,\n onError: (error: OTLPExporterError) => void\n ): void {\n if (this._shutdownOnce.isCalled) {\n diag.debug(\n \"@vercel/otel/otlp: Shutdown already started. Cannot send objects\"\n );\n return;\n }\n\n const serviceRequest = this.convert(items);\n\n let body: string | Uint8Array | Blob;\n let contentType: string;\n let headers: Record<string, string> | undefined;\n try {\n const message = this.toMessage(serviceRequest);\n ({ body, contentType, headers } = message);\n } catch (e) {\n diag.warn(\"@vercel/otel/otlp: no proto\", e);\n return;\n }\n\n const promise = fetch(this.url, {\n method: \"POST\",\n body,\n headers: {\n ...this._headers,\n ...headers,\n \"Content-Type\": contentType,\n \"User-Agent\": \"OTel-OTLP-Exporter-JavaScript/0.46.0\",\n },\n // @ts-expect-error - this handles a Next.js specific issue\n next: { internal: true },\n })\n .then((res) => {\n diag.debug(\"@vercel/otel/otlp: onSuccess\", res.status, res.statusText);\n onSuccess();\n // Drain the response body.\n void res.arrayBuffer().catch(() => undefined);\n })\n .catch((err) => {\n diag.error(\"@vercel/otel/otlp: onError\", err);\n onError(err as OTLPExporterError);\n })\n .finally(() => {\n const index = this._sendingPromises.indexOf(promise);\n this._sendingPromises.splice(index, 1);\n });\n\n this._sendingPromises.push(promise);\n }\n\n getDefaultUrl(_config: OTLPExporterConfig): string {\n throw new Error(\"Method not implemented.\");\n }\n\n abstract toMessage(serviceRequest: ServiceRequest): {\n body: string | Uint8Array | Blob;\n contentType: string;\n headers?: Record<string, string>;\n };\n}\n", "import type { OTLPExporterConfig } from \"./config\";\n\nconst DEFAULT_COLLECTOR_RESOURCE_PATH = \"v1/traces\";\nconst DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;\n\n/** @internal */\nexport function getDefaultUrl(config: OTLPExporterConfig): string {\n if (typeof config.url === \"string\") {\n return config.url;\n }\n return DEFAULT_COLLECTOR_URL;\n}\n", "import type { ReadableSpan, SpanExporter } from \"@opentelemetry/sdk-trace-base\";\nimport type { IExportTraceServiceRequest } from \"@opentelemetry/otlp-transformer\";\nimport { createExportTraceServiceRequest } from \"@opentelemetry/otlp-transformer/build/src/trace\";\nimport type { ExportResult } from \"@opentelemetry/core\";\nimport { OTLPExporterEdgeBase } from \"./otlp-exporter-base\";\nimport { getDefaultUrl } from \"./trace-config\";\nimport type { OTLPExporterConfig } from \"./config\";\nimport { encodeTraceServiceRequest } from \"./proto\";\n\n/**\n * OTLP exporter for the `http/protobuf` protocol. Compatible with the \"edge\" runtime.\n */\nexport class OTLPHttpProtoTraceExporter implements SpanExporter {\n /** @internal */\n private readonly impl: Impl;\n\n constructor(config: OTLPExporterConfig = {}) {\n this.impl = new Impl(config);\n }\n\n /** See `SpanExporter#export()` */\n export(\n spans: ReadableSpan[],\n resultCallback: (result: ExportResult) => void\n ): void {\n this.impl.export(spans, resultCallback);\n }\n\n /** See `SpanExporter#shutdown()` */\n shutdown(): Promise<void> {\n return this.impl.shutdown();\n }\n\n /** See `SpanExporter#forceFlush()` */\n forceFlush(): Promise<void> {\n return this.impl.forceFlush();\n }\n}\n\n/** @internal */\nclass Impl extends OTLPExporterEdgeBase<\n ReadableSpan,\n IExportTraceServiceRequest\n> {\n convert(spans: ReadableSpan[]): IExportTraceServiceRequest {\n return createExportTraceServiceRequest(spans, undefined);\n }\n\n override toMessage(serviceRequest: IExportTraceServiceRequest): {\n body: string | Uint8Array | Blob;\n contentType: string;\n headers?: Record<string, string> | undefined;\n } {\n const body = encodeTraceServiceRequest(serviceRequest);\n return {\n body,\n contentType: \"application/x-protobuf\",\n headers: { accept: \"application/x-protobuf\" },\n };\n }\n\n getDefaultUrl(config: OTLPExporterConfig): string {\n return getDefaultUrl(config);\n }\n}\n", "/* eslint-disable eslint-comments/disable-enable-pair */\n/* eslint-disable camelcase */\n/* eslint-disable eqeqeq */\n\n/* eslint-disable @typescript-eslint/prefer-optional-chain */\n/* eslint-disable @typescript-eslint/prefer-for-of */\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n/* eslint-disable @typescript-eslint/no-unnecessary-condition */\n\n/**\n * This file is constructed by:\n *\n * 1. Clone https://github.com/open-telemetry/opentelemetry-js.git\n * 2. Run `protos:generate` in `experimental/packages/otlp-proto-exporter-base/`\n * 3. Fork `experimental/packages/otlp-proto-exporter-base/src/generated/root.js` and inline all encode methods. Throw away the rest of the code.\n *\n * The OTLP protocol is very stable, so these steps would only need to be done rarely.\n */\n\nimport type {\n IAnyValue,\n IArrayValue,\n IEvent,\n IExportTraceServiceRequest,\n IInstrumentationScope,\n IKeyValue,\n IKeyValueList,\n ILink,\n IResource,\n IResourceSpans,\n IScopeSpans,\n ISpan,\n IStatus,\n} from \"@opentelemetry/otlp-transformer\";\nimport type { Long } from \"protobufjs/minimal\";\nimport { Writer } from \"protobufjs/minimal\";\n\nexport function encodeTraceServiceRequest(\n message: IExportTraceServiceRequest\n): Uint8Array {\n const writer = new Writer();\n ExportTraceServiceRequest_encode(message, writer);\n return writer.finish();\n}\n\nexport function ExportTraceServiceRequest_encode(\n message: IExportTraceServiceRequest,\n writer: Writer\n): Writer {\n if (message.resourceSpans != null && message.resourceSpans.length)\n for (let i = 0; i < message.resourceSpans.length; ++i)\n ResourceSpans_encode(\n message.resourceSpans[i]!,\n writer.uint32(/* id 1, wireType 2 =*/ 10).fork()\n ).ldelim();\n return writer;\n}\n\nfunction ResourceSpans_encode(message: IResourceSpans, writer: Writer): Writer {\n if (message.resource != null)\n Resource_encode(\n message.resource,\n writer.uint32(/* id 1, wireType 2 =*/ 10).fork()\n ).ldelim();\n if (message.scopeSpans != null && message.scopeSpans.length)\n for (let i = 0; i < message.scopeSpans.length; ++i)\n ScopeSpans_encode(\n message.scopeSpans[i]!,\n writer.uint32(/* id 2, wireType 2 =*/ 18).fork()\n ).ldelim();\n if (message.schemaUrl != null)\n writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.schemaUrl);\n return writer;\n}\n\nfunction Resource_encode(message: IResource, writer: Writer): Writer {\n if (message.attributes != null && message.attributes.length)\n for (let i = 0; i < message.attributes.length; ++i)\n KeyValue_encode(\n message.attributes[i]!,\n writer.uint32(/* id 1, wireType 2 =*/ 10).fork()\n ).ldelim();\n if (message.droppedAttributesCount != null)\n writer\n .uint32(/* id 2, wireType 0 =*/ 16)\n .uint32(message.droppedAttributesCount);\n return writer;\n}\n\nfunction ScopeSpans_encode(message: IScopeSpans, writer: Writer): Writer {\n if (message.scope != null)\n InstrumentationScope_encode(\n message.scope,\n writer.uint32(/* id 1, wireType 2 =*/ 10).fork()\n ).ldelim();\n if (message.spans != null && message.spans.length)\n for (let i = 0; i < message.spans.length; ++i)\n Span_encode(\n message.spans[i]!,\n writer.uint32(/* id 2, wireType 2 =*/ 18).fork()\n ).ldelim();\n if (message.schemaUrl != null)\n writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.schemaUrl);\n return writer;\n}\n\nfunction KeyValue_encode(message: IKeyValue, writer: Writer): Writer {\n if (message.key != null)\n writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.key);\n if (message.value != null)\n AnyValue_encode(\n message.value,\n writer.uint32(/* id 2, wireType 2 =*/ 18).fork()\n ).ldelim();\n return writer;\n}\n\nfunction AnyValue_encode(message: IAnyValue, writer: Writer): Writer {\n if (message.stringValue != null)\n writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.stringValue);\n if (message.boolValue != null)\n writer.uint32(/* id 2, wireType 0 =*/ 16).bool(message.boolValue);\n if (message.intValue != null)\n writer.uint32(/* id 3, wireType 0 =*/ 24).int64(message.intValue);\n if (message.doubleValue != null)\n writer.uint32(/* id 4, wireType 1 =*/ 33).double(message.doubleValue);\n if (message.arrayValue != null)\n ArrayValue_encode(\n message.arrayValue,\n writer.uint32(/* id 5, wireType 2 =*/ 42).fork()\n ).ldelim();\n if (message.kvlistValue != null)\n KeyValueList_encode(\n message.kvlistValue,\n writer.uint32(/* id 6, wireType 2 =*/ 50).fork()\n ).ldelim();\n if (message.bytesValue != null)\n writer.uint32(/* id 7, wireType 2 =*/ 58).bytes(message.bytesValue);\n return writer;\n}\n\nfunction ArrayValue_encode(message: IArrayValue, writer: Writer): Writer {\n if (message.values != null && message.values.length)\n for (let i = 0; i < message.values.length; ++i)\n AnyValue_encode(\n message.values[i]!,\n writer.uint32(/* id 1, wireType 2 =*/ 10).fork()\n ).ldelim();\n return writer;\n}\n\nfunction KeyValueList_encode(message: IKeyValueList, writer: Writer): Writer {\n if (message.values != null && message.values.length)\n for (let i = 0; i < message.values.length; ++i)\n KeyValue_encode(\n message.values[i]!,\n writer.uint32(/* id 1, wireType 2 =*/ 10).fork()\n ).ldelim();\n return writer;\n}\n\nfunction InstrumentationScope_encode(\n message: IInstrumentationScope,\n writer: Writer\n): Writer {\n if (message.name != null)\n writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.name);\n if (message.version != null)\n writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.version);\n if (message.attributes != null && message.attributes.length)\n for (let i = 0; i < message.attributes.length; ++i)\n KeyValue_encode(\n message.attributes[i]!,\n writer.uint32(/* id 3, wireType 2 =*/ 26).fork()\n ).ldelim();\n if (message.droppedAttributesCount != null)\n writer\n .uint32(/* id 4, wireType 0 =*/ 32)\n .uint32(message.droppedAttributesCount);\n return writer;\n}\n\nfunction Span_encode(message: ISpan, writer: Writer): Writer {\n if (message.traceId != null)\n writer.uint32(/* id 1, wireType 2 =*/ 10).bytes(message.traceId);\n if (message.spanId != null)\n writer.uint32(/* id 2, wireType 2 =*/ 18).bytes(message.spanId);\n if (message.traceState != null)\n writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.traceState);\n if (message.parentSpanId != null)\n writer.uint32(/* id 4, wireType 2 =*/ 34).bytes(message.parentSpanId);\n if (message.name != null)\n writer.uint32(/* id 5, wireType 2 =*/ 42).string(message.name);\n if (message.kind != null)\n writer.uint32(/* id 6, wireType 0 =*/ 48).int32(message.kind);\n if (message.startTimeUnixNano != null)\n writer\n .uint32(/* id 7, wireType 1 =*/ 57)\n .fixed64(message.startTimeUnixNano as Long);\n if (message.endTimeUnixNano != null)\n writer\n .uint32(/* id 8, wireType 1 =*/ 65)\n .fixed64(message.endTimeUnixNano as Long);\n if (message.attributes != null && message.attributes.length)\n for (let i = 0; i < message.attributes.length; ++i)\n KeyValue_encode(\n message.attributes[i]!,\n writer.uint32(/* id 9, wireType 2 =*/ 74).fork()\n ).ldelim();\n if (message.droppedAttributesCount != null)\n writer\n .uint32(/* id 10, wireType 0 =*/ 80)\n .uint32(message.droppedAttributesCount);\n if (message.events != null && message.events.length)\n for (let i = 0; i < message.events.length; ++i)\n Event_encode(\n message.events[i]!,\n writer.uint32(/* id 11, wireType 2 =*/ 90).fork()\n ).ldelim();\n if (message.droppedEventsCount != null)\n writer\n .uint32(/* id 12, wireType 0 =*/ 96)\n .uint32(message.droppedEventsCount);\n if (message.links != null && message.links.length)\n for (let i = 0; i < message.links.length; ++i)\n Link_encode(\n message.links[i]!,\n writer.uint32(/* id 13, wireType 2 =*/ 106).fork()\n ).ldelim();\n if (message.droppedLinksCount != null)\n writer\n .uint32(/* id 14, wireType 0 =*/ 112)\n .uint32(message.droppedLinksCount);\n if (message.status != null)\n Status_encode(\n message.status,\n writer.uint32(/* id 15, wireType 2 =*/ 122).fork()\n ).ldelim();\n return writer;\n}\n\nfunction Status_encode(message: IStatus, writer: Writer): Writer {\n if (message.message != null)\n writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.message);\n if (message.code != null)\n writer.uint32(/* id 3, wireType 0 =*/ 24).int32(message.code);\n return writer;\n}\n\nfunction Event_encode(message: IEvent, writer: Writer): Writer {\n if (message.timeUnixNano != null)\n writer\n .uint32(/* id 1, wireType 1 =*/ 9)\n .fixed64(message.timeUnixNano as Long);\n if (message.name != null)\n writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.name);\n if (message.attributes != null && message.attributes.length)\n for (let i = 0; i < message.attributes.length; ++i)\n KeyValue_encode(\n message.attributes[i]!,\n writer.uint32(/* id 3, wireType 2 =*/ 26).fork()\n ).ldelim();\n if (message.droppedAttributesCount != null)\n writer\n .uint32(/* id 4, wireType 0 =*/ 32)\n .uint32(message.droppedAttributesCount);\n return writer;\n}\n\nfunction Link_encode(message: ILink, writer: Writer): Writer {\n if (message.traceId != null)\n writer.uint32(/* id 1, wireType 2 =*/ 10).bytes(message.traceId);\n if (message.spanId != null)\n writer.uint32(/* id 2, wireType 2 =*/ 18).bytes(message.spanId);\n if (message.traceState != null)\n writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.traceState);\n if (message.attributes != null && message.attributes.length)\n for (let i = 0; i < message.attributes.length; ++i)\n KeyValue_encode(\n message.attributes[i]!,\n writer.uint32(/* id 4, wireType 2 =*/ 34).fork()\n ).ldelim();\n if (message.droppedAttributesCount != null)\n writer\n .uint32(/* id 5, wireType 0 =*/ 40)\n .uint32(message.droppedAttributesCount);\n return writer;\n}\n", "import {\n SpanKind,\n SpanStatusCode,\n propagation,\n context,\n trace as traceApi,\n} from \"@opentelemetry/api\";\nimport type {\n Attributes,\n Span,\n TextMapSetter,\n TracerProvider,\n} from \"@opentelemetry/api\";\nimport type {\n Instrumentation,\n InstrumentationConfig,\n} from \"@opentelemetry/instrumentation\";\nimport { SemanticAttributes } from \"@opentelemetry/semantic-conventions\";\nimport { resolveTemplate } from \"../util/template\";\nimport { getVercelRequestContext } from \"../vercel-request-context/api\";\nimport { isSampled } from \"../util/sampled\";\n\n/**\n * Configuration for the \"fetch\" instrumentation.\n *\n * Some of this configuration can be overriden on a per-fetch call basis by\n * using the `opentelemetry` property in the `RequestInit` object (requires Next 14.1.1 or above).\n * This property can include:\n * - `ignore`: boolean - whether to ignore the fetch call from tracing. Overrides\n * `ignoreUrls`.\n * - `propagateContext: boolean`: overrides `propagateContextUrls` for this call.\n * - `spanName: string`: overrides the computed span name for this call.\n * - `attributes: Attributes`: overrides the computed attributes for this call.\n */\nexport interface FetchInstrumentationConfig extends InstrumentationConfig {\n /**\n * A set of URL matchers (string prefix or regex) that should be ignored from tracing.\n * By default all URLs are traced.\n * Can be overriden by the `opentelemetry.ignore` property in the `RequestInit` object.\n *\n * Example: `fetch: { ignoreUrls: [/example.com/] }`.\n */\n ignoreUrls?: (string | RegExp)[];\n\n /**\n * A set of URL matchers (string prefix or regex) for which the tracing context\n * should be propagated (see [`propagators`](Configuration#propagators)).\n * By default the context is propagated _only_ for the\n * [deployment URLs](https://vercel.com/docs/deployments/generated-urls), all\n * other URLs should be enabled explicitly.\n * Can be overriden by the `opentelemetry.propagateContext` property in the `RequestInit` object.\n *\n * Example: `fetch: { propagateContextUrls: [ /my.api/ ] }`.\n */\n propagateContextUrls?: (string | RegExp)[];\n\n /**\n * A set of URL matchers (string prefix or regex) for which the tracing context\n * should not be propagated (see [`propagators`](Configuration#propagators)). This allows you to exclude a\n * subset of URLs allowed by the [`propagateContextUrls`](FetchInstrumentationConfig#propagateContextUrls).\n * Can be overriden by the `opentelemetry.propagateContext` property in the `RequestInit` object.\n */\n dontPropagateContextUrls?: (string | RegExp)[];\n\n /**\n * A string for the \"resource.name\" attribute that can include attribute expressions in `{}`.\n * Can be overriden by the `opentelemetry.attributes` property in the `RequestInit` object.\n *\n * Example: `fetch: { resourceNameTemplate: \"{http.host}\" }`.\n */\n resourceNameTemplate?: string;\n\n /**\n * A map of attributes that should be created from the request headers. The keys of the map are\n * attribute names and the values are request header names. If a resonse header doesn't exist, no\n * attribute will be created for it.\n *\n * Example: `fetch: { attributesFromRequestHeaders: { \"attr1\": \"X-Attr\" } }`\n */\n attributesFromRequestHeaders?: Record<string, string>;\n\n /**\n * A map of attributes that should be created from the response headers. The keys of the map are\n * attribute names and the values are response header names. If a resonse header doesn't exist, no\n * attribute will be created for it.\n *\n * Example: `fetch: { attributesFromResponseHeaders: { \"attr1\": \"X-Attr\" } }`\n */\n attributesFromResponseHeaders?: Record<string, string>;\n}\n\ndeclare global {\n interface RequestInit {\n opentelemetry?: {\n ignore?: boolean;\n propagateContext?: boolean;\n spanName?: string;\n attributes?: Attributes;\n };\n }\n}\n\ntype InternalRequestInit = RequestInit & {\n next?: {\n internal: boolean;\n };\n};\n\nexport class FetchInstrumentation implements Instrumentation {\n instrumentationName = \"@vercel/otel/fetch\";\n instrumentationVersion = \"1.0.0\";\n /** @internal */\n private config: FetchInstrumentationConfig;\n /** @internal */\n private originalFetch: typeof fetch | undefined;\n /** @internal */\n private tracerProvider: TracerProvider | undefined;\n\n constructor(config: FetchInstrumentationConfig = {}) {\n this.config = config;\n }\n\n getConfig(): FetchInstrumentationConfig {\n return this.config;\n }\n\n setConfig(): void {\n // Nothing.\n }\n\n setTracerProvider(tracerProvider: TracerProvider): void {\n this.tracerProvider = tracerProvider;\n }\n\n setMeterProvider(): void {\n // Nothing.\n }\n\n public enable(): void {\n this.disable();\n\n const { tracerProvider } = this;\n if (!tracerProvider) {\n return;\n }\n\n const tracer = tracerProvider.getTracer(\n this.instrumentationName,\n this.instrumentationVersion\n );\n\n const ignoreUrls = this.config.ignoreUrls ?? [];\n\n const shouldIgnore = (\n url: URL,\n init: InternalRequestInit | undefined\n ): boolean => {\n if (init?.opentelemetry?.ignore !== undefined) {\n return init.opentelemetry.ignore;\n }\n if (ignoreUrls.length === 0) {\n return false;\n }\n const urlString = url.toString();\n return ignoreUrls.some((match) => {\n if (typeof match === \"string\") {\n if (match === \"*\") {\n return true;\n }\n return urlString.startsWith(match);\n }\n return match.test(urlString);\n });\n };\n\n const host =\n process.env.VERCEL_URL || process.env.NEXT_PUBLIC_VERCEL_URL || null;\n const branchHost =\n process.env.VERCEL_BRANCH_URL ||\n process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL ||\n null;\n const propagateContextUrls = this.config.propagateContextUrls ?? [];\n const dontPropagateContextUrls = this.config.dontPropagateContextUrls ?? [];\n const resourceNameTemplate = this.config.resourceNameTemplate;\n const { attributesFromRequestHeaders, attributesFromResponseHeaders } =\n this.config;\n\n const shouldPropagate = (\n url: URL,\n init: InternalRequestInit | undefined\n ): boolean => {\n if (init?.opentelemetry?.propagateContext) {\n return init.opentelemetry.propagateContext;\n }\n const urlString = url.toString();\n if (\n dontPropagateContextUrls.length > 0 &&\n dontPropagateContextUrls.some((match) => {\n if (typeof match === \"string\") {\n if (match === \"*\") {\n return true;\n }\n return urlString.startsWith(match);\n }\n return match.test(urlString);\n })\n ) {\n return false;\n }\n // Allow same origin.\n if (\n host &&\n url.protocol === \"https:\" &&\n (url.host === host ||\n url.host === branchHost ||\n url.host === getVercelRequestContext()?.headers.host)\n ) {\n return true;\n }\n // Allow localhost for testing in a dev mode.\n if (!host && url.protocol === \"http:\" && url.hostname === \"localhost\") {\n return true;\n }\n return propagateContextUrls.some((match) => {\n if (typeof match === \"string\") {\n if (match === \"*\") {\n return true;\n }\n return urlString.startsWith(match);\n }\n return match.test(urlString);\n });\n };\n\n // Disable fetch tracing in Next.js.\n process.env.NEXT_OTEL_FETCH_DISABLED = \"1\";\n\n const originalFetch = globalThis.fetch;\n this.originalFetch = originalFetch;\n\n const doFetch: typeof fetch = async (input, initArg) => {\n const init = initArg as InternalRequestInit | undefined;\n\n // Passthrough internal requests.\n if (init?.next?.internal) {\n return originalFetch(input, init);\n }\n\n const req = new Request(\n // The input Request must be cloned to avoid the bug\n // on Edge runtime where the `new Request()` eagerly\n // consumes the body of the original Request.\n input instanceof Request ? input.clone() : input,\n init\n );\n const url = new URL(req.url);\n if (shouldIgnore(url, init)) {\n return originalFetch(input, init);\n }\n\n const attrs = {\n [SemanticAttributes.HTTP_METHOD]: req.method,\n [SemanticAttributes.HTTP_URL]: req.url,\n [SemanticAttributes.HTTP_HOST]: url.host,\n [SemanticAttributes.HTTP_SCHEME]: url.protocol.replace(\":\", \"\"),\n [SemanticAttributes.NET_PEER_NAME]: url.hostname,\n [SemanticAttributes.NET_PEER_PORT]: url.port,\n };\n const resourceName = resourceNameTemplate\n ? resolveTemplate(resourceNameTemplate, attrs)\n : removeSearch(req.url);\n\n const spanName =\n init?.opentelemetry?.spanName ?? `fetch ${req.method} ${req.url}`;\n\n const parentContext = context.active();\n\n const span = tracer.startSpan(\n spanName,\n {\n kind: SpanKind.CLIENT,\n attributes: {\n ...attrs,\n \"operation.name\": `fetch.${req.method}`,\n \"resource.name\": resourceName,\n ...init?.opentelemetry?.attributes,\n },\n },\n parentContext\n );\n if (!span.isRecording() || !isSampled(span.spanContext().traceFlags)) {\n span.end();\n return originalFetch(input, init);\n }\n\n if (shouldPropagate(url, init)) {\n const fetchContext = traceApi.setSpan(parentContext, span);\n propagation.inject(fetchContext, req.headers, HEADERS_SETTER);\n }\n\n if (attributesFromRequestHeaders) {\n headersToAttributes(span, attributesFromRequestHeaders, req.headers);\n }\n\n try {\n const startTime = Date.now();\n // Remove \"content-type\" for a FormData body because undici regenerates\n // a new multipart separator each time.\n if (init?.body && init.body instanceof FormData) {\n req.headers.delete(\"content-type\");\n }\n const res = await originalFetch(input, {\n ...init,\n headers: req.headers,\n });\n const duration = Date.now() - startTime;\n span.setAttribute(SemanticAttributes.HTTP_STATUS_CODE, res.status);\n span.setAttribute(\"http.response_time\", duration);\n if (attributesFromResponseHeaders) {\n headersToAttributes(span, attributesFromResponseHeaders, res.headers);\n }\n if (res.status >= 500) {\n onError(span, `Status: ${res.status} (${res.statusText})`);\n }\n\n // Flush body, but non-blocking.\n if (res.body) {\n void pipeResponse(res).then(\n (byteLength) => {\n if (span.isRecording()) {\n span.setAttribute(\n SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED,\n byteLength\n );\n span.end();\n }\n },\n (err) => {\n if (span.isRecording()) {\n onError(span, err);\n span.end();\n }\n }\n );\n } else {\n span.end();\n }\n\n return res;\n } catch (e) {\n onError(span, e);\n span.end();\n throw e;\n }\n };\n globalThis.fetch = doFetch;\n }\n\n public disable(): void {\n if (this.originalFetch) {\n globalThis.fetch = this.originalFetch;\n }\n }\n}\n\nconst HEADERS_SETTER: TextMapSetter<Headers> = {\n set(carrier: Headers, key: string, value: string): void {\n carrier.set(key, value);\n },\n};\n\nfunction removeSearch(url: string): string {\n const index = url.indexOf(\"?\");\n return index === -1 ? url : url.substring(0, index);\n}\n\nfunction pipeResponse(res: Response): Promise<number> {\n let length = 0;\n const clone = res.clone();\n const reader = clone.body?.getReader();\n if (!reader) {\n return Promise.resolve(0);\n }\n const read = (): Promise<void> => {\n return reader.read().then(({ done, value }) => {\n if (done) {\n return;\n }\n length += value.byteLength;\n return read();\n });\n };\n return read().then(() => length);\n}\n\nfunction onError(span: Span, err: unknown): void {\n if (err instanceof Error) {\n span.recordException(err);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: err.message,\n });\n } else {\n const message = String(err);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message,\n });\n }\n}\n\nfunction headersToAttributes(\n span: Span,\n attrsToHeadersMap: Record<string, string>,\n headers: Headers\n): void {\n for (const [attrName, headerName] of Object.entries(attrsToHeadersMap)) {\n const headerValue = headers.get(headerName);\n if (headerValue !== null) {\n span.setAttribute(attrName, headerValue);\n }\n }\n}\n", "import type { Attributes } from \"@opentelemetry/api\";\n\nexport function resolveTemplate(template: string, attrs: Attributes): string {\n return template.replace(/\\{(?<temp1>[^{}]+)\\}/g, (match, key) => {\n const value = attrs[key as string];\n if (value !== undefined) {\n return String(value);\n }\n return match;\n });\n}\n", "import {\n createTraceState,\n isSpanContextValid,\n trace as traceApi,\n} from \"@opentelemetry/api\";\nimport type {\n Context,\n SpanContext,\n TextMapGetter,\n TextMapPropagator,\n TextMapSetter,\n} from \"@opentelemetry/api\";\nimport { isTracingSuppressed } from \"@opentelemetry/core\";\n\nconst VERSION = \"00\";\n\nconst TRACE_PARENT_HEADER = \"traceparent\";\nconst TRACE_STATE_HEADER = \"tracestate\";\n\n/**\n * Same as the `W3CTraceContextPropagator` from `@opentelemetry/core`, but with\n * a workaround for RegExp issue in Edge.\n */\nexport class W3CTraceContextPropagator implements TextMapPropagator {\n fields(): string[] {\n return [TRACE_PARENT_HEADER, TRACE_STATE_HEADER];\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n inject(context: Context, carrier: any, setter: TextMapSetter): void {\n const spanContext = traceApi.getSpanContext(context);\n if (\n !spanContext ||\n isTracingSuppressed(context) ||\n !isSpanContextValid(spanContext)\n )\n return;\n\n const traceParent = `${VERSION}-${spanContext.traceId}-${\n spanContext.spanId\n }-0${Number(spanContext.traceFlags || 0).toString(16)}`;\n\n setter.set(carrier, TRACE_PARENT_HEADER, traceParent);\n if (spanContext.traceState) {\n setter.set(\n carrier,\n TRACE_STATE_HEADER,\n spanContext.traceState.serialize()\n );\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n extract(context: Context, carrier: any, getter: TextMapGetter): Context {\n const traceParentHeader = getter.get(carrier, TRACE_PARENT_HEADER);\n if (!traceParentHeader) return context;\n const traceParent = Array.isArray(traceParentHeader)\n ? traceParentHeader[0]\n : traceParentHeader;\n if (typeof traceParent !== \"string\") return context;\n const spanContext = parseTraceParent(traceParent);\n if (!spanContext) return context;\n\n spanContext.isRemote = true;\n\n const traceStateHeader = getter.get(carrier, TRACE_STATE_HEADER);\n if (traceStateHeader) {\n // If more than one `tracestate` header is found, we merge them into a\n // single header.\n const state = Array.isArray(traceStateHeader)\n ? traceStateHeader.join(\",\")\n : traceStateHeader;\n spanContext.traceState = createTraceState(\n typeof state === \"string\" ? state : undefined\n );\n }\n return traceApi.setSpanContext(context, spanContext);\n }\n}\n\nfunction parseTraceParent(traceParent: string): SpanContext | null {\n const [version, traceId, spanId, traceFlags, other] = traceParent.split(\"-\");\n if (\n !version ||\n !traceId ||\n !spanId ||\n !traceFlags ||\n version.length !== 2 ||\n traceId.length !== 32 ||\n spanId.length !== 16 ||\n traceFlags.length !== 2\n )\n return null;\n\n // According to the specification the implementation should be compatible\n // with future versions. If there are more parts, we only reject it if it's using version 00\n // See https://www.w3.org/TR/trace-context/#versioning-of-traceparent\n if (version === \"00\" && other) return null;\n\n return {\n traceId,\n spanId,\n traceFlags: parseInt(traceFlags, 16),\n };\n}\n", "import type { Context, TextMapPropagator } from \"@opentelemetry/api\";\nimport { diag, TraceFlags, trace as tracing } from \"@opentelemetry/api\";\nimport { getVercelRequestContext } from \"./api\";\n\nexport class VercelRuntimePropagator implements TextMapPropagator {\n fields(): string[] {\n return [];\n }\n\n inject(): void {\n // Nothing.\n }\n\n extract(context: Context): Context {\n const vrc = getVercelRequestContext();\n if (!vrc?.telemetry) {\n diag.warn(\"@vercel/otel: Vercel telemetry extension not found.\");\n return context;\n }\n\n const { rootSpanContext } = vrc.telemetry;\n if (!rootSpanContext) {\n return context;\n }\n\n diag.debug(\n \"@vercel/otel: Extracted root SpanContext from Vercel request context.\",\n rootSpanContext\n );\n return tracing.setSpanContext(context, {\n ...rootSpanContext,\n isRemote: true,\n traceFlags: rootSpanContext.traceFlags || TraceFlags.SAMPLED,\n });\n }\n}\n", "import { diag } from \"@opentelemetry/api\";\nimport type { ReadableSpan, SpanExporter } from \"@opentelemetry/sdk-trace-base\";\nimport { ExportResultCode, type ExportResult } from \"@opentelemetry/core\";\nimport { createExportTraceServiceRequest } from \"@opentelemetry/otlp-transformer\";\nimport { getVercelRequestContext } from \"./api\";\n\nexport class VercelRuntimeSpanExporter implements SpanExporter {\n export(\n spans: ReadableSpan[],\n resultCallback: (result: ExportResult) => void\n ): void {\n const context = getVercelRequestContext();\n if (!context?.telemetry) {\n diag.warn(\"@vercel/otel: no telemetry context found\");\n resultCallback({ code: ExportResultCode.SUCCESS, error: undefined });\n return;\n }\n\n try {\n // Converts a Span to IResourceSpans > IScopeSpans > ISpan structure, which\n // is OTLP format. It's can be directly serialized to JSON or converted\n // to Protobuf.\n // {\n // // Uses hex-encoding trace and span IDs. Otherwise, base64 is used.\n // useHex: true,\n // // Uses `{high, low}` format for timestamps. Otherwise, `unixNanon` is used.\n // // TODO Fix this\n // useLongBits: false,\n // }\n const data = createExportTraceServiceRequest(spans, {\n useHex: true,\n useLongBits: false,\n });\n\n context.telemetry.reportSpans(data);\n resultCallback({ code: ExportResultCode.SUCCESS, error: undefined });\n } catch (e) {\n resultCallback({\n code: ExportResultCode.FAILED,\n error: e instanceof Error ? e : new Error(String(e)),\n });\n }\n }\n\n shutdown(): Promise<void> {\n return Promise.resolve();\n }\n\n forceFlush?(): Promise<void> {\n return Promise.resolve();\n }\n}\n", "/*\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 type { OtlpEncodingOptions, Fixed64, LongBits } from './types';\nimport { HrTime } from '@opentelemetry/api';\nimport { hexToBase64, hrTimeToNanoseconds } from '@opentelemetry/core';\n\nconst NANOSECONDS = BigInt(1_000_000_000);\n\nexport function hrTimeToNanos(hrTime: HrTime): bigint {\n return BigInt(hrTime[0]) * NANOSECONDS + BigInt(hrTime[1]);\n}\n\nexport function toLongBits(value: bigint): LongBits {\n const low = Number(BigInt.asUintN(32, value));\n const high = Number(BigInt.asUintN(32, value >> BigInt(32)));\n return { low, high };\n}\n\nexport function encodeAsLongBits(hrTime: HrTime): LongBits {\n const nanos = hrTimeToNanos(hrTime);\n return toLongBits(nanos);\n}\n\nexport function encodeAsString(hrTime: HrTime): string {\n const nanos = hrTimeToNanos(hrTime);\n return nanos.toString();\n}\n\nconst encodeTimestamp =\n typeof BigInt !== 'undefined' ? encodeAsString : hrTimeToNanoseconds;\n\nexport type HrTimeEncodeFunction = (hrTime: HrTime) => Fixed64;\nexport type SpanContextEncodeFunction = (spanContext: string) => string;\nexport type OptionalSpanContextEncodeFunction = (\n spanContext: string | undefined\n) => string | undefined;\n\nexport interface Encoder {\n encodeHrTime: HrTimeEncodeFunction;\n encodeSpanContext: SpanContextEncodeFunction;\n encodeOptionalSpanContext: OptionalSpanContextEncodeFunction;\n}\n\nfunction identity<T>(value: T): T {\n return value;\n}\n\nfunction optionalHexToBase64(str: string | undefined): string | undefined {\n if (str === undefined) return undefined;\n return hexToBase64(str);\n}\n\nconst DEFAULT_ENCODER: Encoder = {\n encodeHrTime: encodeAsLongBits,\n encodeSpanContext: hexToBase64,\n encodeOptionalSpanContext: optionalHexToBase64,\n};\n\nexport function getOtlpEncoder(options?: OtlpEncodingOptions): Encoder {\n if (options === undefined) {\n return DEFAULT_ENCODER;\n }\n\n const useLongBits = options.useLongBits ?? true;\n const useHex = options.useHex ?? false;\n return {\n encodeHrTime: useLongBits ? encodeAsLongBits : encodeTimestamp,\n encodeSpanContext: useHex ? identity : hexToBase64,\n encodeOptionalSpanContext: useHex ? identity : optionalHexToBase64,\n };\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport type { IAnyValue, IKeyValue } from './types';\nimport { Attributes } from '@opentelemetry/api';\n\nexport function toAttributes(attributes: Attributes): IKeyValue[] {\n return Object.keys(attributes).map(key => toKeyValue(key, attributes[key]));\n}\n\nexport function toKeyValue(key: string, value: unknown): IKeyValue {\n return {\n key: key,\n value: toAnyValue(value),\n };\n}\n\nexport function toAnyValue(value: unknown): IAnyValue {\n const t = typeof value;\n if (t === 'string') return { stringValue: value as string };\n if (t === 'number') {\n if (!Number.isInteger(value)) return { doubleValue: value as number };\n return { intValue: value as number };\n }\n if (t === 'boolean') return { boolValue: value as boolean };\n if (value instanceof Uint8Array) return { bytesValue: value };\n if (Array.isArray(value))\n return { arrayValue: { values: value.map(toAnyValue) } };\n if (t === 'object' && value != null)\n return {\n kvlistValue: {\n values: Object.entries(value as object).map(([k, v]) =>\n toKeyValue(k, v)\n ),\n },\n };\n\n return {};\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport type { Link } from '@opentelemetry/api';\nimport type { ReadableSpan, TimedEvent } from '@opentelemetry/sdk-trace-base';\nimport type { Encoder } from '../common';\nimport { toAttributes } from '../common/internal';\nimport { EStatusCode, IEvent, ILink, ISpan } from './types';\n\nexport function sdkSpanToOtlpSpan(span: ReadableSpan, encoder: Encoder): ISpan {\n const ctx = span.spanContext();\n const status = span.status;\n return {\n traceId: encoder.encodeSpanContext(ctx.traceId),\n spanId: encoder.encodeSpanContext(ctx.spanId),\n parentSpanId: encoder.encodeOptionalSpanContext(span.parentSpanId),\n traceState: ctx.traceState?.serialize(),\n name: span.name,\n // Span kind is offset by 1 because the API does not define a value for unset\n kind: span.kind == null ? 0 : span.kind + 1,\n startTimeUnixNano: encoder.encodeHrTime(span.startTime),\n endTimeUnixNano: encoder.encodeHrTime(span.endTime),\n attributes: toAttributes(span.attributes),\n droppedAttributesCount: span.droppedAttributesCount,\n events: span.events.map(event => toOtlpSpanEvent(event, encoder)),\n droppedEventsCount: span.droppedEventsCount,\n status: {\n // API and proto enums share the same values\n code: status.code as unknown as EStatusCode,\n message: status.message,\n },\n links: span.links.map(link => toOtlpLink(link, encoder)),\n droppedLinksCount: span.droppedLinksCount,\n };\n}\n\nexport function toOtlpLink(link: Link, encoder: Encoder): ILink {\n return {\n attributes: link.attributes ? toAttributes(link.attributes) : [],\n spanId: encoder.encodeSpanContext(link.context.spanId),\n traceId: encoder.encodeSpanContext(link.context.traceId),\n traceState: link.context.traceState?.serialize(),\n droppedAttributesCount: link.droppedAttributesCount || 0,\n };\n}\n\nexport function toOtlpSpanEvent(\n timedEvent: TimedEvent,\n encoder: Encoder\n): IEvent {\n return {\n attributes: timedEvent.attributes\n ? toAttributes(timedEvent.attributes)\n : [],\n name: timedEvent.name,\n timeUnixNano: encoder.encodeHrTime(timedEvent.time),\n droppedAttributesCount: timedEvent.droppedAttributesCount || 0,\n };\n}\n", "/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport type { IResource } from '@opentelemetry/resources';\nimport type { ReadableSpan } from '@opentelemetry/sdk-trace-base';\nimport type { OtlpEncodingOptions } from '../common/types';\nimport { toAttributes } from '../common/internal';\nimport { sdkSpanToOtlpSpan } from './internal';\nimport {\n IExportTraceServiceRequest,\n IResourceSpans,\n IScopeSpans,\n} from './types';\nimport { Encoder, getOtlpEncoder } from '../common';\n\nexport function createExportTraceServiceRequest(\n spans: ReadableSpan[],\n options?: OtlpEncodingOptions\n): IExportTraceServiceRequest {\n const encoder = getOtlpEncoder(options);\n return {\n resourceSpans: spanRecordsToResourceSpans(spans, encoder),\n };\n}\n\nfunction createResourceMap(readableSpans: ReadableSpan[]) {\n const resourceMap: Map<IResource, Map<string, ReadableSpan[]>> = new Map();\n for (const record of readableSpans) {\n let ilmMap = resourceMap.get(record.resource);\n\n if (!ilmMap) {\n ilmMap = new Map();\n resourceMap.set(record.resource, ilmMap);\n }\n\n // TODO this is duplicated in basic tracer. Consolidate on a common helper in core\n const instrumentationLibraryKey = `${record.instrumentationLibrary.name}@${\n record.instrumentationLibrary.version || ''\n }:${record.instrumentationLibrary.schemaUrl || ''}`;\n let records = ilmMap.get(instrumentationLibraryKey);\n\n if (!records) {\n records = [];\n ilmMap.set(instrumentationLibraryKey, records);\n }\n\n records.push(record);\n }\n\n return resourceMap;\n}\n\nfunction spanRecordsToResourceSpans(\n readableSpans: ReadableSpan[],\n encoder: Encoder\n): IResourceSpans[] {\n const resourceMap = createResourceMap(readableSpans);\n const out: IResourceSpans[] = [];\n\n const entryIterator = resourceMap.entries();\n let entry = entryIterator.next();\n while (!entry.done) {\n const [resource, ilmMap] = entry.value;\n const scopeResourceSpans: IScopeSpans[] = [];\n const ilmIterator = ilmMap.values();\n let ilmEntry = ilmIterator.next();\n while (!ilmEntry.done) {\n const scopeSpans = ilmEntry.value;\n if (scopeSpans.length > 0) {\n const { name, version, schemaUrl } =\n scopeSpans[0].instrumentationLibrary;\n const spans = scopeSpans.map(readableSpan =>\n sdkSpanToOtlpSpan(readableSpan, encoder)\n );\n\n scopeResourceSpans.push({\n scope: { name, version },\n spans: spans,\n schemaUrl: schemaUrl,\n });\n }\n ilmEntry = ilmIterator.next();\n }\n // TODO SDK types don't provide resource schema URL at this time\n const transformedSpans: IResourceSpans = {\n resource: {\n attributes: toAttributes(resource.attributes),\n droppedAttributesCount: 0,\n },\n scopeSpans: scopeResourceSpans,\n schemaUrl: undefined,\n };\n\n out.push(transformedSpans);\n entry = entryIterator.next();\n }\n\n return out;\n}\n", "import type { Configuration } from \"./types\";\nimport { Sdk } from \"./sdk\";\n\nexport type * from \"./types\";\nexport type { OTLPExporterConfig } from \"./exporters/config\";\nexport { OTLPHttpJsonTraceExporter } from \"./exporters/exporter-trace-otlp-http-fetch\";\nexport { OTLPHttpProtoTraceExporter } from \"./exporters/exporter-trace-otlp-proto-fetch\";\nexport {\n type FetchInstrumentationConfig,\n FetchInstrumentation,\n} from \"./instrumentations/fetch\";\n\n/**\n * Registers the OpenTelemetry SDK with the specified service name and the default configuration.\n * Should be included in the `instrumentation.ts`. For example:\n *\n * ```ts\n * import { registerOTel } from \"@vercel/otel\";\n *\n * export function register() {\n * registerOTel({\n * serviceName: \"my-app\",\n * ...\n * });\n * }\n * ```\n *\n * @param optionsOrServiceName - Either a service name as a string or a configuration object.\n */\nexport function registerOTel(\n optionsOrServiceName?: Configuration | string\n): void {\n let options: Configuration;\n if (!optionsOrServiceName) {\n options = {};\n } else if (typeof optionsOrServiceName === \"string\") {\n options = { serviceName: optionsOrServiceName };\n } else {\n options = optionsOrServiceName;\n }\n const sdk = new Sdk(options);\n sdk.start();\n}\n"],
|
|
5
|
+
"mappings": ";;;spBAAA,IAAAA,EAAA,aAAAC,OAAc,qBAAd,IAAAC,EAAAC,GAAA,KAAAC,EAAAJ,EAAAC,yJCgBA,IAAAI,GAAA,WAEMC,MAAuBD,GAAA,kBAC3B,gDAAgD,EAGlD,SAAgBE,GAAgBC,EAAgB,CAC9C,OAAOA,EAAQ,SAASF,GAAsB,EAAI,CACpD,CAFAG,GAAA,gBAAAF,GAIA,SAAgBG,GAAkBF,EAAgB,CAChD,OAAOA,EAAQ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ACzCC,EAAU,CAAE,YAAaD,CAAqB,EAE9CC,EAAUD,EAJVC,EAAU,CAAC,EAMD,IAAIC,GAAID,CAAO,EACvB,MAAM,CACZ",
|
|
6
|
+
"names": ["api_exports", "api_star", "init_api", "__esmMin", "__reExport", "api_1", "SUPPRESS_TRACING_KEY", "suppressTracing", "context", "exports", "unsuppressTracing", "isTracingSuppressed", "exports", "api_1", "constants_1", "serializeKeyPairs", "keyPairs", "hValue", "current", "value", "exports", "getKeyPairs", "baggage", "key", "entry", "parsePairKeyValue", "valueProps", "keyPairPart", "separatorIndex", "metadata", "parseKeyPairsIntoRecord", "keyPair", "headers", "api_1", "suppress_tracing_1", "constants_1", "utils_1", "W3CBaggagePropagator", "context", "carrier", "setter", "baggage", "keyPairs", "pair", "headerValue", "getter", "baggageString", "entry", "keyPair", "baggageEntry", "exports", "AnchoredClock", "systemClock", "monotonicClock", "delta", "exports", "api_1", "sanitizeAttributes", "attributes", "out", "key", "val", "isAttributeKey", "isAttributeValue", "exports", "isHomogeneousAttributeValueArray", "isValidPrimitiveAttributeValue", "arr", "type", "element", "api_1", "loggingErrorHandler", "ex", "stringifyException", "exports", "flattenException", "result", "current", "propertyName", "value", "logging_error_handler_1", "delegateHandler", "setGlobalErrorHandler", "handler", "exports", "globalErrorHandler", "ex", "TracesSamplerValues", "exports", "exports", "api_1", "sampling_1", "globalThis_1", "DEFAULT_LIST_SEPARATOR", "ENVIRONMENT_BOOLEAN_KEYS", "isEnvVarABoolean", "key", "ENVIRONMENT_NUMBERS_KEYS", "isEnvVarANumber", "ENVIRONMENT_LISTS_KEYS", "isEnvVarAList", "exports", "parseBoolean", "environment", "values", "value", "parseNumber", "name", "min", "max", "parseStringList", "output", "input", "separator", "givenValue", "v", "logLevelMap", "setLogLevelFromEnv", "theLevel", "parseEnvironment", "env", "getEnvWithoutDefaults", "environment_1", "globalThis_1", "getEnv", "globalEnv", "exports", "hexToBase64", "hexStr", "hexStrLen", "hexAsciiCharsStr", "i", "hexPair", "hexVal", "exports", "SPAN_ID_BYTES", "TRACE_ID_BYTES", "RandomIdGenerator", "getIdGenerator", "exports", "SHARED_CHAR_CODES_ARRAY", "bytes", "i", "exports", "exports", "exports", "__exportStar", "exports", "exports", "__exportStar", "exports", "__exportStar", "exports", "version_1", "semantic_conventions_1", "exports", "unrefTimer", "_timer", "exports", "__exportStar", "exports", "platform_1", "NANOSECOND_DIGITS", "NANOSECOND_DIGITS_IN_MILLIS", "MILLISECONDS_TO_NANOSECONDS", "SECOND_TO_NANOSECONDS", "millisToHrTime", "epochMillis", "epochSeconds", "seconds", "nanos", "exports", "getTimeOrigin", "timeOrigin", "perf", "hrTime", "performanceNow", "now", "addHrTimes", "timeInputToHrTime", "time", "isTimeInputHrTime", "hrTimeDuration", "startTime", "endTime", "hrTimeToTimeStamp", "precision", "tmp", "nanoString", "hrTimeToNanoseconds", "hrTimeToMilliseconds", "hrTimeToMicroseconds", "value", "isTimeInput", "time1", "time2", "out", "ExportResultCode", "exports", "api_1", "CompositePropagator", "config", "_a", "p", "x", "y", "context", "carrier", "setter", "propagator", "err", "getter", "ctx", "exports", "VALID_KEY_CHAR_RANGE", "VALID_KEY", "VALID_VENDOR_KEY", "VALID_KEY_REGEX", "VALID_VALUE_BASE_REGEX", "INVALID_VALUE_COMMA_EQUAL_REGEX", "validateKey", "key", "exports", "validateValue", "value", "validators_1", "MAX_TRACE_STATE_ITEMS", "MAX_TRACE_STATE_LEN", "LIST_MEMBERS_SEPARATOR", "LIST_MEMBER_KEY_VALUE_SPLITTER", "TraceState", "_TraceState", "rawTraceState", "key", "value", "traceState", "agg", "part", "listMember", "exports", "api_1", "suppress_tracing_1", "TraceState_1", "exports", "VERSION", "VERSION_PART", "TRACE_ID_PART", "PARENT_ID_PART", "FLAGS_PART", "TRACE_PARENT_REGEX", "parseTraceParent", "traceParent", "match", "W3CTraceContextPropagator", "context", "carrier", "setter", "spanContext", "getter", "traceParentHeader", "traceStateHeader", "state", "api_1", "RPC_METADATA_KEY", "RPCType", "exports", "setRPCMetadata", "context", "meta", "deleteRPCMetadata", "getRPCMetadata", "api_1", "AlwaysOffSampler", "exports", "api_1", "AlwaysOnSampler", "exports", "api_1", "global_error_handler_1", "AlwaysOffSampler_1", "AlwaysOnSampler_1", "ParentBasedSampler", "config", "_a", "_b", "_c", "_d", "context", "traceId", "spanName", "spanKind", "attributes", "links", "parentContext", "exports", "api_1", "TraceIdRatioBasedSampler", "_ratio", "context", "traceId", "ratio", "accumulation", "i", "pos", "part", "exports", "objectTag", "nullTag", "undefinedTag", "funcProto", "funcToString", "objectCtorString", "getPrototype", "overArg", "objectProto", "hasOwnProperty", "symToStringTag", "nativeObjectToString", "func", "transform", "arg", "isPlainObject", "value", "isObjectLike", "baseGetTag", "proto", "Ctor", "exports", "getRawTag", "objectToString", "isOwn", "tag", "unmasked", "result", "lodash_merge_1", "MAX_LEVEL", "merge", "args", "result", "objects", "mergeTwoObjects", "exports", "takeValue", "value", "isArray", "one", "two", "level", "isPrimitive", "isFunction", "j", "isObject", "keys", "i", "key", "shouldMerge", "twoValue", "obj1", "obj2", "wasObjectReferenced", "arr1", "arr2", "obj", "arr", "info", "TimeoutError", "_TimeoutError", "message", "exports", "callWithTimeout", "promise", "timeout", "timeoutHandle", "timeoutPromise", "_resolve", "reject", "result", "reason", "urlMatches", "url", "urlToMatch", "exports", "isUrlIgnored", "ignoredUrls", "ignoreUrl", "isWrapped", "func", "exports", "Deferred", "resolve", "reject", "val", "err", "exports", "promise_1", "BindOnceFuture", "_callback", "_that", "args", "val", "err", "exports", "api_1", "suppress_tracing_1", "_export", "exporter", "arg", "resolve", "result", "exports", "__exportStar", "exports", "exporter_1", "parseInstrumentationOptions", "options", "instrumentations", "i", "j", "option", "results", "exports", "enableInstrumentations", "tracerProvider", "meterProvider", "instrumentation", "disableInstrumentations", "api_1", "autoLoaderUtils_1", "registerInstrumentations", "options", "instrumentations", "tracerProvider", "meterProvider", "exports", "async_hooks_exports", "async_hooks_star", "init_async_hooks", "__esmMin", "__reExport", "events_exports", "events_star", "init_events", "__esmMin", "__reExport", "events_1", "ADD_LISTENER_METHODS", "AbstractAsyncHooksContextManager", "context", "target", "manager", "contextWrapper", "args", "ee", "methodName", "original", "contextManager", "event", "listener", "events", "_a", "patchedListener", "map", "listeners", "exports", "api_1", "async_hooks_1", "AbstractAsyncHooksContextManager_1", "AsyncLocalStorageContextManager", "_a", "context", "fn", "thisArg", "args", "cb", "exports", "toAttributes", "attributes", "key", "toKeyValue", "exports", "value", "toAnyValue", "t", "k", "v", "internal_1", "sdkSpanToOtlpSpan", "span", "encoder", "ctx", "status", "_a", "event", "toOtlpSpanEvent", "link", "toOtlpLink", "exports", "timedEvent", "core_1", "NANOSECONDS", "hrTimeToNanos", "hrTime", "exports", "toLongBits", "value", "low", "high", "encodeAsLongBits", "nanos", "encodeAsString", "encodeTimestamp", "identity", "optionalHexToBase64", "str", "DEFAULT_ENCODER", "getOtlpEncoder", "options", "useLongBits", "_a", "useHex", "_b", "internal_1", "internal_2", "common_1", "createExportTraceServiceRequest", "spans", "options", "encoder", "spanRecordsToResourceSpans", "exports", "createResourceMap", "readableSpans", "resourceMap", "record", "ilmMap", "instrumentationLibraryKey", "records", "out", "entryIterator", "entry", "resource", "scopeResourceSpans", "ilmIterator", "ilmEntry", "scopeSpans", "name", "version", "schemaUrl", "readableSpan", "transformedSpans", "api_1", "core_1", "DEFAULT_TRACE_TIMEOUT", "exports", "parseHeaders", "partialHeaders", "headers", "key", "value", "appendResourcePathToUrl", "url", "path", "appendRootPathToUrlIfNeeded", "parsedUrl", "configureExporterTimeout", "timeoutMillis", "invalidTimeout", "getExporterTimeoutFromEnv", "definedTimeout", "_a", "timeout", "defaultTimeout", "isExportRetryable", "statusCode", "parseRetryAfterToMills", "retryAfter", "seconds", "delay", "api_1", "core_1", "util_1", "OTLPExporterBase", "config", "items", "resultCallback", "error", "resolve", "reject", "e", "exports", "require_aspromise", "__commonJSMin", "exports", "module", "asPromise", "fn", "ctx", "params", "offset", "index", "pending", "resolve", "reject", "err", "require_base64", "__commonJSMin", "exports", "base64", "string", "p", "b64", "s64", "i", "buffer", "start", "end", "parts", "chunk", "j", "t", "b", "invalidEncoding", "offset", "require_eventemitter", "__commonJSMin", "exports", "module", "EventEmitter", "evt", "fn", "ctx", "listeners", "i", "args", "require_float", "__commonJSMin", "exports", "module", "factory", "f32", "f8b", "le", "writeFloat_f32_cpy", "val", "buf", "pos", "writeFloat_f32_rev", "readFloat_f32_cpy", "readFloat_f32_rev", "writeFloat_ieee754", "writeUint", "sign", "exponent", "mantissa", "writeUintLE", "writeUintBE", "readFloat_ieee754", "readUint", "uint", "readUintLE", "readUintBE", "f64", "writeDouble_f64_cpy", "writeDouble_f64_rev", "readDouble_f64_cpy", "readDouble_f64_rev", "writeDouble_ieee754", "off0", "off1", "readDouble_ieee754", "lo", "hi", "require_inquire", "__commonJSMin", "exports", "module", "inquire", "moduleName", "require_utf8", "__commonJSMin", "exports", "utf8", "string", "len", "c", "i", "buffer", "start", "end", "parts", "chunk", "t", "offset", "c1", "c2", "require_pool", "__commonJSMin", "exports", "module", "pool", "alloc", "slice", "size", "SIZE", "MAX", "slab", "offset", "buf", "require_longbits", "__commonJSMin", "exports", "module", "LongBits", "util", "lo", "hi", "zero", "zeroHash", "value", "sign", "unsigned", "charCodeAt", "hash", "mask", "part0", "part1", "part2", "require_minimal", "__commonJSMin", "exports", "util", "value", "obj", "prop", "Buffer", "sizeOrArray", "hash", "unsigned", "bits", "merge", "dst", "src", "ifNotSet", "keys", "i", "str", "newError", "name", "CustomError", "message", "properties", "fieldNames", "fieldMap", "encoding", "size", "require_writer", "__commonJSMin", "exports", "module", "Writer", "util", "BufferWriter", "LongBits", "base64", "utf8", "Op", "fn", "len", "val", "noop", "State", "writer", "create", "size", "writeByte", "buf", "pos", "writeVarint32", "VarintOp", "value", "writeVarint64", "bits", "writeFixed32", "writeBytes", "i", "head", "tail", "BufferWriter_", "require_writer_buffer", "__commonJSMin", "exports", "module", "BufferWriter", "Writer", "util", "val", "buf", "pos", "i", "value", "len", "writeStringBuffer", "require_reader", "__commonJSMin", "exports", "module", "Reader", "util", "BufferReader", "LongBits", "utf8", "indexOutOfRange", "reader", "writeLength", "buffer", "create_array", "create", "value", "readLongVarint", "bits", "i", "readFixed32_end", "buf", "end", "readFixed64", "length", "start", "nativeBuffer", "bytes", "wireType", "BufferReader_", "fn", "require_reader_buffer", "__commonJSMin", "exports", "module", "BufferReader", "Reader", "util", "buffer", "len", "require_service", "__commonJSMin", "exports", "module", "Service", "util", "rpcImpl", "requestDelimited", "responseDelimited", "rpcCall", "method", "requestCtor", "responseCtor", "request", "callback", "self", "err", "response", "endedByRPC", "require_rpc", "__commonJSMin", "exports", "rpc", "require_roots", "__commonJSMin", "exports", "module", "require_index_minimal", "__commonJSMin", "exports", "protobuf", "configure", "require_minimal", "__commonJSMin", "exports", "module", "init_api", "import_core", "init_api", "import_core", "import_semantic_conventions", "ExceptionEventName", "Span", "parentTracer", "context", "spanName", "spanContext", "kind", "parentSpanId", "links", "startTime", "_deprecatedClock", "attributes", "now", "key", "value", "_b", "__values", "_c", "_d", "__read", "k", "v", "name", "attributesOrStartTime", "timeStamp", "status", "endTime", "inp", "msDuration", "exception", "time", "ExceptionEventName", "limit", "_this", "val", "init_api", "import_core", "SamplingDecision", "AlwaysOffSampler", "SamplingDecision", "AlwaysOnSampler", "SamplingDecision", "init_api", "import_core", "ParentBasedSampler", "config", "AlwaysOnSampler", "_a", "_b", "AlwaysOffSampler", "_c", "_d", "context", "traceId", "spanName", "spanKind", "attributes", "links", "parentContext", "init_api", "TraceIdRatioBasedSampler", "_ratio", "context", "traceId", "SamplingDecision", "ratio", "accumulation", "i", "pos", "part", "env", "FALLBACK_OTEL_TRACES_SAMPLER", "DEFAULT_RATIO", "loadDefaultConfig", "buildSamplerFromEnv", "environment", "AlwaysOnSampler", "AlwaysOffSampler", "ParentBasedSampler", "TraceIdRatioBasedSampler", "getSamplerProbabilityFromEnv", "probability", "import_core", "mergeConfig", "userConfig", "perInstanceDefaults", "buildSamplerFromEnv", "DEFAULT_CONFIG", "loadDefaultConfig", "target", "reconfigureLimits", "spanLimits", "parsedEnvConfig", "_f", "_e", "_d", "_b", "_a", "_c", "_m", "_l", "_k", "_h", "_g", "_j", "init_api", "import_core", "BatchSpanProcessorBase", "_exporter", "config", "env", "_span", "_parentContext", "span", "_this", "resolve", "reject", "promises", "count", "i", "j", "timer", "spans", "doExport", "result", "_a", "pendingResources", "resource", "err", "flush", "e", "BatchSpanProcessor", "_super", "__extends", "_exporter", "config", "_this", "BatchSpanProcessorBase", "SPAN_ID_BYTES", "TRACE_ID_BYTES", "RandomIdGenerator", "getIdGenerator", "SHARED_CHAR_CODES_ARRAY", "getIdGenerator", "bytes", "i", "Tracer", "instrumentationLibrary", "config", "_tracerProvider", "localConfig", "mergeConfig", "RandomIdGenerator", "name", "options", "context", "parentSpan", "nonRecordingSpan", "parentSpanContext", "spanId", "traceId", "traceState", "parentSpanId", "spanKind", "_a", "links", "_b", "link", "attributes", "samplingResult", "_c", "traceFlags", "spanContext", "initAttributes", "span", "Span", "arg2", "arg3", "arg4", "opts", "ctx", "fn", "parentContext", "contextWithSpanSet", "init_api", "import_core", "init_api", "import_semantic_conventions", "import_core", "defaultServiceName", "Resource", "attributes", "asyncAttributesPromise", "_this", "_a", "asyncAttributes", "err", "defaultServiceName", "other", "mergedSyncAttributes", "__assign", "mergedAttributesPromise", "_c", "__read", "thisAsyncAttributes", "otherAsyncAttributes", "_b", "init_api", "import_core", "import_semantic_conventions", "EnvDetectorSync", "_config", "attributes", "env", "rawAttributes", "serviceName", "parsedAttributes", "e", "Resource", "rawEnvAttributes", "rawAttributes_1", "__values", "rawAttributes_1_1", "rawAttribute", "keyValuePair", "_b", "__read", "key", "value", "name", "str", "i", "ch", "envDetectorSync", "init_api", "isPromiseLike", "val", "detectResourcesSync", "config", "resources", "_a", "d", "resourceOrPromise_1", "resource_1", "isPromiseLike", "createPromise", "__awaiter", "resolvedResource", "Resource", "e", "mergedResources", "acc", "resource", "logResources", "resourceDebugString", "import_core", "MultiSpanProcessor", "_spanProcessors", "promises", "_b", "__values", "_c", "spanProcessor", "resolve", "error", "span", "context", "reject", "NoopSpanProcessor", "_span", "_context", "ForceFlushState", "BasicTracerProvider", "config", "mergedConfig", "loadDefaultConfig", "reconfigureLimits", "_a", "Resource", "defaultExporter", "batchProcessor", "BatchSpanProcessor", "NoopSpanProcessor", "name", "version", "options", "key", "Tracer", "spanProcessor", "err", "MultiSpanProcessor", "timeout", "promises", "resolve", "state", "timeoutInterval", "error", "reject", "results", "errors", "result", "_this", "uniquePropagatorNames", "propagators", "propagator", "validPropagators", "list", "item", "exporterName", "exporter", "init_api", "api_logs_exports", "__reExport", "api_logs_star", "import_autoLoader", "init_api", "import_core", "init_api", "init_api", "import_core", "LogRecord", "_sharedState", "instrumentationScope", "logRecord", "timestamp", "observedTimestamp", "severityNumber", "severityText", "body", "_a", "attributes", "context", "now", "spanContext", "key", "value", "_b", "__values", "_c", "_d", "__read", "k", "v", "_this", "limit", "val", "Logger", "instrumentationScope", "_sharedState", "logRecord", "currentContext", "logRecordInstance", "LogRecord", "__assign", "import_core", "loadDefaultConfig", "reconfigureLimits", "logRecordLimits", "parsedEnvConfig", "_c", "_b", "_a", "_f", "_e", "_d", "import_core", "MultiLogRecordProcessor", "processors", "forceFlushTimeoutMillis", "timeout", "processor", "_a", "logRecord", "context", "NoopLogRecordProcessor", "_logRecord", "_context", "LoggerProviderSharedState", "resource", "forceFlushTimeoutMillis", "logRecordLimits", "NoopLogRecordProcessor", "DEFAULT_LOGGER_NAME", "LoggerProvider", "config", "_a", "loadDefaultConfig", "_b", "resource", "Resource", "logRecordLimits", "forceFlushTimeoutMillis", "LoggerProviderSharedState", "reconfigureLimits", "name", "version", "options", "loggerName", "key", "Logger", "processor", "err", "MultiLogRecordProcessor", "AggregationTemporality", "isNotNullish", "item", "hashAttributes", "attributes", "keys", "key", "instrumentationScopeId", "instrumentationScope", "_a", "_b", "TimeoutError", "_super", "__extends", "message", "_this", "callWithTimeout", "promise", "timeout", "timeoutHandle", "timeoutPromise", "_resolve", "reject", "TimeoutError", "result", "reason", "PromiseAllSettled", "promises", "p", "__awaiter", "_this", "ret", "_a", "e_1", "isPromiseAllSettledRejectionResult", "it", "setEquals", "lhs", "rhs", "lhs_1", "__values", "lhs_1_1", "item", "equalsCaseInsensitive", "lhs", "rhs", "init_api", "InstrumentType", "createInstrumentDescriptor", "name", "type", "options", "isValidName", "_a", "_b", "_c", "_d", "createInstrumentDescriptorWithView", "view", "instrument", "isDescriptorCompatibleWith", "descriptor", "otherDescriptor", "equalsCaseInsensitive", "NAME_REGEXP", "init_api", "ViewRegistry", "view", "instrument", "meter", "_this", "views", "registeredView", "selector", "init_api", "import_core", "SyncInstrument", "_writableMetricStorage", "_descriptor", "value", "attributes", "context", "contextApi", "UpDownCounterInstrument", "_super", "__extends", "value", "attributes", "ctx", "SyncInstrument", "CounterInstrument", "_super", "__extends", "value", "attributes", "ctx", "SyncInstrument", "HistogramInstrument", "_super", "__extends", "value", "attributes", "ctx", "SyncInstrument", "ObservableInstrument", "descriptor", "metricStorages", "_observableRegistry", "callback", "ObservableCounterInstrument", "_super", "__extends", "ObservableInstrument", "ObservableGaugeInstrument", "_super", "__extends", "ObservableInstrument", "ObservableUpDownCounterInstrument", "_super", "__extends", "ObservableInstrument", "isObservableInstrument", "it", "ObservableInstrument", "Meter", "_meterSharedState", "name", "options", "descriptor", "createInstrumentDescriptor", "InstrumentType", "storage", "HistogramInstrument", "CounterInstrument", "UpDownCounterInstrument", "storages", "ObservableGaugeInstrument", "ObservableCounterInstrument", "ObservableUpDownCounterInstrument", "callback", "observables", "MetricStorage", "_instrumentDescriptor", "description", "createInstrumentDescriptor", "HashMap", "_hash", "key", "hashCode", "defaultFactory", "hash", "val", "value", "keyIterator", "next", "_a", "valueIterator", "AttributeHashMap", "_super", "__extends", "hashAttributes", "HashMap", "DeltaMetricProcessor", "_aggregator", "AttributeHashMap", "value", "attributes", "_context", "collectionTime", "_this", "accumulation", "measurements", "_a", "_b", "__read", "hashCode", "delta", "previous", "active", "unreportedDelta", "TemporalMetricProcessor", "_aggregator", "collectorHandles", "_this", "handle", "collector", "instrumentDescriptor", "currentAccumulations", "collectionTime", "unreportedAccumulations", "result", "aggregationTemporality", "last", "lastCollectionTime", "AggregationTemporality", "accumulationRecords", "AttributesMapToAccumulationRecords", "currentAccumulation", "registeredCollectors", "registeredCollectors_1", "__values", "registeredCollectors_1_1", "stash", "AttributeHashMap", "unreportedList", "unreportedList_1", "unreportedList_1_1", "it_1", "current", "aggregator", "iterator", "next", "_a", "__read", "key", "record", "hash", "lastAccumulation", "accumulation", "_b", "_c", "_d", "AttributesMapToAccumulationRecords", "map", "AsyncMetricStorage", "_super", "__extends", "_instrumentDescriptor", "aggregator", "_attributesProcessor", "collectorHandles", "_this", "DeltaMetricProcessor", "TemporalMetricProcessor", "measurements", "observationTime", "processed", "AttributeHashMap", "_a", "_b", "__read", "attributes", "value", "collector", "collectionTime", "accumulations", "MetricStorage", "init_api", "getIncompatibilityDetails", "existing", "otherDescriptor", "incompatibility", "getValueTypeConflictResolutionRecipe", "getUnitConflictResolutionRecipe", "getTypeConflictResolutionRecipe", "selector", "selectorString", "getDescriptionResolutionRecipe", "getConflictResolutionRecipe", "MetricStorageRegistry", "collector", "storages", "_c", "__values", "_d", "metricStorages", "perCollectorStorages", "_e", "_f", "storage", "storageMap", "expectedDescriptor", "descriptor", "existingStorages", "compatibleStorage", "existingStorages_1", "existingStorages_1_1", "existingStorage", "existingDescriptor", "isDescriptorCompatibleWith", "getIncompatibilityDetails", "getConflictResolutionRecipe", "MultiMetricStorage", "_backingStorages", "value", "attributes", "context", "recordTime", "it", "init_api", "init_api", "ObservableResultImpl", "_instrumentName", "_valueType", "AttributeHashMap", "value", "attributes", "BatchObservableResultImpl", "metric", "value", "attributes", "isObservableInstrument", "map", "AttributeHashMap", "ObservableRegistry", "callback", "instrument", "idx", "instruments", "observableInstruments", "isObservableInstrument", "collectionTime", "timeoutMillis", "callbackFutures", "batchCallbackFutures", "PromiseAllSettled", "__spreadArray", "__read", "results", "_a", "rejections", "isPromiseAllSettledRejectionResult", "it", "observationTime", "_this", "observableResult", "ObservableResultImpl", "callPromise", "callWithTimeout", "_b", "metricStorage", "BatchObservableResultImpl", "buffer", "record", "setEquals", "SyncMetricStorage", "_super", "__extends", "instrumentDescriptor", "aggregator", "_attributesProcessor", "collectorHandles", "_this", "DeltaMetricProcessor", "TemporalMetricProcessor", "value", "attributes", "context", "recordTime", "collector", "collectionTime", "accumulations", "MetricStorage", "AttributesProcessor", "NOOP", "NoopAttributesProcessor", "_super", "__extends", "incoming", "_context", "AttributesProcessor", "FilteringAttributesProcessor", "_super", "__extends", "_allowedAttributeNames", "_this", "incoming", "_context", "filteredAttributes", "attributeName", "AttributesProcessor", "NOOP", "NoopAttributesProcessor", "MeterSharedState", "_meterProviderSharedState", "_instrumentationScope", "MetricStorageRegistry", "ObservableRegistry", "Meter", "descriptor", "storages", "SyncMetricStorage", "MultiMetricStorage", "AsyncMetricStorage", "collector", "collectionTime", "options", "errors", "_a", "metricDataList", "metricStorage", "isNotNullish", "MetricStorageType", "_this", "views", "view", "viewDescriptor", "createInstrumentDescriptorWithView", "compatibleStorage", "aggregator", "viewStorage", "perCollectorAggregations", "collectorStorages", "_b", "__read", "aggregation", "storage", "AttributesProcessor", "MeterProviderSharedState", "resource", "ViewRegistry", "instrumentationScope", "id", "instrumentationScopeId", "meterSharedState", "MeterSharedState", "instrumentType", "result", "_b", "__values", "_c", "collector", "import_core", "MetricCollector", "_sharedState", "_metricReader", "options", "collectionTime", "scopeMetrics", "errors", "meterCollectionPromises", "meterSharedState", "__awaiter", "_this", "current", "_a", "__spreadArray", "__read", "instrumentType", "MeterProvider", "options", "resource", "Resource", "_b", "MeterProviderSharedState", "_c", "__values", "_d", "view", "name", "version", "metricReader", "collector", "MetricCollector", "_a", "import_semantic_conventions", "import_environment", "import_AsyncLocalStorageContextManager", "import_core", "init_api", "symbol", "getVercelRequestContext", "import_semantic_conventions", "omitUndefinedAttributes", "obj", "_", "value", "parseRequestId", "header", "getVercelRequestContextAttributes", "context", "getVercelRequestContext", "attributesFromHeaders", "rootAttrs", "resolveAttributesFromHeaders", "omitUndefinedAttributes", "parseRequestId", "getter", "_carrier", "carrier", "key", "headers", "attrs", "attrName", "headerName", "headerValue", "init_api", "isSampled", "traceFlags", "CompositeSpanProcessor", "processors", "attributesFromHeaders", "p", "e", "span", "parentContext", "traceId", "spanId", "traceFlags", "isRoot", "isSampled", "vrc", "getVercelRequestContext", "vercelRequestContextAttrs", "getVercelRequestContextAttributes", "promise", "resolve", "timer", "spanProcessor", "sampled", "rootObj", "resourceAttributes", "getResourceAttributes", "openSpan", "i", "pending", "SPAN_KIND_NAME", "kind", "attributes", "operationName", "resourceName", "spanTypeAttr", "nextSpanType", "httpMethod", "httpRoute", "resourceNameResolved", "libraryName", "spanType", "nextOperationName", "toOperationName", "name", "cleanLibraryName", "import_trace", "import_OTLPExporterBase", "init_api", "OTLPExporterEdgeBase", "config", "items", "onSuccess", "onError", "serviceRequest", "body", "contentType", "headers", "e", "promise", "res", "err", "index", "_config", "DEFAULT_COLLECTOR_RESOURCE_PATH", "DEFAULT_COLLECTOR_URL", "getDefaultUrl", "config", "OTLPHttpJsonTraceExporter", "config", "Impl", "spans", "resultCallback", "OTLPExporterEdgeBase", "serviceRequest", "getDefaultUrl", "import_trace", "import_minimal", "encodeTraceServiceRequest", "message", "writer", "ExportTraceServiceRequest_encode", "i", "ResourceSpans_encode", "Resource_encode", "ScopeSpans_encode", "KeyValue_encode", "InstrumentationScope_encode", "Span_encode", "AnyValue_encode", "ArrayValue_encode", "KeyValueList_encode", "Event_encode", "Link_encode", "Status_encode", "OTLPHttpProtoTraceExporter", "config", "Impl", "spans", "resultCallback", "OTLPExporterEdgeBase", "serviceRequest", "encodeTraceServiceRequest", "getDefaultUrl", "init_api", "import_semantic_conventions", "resolveTemplate", "template", "attrs", "match", "key", "value", "FetchInstrumentation", "config", "tracerProvider", "tracer", "ignoreUrls", "shouldIgnore", "url", "init", "urlString", "match", "host", "branchHost", "propagateContextUrls", "dontPropagateContextUrls", "resourceNameTemplate", "attributesFromRequestHeaders", "attributesFromResponseHeaders", "shouldPropagate", "getVercelRequestContext", "originalFetch", "doFetch", "input", "initArg", "req", "attrs", "resourceName", "resolveTemplate", "removeSearch", "spanName", "parentContext", "span", "isSampled", "fetchContext", "traceApi", "HEADERS_SETTER", "headersToAttributes", "startTime", "res", "duration", "onError", "pipeResponse", "byteLength", "err", "e", "carrier", "key", "value", "index", "length", "reader", "read", "done", "message", "attrsToHeadersMap", "headers", "attrName", "headerName", "headerValue", "init_api", "import_core", "VERSION", "TRACE_PARENT_HEADER", "TRACE_STATE_HEADER", "W3CTraceContextPropagator", "context", "carrier", "setter", "spanContext", "traceApi", "traceParent", "getter", "traceParentHeader", "parseTraceParent", "traceStateHeader", "state", "version", "traceId", "spanId", "traceFlags", "other", "init_api", "VercelRuntimePropagator", "context", "vrc", "getVercelRequestContext", "rootSpanContext", "tracing", "init_api", "import_core", "import_core", "NANOSECONDS", "hrTimeToNanos", "hrTime", "toLongBits", "value", "low", "high", "encodeAsLongBits", "nanos", "encodeAsString", "encodeTimestamp", "identity", "optionalHexToBase64", "str", "DEFAULT_ENCODER", "getOtlpEncoder", "options", "useLongBits", "_a", "useHex", "_b", "toAttributes", "attributes", "key", "toKeyValue", "value", "toAnyValue", "t", "_a", "_b", "__read", "k", "v", "sdkSpanToOtlpSpan", "span", "encoder", "ctx", "status", "_a", "toAttributes", "event", "toOtlpSpanEvent", "link", "toOtlpLink", "timedEvent", "createExportTraceServiceRequest", "spans", "options", "encoder", "getOtlpEncoder", "spanRecordsToResourceSpans", "createResourceMap", "readableSpans", "resourceMap", "readableSpans_1", "__values", "readableSpans_1_1", "record", "ilmMap", "instrumentationLibraryKey", "records", "out", "entryIterator", "entry", "_a", "__read", "resource", "scopeResourceSpans", "ilmIterator", "ilmEntry", "scopeSpans", "_b", "name_1", "version", "schemaUrl", "readableSpan", "sdkSpanToOtlpSpan", "transformedSpans", "toAttributes", "VercelRuntimeSpanExporter", "spans", "resultCallback", "context", "getVercelRequestContext", "data", "createExportTraceServiceRequest", "e", "logLevelMap", "Sdk", "configuration", "env", "getEnv", "runtime", "disabled", "idGenerator", "RandomIdGenerator", "contextManager", "serviceName", "resource", "Resource", "omitUndefinedAttributes", "resourceDetectors", "envDetectorSync", "internalConfig", "detectResourcesSync", "propagators", "parsePropagators", "traceSampler", "parseSampler", "spanProcessors", "parseSpanProcessor", "spanLimits", "tracerProvider", "BasicTracerProvider", "CompositeSpanProcessor", "loggerProvider", "LoggerProvider", "meterProvider", "MeterProvider", "instrumentations", "parseInstrumentations", "promises", "disableInstrumentations", "processEnv", "arg", "instrumentationConfig", "instrumentationOrName", "FetchInstrumentation", "envPropagators", "propagatorOrName", "autoList", "W3CTraceContextPropagator", "VercelRuntimePropagator", "i", "FALLBACK_OTEL_TRACES_SAMPLER", "DEFAULT_RATIO", "name", "AlwaysOnSampler", "AlwaysOffSampler", "ParentBasedSampler", "TraceIdRatioBasedSampler", "getSamplerProbabilityFromEnv", "probability", "spanProcessorOrName", "processors", "BatchSpanProcessor", "VercelRuntimeSpanExporter", "port", "protocol", "config", "exporter", "OTLPHttpProtoTraceExporter", "OTLPHttpJsonTraceExporter", "parseTraceExporter", "isNotNull", "url", "buildExporterUrlFromEnv", "headers", "DEFAULT_COLLECTOR_RESOURCE_PATH", "DEFAULT_COLLECTOR_URL", "defaultUrlFromEnv", "defaultUrlFromEnvAll", "x", "registerOTel", "optionsOrServiceName", "options", "Sdk"]
|
|
7
7
|
}
|