prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  pytest plugin starts tracer when plugin is disabled
  ### Which version of dd-trace-py are you using?
  
  1.1.1
  
  ### Which version of pip are you using?
  
  ```
  # pip --version
  pip 22.0.4 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)
  ```
  
  ### Which version of the libraries are you using?
  
  ```
  # pip freeze
  attrs==21.4.0
  ddsketch==2.0.1
  ddtrace==1.1.1
  iniconfig==1.1.1
  packaging==21.3
  pluggy==1.0.0
  protobuf==3.20.1
  py==1.11.0
  pyparsing==3.0.8
  pytest==7.1.2
  six==1.16.0
  tenacity==8.0.1
  tomli==2.0.1
  ```
  
  ### How can we reproduce your problem?
  
  Check out https://gist.github.com/majorgreys/f799970f731fdf70d865d18325e1c34d and run:
  
  ```
  docker run -it --rm (docker build -q .)
  ```
  
  ### What is the result that you get?
  
  `ddtrace` modules are imported by the Python interpreter. Importing any of these modules starts the global tracer.
  
  The workaround for this is to disable the `ddtrace` plugin with `-p no:ddtrace` in the command.
  
  ### What is the result that you expected?
  
  `ddtrace` should not be the modules imported by the Python interpreter.
  
  
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `ddtrace/contrib/pytest/__init__.py`
  Content:
  ```
  1 """
  2 The pytest integration traces test executions.
  3 
  4 Enabling
  5 ~~~~~~~~
  6 
  7 Enable traced execution of tests using ``pytest`` runner by
  8 running ``pytest --ddtrace`` or by modifying any configuration
  9 file read by pytest (``pytest.ini``, ``setup.cfg``, ...)::
  10 
  11     [pytest]
  12     ddtrace = 1
  13 
  14 You can enable all integrations by using the ``--ddtrace-patch-all`` option
  15 alongside ``--ddtrace`` or by adding this to your configuration::
  16 
  17     [pytest]
  18     ddtrace = 1
  19     ddtrace-patch-all = 1
  20 
  21 Global Configuration
  22 ~~~~~~~~~~~~~~~~~~~~
  23 
  24 .. py:data:: ddtrace.config.pytest["service"]
  25 
  26    The service name reported by default for pytest traces.
  27 
  28    This option can also be set with the integration specific ``DD_PYTEST_SERVICE`` environment
  29    variable, or more generally with the `DD_SERVICE` environment variable.
  30 
  31    Default: Name of the repository being tested, otherwise ``"pytest"`` if the repository name cannot be found.
  32 
  33 
  34 .. py:data:: ddtrace.config.pytest["operation_name"]
  35 
  36    The operation name reported by default for pytest traces.
  37 
  38    This option can also be set with the ``DD_PYTEST_OPERATION_NAME`` environment
  39    variable.
  40 
  41    Default: ``"pytest.test"``
  42 """
  43 
  44 import os
  45 
  46 from ddtrace import config
  47 
  48 
  49 # pytest default settings
  50 config._add(
  51     "pytest",
  52     dict(
  53         _default_service="pytest",
  54         operation_name=os.getenv("DD_PYTEST_OPERATION_NAME", default="pytest.test"),
  55     ),
  56 )
  57
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/ddtrace/contrib/pytest/__init__.py b/ddtrace/contrib/pytest/__init__.py
  --- a/ddtrace/contrib/pytest/__init__.py
  +++ b/ddtrace/contrib/pytest/__init__.py
  @@ -18,6 +18,22 @@
       ddtrace = 1
       ddtrace-patch-all = 1
   
  +
  +.. note::
  +   The ddtrace plugin for pytest has the side effect of importing the ddtrace
  +   package and starting a global tracer.
  +
  +   If this is causing issues for your pytest runs where traced execution of
  +   tests is not enabled, you can deactivate the plugin::
  +
  +     [pytest]
  +     addopts = -p no:ddtrace
  +
  +   See the `pytest documentation
  +   <https://docs.pytest.org/en/7.1.x/how-to/plugins.html#deactivating-unregistering-a-plugin-by-name>`_
  +   for more details.
  +
  +
   Global Configuration
   ~~~~~~~~~~~~~~~~~~~~
  
