-
Notifications
You must be signed in to change notification settings - Fork 977
Description
See #4186 where we worked through remove all other export * from ... usage in published packages. These in the sdk-node package are the last remaining ones:
opentelemetry-js/experimental/packages/opentelemetry-sdk-node/src/index.ts
Lines 20 to 27 in e7865c6
| export * as api from '@opentelemetry/api'; | |
| export * as contextBase from '@opentelemetry/api'; | |
| export * as core from '@opentelemetry/core'; | |
| export * as logs from '@opentelemetry/sdk-logs'; | |
| 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'; |
The original motivations for remove export * usage:
- to not inadvertently made public and become part of the public API
- to not be a blocker for using tslib (see Named esm import fails on v1.15.0 #3976 (comment))
Some discussion specifically about the export * in the sdk-node package start here: #4186 (comment)
Does anyone use these re-exports?
Some anecdotal data on how common it is that these re-exports are used from the sdk-node package.
The contrib repo has three cases of using these re-exports:
metapackages/auto-instrumentations-node/src/register.ts
16:import * as opentelemetry from '@opentelemetry/sdk-node';
packages/baggage-span-processor/README.md
33:import { NodeSDK, tracing } from '@opentelemetry/sdk-node';
packages/opentelemetry-test-utils/src/test-fixtures.ts
27:import { NodeSDK, tracing } from '@opentelemetry/sdk-node';
The first one (in auto-instrumentations-node) will be removed as part of #5443 and open-telemetry/opentelemetry-js-contrib#2708).
I acknowledge the convenience of using the tracing re-export to get common classes like tracing.SimpleSpanProcessor and tracing.ConsoleSpanExporter.
An unscientific read through results from https://github.com/search?q=%22from+'%2540opentelemetry%252Fsdk-node'%22 suggests that somewhere around 10% of hits for import { ... } from '@opentelemetry/sdk-node' are using one of these re-exports.