We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Consider removing exporters from MeterProvider __init__ parameters
From [this comment](https://github.com/open-telemetry/opentelemetry-python/pull/2296#discussion_r765002669).

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `opentelemetry-sdk/src/opentelemetry/sdk/_metrics/__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 from atexit import register, unregister
16 from logging import getLogger
17 from threading import Lock
18 from typing import Optional, Sequence
19 
20 from opentelemetry._metrics import Meter as APIMeter
21 from opentelemetry._metrics import MeterProvider as APIMeterProvider
22 from opentelemetry._metrics import _DefaultMeter
23 from opentelemetry._metrics.instrument import Counter as APICounter
24 from opentelemetry._metrics.instrument import Histogram as APIHistogram
25 from opentelemetry._metrics.instrument import (
26     ObservableCounter as APIObservableCounter,
27 )
28 from opentelemetry._metrics.instrument import (
29     ObservableGauge as APIObservableGauge,
30 )
31 from opentelemetry._metrics.instrument import (
32     ObservableUpDownCounter as APIObservableUpDownCounter,
33 )
34 from opentelemetry._metrics.instrument import UpDownCounter as APIUpDownCounter
35 from opentelemetry.sdk._metrics.export import MetricExporter
36 from opentelemetry.sdk._metrics.instrument import (
37     Counter,
38     Histogram,
39     ObservableCounter,
40     ObservableGauge,
41     ObservableUpDownCounter,
42     UpDownCounter,
43 )
44 from opentelemetry.sdk._metrics.metric_reader import MetricReader
45 from opentelemetry.sdk.resources import Resource
46 from opentelemetry.sdk.util.instrumentation import InstrumentationInfo
47 
48 _logger = getLogger(__name__)
49 
50 
51 class Meter(APIMeter):
52     def __init__(
53         self,
54         instrumentation_info: InstrumentationInfo,
55         meter_provider: APIMeterProvider,
56     ):
57         super().__init__(instrumentation_info)
58         self._instrumentation_info = instrumentation_info
59         self._meter_provider = meter_provider
60 
61     def create_counter(self, name, unit=None, description=None) -> APICounter:
62         return Counter(self._instrumentation_info, name, unit, description)
63 
64     def create_up_down_counter(
65         self, name, unit=None, description=None
66     ) -> APIUpDownCounter:
67         return UpDownCounter(
68             self._instrumentation_info, name, unit, description
69         )
70 
71     def create_observable_counter(
72         self, name, callback, unit=None, description=None
73     ) -> APIObservableCounter:
74         return ObservableCounter(
75             self._instrumentation_info, name, callback, unit, description
76         )
77 
78     def create_histogram(
79         self, name, unit=None, description=None
80     ) -> APIHistogram:
81         return Histogram(self._instrumentation_info, name, unit, description)
82 
83     def create_observable_gauge(
84         self, name, callback, unit=None, description=None
85     ) -> APIObservableGauge:
86         return ObservableGauge(
87             self._instrumentation_info, name, callback, unit, description
88         )
89 
90     def create_observable_up_down_counter(
91         self, name, callback, unit=None, description=None
92     ) -> APIObservableUpDownCounter:
93         return ObservableUpDownCounter(
94             self._instrumentation_info, name, callback, unit, description
95         )
96 
97 
98 class MeterProvider(APIMeterProvider):
99     """See `opentelemetry._metrics.MeterProvider`."""
100 
101     def __init__(
102         self,
103         metric_exporters: Sequence[MetricExporter] = (),
104         metric_readers: Sequence[MetricReader] = (),
105         resource: Resource = Resource.create({}),
106         shutdown_on_exit: bool = True,
107     ):
108         self._lock = Lock()
109         self._atexit_handler = None
110 
111         if shutdown_on_exit:
112             self._atexit_handler = register(self.shutdown)
113 
114         self._metric_readers = metric_readers
115 
116         for metric_reader in self._metric_readers:
117             metric_reader._register_meter_provider(self)
118 
119         self._metric_exporters = metric_exporters
120 
121         self._resource = resource
122         self._shutdown = False
123 
124     def force_flush(self) -> bool:
125 
126         # FIXME implement a timeout
127 
128         metric_reader_result = True
129         metric_exporter_result = True
130 
131         for metric_reader in self._metric_readers:
132             metric_reader_result = (
133                 metric_reader_result and metric_reader.force_flush()
134             )
135 
136         if not metric_reader_result:
137             _logger.warning("Unable to force flush all metric readers")
138 
139         for metric_exporter in self._metric_exporters:
140             metric_exporter_result = (
141                 metric_exporter_result and metric_exporter.force_flush()
142             )
143 
144         if not metric_exporter_result:
145             _logger.warning("Unable to force flush all metric exporters")
146 
147         return metric_reader_result and metric_exporter_result
148 
149     def shutdown(self):
150         # FIXME implement a timeout
151 
152         if self._shutdown:
153             _logger.warning("shutdown can only be called once")
154             return False
155 
156         result = True
157 
158         for metric_reader in self._metric_readers:
159             result = result and metric_reader.shutdown()
160 
161             if not result:
162                 _logger.warning("A MetricReader failed to shutdown")
163 
164         for metric_exporter in self._metric_exporters:
165             result = result and metric_exporter.shutdown()
166 
167             if not result:
168                 _logger.warning("A MetricExporter failed to shutdown")
169 
170         self._shutdown = True
171 
172         if self._atexit_handler is not None:
173             unregister(self._atexit_handler)
174             self._atexit_handler = None
175 
176         return result
177 
178     def get_meter(
179         self,
180         name: str,
181         version: Optional[str] = None,
182         schema_url: Optional[str] = None,
183     ) -> Meter:
184 
185         if self._shutdown:
186             _logger.warning(
187                 "A shutdown `MeterProvider` can not provide a `Meter`"
188             )
189             return _DefaultMeter(name, version=version, schema_url=schema_url)
190 
191         return Meter(InstrumentationInfo(name, version, schema_url), self)
192
```
--- 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/opentelemetry-sdk/src/opentelemetry/sdk/_metrics/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/_metrics/__init__.py
--- a/opentelemetry-sdk/src/opentelemetry/sdk/_metrics/__init__.py
+++ b/opentelemetry-sdk/src/opentelemetry/sdk/_metrics/__init__.py
@@ -32,7 +32,6 @@
     ObservableUpDownCounter as APIObservableUpDownCounter,
 )
 from opentelemetry._metrics.instrument import UpDownCounter as APIUpDownCounter
