Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sdk-node): register instrumentations early #3502

Merged
merged 12 commits into from
Jan 27, 2023
1 change: 1 addition & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ All notable changes to experimental packages in this project will be documented
* fix(prometheus-sanitization): replace repeated `_` with a single `_` [3470](https://github.com/open-telemetry/opentelemetry-js/pull/3470) @samimusallam
* fix(prometheus-serializer): correct string used for NaN [#3477](https://github.com/open-telemetry/opentelemetry-js/pull/3477) @JacksonWeber
* fix(instrumentation-http): close server span when response finishes [#3407](https://github.com/open-telemetry/opentelemetry-js/pull/3407) @legendecas
* fix(sdk-node): register instrumentations early [#3502](https://github.com/open-telemetry/opentelemetry-js/pull/3502) @flarna

### :books: (Refine Doc)

Expand Down
8 changes: 4 additions & 4 deletions experimental/packages/opentelemetry-sdk-node/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ export class NodeSDK {
* Once the SDK has been configured, call this method to construct SDK components and register them with the OpenTelemetry API.
*/
public async start(): Promise<void> {
registerInstrumentations({
instrumentations: this._instrumentations,
});

if (this._autoDetectResources) {
await this.detectResources();
}
Expand Down Expand Up @@ -238,10 +242,6 @@ export class NodeSDK {

metrics.setGlobalMeterProvider(meterProvider);
}

registerInstrumentations({
instrumentations: this._instrumentations,
});
}

public shutdown(): Promise<void> {
Expand Down