verification_info: {"golden_diff": "diff --git a/ddtrace/contrib/pytest/__init__.py b/ddtrace/contrib/pytest/__init__.py\n--- a/ddtrace/contrib/pytest/__init__.py\n+++ b/ddtrace/contrib/pytest/__init__.py\n@@ -18,6 +18,22 @@\n     ddtrace = 1\n     ddtrace-patch-all = 1\n \n+\n+.. note::\n+   The ddtrace plugin for pytest has the side effect of importing the ddtrace\n+   package and starting a global tracer.\n+\n+   If this is causing issues for your pytest runs where traced execution of\n+   tests is not enabled, you can deactivate the plugin::\n+\n+     [pytest]\n+     addopts = -p no:ddtrace\n+\n+   See the `pytest documentation\n+   <https://docs.pytest.org/en/7.1.x/how-to/plugins.html#deactivating-unregistering-a-plugin-by-name>`_\n+   for more details.\n+\n+\n Global Configuration\n ~~~~~~~~~~~~~~~~~~~~\n", "issue": "pytest plugin starts tracer when plugin is disabled\n### Which version of dd-trace-py are you using?\r\n\r\n1.1.1\r\n\r\n### Which version of pip are you using?\r\n\r\n```\r\n# pip --version\r\npip 22.0.4 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)\r\n```\r\n\r\n### Which version of the libraries are you using?\r\n\r\n```\r\n# pip freeze\r\nattrs==21.4.0\r\nddsketch==2.0.1\r\nddtrace==1.1.1\r\niniconfig==1.1.1\r\npackaging==21.3\r\npluggy==1.0.0\r\nprotobuf==3.20.1\r\npy==1.11.0\r\npyparsing==3.0.8\r\npytest==7.1.2\r\nsix==1.16.0\r\ntenacity==8.0.1\r\ntomli==2.0.1\r\n```\r\n\r\n### How can we reproduce your problem?\r\n\r\nCheck out https://gist.github.com/majorgreys/f799970f731fdf70d865d18325e1c34d and run:\r\n\r\n```\r\ndocker run -it --rm (docker build -q .)\r\n```\r\n\r\n### What is the result that you get?\r\n\r\n`ddtrace` modules are imported by the Python interpreter. Importing any of these modules starts the global tracer.\r\n\r\nThe workaround for this is to disable the `ddtrace` plugin with `-p no:ddtrace` in the command.\r\n\r\n### What is the result that you expected?\r\n\r\n`ddtrace` should not be the modules imported by the Python interpreter.\r\n\r\n\r\n\n", "before_files": [{"content": "\"\"\"\nThe pytest integration traces test executions.\n\nEnabling\n~~~~~~~~\n\nEnable traced execution of tests using ``pytest`` runner by\nrunning ``pytest --ddtrace`` or by modifying any configuration\nfile read by pytest (``pytest.ini``, ``setup.cfg``, ...)::\n\n    [pytest]\n    ddtrace = 1\n\nYou can enable all integrations by using the ``--ddtrace-patch-all`` option\nalongside ``--ddtrace`` or by adding this to your configuration::\n\n    [pytest]\n    ddtrace = 1\n    ddtrace-patch-all = 1\n\nGlobal Configuration\n~~~~~~~~~~~~~~~~~~~~\n\n.. py:data:: ddtrace.config.pytest[\"service\"]\n\n   The service name reported by default for pytest traces.\n\n   This option can also be set with the integration specific ``DD_PYTEST_SERVICE`` environment\n   variable, or more generally with the `DD_SERVICE` environment variable.\n\n   Default: Name of the repository being tested, otherwise ``\"pytest\"`` if the repository name cannot be found.\n\n\n.. py:data:: ddtrace.config.pytest[\"operation_name\"]\n\n   The operation name reported by default for pytest traces.\n\n   This option can also be set with the ``DD_PYTEST_OPERATION_NAME`` environment\n   variable.\n\n   Default: ``\"pytest.test\"``\n\"\"\"\n\nimport os\n\nfrom ddtrace import config\n\n\n# pytest default settings\nconfig._add(\n    \"pytest\",\n    dict(\n        _default_service=\"pytest\",\n        operation_name=os.getenv(\"DD_PYTEST_OPERATION_NAME\", default=\"pytest.test\"),\n    ),\n)\n", "path": "ddtrace/contrib/pytest/__init__.py"}], "after_files": [{"content": "\"\"\"\nThe pytest integration traces test executions.\n\nEnabling\n~~~~~~~~\n\nEnable traced execution of tests using ``pytest`` runner by\nrunning ``pytest --ddtrace`` or by modifying any configuration\nfile read by pytest (``pytest.ini``, ``setup.cfg``, ...)::\n\n    [pytest]\n    ddtrace = 1\n\nYou can enable all integrations by using the ``--ddtrace-patch-all`` option\nalongside ``--ddtrace`` or by adding this to your configuration::\n\n    [pytest]\n    ddtrace = 1\n    ddtrace-patch-all = 1\n\n\n.. note::\n   The ddtrace plugin for pytest has the side effect of importing the ddtrace\n   package and starting a global tracer.\n\n   If this is causing issues for your pytest runs where traced execution of\n   tests is not enabled, you can deactivate the plugin::\n\n     [pytest]\n     addopts = -p no:ddtrace\n\n   See the `pytest documentation\n   <https://docs.pytest.org/en/7.1.x/how-to/plugins.html#deactivating-unregistering-a-plugin-by-name>`_\n   for more details.\n\n\nGlobal Configuration\n~~~~~~~~~~~~~~~~~~~~\n\n.. py:data:: ddtrace.config.pytest[\"service\"]\n\n   The service name reported by default for pytest traces.\n\n   This option can also be set with the integration specific ``DD_PYTEST_SERVICE`` environment\n   variable, or more generally with the `DD_SERVICE` environment variable.\n\n   Default: Name of the repository being tested, otherwise ``\"pytest\"`` if the repository name cannot be found.\n\n\n.. py:data:: ddtrace.config.pytest[\"operation_name\"]\n\n   The operation name reported by default for pytest traces.\n\n   This option can also be set with the ``DD_PYTEST_OPERATION_NAME`` environment\n   variable.\n\n   Default: ``\"pytest.test\"``\n\"\"\"\n\nimport os\n\nfrom ddtrace import config\n\n\n# pytest default settings\nconfig._add(\n    \"pytest\",\n    dict(\n        _default_service=\"pytest\",\n        operation_name=os.getenv(\"DD_PYTEST_OPERATION_NAME\", default=\"pytest.test\"),\n    ),\n)\n", "path": "ddtrace/contrib/pytest/__init__.py"}]}