From cf8edbed43c3e54eadcafe6fc6f39a1d03c89aa7 Mon Sep 17 00:00:00 2001 From: Robb Kidd Date: Fri, 9 Aug 2024 06:42:38 -0400 Subject: [PATCH] refactor: remove "export *" in favor of explicit named exports (#4880) Co-authored-by: Jamie Danielson Co-authored-by: Trent Mick Co-authored-by: Marc Pichler --- CHANGELOG.md | 13 ++ api/CHANGELOG.md | 2 + api/src/platform/browser/index.ts | 2 +- api/src/platform/index.ts | 2 +- api/src/platform/node/index.ts | 2 +- eslint.base.js | 1 + experimental/CHANGELOG.md | 10 ++ experimental/packages/api-events/src/index.ts | 8 +- .../api-events/src/platform/browser/index.ts | 2 +- .../packages/api-events/src/platform/index.ts | 2 +- .../api-events/src/platform/node/index.ts | 2 +- experimental/packages/api-logs/src/index.ts | 19 ++- .../api-logs/src/platform/browser/index.ts | 2 +- .../packages/api-logs/src/platform/index.ts | 2 +- .../api-logs/src/platform/node/index.ts | 2 +- .../exporter-logs-otlp-grpc/src/index.ts | 3 + .../exporter-trace-otlp-grpc/src/index.ts | 3 + .../exporter-trace-otlp-http/src/index.ts | 3 + .../src/platform/browser/index.ts | 3 + .../src/platform/index.ts | 3 + .../src/platform/node/index.ts | 3 + .../src/index.ts | 2 +- .../src/index.ts | 3 + .../src/index.ts | 3 + .../src/platform/browser/index.ts | 3 + .../src/platform/index.ts | 3 + .../src/platform/node/index.ts | 3 + .../src/index.ts | 3 + .../src/index.ts | 6 +- .../src/index.ts | 6 +- .../src/index.ts | 49 ++++++- .../src/index.ts | 6 +- .../src/index.ts | 17 ++- .../opentelemetry-sdk-node/src/index.ts | 7 +- .../packages/otlp-exporter-base/src/index.ts | 4 + integration-tests/api/package.json | 1 + .../api/test/core-entries.test.js | 38 +++++ package-lock.json | 2 + .../opentelemetry-context-zone/src/index.ts | 6 +- packages/opentelemetry-core/src/index.ts | 131 ++++++++++++++---- .../src/platform/browser/index.ts | 12 +- .../opentelemetry-core/src/platform/index.ts | 11 +- .../src/platform/node/index.ts | 12 +- .../src/index.ts | 2 +- .../src/index.ts | 4 +- .../src/platform/browser/index.ts | 2 +- .../src/platform/index.ts | 2 +- .../src/platform/node/index.ts | 2 +- .../opentelemetry-propagator-b3/src/index.ts | 13 +- .../src/index.ts | 6 +- .../opentelemetry-sdk-trace-base/src/index.ts | 50 ++++--- .../src/platform/browser/index.ts | 4 +- .../src/platform/index.ts | 2 +- .../src/platform/node/index.ts | 4 +- .../opentelemetry-sdk-trace-node/src/index.ts | 35 ++++- .../opentelemetry-sdk-trace-web/src/index.ts | 59 +++++++- .../src/index.ts | 5 + .../src/resource/index.ts | 5 + .../src/trace/index.ts | 5 + packages/propagator-aws-xray/src/index.ts | 5 +- packages/sdk-metrics/src/aggregator/index.ts | 13 +- packages/sdk-metrics/src/exemplar/index.ts | 19 +-- 62 files changed, 521 insertions(+), 133 deletions(-) create mode 100644 integration-tests/api/test/core-entries.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 2176ff6d56..33d99411d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,19 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/ ### :house: (Internal) * refactor: Simplify the code for the `getEnv` function [#4799](https://github.com/open-telemetry/opentelemetry-js/pull/4799) @danstarns +* refactor: remove "export *" in favor of explicit named exports [#4880](https://github.com/open-telemetry/opentelemetry-js/pull/4880) @robbkidd + * Packages updated: + * opentelemetry-context-zone + * opentelemetry-core + * opentelemetry-exporter-jaeger + * opentelemetry-exporter-zipkin + * opentelemetry-propagator-b3 + * opentelemetry-propagator-jaeger + * opentelemetry-sdk-trace-base + * opentelemetry-sdk-trace-node + * opentelemetry-sdk-trace-web + * propagator-aws-xray + * sdk-metrics ## 1.25.1 diff --git a/api/CHANGELOG.md b/api/CHANGELOG.md index 860f839c37..758829935e 100644 --- a/api/CHANGELOG.md +++ b/api/CHANGELOG.md @@ -15,6 +15,8 @@ All notable changes to this project will be documented in this file. ### :house: (Internal) +* refactor(api): remove "export *" in favor of explicit named exports [#4880](https://github.com/open-telemetry/opentelemetry-js/pull/4880) @robbkidd + ## 1.9.0 ### :rocket: (Enhancement) diff --git a/api/src/platform/browser/index.ts b/api/src/platform/browser/index.ts index e9d6ebed71..e4d18640b4 100644 --- a/api/src/platform/browser/index.ts +++ b/api/src/platform/browser/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export * from './globalThis'; +export { _globalThis } from './globalThis'; diff --git a/api/src/platform/index.ts b/api/src/platform/index.ts index cdaf8858ce..a6deb70b17 100644 --- a/api/src/platform/index.ts +++ b/api/src/platform/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export * from './node'; +export { _globalThis } from './node'; diff --git a/api/src/platform/node/index.ts b/api/src/platform/node/index.ts index e9d6ebed71..e4d18640b4 100644 --- a/api/src/platform/node/index.ts +++ b/api/src/platform/node/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export * from './globalThis'; +export { _globalThis } from './globalThis'; diff --git a/eslint.base.js b/eslint.base.js index b17bebcd31..09ab67d949 100644 --- a/eslint.base.js +++ b/eslint.base.js @@ -55,6 +55,7 @@ module.exports = { } }], "@typescript-eslint/no-shadow": ["warn"], + "no-restricted-syntax": ["error", "ExportAllDeclaration"], "prefer-rest-params": "off", } }, diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index 24ebe265b8..7162afeb5d 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -31,6 +31,16 @@ All notable changes to experimental packages in this project will be documented ### :house: (Internal) * refactor: Simplify the code for the `getEnv` function [#4799](https://github.com/open-telemetry/opentelemetry-js/pull/4799) @danstarns +* refactor: remove "export *" in favor of explicit named exports [#4880](https://github.com/open-telemetry/opentelemetry-js/pull/4880) @robbkidd + * Packages updated: + * api-events + * api-logs + * opentelemetry-browser-detector + * opentelemetry-exporter-prometheus + * opentelemetry-instrumentation-fetch + * opentelemetry-instrumentation-http + * opentelemetry-instrumentation-xml-http-request + * opentelemetry-instrumentation ## 0.52.1 diff --git a/experimental/packages/api-events/src/index.ts b/experimental/packages/api-events/src/index.ts index dbd464027e..f3d655e35c 100644 --- a/experimental/packages/api-events/src/index.ts +++ b/experimental/packages/api-events/src/index.ts @@ -14,10 +14,10 @@ * limitations under the License. */ -export * from './types/EventLogger'; -export * from './types/EventLoggerProvider'; -export * from './types/Event'; -export * from './types/EventLoggerOptions'; +export { EventLogger } from './types/EventLogger'; +export { EventLoggerProvider } from './types/EventLoggerProvider'; +export { Event } from './types/Event'; +export { EventLoggerOptions } from './types/EventLoggerOptions'; import { EventsAPI } from './api/events'; export const events = EventsAPI.getInstance(); diff --git a/experimental/packages/api-events/src/platform/browser/index.ts b/experimental/packages/api-events/src/platform/browser/index.ts index e9d6ebed71..e4d18640b4 100644 --- a/experimental/packages/api-events/src/platform/browser/index.ts +++ b/experimental/packages/api-events/src/platform/browser/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export * from './globalThis'; +export { _globalThis } from './globalThis'; diff --git a/experimental/packages/api-events/src/platform/index.ts b/experimental/packages/api-events/src/platform/index.ts index cdaf8858ce..a6deb70b17 100644 --- a/experimental/packages/api-events/src/platform/index.ts +++ b/experimental/packages/api-events/src/platform/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export * from './node'; +export { _globalThis } from './node'; diff --git a/experimental/packages/api-events/src/platform/node/index.ts b/experimental/packages/api-events/src/platform/node/index.ts index e9d6ebed71..e4d18640b4 100644 --- a/experimental/packages/api-events/src/platform/node/index.ts +++ b/experimental/packages/api-events/src/platform/node/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export * from './globalThis'; +export { _globalThis } from './globalThis'; diff --git a/experimental/packages/api-logs/src/index.ts b/experimental/packages/api-logs/src/index.ts index 3ea2ae39c8..55f31b770a 100644 --- a/experimental/packages/api-logs/src/index.ts +++ b/experimental/packages/api-logs/src/index.ts @@ -14,13 +14,18 @@ * limitations under the License. */ -export * from './types/Logger'; -export * from './types/LoggerProvider'; -export * from './types/LogRecord'; -export * from './types/LoggerOptions'; -export * from './types/AnyValue'; -export * from './NoopLogger'; -export * from './NoopLoggerProvider'; +export { Logger } from './types/Logger'; +export { LoggerProvider } from './types/LoggerProvider'; +export { + LogAttributes, + LogBody, + LogRecord, + SeverityNumber, +} from './types/LogRecord'; +export { LoggerOptions } from './types/LoggerOptions'; +export { AnyValue, AnyValueMap } from './types/AnyValue'; +export { NOOP_LOGGER, NoopLogger } from './NoopLogger'; +export { NOOP_LOGGER_PROVIDER, NoopLoggerProvider } from './NoopLoggerProvider'; import { LogsAPI } from './api/logs'; export const logs = LogsAPI.getInstance(); diff --git a/experimental/packages/api-logs/src/platform/browser/index.ts b/experimental/packages/api-logs/src/platform/browser/index.ts index e9d6ebed71..e4d18640b4 100644 --- a/experimental/packages/api-logs/src/platform/browser/index.ts +++ b/experimental/packages/api-logs/src/platform/browser/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export * from './globalThis'; +export { _globalThis } from './globalThis'; diff --git a/experimental/packages/api-logs/src/platform/index.ts b/experimental/packages/api-logs/src/platform/index.ts index cdaf8858ce..a6deb70b17 100644 --- a/experimental/packages/api-logs/src/platform/index.ts +++ b/experimental/packages/api-logs/src/platform/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export * from './node'; +export { _globalThis } from './node'; diff --git a/experimental/packages/api-logs/src/platform/node/index.ts b/experimental/packages/api-logs/src/platform/node/index.ts index e9d6ebed71..e4d18640b4 100644 --- a/experimental/packages/api-logs/src/platform/node/index.ts +++ b/experimental/packages/api-logs/src/platform/node/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export * from './globalThis'; +export { _globalThis } from './globalThis'; diff --git a/experimental/packages/exporter-logs-otlp-grpc/src/index.ts b/experimental/packages/exporter-logs-otlp-grpc/src/index.ts index b071c78ef5..2edd35dc61 100644 --- a/experimental/packages/exporter-logs-otlp-grpc/src/index.ts +++ b/experimental/packages/exporter-logs-otlp-grpc/src/index.ts @@ -14,4 +14,7 @@ * limitations under the License. */ +/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] -- + * TODO: Replace export * with named exports before next major version + */ export * from './OTLPLogExporter'; diff --git a/experimental/packages/exporter-trace-otlp-grpc/src/index.ts b/experimental/packages/exporter-trace-otlp-grpc/src/index.ts index 761e8a9262..5a3361b4cf 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/src/index.ts +++ b/experimental/packages/exporter-trace-otlp-grpc/src/index.ts @@ -14,4 +14,7 @@ * limitations under the License. */ +/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] -- + * TODO: Replace export * with named exports before next major version + */ export * from './OTLPTraceExporter'; diff --git a/experimental/packages/exporter-trace-otlp-http/src/index.ts b/experimental/packages/exporter-trace-otlp-http/src/index.ts index 52ec5f71f5..44d69b8bb6 100644 --- a/experimental/packages/exporter-trace-otlp-http/src/index.ts +++ b/experimental/packages/exporter-trace-otlp-http/src/index.ts @@ -14,4 +14,7 @@ * limitations under the License. */ +/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] -- + * TODO: Replace export * with named exports before next major version + */ export * from './platform'; diff --git a/experimental/packages/exporter-trace-otlp-http/src/platform/browser/index.ts b/experimental/packages/exporter-trace-otlp-http/src/platform/browser/index.ts index 761e8a9262..5a3361b4cf 100644 --- a/experimental/packages/exporter-trace-otlp-http/src/platform/browser/index.ts +++ b/experimental/packages/exporter-trace-otlp-http/src/platform/browser/index.ts @@ -14,4 +14,7 @@ * limitations under the License. */ +/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] -- + * TODO: Replace export * with named exports before next major version + */ export * from './OTLPTraceExporter'; diff --git a/experimental/packages/exporter-trace-otlp-http/src/platform/index.ts b/experimental/packages/exporter-trace-otlp-http/src/platform/index.ts index cdaf8858ce..65e269f677 100644 --- a/experimental/packages/exporter-trace-otlp-http/src/platform/index.ts +++ b/experimental/packages/exporter-trace-otlp-http/src/platform/index.ts @@ -14,4 +14,7 @@ * limitations under the License. */ +/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] -- + * TODO: Replace export * with named exports before next major version + */ export * from './node'; diff --git a/experimental/packages/exporter-trace-otlp-http/src/platform/node/index.ts b/experimental/packages/exporter-trace-otlp-http/src/platform/node/index.ts index 761e8a9262..5a3361b4cf 100644 --- a/experimental/packages/exporter-trace-otlp-http/src/platform/node/index.ts +++ b/experimental/packages/exporter-trace-otlp-http/src/platform/node/index.ts @@ -14,4 +14,7 @@ * limitations under the License. */ +/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] -- + * TODO: Replace export * with named exports before next major version + */ export * from './OTLPTraceExporter'; diff --git a/experimental/packages/opentelemetry-browser-detector/src/index.ts b/experimental/packages/opentelemetry-browser-detector/src/index.ts index 7209990763..682624453d 100644 --- a/experimental/packages/opentelemetry-browser-detector/src/index.ts +++ b/experimental/packages/opentelemetry-browser-detector/src/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export * from './BrowserDetector'; +export { browserDetector } from './BrowserDetector'; diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/index.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/index.ts index 7b73804ce4..231f75b593 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/index.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/index.ts @@ -14,4 +14,7 @@ * limitations under the License. */ +/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] -- + * TODO: Replace export * with named exports before next major version + */ export * from './OTLPMetricExporter'; diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/index.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/index.ts index ee1b1574a6..44b5a3e1b2 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/index.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/index.ts @@ -14,6 +14,9 @@ * limitations under the License. */ +/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] -- + * TODO: Replace export * with named exports before next major version + */ export * from './platform'; export * from './OTLPMetricExporterOptions'; export * from './OTLPMetricExporterBase'; diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/browser/index.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/browser/index.ts index 7b73804ce4..231f75b593 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/browser/index.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/browser/index.ts @@ -14,4 +14,7 @@ * limitations under the License. */ +/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] -- + * TODO: Replace export * with named exports before next major version + */ export * from './OTLPMetricExporter'; diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/index.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/index.ts index cdaf8858ce..65e269f677 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/index.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/index.ts @@ -14,4 +14,7 @@ * limitations under the License. */ +/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] -- + * TODO: Replace export * with named exports before next major version + */ export * from './node'; diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/index.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/index.ts index 7b73804ce4..231f75b593 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/index.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/index.ts @@ -14,4 +14,7 @@ * limitations under the License. */ +/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] -- + * TODO: Replace export * with named exports before next major version + */ export * from './OTLPMetricExporter'; diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/src/index.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/src/index.ts index 7b73804ce4..231f75b593 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/src/index.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/src/index.ts @@ -14,4 +14,7 @@ * limitations under the License. */ +/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] -- + * TODO: Replace export * with named exports before next major version + */ export * from './OTLPMetricExporter'; diff --git a/experimental/packages/opentelemetry-exporter-prometheus/src/index.ts b/experimental/packages/opentelemetry-exporter-prometheus/src/index.ts index 20041cda13..08ba36f954 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/src/index.ts +++ b/experimental/packages/opentelemetry-exporter-prometheus/src/index.ts @@ -14,6 +14,6 @@ * limitations under the License. */ -export * from './PrometheusExporter'; -export * from './PrometheusSerializer'; -export * from './export/types'; +export { PrometheusExporter } from './PrometheusExporter'; +export { PrometheusSerializer } from './PrometheusSerializer'; +export { ExporterConfig } from './export/types'; diff --git a/experimental/packages/opentelemetry-instrumentation-fetch/src/index.ts b/experimental/packages/opentelemetry-instrumentation-fetch/src/index.ts index 1d39792560..85bd597973 100644 --- a/experimental/packages/opentelemetry-instrumentation-fetch/src/index.ts +++ b/experimental/packages/opentelemetry-instrumentation-fetch/src/index.ts @@ -14,4 +14,8 @@ * limitations under the License. */ -export * from './fetch'; +export { + FetchCustomAttributeFunction, + FetchInstrumentation, + FetchInstrumentationConfig, +} from './fetch'; diff --git a/experimental/packages/opentelemetry-instrumentation-http/src/index.ts b/experimental/packages/opentelemetry-instrumentation-http/src/index.ts index 265bc235a7..62d2d69910 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/src/index.ts +++ b/experimental/packages/opentelemetry-instrumentation-http/src/index.ts @@ -14,6 +14,49 @@ * limitations under the License. */ -export * from './http'; -export * from './types'; -export * from './utils'; +export { HttpInstrumentation } from './http'; +export { + Err, + Func, + GetFunction, + Http, + HttpCallback, + HttpCallbackOptional, + HttpCustomAttributeFunction, + HttpInstrumentationConfig, + HttpRequestArgs, + HttpRequestCustomAttributeFunction, + HttpResponseCustomAttributeFunction, + Https, + IgnoreIncomingRequestFunction, + IgnoreMatcher, + IgnoreOutgoingRequestFunction, + ParsedRequestOptions, + RequestFunction, + RequestSignature, + StartIncomingSpanCustomAttributeFunction, + StartOutgoingSpanCustomAttributeFunction, +} from './types'; +export { + extractHostnameAndPort, + getAbsoluteUrl, + getIncomingRequestAttributes, + getIncomingRequestAttributesOnResponse, + getIncomingRequestMetricAttributes, + getIncomingRequestMetricAttributesOnResponse, + getOutgoingRequestAttributes, + getOutgoingRequestAttributesOnResponse, + getOutgoingRequestMetricAttributes, + getOutgoingRequestMetricAttributesOnResponse, + getRequestInfo, + headerCapture, + isCompressed, + isIgnored, + isValidOptionsType, + parseResponseStatus, + satisfiesPattern, + setAttributesFromHttpKind, + setRequestContentLengthAttribute, + setResponseContentLengthAttribute, + setSpanWithError, +} from './utils'; diff --git a/experimental/packages/opentelemetry-instrumentation-xml-http-request/src/index.ts b/experimental/packages/opentelemetry-instrumentation-xml-http-request/src/index.ts index 80ed3961b0..d90bc0022a 100644 --- a/experimental/packages/opentelemetry-instrumentation-xml-http-request/src/index.ts +++ b/experimental/packages/opentelemetry-instrumentation-xml-http-request/src/index.ts @@ -14,4 +14,8 @@ * limitations under the License. */ -export * from './xhr'; +export { + XHRCustomAttributeFunction, + XMLHttpRequestInstrumentation, + XMLHttpRequestInstrumentationConfig, +} from './xhr'; diff --git a/experimental/packages/opentelemetry-instrumentation/src/index.ts b/experimental/packages/opentelemetry-instrumentation/src/index.ts index 1e35147192..03e28ffaa5 100644 --- a/experimental/packages/opentelemetry-instrumentation/src/index.ts +++ b/experimental/packages/opentelemetry-instrumentation/src/index.ts @@ -18,6 +18,17 @@ export { registerInstrumentations } from './autoLoader'; export { InstrumentationBase } from './platform/index'; export { InstrumentationNodeModuleDefinition } from './instrumentationNodeModuleDefinition'; export { InstrumentationNodeModuleFile } from './instrumentationNodeModuleFile'; -export * from './types'; -export * from './types_internal'; -export * from './utils'; +export { + Instrumentation, + InstrumentationConfig, + InstrumentationModuleDefinition, + InstrumentationModuleFile, + ShimWrapped, + SpanCustomizationHook, +} from './types'; +export { AutoLoaderOptions, AutoLoaderResult } from './types_internal'; +export { + isWrapped, + safeExecuteInTheMiddle, + safeExecuteInTheMiddleAsync, +} from './utils'; diff --git a/experimental/packages/opentelemetry-sdk-node/src/index.ts b/experimental/packages/opentelemetry-sdk-node/src/index.ts index 891288ee6e..5b296eb3bd 100644 --- a/experimental/packages/opentelemetry-sdk-node/src/index.ts +++ b/experimental/packages/opentelemetry-sdk-node/src/index.ts @@ -14,6 +14,9 @@ * limitations under the License. */ +/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] -- + * TODO: Replace export * with named exports before next major version + */ export * as api from '@opentelemetry/api'; export * as contextBase from '@opentelemetry/api'; export * as core from '@opentelemetry/core'; @@ -22,5 +25,5 @@ export * as metrics from '@opentelemetry/sdk-metrics'; export * as node from '@opentelemetry/sdk-trace-node'; export * as resources from '@opentelemetry/resources'; export * as tracing from '@opentelemetry/sdk-trace-base'; -export * from './sdk'; -export * from './types'; +export { LoggerProviderConfig, MeterProviderConfig, NodeSDK } from './sdk'; +export { NodeSDKConfiguration } from './types'; diff --git a/experimental/packages/otlp-exporter-base/src/index.ts b/experimental/packages/otlp-exporter-base/src/index.ts index a2722f7ef5..2150f6c2c5 100644 --- a/experimental/packages/otlp-exporter-base/src/index.ts +++ b/experimental/packages/otlp-exporter-base/src/index.ts @@ -13,6 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] -- + * TODO: Replace export * with named exports before next major version + */ export * from './platform'; export { OTLPExporterBase } from './OTLPExporterBase'; export { diff --git a/integration-tests/api/package.json b/integration-tests/api/package.json index f0c5b10178..820a1e4ac5 100644 --- a/integration-tests/api/package.json +++ b/integration-tests/api/package.json @@ -29,6 +29,7 @@ }, "devDependencies": { "@opentelemetry/api": "^1.0.0", + "@opentelemetry/core": "^1.0.0", "@types/mocha": "10.0.7", "@types/node": "18.6.5", "codecov": "3.8.3", diff --git a/integration-tests/api/test/core-entries.test.js b/integration-tests/api/test/core-entries.test.js new file mode 100644 index 0000000000..d3b868055f --- /dev/null +++ b/integration-tests/api/test/core-entries.test.js @@ -0,0 +1,38 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const assert = require('assert'); + +// TypeScript v4.4.4 doesn't support `node16` or `nodenext` in +// [Module Resolution](https://www.typescriptlang.org/tsconfig#moduleResolution) +// which is required for typescript to resolve the `package.json#exports` +// entries. +// Additionally, using `node16` or `nodenext` in `tsconfig.json#moduleResolution` +// requires the TypeScript to generate ESModule outputs. This is a breaking +// change for CJS users. +// So we have to use plain JavaScript to verity the `package.json#exports` here. + +describe('@opentelemetry/core entries', () => { + it('should import baggage utils under named const', async () => { + const mod = await import('@opentelemetry/core'); + assert.ok(mod.baggageUtils.getKeyPairs != null); + }); + + it('should require baggage utils under named const', () => { + const mod = require('@opentelemetry/core'); + assert.ok(mod.baggageUtils.getKeyPairs != null); + }); +}); diff --git a/package-lock.json b/package-lock.json index 01adaf34b3..7d6bf8bb52 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3991,6 +3991,7 @@ "license": "Apache-2.0", "devDependencies": { "@opentelemetry/api": "^1.0.0", + "@opentelemetry/core": "^1.0.0", "@types/mocha": "10.0.7", "@types/node": "18.6.5", "codecov": "3.8.3", @@ -38999,6 +39000,7 @@ "version": "file:integration-tests/api", "requires": { "@opentelemetry/api": "^1.0.0", + "@opentelemetry/core": "^1.0.0", "@types/mocha": "10.0.7", "@types/node": "18.6.5", "codecov": "3.8.3", diff --git a/packages/opentelemetry-context-zone/src/index.ts b/packages/opentelemetry-context-zone/src/index.ts index ba99ea33bd..047e867d0d 100644 --- a/packages/opentelemetry-context-zone/src/index.ts +++ b/packages/opentelemetry-context-zone/src/index.ts @@ -14,5 +14,9 @@ * limitations under the License. */ -export * from '@opentelemetry/context-zone-peer-dep'; +export { + Func, + TargetWithEvents, + ZoneContextManager, +} from '@opentelemetry/context-zone-peer-dep'; import 'zone.js'; diff --git a/packages/opentelemetry-core/src/index.ts b/packages/opentelemetry-core/src/index.ts index 4ec08b1db1..0c2dc7c1a8 100644 --- a/packages/opentelemetry-core/src/index.ts +++ b/packages/opentelemetry-core/src/index.ts @@ -14,35 +14,108 @@ * limitations under the License. */ -export * from './baggage/propagation/W3CBaggagePropagator'; -export * from './common/anchored-clock'; -export * from './common/attributes'; -export * from './common/global-error-handler'; -export * from './common/logging-error-handler'; -export * from './common/time'; -export * from './common/types'; -export * from './common/hex-to-binary'; -export * from './ExportResult'; -export * as baggageUtils from './baggage/utils'; -export * from './platform'; -export * from './propagation/composite'; -export * from './trace/W3CTraceContextPropagator'; -export * from './trace/IdGenerator'; -export * from './trace/rpc-metadata'; -export * from './trace/sampler/AlwaysOffSampler'; -export * from './trace/sampler/AlwaysOnSampler'; -export * from './trace/sampler/ParentBasedSampler'; -export * from './trace/sampler/TraceIdRatioBasedSampler'; -export * from './trace/suppress-tracing'; -export * from './trace/TraceState'; -export * from './utils/environment'; -export * from './utils/merge'; -export * from './utils/sampling'; -export * from './utils/timeout'; -export * from './utils/url'; -export * from './utils/wrap'; -export * from './utils/callback'; -export * from './version'; +export { W3CBaggagePropagator } from './baggage/propagation/W3CBaggagePropagator'; +export { AnchoredClock, Clock } from './common/anchored-clock'; +export { + isAttributeKey, + isAttributeValue, + sanitizeAttributes, +} from './common/attributes'; +export { + globalErrorHandler, + setGlobalErrorHandler, +} from './common/global-error-handler'; +export { loggingErrorHandler } from './common/logging-error-handler'; +export { + addHrTimes, + getTimeOrigin, + hrTime, + hrTimeDuration, + hrTimeToMicroseconds, + hrTimeToMilliseconds, + hrTimeToNanoseconds, + hrTimeToTimeStamp, + isTimeInput, + isTimeInputHrTime, + millisToHrTime, + timeInputToHrTime, +} from './common/time'; +export { + ErrorHandler, + InstrumentationLibrary, + InstrumentationScope, + ShimWrapped, + TimeOriginLegacy, +} from './common/types'; +export { hexToBinary } from './common/hex-to-binary'; +export { ExportResult, ExportResultCode } from './ExportResult'; +import { + getKeyPairs, + serializeKeyPairs, + parseKeyPairsIntoRecord, + parsePairKeyValue, +} from './baggage/utils'; +export const baggageUtils = { + getKeyPairs, + serializeKeyPairs, + parseKeyPairsIntoRecord, + parsePairKeyValue, +}; +export { + RandomIdGenerator, + SDK_INFO, + _globalThis, + getEnv, + getEnvWithoutDefaults, + hexToBase64, + otperformance, + unrefTimer, +} from './platform'; +export { + CompositePropagator, + CompositePropagatorConfig, +} from './propagation/composite'; +export { + TRACE_PARENT_HEADER, + TRACE_STATE_HEADER, + W3CTraceContextPropagator, + parseTraceParent, +} from './trace/W3CTraceContextPropagator'; +export { IdGenerator } from './trace/IdGenerator'; +export { + RPCMetadata, + RPCType, + deleteRPCMetadata, + getRPCMetadata, + setRPCMetadata, +} from './trace/rpc-metadata'; +export { AlwaysOffSampler } from './trace/sampler/AlwaysOffSampler'; +export { AlwaysOnSampler } from './trace/sampler/AlwaysOnSampler'; +export { ParentBasedSampler } from './trace/sampler/ParentBasedSampler'; +export { TraceIdRatioBasedSampler } from './trace/sampler/TraceIdRatioBasedSampler'; +export { + isTracingSuppressed, + suppressTracing, + unsuppressTracing, +} from './trace/suppress-tracing'; +export { TraceState } from './trace/TraceState'; +export { + DEFAULT_ATTRIBUTE_COUNT_LIMIT, + DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT, + DEFAULT_ENVIRONMENT, + DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT, + DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT, + ENVIRONMENT, + RAW_ENVIRONMENT, + parseEnvironment, +} from './utils/environment'; +export { merge } from './utils/merge'; +export { TracesSamplerValues } from './utils/sampling'; +export { TimeoutError, callWithTimeout } from './utils/timeout'; +export { isUrlIgnored, urlMatches } from './utils/url'; +export { isWrapped } from './utils/wrap'; +export { BindOnceFuture } from './utils/callback'; +export { VERSION } from './version'; import { _export } from './internal/exporter'; export const internal = { _export, diff --git a/packages/opentelemetry-core/src/platform/browser/index.ts b/packages/opentelemetry-core/src/platform/browser/index.ts index ca373f3d4d..9fedc44d73 100644 --- a/packages/opentelemetry-core/src/platform/browser/index.ts +++ b/packages/opentelemetry-core/src/platform/browser/index.ts @@ -15,9 +15,9 @@ */ export { getEnvWithoutDefaults, getEnv } from './environment'; -export * from './globalThis'; -export * from './hex-to-base64'; -export * from './RandomIdGenerator'; -export * from './performance'; -export * from './sdk-info'; -export * from './timer-util'; +export { _globalThis } from './globalThis'; +export { hexToBase64 } from './hex-to-base64'; +export { RandomIdGenerator } from './RandomIdGenerator'; +export { otperformance } from './performance'; +export { SDK_INFO } from './sdk-info'; +export { unrefTimer } from './timer-util'; diff --git a/packages/opentelemetry-core/src/platform/index.ts b/packages/opentelemetry-core/src/platform/index.ts index a12506ffa9..f2139e6451 100644 --- a/packages/opentelemetry-core/src/platform/index.ts +++ b/packages/opentelemetry-core/src/platform/index.ts @@ -13,4 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export * from './node'; +export { + RandomIdGenerator, + SDK_INFO, + _globalThis, + getEnv, + getEnvWithoutDefaults, + hexToBase64, + otperformance, + unrefTimer, +} from './node'; diff --git a/packages/opentelemetry-core/src/platform/node/index.ts b/packages/opentelemetry-core/src/platform/node/index.ts index ca373f3d4d..9fedc44d73 100644 --- a/packages/opentelemetry-core/src/platform/node/index.ts +++ b/packages/opentelemetry-core/src/platform/node/index.ts @@ -15,9 +15,9 @@ */ export { getEnvWithoutDefaults, getEnv } from './environment'; -export * from './globalThis'; -export * from './hex-to-base64'; -export * from './RandomIdGenerator'; -export * from './performance'; -export * from './sdk-info'; -export * from './timer-util'; +export { _globalThis } from './globalThis'; +export { hexToBase64 } from './hex-to-base64'; +export { RandomIdGenerator } from './RandomIdGenerator'; +export { otperformance } from './performance'; +export { SDK_INFO } from './sdk-info'; +export { unrefTimer } from './timer-util'; diff --git a/packages/opentelemetry-exporter-jaeger/src/index.ts b/packages/opentelemetry-exporter-jaeger/src/index.ts index 520ddca099..e15b093d5a 100644 --- a/packages/opentelemetry-exporter-jaeger/src/index.ts +++ b/packages/opentelemetry-exporter-jaeger/src/index.ts @@ -14,5 +14,5 @@ * limitations under the License. */ -export * from './jaeger'; +export { JaegerExporter } from './jaeger'; export { ExporterConfig } from './types'; diff --git a/packages/opentelemetry-exporter-zipkin/src/index.ts b/packages/opentelemetry-exporter-zipkin/src/index.ts index cdf0ae281d..ffdbbb4a8e 100644 --- a/packages/opentelemetry-exporter-zipkin/src/index.ts +++ b/packages/opentelemetry-exporter-zipkin/src/index.ts @@ -14,6 +14,6 @@ * limitations under the License. */ -export * from './platform'; +export { prepareSend } from './platform'; export { ExporterConfig } from './types'; -export * from './zipkin'; +export { ZipkinExporter } from './zipkin'; diff --git a/packages/opentelemetry-exporter-zipkin/src/platform/browser/index.ts b/packages/opentelemetry-exporter-zipkin/src/platform/browser/index.ts index 3786b94827..a6ae762582 100644 --- a/packages/opentelemetry-exporter-zipkin/src/platform/browser/index.ts +++ b/packages/opentelemetry-exporter-zipkin/src/platform/browser/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export * from './util'; +export { prepareSend } from './util'; diff --git a/packages/opentelemetry-exporter-zipkin/src/platform/index.ts b/packages/opentelemetry-exporter-zipkin/src/platform/index.ts index cdaf8858ce..38e9417b3a 100644 --- a/packages/opentelemetry-exporter-zipkin/src/platform/index.ts +++ b/packages/opentelemetry-exporter-zipkin/src/platform/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export * from './node'; +export { prepareSend } from './node'; diff --git a/packages/opentelemetry-exporter-zipkin/src/platform/node/index.ts b/packages/opentelemetry-exporter-zipkin/src/platform/node/index.ts index 3786b94827..a6ae762582 100644 --- a/packages/opentelemetry-exporter-zipkin/src/platform/node/index.ts +++ b/packages/opentelemetry-exporter-zipkin/src/platform/node/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export * from './util'; +export { prepareSend } from './util'; diff --git a/packages/opentelemetry-propagator-b3/src/index.ts b/packages/opentelemetry-propagator-b3/src/index.ts index 5bc5069e1f..12dbc163bc 100644 --- a/packages/opentelemetry-propagator-b3/src/index.ts +++ b/packages/opentelemetry-propagator-b3/src/index.ts @@ -14,6 +14,13 @@ * limitations under the License. */ -export * from './B3Propagator'; -export * from './constants'; -export * from './types'; +export { B3Propagator } from './B3Propagator'; +export { + B3_CONTEXT_HEADER, + X_B3_FLAGS, + X_B3_PARENT_SPAN_ID, + X_B3_SAMPLED, + X_B3_SPAN_ID, + X_B3_TRACE_ID, +} from './constants'; +export { B3InjectEncoding, B3PropagatorConfig } from './types'; diff --git a/packages/opentelemetry-propagator-jaeger/src/index.ts b/packages/opentelemetry-propagator-jaeger/src/index.ts index 214953bd04..46e7f3b275 100644 --- a/packages/opentelemetry-propagator-jaeger/src/index.ts +++ b/packages/opentelemetry-propagator-jaeger/src/index.ts @@ -14,4 +14,8 @@ * limitations under the License. */ -export * from './JaegerPropagator'; +export { + JaegerPropagator, + UBER_BAGGAGE_HEADER_PREFIX, + UBER_TRACE_ID_HEADER, +} from './JaegerPropagator'; diff --git a/packages/opentelemetry-sdk-trace-base/src/index.ts b/packages/opentelemetry-sdk-trace-base/src/index.ts index 38a787950e..9af71378b6 100644 --- a/packages/opentelemetry-sdk-trace-base/src/index.ts +++ b/packages/opentelemetry-sdk-trace-base/src/index.ts @@ -14,22 +14,34 @@ * limitations under the License. */ -export * from './Tracer'; -export * from './BasicTracerProvider'; -export * from './platform'; -export * from './export/ConsoleSpanExporter'; -export * from './export/InMemorySpanExporter'; -export * from './export/ReadableSpan'; -export * from './export/SimpleSpanProcessor'; -export * from './export/SpanExporter'; -export * from './export/NoopSpanProcessor'; -export * from './sampler/AlwaysOffSampler'; -export * from './sampler/AlwaysOnSampler'; -export * from './sampler/ParentBasedSampler'; -export * from './sampler/TraceIdRatioBasedSampler'; -export * from './Sampler'; -export * from './Span'; -export * from './SpanProcessor'; -export * from './TimedEvent'; -export * from './types'; -export * from './IdGenerator'; +export { Tracer } from './Tracer'; +export { + BasicTracerProvider, + EXPORTER_FACTORY, + ForceFlushState, + PROPAGATOR_FACTORY, +} from './BasicTracerProvider'; +export { BatchSpanProcessor, RandomIdGenerator } from './platform'; +export { ConsoleSpanExporter } from './export/ConsoleSpanExporter'; +export { InMemorySpanExporter } from './export/InMemorySpanExporter'; +export { ReadableSpan } from './export/ReadableSpan'; +export { SimpleSpanProcessor } from './export/SimpleSpanProcessor'; +export { SpanExporter } from './export/SpanExporter'; +export { NoopSpanProcessor } from './export/NoopSpanProcessor'; +export { AlwaysOffSampler } from './sampler/AlwaysOffSampler'; +export { AlwaysOnSampler } from './sampler/AlwaysOnSampler'; +export { ParentBasedSampler } from './sampler/ParentBasedSampler'; +export { TraceIdRatioBasedSampler } from './sampler/TraceIdRatioBasedSampler'; +export { Sampler, SamplingDecision, SamplingResult } from './Sampler'; +export { Span } from './Span'; +export { SpanProcessor } from './SpanProcessor'; +export { TimedEvent } from './TimedEvent'; +export { + BatchSpanProcessorBrowserConfig, + BufferConfig, + GeneralLimits, + SDKRegistrationConfig, + SpanLimits, + TracerConfig, +} from './types'; +export { IdGenerator } from './IdGenerator'; diff --git a/packages/opentelemetry-sdk-trace-base/src/platform/browser/index.ts b/packages/opentelemetry-sdk-trace-base/src/platform/browser/index.ts index 652d686e04..752af89f78 100644 --- a/packages/opentelemetry-sdk-trace-base/src/platform/browser/index.ts +++ b/packages/opentelemetry-sdk-trace-base/src/platform/browser/index.ts @@ -14,5 +14,5 @@ * limitations under the License. */ -export * from './export/BatchSpanProcessor'; -export * from './RandomIdGenerator'; +export { BatchSpanProcessor } from './export/BatchSpanProcessor'; +export { RandomIdGenerator } from './RandomIdGenerator'; diff --git a/packages/opentelemetry-sdk-trace-base/src/platform/index.ts b/packages/opentelemetry-sdk-trace-base/src/platform/index.ts index cdaf8858ce..ac851124b2 100644 --- a/packages/opentelemetry-sdk-trace-base/src/platform/index.ts +++ b/packages/opentelemetry-sdk-trace-base/src/platform/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export * from './node'; +export { BatchSpanProcessor, RandomIdGenerator } from './node'; diff --git a/packages/opentelemetry-sdk-trace-base/src/platform/node/index.ts b/packages/opentelemetry-sdk-trace-base/src/platform/node/index.ts index 652d686e04..752af89f78 100644 --- a/packages/opentelemetry-sdk-trace-base/src/platform/node/index.ts +++ b/packages/opentelemetry-sdk-trace-base/src/platform/node/index.ts @@ -14,5 +14,5 @@ * limitations under the License. */ -export * from './export/BatchSpanProcessor'; -export * from './RandomIdGenerator'; +export { BatchSpanProcessor } from './export/BatchSpanProcessor'; +export { RandomIdGenerator } from './RandomIdGenerator'; diff --git a/packages/opentelemetry-sdk-trace-node/src/index.ts b/packages/opentelemetry-sdk-trace-node/src/index.ts index 8f6c5b9311..049759f222 100644 --- a/packages/opentelemetry-sdk-trace-node/src/index.ts +++ b/packages/opentelemetry-sdk-trace-node/src/index.ts @@ -15,5 +15,36 @@ */ export { NodeTracerConfig } from './config'; -export * from './NodeTracerProvider'; -export * from '@opentelemetry/sdk-trace-base'; +export { NodeTracerProvider } from './NodeTracerProvider'; +export { + AlwaysOffSampler, + AlwaysOnSampler, + BasicTracerProvider, + BatchSpanProcessor, + BatchSpanProcessorBrowserConfig, + BufferConfig, + ConsoleSpanExporter, + EXPORTER_FACTORY, + ForceFlushState, + GeneralLimits, + IdGenerator, + InMemorySpanExporter, + NoopSpanProcessor, + ParentBasedSampler, + PROPAGATOR_FACTORY, + RandomIdGenerator, + ReadableSpan, + Sampler, + SamplingDecision, + SamplingResult, + SDKRegistrationConfig, + SimpleSpanProcessor, + Span, + SpanExporter, + SpanLimits, + SpanProcessor, + TimedEvent, + TraceIdRatioBasedSampler, + Tracer, + TracerConfig, +} from '@opentelemetry/sdk-trace-base'; diff --git a/packages/opentelemetry-sdk-trace-web/src/index.ts b/packages/opentelemetry-sdk-trace-web/src/index.ts index d7bfeaf382..017b934a8f 100644 --- a/packages/opentelemetry-sdk-trace-web/src/index.ts +++ b/packages/opentelemetry-sdk-trace-web/src/index.ts @@ -14,9 +14,56 @@ * limitations under the License. */ -export * from './WebTracerProvider'; -export * from './StackContextManager'; -export * from './enums/PerformanceTimingNames'; -export * from './types'; -export * from './utils'; -export * from '@opentelemetry/sdk-trace-base'; +export { WebTracerConfig, WebTracerProvider } from './WebTracerProvider'; +export { StackContextManager } from './StackContextManager'; +export { PerformanceTimingNames } from './enums/PerformanceTimingNames'; +export { + PerformanceEntries, + PerformanceLegacy, + PerformanceResourceTimingInfo, + PropagateTraceHeaderCorsUrls, +} from './types'; +export { + URLLike, + addSpanNetworkEvent, + addSpanNetworkEvents, + getElementXPath, + getResource, + hasKey, + normalizeUrl, + parseUrl, + shouldPropagateTraceHeaders, + sortResources, +} from './utils'; +export { + AlwaysOffSampler, + AlwaysOnSampler, + BasicTracerProvider, + BatchSpanProcessor, + BatchSpanProcessorBrowserConfig, + BufferConfig, + ConsoleSpanExporter, + EXPORTER_FACTORY, + ForceFlushState, + GeneralLimits, + IdGenerator, + InMemorySpanExporter, + NoopSpanProcessor, + ParentBasedSampler, + PROPAGATOR_FACTORY, + RandomIdGenerator, + ReadableSpan, + Sampler, + SamplingDecision, + SamplingResult, + SDKRegistrationConfig, + SimpleSpanProcessor, + Span, + SpanExporter, + SpanLimits, + SpanProcessor, + TimedEvent, + TraceIdRatioBasedSampler, + Tracer, + TracerConfig, +} from '@opentelemetry/sdk-trace-base'; diff --git a/packages/opentelemetry-semantic-conventions/src/index.ts b/packages/opentelemetry-semantic-conventions/src/index.ts index d9674f1eaf..d409c8194d 100644 --- a/packages/opentelemetry-semantic-conventions/src/index.ts +++ b/packages/opentelemetry-semantic-conventions/src/index.ts @@ -14,6 +14,11 @@ * limitations under the License. */ +/* eslint-disable no-restricted-syntax -- + * These re-exports are only of constants, only two-levels deep, and + * should not cause problems for tree-shakers. + */ + // Deprecated. These are kept around for compatibility purposes export * from './trace'; export * from './resource'; diff --git a/packages/opentelemetry-semantic-conventions/src/resource/index.ts b/packages/opentelemetry-semantic-conventions/src/resource/index.ts index 9e9c593f2c..189a57dd22 100644 --- a/packages/opentelemetry-semantic-conventions/src/resource/index.ts +++ b/packages/opentelemetry-semantic-conventions/src/resource/index.ts @@ -13,4 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +/* eslint-disable no-restricted-syntax -- + * These re-exports are only of constants, only one-level deep at this point, + * and should not cause problems for tree-shakers. + */ export * from './SemanticResourceAttributes'; diff --git a/packages/opentelemetry-semantic-conventions/src/trace/index.ts b/packages/opentelemetry-semantic-conventions/src/trace/index.ts index aa5c102427..11cbc6b2f7 100644 --- a/packages/opentelemetry-semantic-conventions/src/trace/index.ts +++ b/packages/opentelemetry-semantic-conventions/src/trace/index.ts @@ -13,4 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +/* eslint-disable no-restricted-syntax -- + * These re-exports are only of constants, only one-level deep at this point, + * and should not cause problems for tree-shakers. + */ export * from './SemanticAttributes'; diff --git a/packages/propagator-aws-xray/src/index.ts b/packages/propagator-aws-xray/src/index.ts index dea8476683..ff6d1ed17e 100644 --- a/packages/propagator-aws-xray/src/index.ts +++ b/packages/propagator-aws-xray/src/index.ts @@ -14,4 +14,7 @@ * limitations under the License. */ -export * from './AWSXRayPropagator'; +export { + AWSXRAY_TRACE_ID_HEADER, + AWSXRayPropagator, +} from './AWSXRayPropagator'; diff --git a/packages/sdk-metrics/src/aggregator/index.ts b/packages/sdk-metrics/src/aggregator/index.ts index b304997dd6..b7b49b9c07 100644 --- a/packages/sdk-metrics/src/aggregator/index.ts +++ b/packages/sdk-metrics/src/aggregator/index.ts @@ -14,9 +14,12 @@ * limitations under the License. */ -export * from './Drop'; -export * from './Histogram'; -export * from './ExponentialHistogram'; -export * from './LastValue'; -export * from './Sum'; +export { DropAggregator } from './Drop'; +export { HistogramAccumulation, HistogramAggregator } from './Histogram'; +export { + ExponentialHistogramAccumulation, + ExponentialHistogramAggregator, +} from './ExponentialHistogram'; +export { LastValueAccumulation, LastValueAggregator } from './LastValue'; +export { SumAccumulation, SumAggregator } from './Sum'; export { Aggregator } from './types'; diff --git a/packages/sdk-metrics/src/exemplar/index.ts b/packages/sdk-metrics/src/exemplar/index.ts index b9e84259ff..6a90e9f778 100644 --- a/packages/sdk-metrics/src/exemplar/index.ts +++ b/packages/sdk-metrics/src/exemplar/index.ts @@ -14,11 +14,14 @@ * limitations under the License. */ -export * from './Exemplar'; -export * from './ExemplarFilter'; -export * from './AlwaysSampleExemplarFilter'; -export * from './NeverSampleExemplarFilter'; -export * from './WithTraceExemplarFilter'; -export * from './ExemplarReservoir'; -export * from './AlignedHistogramBucketExemplarReservoir'; -export * from './SimpleFixedSizeExemplarReservoir'; +export { Exemplar } from './Exemplar'; +export { ExemplarFilter } from './ExemplarFilter'; +export { AlwaysSampleExemplarFilter } from './AlwaysSampleExemplarFilter'; +export { NeverSampleExemplarFilter } from './NeverSampleExemplarFilter'; +export { WithTraceExemplarFilter } from './WithTraceExemplarFilter'; +export { + ExemplarReservoir, + FixedSizeExemplarReservoirBase, +} from './ExemplarReservoir'; +export { AlignedHistogramBucketExemplarReservoir } from './AlignedHistogramBucketExemplarReservoir'; +export { SimpleFixedSizeExemplarReservoir } from './SimpleFixedSizeExemplarReservoir';