-from opentelemetry.sdk._metrics.export import MetricExporter
 from opentelemetry.sdk._metrics.instrument import (
     Counter,
     Histogram,
@@ -100,7 +99,6 @@
 
     def __init__(
         self,
-        metric_exporters: Sequence[MetricExporter] = (),
         metric_readers: Sequence[MetricReader] = (),
         resource: Resource = Resource.create({}),
         shutdown_on_exit: bool = True,
@@ -116,8 +114,6 @@
         for metric_reader in self._metric_readers:
             metric_reader._register_meter_provider(self)
 
-        self._metric_exporters = metric_exporters
-
         self._resource = resource
         self._shutdown = False
 
@@ -126,7 +122,6 @@
         # FIXME implement a timeout
 
         metric_reader_result = True
-        metric_exporter_result = True
 
         for metric_reader in self._metric_readers:
             metric_reader_result = (
@@ -136,15 +131,7 @@
         if not metric_reader_result:
             _logger.warning("Unable to force flush all metric readers")
 
-        for metric_exporter in self._metric_exporters:
-            metric_exporter_result = (
-                metric_exporter_result and metric_exporter.force_flush()
-            )
-
-        if not metric_exporter_result:
-            _logger.warning("Unable to force flush all metric exporters")
-
-        return metric_reader_result and metric_exporter_result
+        return metric_reader_result
 
     def shutdown(self):
         # FIXME implement a timeout
@@ -161,12 +148,6 @@
             if not result:
                 _logger.warning("A MetricReader failed to shutdown")
 
-        for metric_exporter in self._metric_exporters:
-            result = result and metric_exporter.shutdown()
-
-            if not result:
-                _logger.warning("A MetricExporter failed to shutdown")
-
         self._shutdown = True
 
         if self._atexit_handler is not None:

{"golden_diff": "diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/_metrics/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/_metrics/__init__.py\n--- a/opentelemetry-sdk/src/opentelemetry/sdk/_metrics/__init__.py\n+++ b/opentelemetry-sdk/src/opentelemetry/sdk/_metrics/__init__.py\n@@ -32,7 +32,6 @@\n     ObservableUpDownCounter as APIObservableUpDownCounter,\n )\n from opentelemetry._metrics.instrument import UpDownCounter as APIUpDownCounter\n-from opentelemetry.sdk._metrics.export import MetricExporter\n from opentelemetry.sdk._metrics.instrument import (\n     Counter,\n     Histogram,\n@@ -100,7 +99,6 @@\n \n     def __init__(\n         self,\n-        metric_exporters: Sequence[MetricExporter] = (),\n         metric_readers: Sequence[MetricReader] = (),\n         resource: Resource = Resource.create({}),\n         shutdown_on_exit: bool = True,\n@@ -116,8 +114,6 @@\n         for metric_reader in self._metric_readers:\n             metric_reader._register_meter_provider(self)\n \n-        self._metric_exporters = metric_exporters\n-\n         self._resource = resource\n         self._shutdown = False\n \n@@ -126,7 +122,6 @@\n         # FIXME implement a timeout\n \n         metric_reader_result = True\n-        metric_exporter_result = True\n \n         for metric_reader in self._metric_readers:\n             metric_reader_result = (\n@@ -136,15 +131,7 @@\n         if not metric_reader_result:\n             _logger.warning(\"Unable to force flush all metric readers\")\n \n-        for metric_exporter in self._metric_exporters:\n-            metric_exporter_result = (\n-                metric_exporter_result and metric_exporter.force_flush()\n-            )\n-\n-        if not metric_exporter_result:\n-            _logger.warning(\"Unable to force flush all metric exporters\")\n-\n-        return metric_reader_result and metric_exporter_result\n+        return metric_reader_result\n \n     def shutdown(self):\n         # FIXME implement a timeout\n@@ -161,12 +148,6 @@\n             if not result:\n                 _logger.warning(\"A MetricReader failed to shutdown\")\n \n-        for metric_exporter in self._metric_exporters:\n-            result = result and metric_exporter.shutdown()\n-\n-            if not result:\n-                _logger.warning(\"A MetricExporter failed to shutdown\")\n-\n         self._shutdown = True\n \n         if self._atexit_handler is not None:\n", "issue": "Consider removing exporters from MeterProvider __init__ parameters\nFrom [this comment](https://github.com/open-telemetry/opentelemetry-python/pull/2296#discussion_r765002669).\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\nfrom atexit import register, unregister\nfrom logging import getLogger\nfrom threading import Lock\nfrom typing import Optional, Sequence\n\nfrom opentelemetry._metrics import Meter as APIMeter\nfrom opentelemetry._metrics import MeterProvider as APIMeterProvider\nfrom opentelemetry._metrics import _DefaultMeter\nfrom opentelemetry._metrics.instrument import Counter as APICounter\nfrom opentelemetry._metrics.instrument import Histogram as APIHistogram\nfrom opentelemetry._metrics.instrument import (\n    ObservableCounter as APIObservableCounter,\n)\nfrom opentelemetry._metrics.instrument import (\n    ObservableGauge as APIObservableGauge,\n)\nfrom opentelemetry._metrics.instrument import (\n    ObservableUpDownCounter as APIObservableUpDownCounter,\n)\nfrom opentelemetry._metrics.instrument import UpDownCounter as APIUpDownCounter\nfrom opentelemetry.sdk._metrics.export import MetricExporter\nfrom opentelemetry.sdk._metrics.instrument import (\n    Counter,\n    Histogram,\n    ObservableCounter,\n    ObservableGauge,\n    ObservableUpDownCounter,\n    UpDownCounter,\n)\nfrom opentelemetry.sdk._metrics.metric_reader import MetricReader\nfrom opentelemetry.sdk.resources import Resource\nfrom opentelemetry.sdk.util.instrumentation import InstrumentationInfo\n\n_logger = getLogger(__name__)\n\n\nclass Meter(APIMeter):\n    def __init__(\n        self,\n        instrumentation_info: InstrumentationInfo,\n        meter_provider: APIMeterProvider,\n    ):\n        super().__init__(instrumentation_info)\n        self._instrumentation_info = instrumentation_info\n        self._meter_provider = meter_provider\n\n    def create_counter(self, name, unit=None, description=None) -> APICounter:\n        return Counter(self._instrumentation_info, name, unit, description)\n\n    def create_up_down_counter(\n        self, name, unit=None, description=None\n    ) -> APIUpDownCounter:\n        return UpDownCounter(\n            self._instrumentation_info, name, unit, description\n        )\n\n    def create_observable_counter(\n        self, name, callback, unit=None, description=None\n    ) -> APIObservableCounter:\n        return ObservableCounter(\n            self._instrumentation_info, name, callback, unit, description\n        )\n\n    def create_histogram(\n        self, name, unit=None, description=None\n    ) -> APIHistogram:\n        return Histogram(self._instrumentation_info, name, unit, description)\n\n    def create_observable_gauge(\n        self, name, callback, unit=None, description=None\n    ) -> APIObservableGauge:\n        return ObservableGauge(\n            self._instrumentation_info, name, callback, unit, description\n        )\n\n    def create_observable_up_down_counter(\n        self, name, callback, unit=None, description=None\n    ) -> APIObservableUpDownCounter:\n        return ObservableUpDownCounter(\n            self._instrumentation_info, name, callback, unit, description\n        )\n\n\nclass MeterProvider(APIMeterProvider):\n    \"\"\"See `opentelemetry._metrics.MeterProvider`.\"\"\"\n\n    def __init__(\n        self,\n        metric_exporters: Sequence[MetricExporter] = (),\n        metric_readers: Sequence[MetricReader] = (),\n        resource: Resource = Resource.create({}),\n        shutdown_on_exit: bool = True,\n    ):\n        self._lock = Lock()\n        self._atexit_handler = None\n\n        if shutdown_on_exit:\n            self._atexit_handler = register(self.shutdown)\n\n        self._metric_readers = metric_readers\n\n        for metric_reader in self._metric_readers:\n            metric_reader._register_meter_provider(self)\n\n        self._metric_exporters = metric_exporters\n\n        self._resource = resource\n        self._shutdown = False\n\n    def force_flush(self) -> bool:\n\n        # FIXME implement a timeout\n\n        metric_reader_result = True\n        metric_exporter_result = True\n\n        for metric_reader in self._metric_readers:\n            metric_reader_result = (\n                metric_reader_result and metric_reader.force_flush()\n            )\n\n        if not metric_reader_result:\n            _logger.warning(\"Unable to force flush all metric readers\")\n\n        for metric_exporter in self._metric_exporters:\n            metric_exporter_result = (\n                metric_exporter_result and metric_exporter.force_flush()\n            )\n\n        if not metric_exporter_result:\n            _logger.warning(\"Unable to force flush all metric exporters\")\n\n        return metric_reader_result and metric_exporter_result\n\n    def shutdown(self):\n        # FIXME implement a timeout\n\n        if self._shutdown:\n            _logger.warning(\"shutdown can only be called once\")\n            return False\n\n        result = True\n\n        for metric_reader in self._metric_readers:\n            result = result and metric_reader.shutdown()\n\n            if not result:\n                _logger.warning(\"A MetricReader failed to shutdown\")\n\n        for metric_exporter in self._metric_exporters:\n            result = result and metric_exporter.shutdown()\n\n            if not result:\n                _logger.warning(\"A MetricExporter failed to shutdown\")\n\n        self._shutdown = True\n\n        if self._atexit_handler is not None:\n            unregister(self._atexit_handler)\n            self._atexit_handler = None\n\n        return result\n\n    def get_meter(\n        self,\n        name: str,\n        version: Optional[str] = None,\n        schema_url: Optional[str] = None,\n    ) -> Meter:\n\n        if self._shutdown:\n            _logger.warning(\n                \"A shutdown `MeterProvider` can not provide a `Meter`\"\n            )\n            return _DefaultMeter(name, version=version, schema_url=schema_url)\n\n        return Meter(InstrumentationInfo(name, version, schema_url), self)\n", "path": "opentelemetry-sdk/src/opentelemetry/sdk/_metrics/__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\nfrom atexit import register, unregister\nfrom logging import getLogger\nfrom threading import Lock\nfrom typing import Optional, Sequence\n\nfrom opentelemetry._metrics import Meter as APIMeter\nfrom opentelemetry._metrics import MeterProvider as APIMeterProvider\nfrom opentelemetry._metrics import _DefaultMeter\nfrom opentelemetry._metrics.instrument import Counter as APICounter\nfrom opentelemetry._metrics.instrument import Histogram as APIHistogram\nfrom opentelemetry._metrics.instrument import (\n    ObservableCounter as APIObservableCounter,\n)\nfrom opentelemetry._metrics.instrument import (\n    ObservableGauge as APIObservableGauge,\n)\nfrom opentelemetry._metrics.instrument import (\n    ObservableUpDownCounter as APIObservableUpDownCounter,\n)\nfrom opentelemetry._metrics.instrument import UpDownCounter as APIUpDownCounter\nfrom opentelemetry.sdk._metrics.instrument import (\n    Counter,\n    Histogram,\n    ObservableCounter,\n    ObservableGauge,\n    ObservableUpDownCounter,\n    UpDownCounter,\n)\nfrom opentelemetry.sdk._metrics.metric_reader import MetricReader\nfrom opentelemetry.sdk.resources import Resource\nfrom opentelemetry.sdk.util.instrumentation import InstrumentationInfo\n\n_logger = getLogger(__name__)\n\n\nclass Meter(APIMeter):\n    def __init__(\n        self,\n        instrumentation_info: InstrumentationInfo,\n        meter_provider: APIMeterProvider,\n    ):\n        super().__init__(instrumentation_info)\n        self._instrumentation_info = instrumentation_info\n        self._meter_provider = meter_provider\n\n    def create_counter(self, name, unit=None, description=None) -> APICounter:\n        return Counter(self._instrumentation_info, name, unit, description)\n\n    def create_up_down_counter(\n        self, name, unit=None, description=None\n    ) -> APIUpDownCounter:\n        return UpDownCounter(\n            self._instrumentation_info, name, unit, description\n        )\n\n    def create_observable_counter(\n        self, name, callback, unit=None, description=None\n    ) -> APIObservableCounter:\n        return ObservableCounter(\n            self._instrumentation_info, name, callback, unit, description\n        )\n\n    def create_histogram(\n        self, name, unit=None, description=None\n    ) -> APIHistogram:\n        return Histogram(self._instrumentation_info, name, unit, description)\n\n    def create_observable_gauge(\n        self, name, callback, unit=None, description=None\n    ) -> APIObservableGauge:\n        return ObservableGauge(\n            self._instrumentation_info, name, callback, unit, description\n        )\n\n    def create_observable_up_down_counter(\n        self, name, callback, unit=None, description=None\n    ) -> APIObservableUpDownCounter:\n        return ObservableUpDownCounter(\n            self._instrumentation_info, name, callback, unit, description\n        )\n\n\nclass MeterProvider(APIMeterProvider):\n    \"\"\"See `opentelemetry._metrics.MeterProvider`.\"\"\"\n\n    def __init__(\n        self,\n        metric_readers: Sequence[MetricReader] = (),\n        resource: Resource = Resource.create({}),\n        shutdown_on_exit: bool = True,\n    ):\n        self._lock = Lock()\n        self._atexit_handler = None\n\n        if shutdown_on_exit:\n            self._atexit_handler = register(self.shutdown)\n\n        self._metric_readers = metric_readers\n\n        for metric_reader in self._metric_readers:\n            metric_reader._register_meter_provider(self)\n\n        self._resource = resource\n        self._shutdown = False\n\n    def force_flush(self) -> bool:\n\n        # FIXME implement a timeout\n\n        metric_reader_result = True\n\n        for metric_reader in self._metric_readers:\n            metric_reader_result = (\n                metric_reader_result and metric_reader.force_flush()\n            )\n\n        if not metric_reader_result:\n            _logger.warning(\"Unable to force flush all metric readers\")\n\n        return metric_reader_result\n\n    def shutdown(self):\n        # FIXME implement a timeout\n\n        if self._shutdown:\n            _logger.warning(\"shutdown can only be called once\")\n            return False\n\n        result = True\n\n        for metric_reader in self._metric_readers:\n            result = result and metric_reader.shutdown()\n\n            if not result:\n                _logger.warning(\"A MetricReader failed to shutdown\")\n\n        self._shutdown = True\n\n        if self._atexit_handler is not None:\n            unregister(self._atexit_handler)\n            self._atexit_handler = None\n\n        return result\n\n    def get_meter(\n        self,\n        name: str,\n        version: Optional[str] = None,\n        schema_url: Optional[str] = None,\n    ) -> Meter:\n\n        if self._shutdown:\n            _logger.warning(\n                \"A shutdown `MeterProvider` can not provide a `Meter`\"\n            )\n            return _DefaultMeter(name, version=version, schema_url=schema_url)\n\n        return Meter(InstrumentationInfo(name, version, schema_url), self)\n", "path": "opentelemetry-sdk/src/opentelemetry/sdk/_metrics/__init__.py"}]}