We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
opentelemetry-instrumentation-pymongo is not checking suppress_information 
**Describe your environment** 
- Python 3.9
- opentelemetry-instrumentation-pymongo==0.23b2

**Steps to reproduce**
A method polls our database waiting for success. We've tried to add suppression for this because we get many 10s of segments for this polling, but spans still get generated.

```
  ctx = set_value("suppress_instrumentation", True)

  with tracer.start_as_current_span("polling", ctx):
      tt = time.time()
      while timeout is None or float(timeout) > time.time() - tt:
          status = cls.status(job_id)
          if not status.is_pending():
              return
          await asyncio.sleep(increment)
```
Invoking `cls.status(job_id)` does a mongo query to determine status.

**What is the expected behavior?**
I expect that the mongo query triggered by the status call doesn't generate a span.

**What is the actual behavior?**
many 10s of spans are included in the output of the instrumentation.

**Additional context**
There's a possibility I'm invoking the code wrong here (I'm new to OpenTelemetry), but the implementation for PyMongo doesn't reference the suppression key like other libraries.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo/__init__.py`
Content:
```
1 # Copyright The OpenTelemetry Authors
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 
15 """
16 The integration with MongoDB supports the `pymongo`_ library, it can be
17 enabled using the ``PymongoInstrumentor``.
18 
19 .. _pymongo: https://pypi.org/project/pymongo
20 
21 Usage
22 -----
23 
24 .. code:: python
25 
26     from pymongo import MongoClient
27     from opentelemetry.instrumentation.pymongo import PymongoInstrumentor
28 
29 
30     PymongoInstrumentor().instrument()
31     client = MongoClient()
32     db = client["MongoDB_Database"]
33     collection = db["MongoDB_Collection"]
34     collection.find_one()
35 
36 API
37 ---
38 """
39 
40 from typing import Collection
41 
42 from pymongo import monitoring
43 
44 from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
45 from opentelemetry.instrumentation.pymongo.package import _instruments
46 from opentelemetry.instrumentation.pymongo.version import __version__
47 from opentelemetry.semconv.trace import DbSystemValues, SpanAttributes
48 from opentelemetry.trace import SpanKind, get_tracer
49 from opentelemetry.trace.status import Status, StatusCode
50 
51 
52 class CommandTracer(monitoring.CommandListener):
53     def __init__(self, tracer):
54         self._tracer = tracer
55         self._span_dict = {}
56         self.is_enabled = True
57 
58     def started(self, event: monitoring.CommandStartedEvent):
59         """ Method to handle a pymongo CommandStartedEvent """
60         if not self.is_enabled:
61             return
62         command = event.command.get(event.command_name, "")
63         name = event.command_name
64         statement = event.command_name
65         if command:
66             name += "." + str(command)
67             statement += " " + str(command)
68 
69         try:
70             span = self._tracer.start_span(name, kind=SpanKind.CLIENT)
71             if span.is_recording():
72                 span.set_attribute(
73                     SpanAttributes.DB_SYSTEM, DbSystemValues.MONGODB.value
74                 )
75                 span.set_attribute(SpanAttributes.DB_NAME, event.database_name)
76                 span.set_attribute(SpanAttributes.DB_STATEMENT, statement)
77                 if event.connection_id is not None:
78                     span.set_attribute(
79                         SpanAttributes.NET_PEER_NAME, event.connection_id[0]
80                     )
81                     span.set_attribute(
82                         SpanAttributes.NET_PEER_PORT, event.connection_id[1]
83                     )
84 
85             # Add Span to dictionary
86             self._span_dict[_get_span_dict_key(event)] = span
87         except Exception as ex:  # noqa pylint: disable=broad-except
88             if span is not None and span.is_recording():
89                 span.set_status(Status(StatusCode.ERROR, str(ex)))
90                 span.end()
91                 self._pop_span(event)
92 
93     def succeeded(self, event: monitoring.CommandSucceededEvent):
94         """ Method to handle a pymongo CommandSucceededEvent """
95         if not self.is_enabled:
96             return
97         span = self._pop_span(event)
98         if span is None:
99             return
100         span.end()
101 
102     def failed(self, event: monitoring.CommandFailedEvent):
103         """ Method to handle a pymongo CommandFailedEvent """
104         if not self.is_enabled:
105             return
106         span = self._pop_span(event)
107         if span is None:
108             return
109         if span.is_recording():
110             span.set_status(Status(StatusCode.ERROR, event.failure))
111         span.end()
112 
113     def _pop_span(self, event):
114         return self._span_dict.pop(_get_span_dict_key(event), None)
115 
116 
117 def _get_span_dict_key(event):
118     if event.connection_id is not None:
119         return (event.request_id, event.connection_id)
120     return event.request_id
121 
122 
123 class PymongoInstrumentor(BaseInstrumentor):
124     _commandtracer_instance = None  # type CommandTracer
125     # The instrumentation for PyMongo is based on the event listener interface
126     # https://api.mongodb.com/python/current/api/pymongo/monitoring.html.
127     # This interface only allows to register listeners and does not provide
128     # an unregister API. In order to provide a mechanishm to disable
129     # instrumentation an enabled flag is implemented in CommandTracer,
130     # it's checked in the different listeners.
131 
132     def instrumentation_dependencies(self) -> Collection[str]:
133         return _instruments
134 
135     def _instrument(self, **kwargs):
136         """Integrate with pymongo to trace it using event listener.
137         https://api.mongodb.com/python/current/api/pymongo/monitoring.html
138 
139         Args:
140             tracer_provider: The `TracerProvider` to use. If none is passed the
141                 current configured one is used.
142         """
143 
144         tracer_provider = kwargs.get("tracer_provider")
145 
146         # Create and register a CommandTracer only the first time
147         if self._commandtracer_instance is None:
148             tracer = get_tracer(__name__, __version__, tracer_provider)
149 
150             self._commandtracer_instance = CommandTracer(tracer)
151             monitoring.register(self._commandtracer_instance)
152 
153         # If already created, just enable it
154         self._commandtracer_instance.is_enabled = True
155 
156     def _uninstrument(self, **kwargs):
157         if self._commandtracer_instance is not None:
158             self._commandtracer_instance.is_enabled = False
159
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo/__init__.py b/instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo/__init__.py
--- a/instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo/__init__.py
+++ b/instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo/__init__.py
@@ -41,9 +41,11 @@
 
 from pymongo import monitoring
 
+from opentelemetry import context
 from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
 from opentelemetry.instrumentation.pymongo.package import _instruments
 from opentelemetry.instrumentation.pymongo.version import __version__
+from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY
 from opentelemetry.semconv.trace import DbSystemValues, SpanAttributes
 from opentelemetry.trace import SpanKind, get_tracer
 from opentelemetry.trace.status import Status, StatusCode
@@ -57,7 +59,9 @@
 
     def started(self, event: monitoring.CommandStartedEvent):
         """ Method to handle a pymongo CommandStartedEvent """
-        if not self.is_enabled:
+        if not self.is_enabled or context.get_value(
+            _SUPPRESS_INSTRUMENTATION_KEY
+        ):
             return
         command = event.command.get(event.command_name, "")
         name = event.command_name
@@ -92,7 +96,9 @@
 
     def succeeded(self, event: monitoring.CommandSucceededEvent):
         """ Method to handle a pymongo CommandSucceededEvent """
-        if not self.is_enabled:
+        if not self.is_enabled or context.get_value(
+            _SUPPRESS_INSTRUMENTATION_KEY
+        ):
             return
         span = self._pop_span(event)
         if span is None:
@@ -101,7 +107,9 @@
 
     def failed(self, event: monitoring.CommandFailedEvent):
         """ Method to handle a pymongo CommandFailedEvent """
-        if not self.is_enabled:
+        if not self.is_enabled or context.get_value(
+            _SUPPRESS_INSTRUMENTATION_KEY
+        ):
             return
         span = self._pop_span(event)
         if span is None:

{"golden_diff": "diff --git a/instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo/__init__.py b/instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo/__init__.py\n--- a/instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo/__init__.py\n+++ b/instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo/__init__.py\n@@ -41,9 +41,11 @@\n \n from pymongo import monitoring\n \n+from opentelemetry import context\n from opentelemetry.instrumentation.instrumentor import BaseInstrumentor\n from opentelemetry.instrumentation.pymongo.package import _instruments\n from opentelemetry.instrumentation.pymongo.version import __version__\n+from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY\n from opentelemetry.semconv.trace import DbSystemValues, SpanAttributes\n from opentelemetry.trace import SpanKind, get_tracer\n from opentelemetry.trace.status import Status, StatusCode\n@@ -57,7 +59,9 @@\n \n     def started(self, event: monitoring.CommandStartedEvent):\n         \"\"\" Method to handle a pymongo CommandStartedEvent \"\"\"\n-        if not self.is_enabled:\n+        if not self.is_enabled or context.get_value(\n+            _SUPPRESS_INSTRUMENTATION_KEY\n+        ):\n             return\n         command = event.command.get(event.command_name, \"\")\n         name = event.command_name\n@@ -92,7 +96,9 @@\n \n     def succeeded(self, event: monitoring.CommandSucceededEvent):\n         \"\"\" Method to handle a pymongo CommandSucceededEvent \"\"\"\n-        if not self.is_enabled:\n+        if not self.is_enabled or context.get_value(\n+            _SUPPRESS_INSTRUMENTATION_KEY\n+        ):\n             return\n         span = self._pop_span(event)\n         if span is None:\n@@ -101,7 +107,9 @@\n \n     def failed(self, event: monitoring.CommandFailedEvent):\n         \"\"\" Method to handle a pymongo CommandFailedEvent \"\"\"\n-        if not self.is_enabled:\n+        if not self.is_enabled or context.get_value(\n+            _SUPPRESS_INSTRUMENTATION_KEY\n+        ):\n             return\n         span = self._pop_span(event)\n         if span is None:\n", "issue": "opentelemetry-instrumentation-pymongo is not checking suppress_information \n**Describe your environment** \r\n- Python 3.9\r\n- opentelemetry-instrumentation-pymongo==0.23b2\r\n\r\n**Steps to reproduce**\r\nA method polls our database waiting for success. We've tried to add suppression for this because we get many 10s of segments for this polling, but spans still get generated.\r\n\r\n```\r\n  ctx = set_value(\"suppress_instrumentation\", True)\r\n\r\n  with tracer.start_as_current_span(\"polling\", ctx):\r\n      tt = time.time()\r\n      while timeout is None or float(timeout) > time.time() - tt:\r\n          status = cls.status(job_id)\r\n          if not status.is_pending():\r\n              return\r\n          await asyncio.sleep(increment)\r\n```\r\nInvoking `cls.status(job_id)` does a mongo query to determine status.\r\n\r\n**What is the expected behavior?**\r\nI expect that the mongo query triggered by the status call doesn't generate a span.\r\n\r\n**What is the actual behavior?**\r\nmany 10s of spans are included in the output of the instrumentation.\r\n\r\n**Additional context**\r\nThere's a possibility I'm invoking the code wrong here (I'm new to OpenTelemetry), but the implementation for PyMongo doesn't reference the suppression key like other libraries.\r\n\n", "before_files": [{"content": "# Copyright The OpenTelemetry Authors\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"\nThe integration with MongoDB supports the `pymongo`_ library, it can be\nenabled using the ``PymongoInstrumentor``.\n\n.. _pymongo: https://pypi.org/project/pymongo\n\nUsage\n-----\n\n.. code:: python\n\n    from pymongo import MongoClient\n    from opentelemetry.instrumentation.pymongo import PymongoInstrumentor\n\n\n    PymongoInstrumentor().instrument()\n    client = MongoClient()\n    db = client[\"MongoDB_Database\"]\n    collection = db[\"MongoDB_Collection\"]\n    collection.find_one()\n\nAPI\n---\n\"\"\"\n\nfrom typing import Collection\n\nfrom pymongo import monitoring\n\nfrom opentelemetry.instrumentation.instrumentor import BaseInstrumentor\nfrom opentelemetry.instrumentation.pymongo.package import _instruments\nfrom opentelemetry.instrumentation.pymongo.version import __version__\nfrom opentelemetry.semconv.trace import DbSystemValues, SpanAttributes\nfrom opentelemetry.trace import SpanKind, get_tracer\nfrom opentelemetry.trace.status import Status, StatusCode\n\n\nclass CommandTracer(monitoring.CommandListener):\n    def __init__(self, tracer):\n        self._tracer = tracer\n        self._span_dict = {}\n        self.is_enabled = True\n\n    def started(self, event: monitoring.CommandStartedEvent):\n        \"\"\" Method to handle a pymongo CommandStartedEvent \"\"\"\n        if not self.is_enabled:\n            return\n        command = event.command.get(event.command_name, \"\")\n        name = event.command_name\n        statement = event.command_name\n        if command:\n            name += \".\" + str(command)\n            statement += \" \" + str(command)\n\n        try:\n            span = self._tracer.start_span(name, kind=SpanKind.CLIENT)\n            if span.is_recording():\n                span.set_attribute(\n                    SpanAttributes.DB_SYSTEM, DbSystemValues.MONGODB.value\n                )\n                span.set_attribute(SpanAttributes.DB_NAME, event.database_name)\n                span.set_attribute(SpanAttributes.DB_STATEMENT, statement)\n                if event.connection_id is not None:\n                    span.set_attribute(\n                        SpanAttributes.NET_PEER_NAME, event.connection_id[0]\n                    )\n                    span.set_attribute(\n                        SpanAttributes.NET_PEER_PORT, event.connection_id[1]\n                    )\n\n            # Add Span to dictionary\n            self._span_dict[_get_span_dict_key(event)] = span\n        except Exception as ex:  # noqa pylint: disable=broad-except\n            if span is not None and span.is_recording():\n                span.set_status(Status(StatusCode.ERROR, str(ex)))\n                span.end()\n                self._pop_span(event)\n\n    def succeeded(self, event: monitoring.CommandSucceededEvent):\n        \"\"\" Method to handle a pymongo CommandSucceededEvent \"\"\"\n        if not self.is_enabled:\n            return\n        span = self._pop_span(event)\n        if span is None:\n            return\n        span.end()\n\n    def failed(self, event: monitoring.CommandFailedEvent):\n        \"\"\" Method to handle a pymongo CommandFailedEvent \"\"\"\n        if not self.is_enabled:\n            return\n        span = self._pop_span(event)\n        if span is None:\n            return\n        if span.is_recording():\n            span.set_status(Status(StatusCode.ERROR, event.failure))\n        span.end()\n\n    def _pop_span(self, event):\n        return self._span_dict.pop(_get_span_dict_key(event), None)\n\n\ndef _get_span_dict_key(event):\n    if event.connection_id is not None:\n        return (event.request_id, event.connection_id)\n    return event.request_id\n\n\nclass PymongoInstrumentor(BaseInstrumentor):\n    _commandtracer_instance = None  # type CommandTracer\n    # The instrumentation for PyMongo is based on the event listener interface\n    # https://api.mongodb.com/python/current/api/pymongo/monitoring.html.\n    # This interface only allows to register listeners and does not provide\n    # an unregister API. In order to provide a mechanishm to disable\n    # instrumentation an enabled flag is implemented in CommandTracer,\n    # it's checked in the different listeners.\n\n    def instrumentation_dependencies(self) -> Collection[str]:\n        return _instruments\n\n    def _instrument(self, **kwargs):\n        \"\"\"Integrate with pymongo to trace it using event listener.\n        https://api.mongodb.com/python/current/api/pymongo/monitoring.html\n\n        Args:\n            tracer_provider: The `TracerProvider` to use. If none is passed the\n                current configured one is used.\n        \"\"\"\n\n        tracer_provider = kwargs.get(\"tracer_provider\")\n\n        # Create and register a CommandTracer only the first time\n        if self._commandtracer_instance is None:\n            tracer = get_tracer(__name__, __version__, tracer_provider)\n\n            self._commandtracer_instance = CommandTracer(tracer)\n            monitoring.register(self._commandtracer_instance)\n\n        # If already created, just enable it\n        self._commandtracer_instance.is_enabled = True\n\n    def _uninstrument(self, **kwargs):\n        if self._commandtracer_instance is not None:\n            self._commandtracer_instance.is_enabled = False\n", "path": "instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo/__init__.py"}], "after_files": [{"content": "# Copyright The OpenTelemetry Authors\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"\nThe integration with MongoDB supports the `pymongo`_ library, it can be\nenabled using the ``PymongoInstrumentor``.\n\n.. _pymongo: https://pypi.org/project/pymongo\n\nUsage\n-----\n\n.. code:: python\n\n    from pymongo import MongoClient\n    from opentelemetry.instrumentation.pymongo import PymongoInstrumentor\n\n\n    PymongoInstrumentor().instrument()\n    client = MongoClient()\n    db = client[\"MongoDB_Database\"]\n    collection = db[\"MongoDB_Collection\"]\n    collection.find_one()\n\nAPI\n---\n\"\"\"\n\nfrom typing import Collection\n\nfrom pymongo import monitoring\n\nfrom opentelemetry import context\nfrom opentelemetry.instrumentation.instrumentor import BaseInstrumentor\nfrom opentelemetry.instrumentation.pymongo.package import _instruments\nfrom opentelemetry.instrumentation.pymongo.version import __version__\nfrom opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY\nfrom opentelemetry.semconv.trace import DbSystemValues, SpanAttributes\nfrom opentelemetry.trace import SpanKind, get_tracer\nfrom opentelemetry.trace.status import Status, StatusCode\n\n\nclass CommandTracer(monitoring.CommandListener):\n    def __init__(self, tracer):\n        self._tracer = tracer\n        self._span_dict = {}\n        self.is_enabled = True\n\n    def started(self, event: monitoring.CommandStartedEvent):\n        \"\"\" Method to handle a pymongo CommandStartedEvent \"\"\"\n        if not self.is_enabled or context.get_value(\n            _SUPPRESS_INSTRUMENTATION_KEY\n        ):\n            return\n        command = event.command.get(event.command_name, \"\")\n        name = event.command_name\n        statement = event.command_name\n        if command:\n            name += \".\" + str(command)\n            statement += \" \" + str(command)\n\n        try:\n            span = self._tracer.start_span(name, kind=SpanKind.CLIENT)\n            if span.is_recording():\n                span.set_attribute(\n                    SpanAttributes.DB_SYSTEM, DbSystemValues.MONGODB.value\n                )\n                span.set_attribute(SpanAttributes.DB_NAME, event.database_name)\n                span.set_attribute(SpanAttributes.DB_STATEMENT, statement)\n                if event.connection_id is not None:\n                    span.set_attribute(\n                        SpanAttributes.NET_PEER_NAME, event.connection_id[0]\n                    )\n                    span.set_attribute(\n                        SpanAttributes.NET_PEER_PORT, event.connection_id[1]\n                    )\n\n            # Add Span to dictionary\n            self._span_dict[_get_span_dict_key(event)] = span\n        except Exception as ex:  # noqa pylint: disable=broad-except\n            if span is not None and span.is_recording():\n                span.set_status(Status(StatusCode.ERROR, str(ex)))\n                span.end()\n                self._pop_span(event)\n\n    def succeeded(self, event: monitoring.CommandSucceededEvent):\n        \"\"\" Method to handle a pymongo CommandSucceededEvent \"\"\"\n        if not self.is_enabled or context.get_value(\n            _SUPPRESS_INSTRUMENTATION_KEY\n        ):\n            return\n        span = self._pop_span(event)\n        if span is None:\n            return\n        span.end()\n\n    def failed(self, event: monitoring.CommandFailedEvent):\n        \"\"\" Method to handle a pymongo CommandFailedEvent \"\"\"\n        if not self.is_enabled or context.get_value(\n            _SUPPRESS_INSTRUMENTATION_KEY\n        ):\n            return\n        span = self._pop_span(event)\n        if span is None:\n            return\n        if span.is_recording():\n            span.set_status(Status(StatusCode.ERROR, event.failure))\n        span.end()\n\n    def _pop_span(self, event):\n        return self._span_dict.pop(_get_span_dict_key(event), None)\n\n\ndef _get_span_dict_key(event):\n    if event.connection_id is not None:\n        return (event.request_id, event.connection_id)\n    return event.request_id\n\n\nclass PymongoInstrumentor(BaseInstrumentor):\n    _commandtracer_instance = None  # type CommandTracer\n    # The instrumentation for PyMongo is based on the event listener interface\n    # https://api.mongodb.com/python/current/api/pymongo/monitoring.html.\n    # This interface only allows to register listeners and does not provide\n    # an unregister API. In order to provide a mechanishm to disable\n    # instrumentation an enabled flag is implemented in CommandTracer,\n    # it's checked in the different listeners.\n\n    def instrumentation_dependencies(self) -> Collection[str]:\n        return _instruments\n\n    def _instrument(self, **kwargs):\n        \"\"\"Integrate with pymongo to trace it using event listener.\n        https://api.mongodb.com/python/current/api/pymongo/monitoring.html\n\n        Args:\n            tracer_provider: The `TracerProvider` to use. If none is passed the\n                current configured one is used.\n        \"\"\"\n\n        tracer_provider = kwargs.get(\"tracer_provider\")\n\n        # Create and register a CommandTracer only the first time\n        if self._commandtracer_instance is None:\n            tracer = get_tracer(__name__, __version__, tracer_provider)\n\n            self._commandtracer_instance = CommandTracer(tracer)\n            monitoring.register(self._commandtracer_instance)\n\n        # If already created, just enable it\n        self._commandtracer_instance.is_enabled = True\n\n    def _uninstrument(self, **kwargs):\n        if self._commandtracer_instance is not None:\n            self._commandtracer_instance.is_enabled = False\n", "path": "instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo/__init__.py"}]}