OpenTelemetry Base Instrumentor
- class opentelemetry.instrumentation.instrumentor.BaseInstrumentor(*args, **kwargs)¶
An ABC for instrumentors
Child classes of this ABC should instrument specific third party libraries or frameworks either by using the
opentelemetry-instrumentcommand or by calling their methods directly.
Since every third party library or framework is different and has different instrumentation needs, more methods can be added to the child classes as needed to provide practical instrumentation to the end user.
- abstract instrumentation_dependencies()¶
Return a list of python packages with versions that the will be instrumented.
The format should be the same as used in requirements.txt or setup.py.
For example, if an instrumentation instruments requests 1.x, this method should look like:
- def instrumentation_dependencies(self) -> Collection[str]:
return [‘requests ~= 1.0’]
This will ensure that the instrumentation will only be used when the specified library is present in the environment.
Instrument the library
This method will be called without any optional arguments by the
This means that calling this method directly without passing any optional values should do the very same thing that the
Uninstrument the library
BaseInstrumentor.instrumentfor more information regarding the usage of