Skip to content

Commit

Permalink
refactor: remove "export *" in favor of explicit named exports (open-…
Browse files Browse the repository at this point in the history
…telemetry#4880)

Co-authored-by: Jamie Danielson <jamieedanielson@gmail.com>
Co-authored-by: Trent Mick <trentm@gmail.com>
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
  • Loading branch information
4 people authored and Zirak committed Sep 14, 2024
1 parent ca321bf commit 6573204
Show file tree
Hide file tree
Showing 62 changed files with 521 additions and 133 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion api/src/platform/browser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
* limitations under the License.
*/

export * from './globalThis';
export { _globalThis } from './globalThis';
2 changes: 1 addition & 1 deletion api/src/platform/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
* limitations under the License.
*/

export * from './node';
export { _globalThis } from './node';
2 changes: 1 addition & 1 deletion api/src/platform/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
* limitations under the License.
*/

export * from './globalThis';
export { _globalThis } from './globalThis';
1 change: 1 addition & 0 deletions eslint.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ module.exports = {
}
}],
"@typescript-eslint/no-shadow": ["warn"],
"no-restricted-syntax": ["error", "ExportAllDeclaration"],
"prefer-rest-params": "off",
}
},
Expand Down
10 changes: 10 additions & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions experimental/packages/api-events/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
* limitations under the License.
*/

export * from './globalThis';
export { _globalThis } from './globalThis';
2 changes: 1 addition & 1 deletion experimental/packages/api-events/src/platform/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
* limitations under the License.
*/

export * from './node';
export { _globalThis } from './node';
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
* limitations under the License.
*/

export * from './globalThis';
export { _globalThis } from './globalThis';
19 changes: 12 additions & 7 deletions experimental/packages/api-logs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
* limitations under the License.
*/

export * from './globalThis';
export { _globalThis } from './globalThis';
2 changes: 1 addition & 1 deletion experimental/packages/api-logs/src/platform/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
* limitations under the License.
*/

export * from './node';
export { _globalThis } from './node';
2 changes: 1 addition & 1 deletion experimental/packages/api-logs/src/platform/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
* limitations under the License.
*/

export * from './globalThis';
export { _globalThis } from './globalThis';
3 changes: 3 additions & 0 deletions experimental/packages/exporter-logs-otlp-grpc/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
3 changes: 3 additions & 0 deletions experimental/packages/exporter-trace-otlp-grpc/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
3 changes: 3 additions & 0 deletions experimental/packages/exporter-trace-otlp-http/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
* limitations under the License.
*/

export * from './BrowserDetector';
export { browserDetector } from './BrowserDetector';
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@
* limitations under the License.
*/

export * from './fetch';
export {
FetchCustomAttributeFunction,
FetchInstrumentation,
FetchInstrumentationConfig,
} from './fetch';
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@
* limitations under the License.
*/

export * from './xhr';
export {
XHRCustomAttributeFunction,
XMLHttpRequestInstrumentation,
XMLHttpRequestInstrumentationConfig,
} from './xhr';
17 changes: 14 additions & 3 deletions experimental/packages/opentelemetry-instrumentation/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
7 changes: 5 additions & 2 deletions experimental/packages/opentelemetry-sdk-node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
4 changes: 4 additions & 0 deletions experimental/packages/otlp-exporter-base/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions integration-tests/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading

0 comments on commit 6573204

Please sign in to comment.