Skip to content

remove export * from ... usage in sdk-node package #5461

@trentm

Description

@trentm

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:

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions