2424
2525
2626class BaseInstrumentor (ABC ):
27- """An ABC for instrumentors"""
27+ """An ABC for instrumentors
28+
29+ Child classes of this ABC should instrument specific third
30+ party libraries or frameworks either by using the
31+ ``opentelemetry-auto-instrumentation`` command or by calling their methods
32+ directly.
33+
34+ Since every third party library or framework is different and has different
35+ instrumentation needs, more methods can be added to the child classes as
36+ needed to provide practical instrumentation to the end user.
37+ """
2838
2939 _instance = None
3040 _is_instrumented = False
@@ -38,14 +48,30 @@ def __new__(cls):
3848
3949 @abstractmethod
4050 def _instrument (self , ** kwargs ):
41- """Instrument"""
51+ """Instrument the library """
4252
4353 @abstractmethod
4454 def _uninstrument (self , ** kwargs ):
45- """Uninstrument"""
55+ """Uninstrument the library """
4656
4757 def instrument (self , ** kwargs ):
48- """Instrument"""
58+ """Instrument the library
59+
60+ This method will be called without any optional arguments by the
61+ ``opentelemetry-auto-instrumentation`` command. The configuration of
62+ the instrumentation when done in this way should be done by previously
63+ setting the configuration (using environment variables or any other
64+ mechanism) that will be used later by the code in the ``instrument``
65+ implementation via the global ``Configuration`` object.
66+
67+ The ``instrument`` methods ``kwargs`` should default to values from the
68+ ``Configuration`` object.
69+
70+ This means that calling this method directly without passing any
71+ optional values should do the very same thing that the
72+ ``opentelemetry-auto-instrumentation`` command does. This approach is
73+ followed because the ``Configuration`` object is immutable.
74+ """
4975
5076 if not self ._is_instrumented :
5177 result = self ._instrument (** kwargs )
@@ -57,7 +83,11 @@ def instrument(self, **kwargs):
5783 return None
5884
5985 def uninstrument (self , ** kwargs ):
60- """Uninstrument"""
86+ """Uninstrument the library
87+
88+ See ``BaseInstrumentor.instrument`` for more information regarding the
89+ usage of ``kwargs``.
90+ """
6191
6292 if self ._is_instrumented :
6393 result = self ._uninstrument (** kwargs )
0 commit comments