opentelemetry-js
opentelemetry-js copied to clipboard
InstrumentationBase calls init on partly initialized Instrumentations
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 https://github.com/open-telemetry/opentelemetry-js-contrib/pull/354#discussion_r585913312
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
declaresabstract init()
-
init()
most be implemented in a concrete instrumentation class extendingInstrumentationBase
- constructor of
InstrumentationBase
callsthis.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.: https://github.com/microsoft/TypeScript/issues/9209
@Flarna I believe this has been fixed. Can you confirm if this is still a bug?
I don't think it's fixed as abstract init
is still called from base class constructor here