Skip to content

Commit

Permalink
fix(sdk-node): register instrumentations early (#3502)
Browse files Browse the repository at this point in the history
* fix(sdk-node): register instrumentations early

Register instrumentations as first step in start() before it gets async to
ensure that modules required during async resource detection get instrumented.

* Update experimental/CHANGELOG.md

---------

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
  • Loading branch information
Flarna and dyladan authored Jan 27, 2023
1 parent 5b070b8 commit a90c558
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ All notable changes to experimental packages in this project will be documented

### :bug: (Bug Fix)

* fix(sdk-node): register instrumentations early [#3502](https://github.com/open-telemetry/opentelemetry-js/pull/3502) @flarna
* fix: include tracestate in export [#3569](https://github.com/open-telemetry/opentelemetry-js/pull/3569) @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 @@ -208,6 +208,10 @@ export class NodeSDK {
return;
}

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

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

metrics.setGlobalMeterProvider(meterProvider);
}

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

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

0 comments on commit a90c558

Please sign in to comment.