prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  ext/pyramid: add docs page
  An entry in the docs is missing for the pyramid instrumentation.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `ext/opentelemetry-ext-pyramid/src/opentelemetry/ext/pyramid/__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 Pyramid instrumentation supporting `pyramid`_, it can be enabled by
  17 using ``PyramidInstrumentor``.
  18 
  19 .. _pyramid: https://docs.pylonsproject.org/projects/pyramid/en/latest/
  20 
  21 Usage
  22 -----
  23     There are two methods to instrument Pyramid:
  24 
  25 Method 1 (Instrument all Configurators):
  26 ----------------------------------------
  27 .. code:: python
  28 
  29     from pyramid.config import Configurator
  30     from opentelemetry.ext.pyramid import PyramidInstrumentor
  31 
  32     PyramidInstrumentor.instrument()
  33 
  34     config = Configurator()
  35 
  36     # use your config as normal
  37     config.add_route('index', '/')
  38 
  39 Method 2 (Instrument one Configurator):
  40 ---------------------------------------
  41 .. code:: python
  42 
  43     from pyramid.config import Configurator
  44     from opentelemetry.ext.pyramid import PyramidInstrumentor
  45 
  46     config = Configurator()
  47     PyramidInstrumentor().instrument_config(config)
  48 
  49     # use your config as normal
  50     config.add_route('index', '/')
  51 
  52 Using ``pyramid.tweens`` settings:
  53 ----------------------------------
  54     If you use Method 2 and then set tweens for your application with the ``pyramid.tweens`` setting,
  55     you need to add ``opentelemetry.ext.pyramid.trace_tween_factory`` explicity to the list,
  56     *as well as* instrumenting the config with `PyramidInstrumentor().instrument_config(config)`.
  57 
  58     For example:
  59 .. code:: python
  60     settings = {
  61         'pyramid.tweens', 'opentelemetry.ext.pyramid.trace_tween_factory\\nyour_tween_no_1\\nyour_tween_no_2',
  62     }
  63     config = Configurator(settings=settings)
  64     PyramidInstrumentor.instrument_config(config)
  65 
  66     # use your config as normal.
  67     config.add_route('index', '/')
  68 ---
  69 """
  70 
  71 import typing
  72 
  73 from pyramid.config import Configurator
  74 from pyramid.path import caller_package
  75 from pyramid.settings import aslist
  76 from wrapt import ObjectProxy
  77 from wrapt import wrap_function_wrapper as _wrap
  78 
  79 from opentelemetry.ext.pyramid.callbacks import (
  80     SETTING_TRACE_ENABLED,
  81     TWEEN_NAME,
  82     trace_tween_factory,
  83 )
  84 from opentelemetry.ext.pyramid.version import __version__
  85 from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
  86 from opentelemetry.instrumentation.utils import unwrap
  87 from opentelemetry.trace import TracerProvider, get_tracer
  88 
  89 
  90 def traced_init(wrapped, instance, args, kwargs):
  91     settings = kwargs.get("settings", {})
  92     tweens = aslist(settings.get("pyramid.tweens", []))
  93 
  94     if tweens and TWEEN_NAME not in settings:
  95         # pyramid.tweens.EXCVIEW is the name of built-in exception view provided by
  96         # pyramid.  We need our tween to be before it, otherwise unhandled
  97         # exceptions will be caught before they reach our tween.
  98         tweens = [TWEEN_NAME] + tweens
  99 
  100         settings["pyramid.tweens"] = "\n".join(tweens)
  101 
  102     kwargs["settings"] = settings
  103 
  104     # `caller_package` works by walking a fixed amount of frames up the stack
  105     # to find the calling package. So if we let the original `__init__`
  106     # function call it, our wrapper will mess things up.
  107     if not kwargs.get("package", None):
  108         # Get the package for the third frame up from this one.
  109         # Default is `level=2` which will give us the package from `wrapt`
  110         # instead of the desired package (the caller)
  111         kwargs["package"] = caller_package(level=3)
  112 
  113     wrapped(*args, **kwargs)
  114     instance.include("opentelemetry.ext.pyramid.callbacks")
  115 
  116 
  117 class PyramidInstrumentor(BaseInstrumentor):
  118     def _instrument(self, **kwargs):
  119         """Integrate with Pyramid Python library.
  120         https://docs.pylonsproject.org/projects/pyramid/en/latest/
  121         """
  122         _wrap("pyramid.config", "Configurator.__init__", traced_init)
  123 
  124     def _uninstrument(self, **kwargs):
  125         """"Disable Pyramid instrumentation"""
  126         unwrap(Configurator, "__init__")
  127 
  128     # pylint:disable=no-self-use
  129     def instrument_config(self, config):
  130         """Enable instrumentation in a Pyramid configurator.
  131 
  132         Args:
  133             config: The Configurator to instrument.
  134 
  135         Returns:
  136             An instrumented Configurator.
  137         """
  138         config.include("opentelemetry.ext.pyramid.callbacks")
  139 
  140     def uninstrument_config(self, config):
  141         config.add_settings({SETTING_TRACE_ENABLED: False})
  142
  ```
  --- 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/ext/opentelemetry-ext-pyramid/src/opentelemetry/ext/pyramid/__init__.py b/ext/opentelemetry-ext-pyramid/src/opentelemetry/ext/pyramid/__init__.py
  --- a/ext/opentelemetry-ext-pyramid/src/opentelemetry/ext/pyramid/__init__.py
  +++ b/ext/opentelemetry-ext-pyramid/src/opentelemetry/ext/pyramid/__init__.py
  @@ -20,16 +20,17 @@
   
   Usage
   -----
  -    There are two methods to instrument Pyramid:
  +There are two methods to instrument Pyramid:
   
   Method 1 (Instrument all Configurators):
   ----------------------------------------
  +
   .. code:: python
   
       from pyramid.config import Configurator
       from opentelemetry.ext.pyramid import PyramidInstrumentor
   
  -    PyramidInstrumentor.instrument()
  +    PyramidInstrumentor().instrument()
   
       config = Configurator()
   
  @@ -38,6 +39,7 @@
   
   Method 2 (Instrument one Configurator):
   ---------------------------------------
  +
   .. code:: python
   
       from pyramid.config import Configurator
  @@ -49,22 +51,30 @@
       # use your config as normal
       config.add_route('index', '/')
   
  -Using ``pyramid.tweens`` settings:
  -----------------------------------
  -    If you use Method 2 and then set tweens for your application with the ``pyramid.tweens`` setting,
  -    you need to add ``opentelemetry.ext.pyramid.trace_tween_factory`` explicity to the list,
  -    *as well as* instrumenting the config with `PyramidInstrumentor().instrument_config(config)`.
  +Using ``pyramid.tweens`` setting:
  +---------------------------------
  +
  +If you use Method 2 and then set tweens for your application with the ``pyramid.tweens`` setting,
  +you need to add ``opentelemetry.ext.pyramid.trace_tween_factory`` explicity to the list,
  +*as well as* instrumenting the config as shown above.
  +
  +For example:
   
  -    For example:
   .. code:: python
  +
  +    from pyramid.config import Configurator
  +    from opentelemetry.ext.pyramid import PyramidInstrumentor
  +
       settings = {
           'pyramid.tweens', 'opentelemetry.ext.pyramid.trace_tween_factory\\nyour_tween_no_1\\nyour_tween_no_2',
       }
       config = Configurator(settings=settings)
  -    PyramidInstrumentor.instrument_config(config)
  +    PyramidInstrumentor().instrument_config(config)
   
       # use your config as normal.
       config.add_route('index', '/')
  +
  +API
   ---
   """
   
  @@ -87,7 +97,7 @@
   from opentelemetry.trace import TracerProvider, get_tracer
   
   
  -def traced_init(wrapped, instance, args, kwargs):
  +def _traced_init(wrapped, instance, args, kwargs):
       settings = kwargs.get("settings", {})
       tweens = aslist(settings.get("pyramid.tweens", []))
   
  @@ -119,7 +129,7 @@
           """Integrate with Pyramid Python library.
           https://docs.pylonsproject.org/projects/pyramid/en/latest/
           """
  -        _wrap("pyramid.config", "Configurator.__init__", traced_init)
  +        _wrap("pyramid.config", "Configurator.__init__", _traced_init)
   
       def _uninstrument(self, **kwargs):
           """"Disable Pyramid instrumentation"""
  @@ -131,9 +141,6 @@
   
           Args:
               config: The Configurator to instrument.
  -
  -        Returns:
  -            An instrumented Configurator.
           """
           config.include("opentelemetry.ext.pyramid.callbacks")
  
verification_info: {"golden_diff": "diff --git a/ext/opentelemetry-ext-pyramid/src/opentelemetry/ext/pyramid/__init__.py b/ext/opentelemetry-ext-pyramid/src/opentelemetry/ext/pyramid/__init__.py\n--- a/ext/opentelemetry-ext-pyramid/src/opentelemetry/ext/pyramid/__init__.py\n+++ b/ext/opentelemetry-ext-pyramid/src/opentelemetry/ext/pyramid/__init__.py\n@@ -20,16 +20,17 @@\n \n Usage\n -----\n-    There are two methods to instrument Pyramid:\n+There are two methods to instrument Pyramid:\n \n Method 1 (Instrument all Configurators):\n ----------------------------------------\n+\n .. code:: python\n \n     from pyramid.config import Configurator\n     from opentelemetry.ext.pyramid import PyramidInstrumentor\n \n-    PyramidInstrumentor.instrument()\n+    PyramidInstrumentor().instrument()\n \n     config = Configurator()\n \n@@ -38,6 +39,7 @@\n \n Method 2 (Instrument one Configurator):\n ---------------------------------------\n+\n .. code:: python\n \n     from pyramid.config import Configurator\n@@ -49,22 +51,30 @@\n     # use your config as normal\n     config.add_route('index', '/')\n \n-Using ``pyramid.tweens`` settings:\n-----------------------------------\n-    If you use Method 2 and then set tweens for your application with the ``pyramid.tweens`` setting,\n-    you need to add ``opentelemetry.ext.pyramid.trace_tween_factory`` explicity to the list,\n-    *as well as* instrumenting the config with `PyramidInstrumentor().instrument_config(config)`.\n+Using ``pyramid.tweens`` setting:\n+---------------------------------\n+\n+If you use Method 2 and then set tweens for your application with the ``pyramid.tweens`` setting,\n+you need to add ``opentelemetry.ext.pyramid.trace_tween_factory`` explicity to the list,\n+*as well as* instrumenting the config as shown above.\n+\n+For example:\n \n-    For example:\n .. code:: python\n+\n+    from pyramid.config import Configurator\n+    from opentelemetry.ext.pyramid import PyramidInstrumentor\n+\n     settings = {\n         'pyramid.tweens', 'opentelemetry.ext.pyramid.trace_tween_factory\\\\nyour_tween_no_1\\\\nyour_tween_no_2',\n     }\n     config = Configurator(settings=settings)\n-    PyramidInstrumentor.instrument_config(config)\n+    PyramidInstrumentor().instrument_config(config)\n \n     # use your config as normal.\n     config.add_route('index', '/')\n+\n+API\n ---\n \"\"\"\n \n@@ -87,7 +97,7 @@\n from opentelemetry.trace import TracerProvider, get_tracer\n \n \n-def traced_init(wrapped, instance, args, kwargs):\n+def _traced_init(wrapped, instance, args, kwargs):\n     settings = kwargs.get(\"settings\", {})\n     tweens = aslist(settings.get(\"pyramid.tweens\", []))\n \n@@ -119,7 +129,7 @@\n         \"\"\"Integrate with Pyramid Python library.\n         https://docs.pylonsproject.org/projects/pyramid/en/latest/\n         \"\"\"\n-        _wrap(\"pyramid.config\", \"Configurator.__init__\", traced_init)\n+        _wrap(\"pyramid.config\", \"Configurator.__init__\", _traced_init)\n \n     def _uninstrument(self, **kwargs):\n         \"\"\"\"Disable Pyramid instrumentation\"\"\"\n@@ -131,9 +141,6 @@\n \n         Args:\n             config: The Configurator to instrument.\n-\n-        Returns:\n-            An instrumented Configurator.\n         \"\"\"\n         config.include(\"opentelemetry.ext.pyramid.callbacks\")\n", "issue": "ext/pyramid: add docs page\nAn entry in the docs is missing for the pyramid instrumentation.\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\"\"\"\nPyramid instrumentation supporting `pyramid`_, it can be enabled by\nusing ``PyramidInstrumentor``.\n\n.. _pyramid: https://docs.pylonsproject.org/projects/pyramid/en/latest/\n\nUsage\n-----\n    There are two methods to instrument Pyramid:\n\nMethod 1 (Instrument all Configurators):\n----------------------------------------\n.. code:: python\n\n    from pyramid.config import Configurator\n    from opentelemetry.ext.pyramid import PyramidInstrumentor\n\n    PyramidInstrumentor.instrument()\n\n    config = Configurator()\n\n    # use your config as normal\n    config.add_route('index', '/')\n\nMethod 2 (Instrument one Configurator):\n---------------------------------------\n.. code:: python\n\n    from pyramid.config import Configurator\n    from opentelemetry.ext.pyramid import PyramidInstrumentor\n\n    config = Configurator()\n    PyramidInstrumentor().instrument_config(config)\n\n    # use your config as normal\n    config.add_route('index', '/')\n\nUsing ``pyramid.tweens`` settings:\n----------------------------------\n    If you use Method 2 and then set tweens for your application with the ``pyramid.tweens`` setting,\n    you need to add ``opentelemetry.ext.pyramid.trace_tween_factory`` explicity to the list,\n    *as well as* instrumenting the config with `PyramidInstrumentor().instrument_config(config)`.\n\n    For example:\n.. code:: python\n    settings = {\n        'pyramid.tweens', 'opentelemetry.ext.pyramid.trace_tween_factory\\\\nyour_tween_no_1\\\\nyour_tween_no_2',\n    }\n    config = Configurator(settings=settings)\n    PyramidInstrumentor.instrument_config(config)\n\n    # use your config as normal.\n    config.add_route('index', '/')\n---\n\"\"\"\n\nimport typing\n\nfrom pyramid.config import Configurator\nfrom pyramid.path import caller_package\nfrom pyramid.settings import aslist\nfrom wrapt import ObjectProxy\nfrom wrapt import wrap_function_wrapper as _wrap\n\nfrom opentelemetry.ext.pyramid.callbacks import (\n    SETTING_TRACE_ENABLED,\n    TWEEN_NAME,\n    trace_tween_factory,\n)\nfrom opentelemetry.ext.pyramid.version import __version__\nfrom opentelemetry.instrumentation.instrumentor import BaseInstrumentor\nfrom opentelemetry.instrumentation.utils import unwrap\nfrom opentelemetry.trace import TracerProvider, get_tracer\n\n\ndef traced_init(wrapped, instance, args, kwargs):\n    settings = kwargs.get(\"settings\", {})\n    tweens = aslist(settings.get(\"pyramid.tweens\", []))\n\n    if tweens and TWEEN_NAME not in settings:\n        # pyramid.tweens.EXCVIEW is the name of built-in exception view provided by\n        # pyramid.  We need our tween to be before it, otherwise unhandled\n        # exceptions will be caught before they reach our tween.\n        tweens = [TWEEN_NAME] + tweens\n\n        settings[\"pyramid.tweens\"] = \"\\n\".join(tweens)\n\n    kwargs[\"settings\"] = settings\n\n    # `caller_package` works by walking a fixed amount of frames up the stack\n    # to find the calling package. So if we let the original `__init__`\n    # function call it, our wrapper will mess things up.\n    if not kwargs.get(\"package\", None):\n        # Get the package for the third frame up from this one.\n        # Default is `level=2` which will give us the package from `wrapt`\n        # instead of the desired package (the caller)\n        kwargs[\"package\"] = caller_package(level=3)\n\n    wrapped(*args, **kwargs)\n    instance.include(\"opentelemetry.ext.pyramid.callbacks\")\n\n\nclass PyramidInstrumentor(BaseInstrumentor):\n    def _instrument(self, **kwargs):\n        \"\"\"Integrate with Pyramid Python library.\n        https://docs.pylonsproject.org/projects/pyramid/en/latest/\n        \"\"\"\n        _wrap(\"pyramid.config\", \"Configurator.__init__\", traced_init)\n\n    def _uninstrument(self, **kwargs):\n        \"\"\"\"Disable Pyramid instrumentation\"\"\"\n        unwrap(Configurator, \"__init__\")\n\n    # pylint:disable=no-self-use\n    def instrument_config(self, config):\n        \"\"\"Enable instrumentation in a Pyramid configurator.\n\n        Args:\n            config: The Configurator to instrument.\n\n        Returns:\n            An instrumented Configurator.\n        \"\"\"\n        config.include(\"opentelemetry.ext.pyramid.callbacks\")\n\n    def uninstrument_config(self, config):\n        config.add_settings({SETTING_TRACE_ENABLED: False})\n", "path": "ext/opentelemetry-ext-pyramid/src/opentelemetry/ext/pyramid/__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\"\"\"\nPyramid instrumentation supporting `pyramid`_, it can be enabled by\nusing ``PyramidInstrumentor``.\n\n.. _pyramid: https://docs.pylonsproject.org/projects/pyramid/en/latest/\n\nUsage\n-----\nThere are two methods to instrument Pyramid:\n\nMethod 1 (Instrument all Configurators):\n----------------------------------------\n\n.. code:: python\n\n    from pyramid.config import Configurator\n    from opentelemetry.ext.pyramid import PyramidInstrumentor\n\n    PyramidInstrumentor().instrument()\n\n    config = Configurator()\n\n    # use your config as normal\n    config.add_route('index', '/')\n\nMethod 2 (Instrument one Configurator):\n---------------------------------------\n\n.. code:: python\n\n    from pyramid.config import Configurator\n    from opentelemetry.ext.pyramid import PyramidInstrumentor\n\n    config = Configurator()\n    PyramidInstrumentor().instrument_config(config)\n\n    # use your config as normal\n    config.add_route('index', '/')\n\nUsing ``pyramid.tweens`` setting:\n---------------------------------\n\nIf you use Method 2 and then set tweens for your application with the ``pyramid.tweens`` setting,\nyou need to add ``opentelemetry.ext.pyramid.trace_tween_factory`` explicity to the list,\n*as well as* instrumenting the config as shown above.\n\nFor example:\n\n.. code:: python\n\n    from pyramid.config import Configurator\n    from opentelemetry.ext.pyramid import PyramidInstrumentor\n\n    settings = {\n        'pyramid.tweens', 'opentelemetry.ext.pyramid.trace_tween_factory\\\\nyour_tween_no_1\\\\nyour_tween_no_2',\n    }\n    config = Configurator(settings=settings)\n    PyramidInstrumentor().instrument_config(config)\n\n    # use your config as normal.\n    config.add_route('index', '/')\n\nAPI\n---\n\"\"\"\n\nimport typing\n\nfrom pyramid.config import Configurator\nfrom pyramid.path import caller_package\nfrom pyramid.settings import aslist\nfrom wrapt import ObjectProxy\nfrom wrapt import wrap_function_wrapper as _wrap\n\nfrom opentelemetry.ext.pyramid.callbacks import (\n    SETTING_TRACE_ENABLED,\n    TWEEN_NAME,\n    trace_tween_factory,\n)\nfrom opentelemetry.ext.pyramid.version import __version__\nfrom opentelemetry.instrumentation.instrumentor import BaseInstrumentor\nfrom opentelemetry.instrumentation.utils import unwrap\nfrom opentelemetry.trace import TracerProvider, get_tracer\n\n\ndef _traced_init(wrapped, instance, args, kwargs):\n    settings = kwargs.get(\"settings\", {})\n    tweens = aslist(settings.get(\"pyramid.tweens\", []))\n\n    if tweens and TWEEN_NAME not in settings:\n        # pyramid.tweens.EXCVIEW is the name of built-in exception view provided by\n        # pyramid.  We need our tween to be before it, otherwise unhandled\n        # exceptions will be caught before they reach our tween.\n        tweens = [TWEEN_NAME] + tweens\n\n        settings[\"pyramid.tweens\"] = \"\\n\".join(tweens)\n\n    kwargs[\"settings\"] = settings\n\n    # `caller_package` works by walking a fixed amount of frames up the stack\n    # to find the calling package. So if we let the original `__init__`\n    # function call it, our wrapper will mess things up.\n    if not kwargs.get(\"package\", None):\n        # Get the package for the third frame up from this one.\n        # Default is `level=2` which will give us the package from `wrapt`\n        # instead of the desired package (the caller)\n        kwargs[\"package\"] = caller_package(level=3)\n\n    wrapped(*args, **kwargs)\n    instance.include(\"opentelemetry.ext.pyramid.callbacks\")\n\n\nclass PyramidInstrumentor(BaseInstrumentor):\n    def _instrument(self, **kwargs):\n        \"\"\"Integrate with Pyramid Python library.\n        https://docs.pylonsproject.org/projects/pyramid/en/latest/\n        \"\"\"\n        _wrap(\"pyramid.config\", \"Configurator.__init__\", _traced_init)\n\n    def _uninstrument(self, **kwargs):\n        \"\"\"\"Disable Pyramid instrumentation\"\"\"\n        unwrap(Configurator, \"__init__\")\n\n    # pylint:disable=no-self-use\n    def instrument_config(self, config):\n        \"\"\"Enable instrumentation in a Pyramid configurator.\n\n        Args:\n            config: The Configurator to instrument.\n        \"\"\"\n        config.include(\"opentelemetry.ext.pyramid.callbacks\")\n\n    def uninstrument_config(self, config):\n        config.add_settings({SETTING_TRACE_ENABLED: False})\n", "path": "ext/opentelemetry-ext-pyramid/src/opentelemetry/ext/pyramid/__init__.py"}]}