Skip to content

InstrumentationBase calls init on partly initialized Instrumentations #1989

@Flarna

Description

@Flarna

What version of OpenTelemetry are you using?

0.17.0

What version of Node are you using?

14.16.0

What did you do?

see open-telemetry/opentelemetry-js-contrib#354 (comment)

Implementing an Instrumentation which uses a private property in init().

What did you expect to see?

Instrumentation should work

What did you see instead?

init() was called before the private property was initialized.

Additional context

  • InstrumentationAbstract declares abstract init()
  • init() most be implemented in a concrete instrumentation class extending InstrumentationBase
  • constructor of InstrumentationBase calls this.init()

==> This result in calling init() of the concrete Instrumentation instance before the constructor has finished. The functions of this instrumentation are in place but the properties are not yet initialized resulting in undefined behavior.

Refs.: microsoft/TypeScript#9209

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpkg:instrumentationpriority:p2Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrectup-for-grabsGood for taking. Extra help will be provided by maintainers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions