prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Tracer and Meter provider lack environment variables
  Now that `Configuration` has been removed, both providers should use consistent environment variables.
  
  --- 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-api/src/opentelemetry/environment_variables/__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 OTEL_PROPAGATORS = "OTEL_PROPAGATORS"
  16 OTEL_PYTHON_CONTEXT = "OTEL_PYTHON_CONTEXT"
  17 OTEL_PYTHON_DISABLED_INSTRUMENTATIONS = "OTEL_PYTHON_DISABLED_INSTRUMENTATIONS"
  18 OTEL_PYTHON_IDS_GENERATOR = "OTEL_PYTHON_IDS_GENERATOR"
  19 OTEL_PYTHON_SERVICE_NAME = "OTEL_PYTHON_SERVICE_NAME"
  20 OTEL_TRACE_EXPORTER = "OTEL_TRACE_EXPORTER"
  21 OTEL_METRICS_EXPORTER = "OTEL_METRICS_EXPORTER"
  22
  ```
  
  Path: `opentelemetry-api/src/opentelemetry/util/__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 import time
  16 from logging import getLogger
  17 from os import environ
  18 from typing import TYPE_CHECKING, Union, cast
  19 
  20 from pkg_resources import iter_entry_points
  21 
  22 if TYPE_CHECKING:
  23     from opentelemetry.metrics import MeterProvider
  24     from opentelemetry.trace import TracerProvider
  25 
  26 Provider = Union["TracerProvider", "MeterProvider"]
  27 
  28 logger = getLogger(__name__)
  29 
  30 # Since we want API users to be able to provide timestamps,
  31 # this needs to be in the API.
  32 
  33 try:
  34     time_ns = time.time_ns
  35 # Python versions < 3.7
  36 except AttributeError:
  37 
  38     def time_ns() -> int:
  39         return int(time.time() * 1e9)
  40 
  41 
  42 def _load_provider(provider: str) -> Provider:
  43     try:
  44         entry_point = next(
  45             iter_entry_points(
  46                 "opentelemetry_{}".format(provider),
  47                 name=cast(
  48                     str,
  49                     environ.get(
  50                         provider.upper(), "default_{}".format(provider),
  51                     ),
  52                 ),
  53             )
  54         )
  55         return cast(Provider, entry_point.load()(),)
  56     except Exception:  # pylint: disable=broad-except
  57         logger.error("Failed to load configured provider %s", provider)
  58         raise
  59 
  60 
  61 def _load_meter_provider(provider: str) -> "MeterProvider":
  62     return cast("MeterProvider", _load_provider(provider))
  63 
  64 
  65 def _load_trace_provider(provider: str) -> "TracerProvider":
  66     return cast("TracerProvider", _load_provider(provider))
  67
  ```
  --- 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/opentelemetry-api/src/opentelemetry/environment_variables/__init__.py b/opentelemetry-api/src/opentelemetry/environment_variables/__init__.py
  --- a/opentelemetry-api/src/opentelemetry/environment_variables/__init__.py
  +++ b/opentelemetry-api/src/opentelemetry/environment_variables/__init__.py
  @@ -19,3 +19,5 @@
   OTEL_PYTHON_SERVICE_NAME = "OTEL_PYTHON_SERVICE_NAME"
   OTEL_TRACE_EXPORTER = "OTEL_TRACE_EXPORTER"
   OTEL_METRICS_EXPORTER = "OTEL_METRICS_EXPORTER"
  +OTEL_PYTHON_TRACER_PROVIDER = "OTEL_PYTHON_TRACER_PROVIDER"
  +OTEL_PYTHON_METER_PROVIDER = "OTEL_PYTHON_METER_PROVIDER"
  diff --git a/opentelemetry-api/src/opentelemetry/util/__init__.py b/opentelemetry-api/src/opentelemetry/util/__init__.py
  --- a/opentelemetry-api/src/opentelemetry/util/__init__.py
  +++ b/opentelemetry-api/src/opentelemetry/util/__init__.py
  @@ -19,6 +19,11 @@
   
   from pkg_resources import iter_entry_points
   
  +from opentelemetry.environment_variables import (
  +    OTEL_PYTHON_METER_PROVIDER,
  +    OTEL_PYTHON_TRACER_PROVIDER,
  +)
  +
   if TYPE_CHECKING:
       from opentelemetry.metrics import MeterProvider
       from opentelemetry.trace import TracerProvider
  @@ -39,7 +44,9 @@
           return int(time.time() * 1e9)
   
   
  -def _load_provider(provider: str) -> Provider:
  +def _load_provider(
  +    provider_environment_variable: str, provider: str
  +) -> Provider:
       try:
           entry_point = next(
               iter_entry_points(
  @@ -47,7 +54,8 @@
                   name=cast(
                       str,
                       environ.get(
  -                        provider.upper(), "default_{}".format(provider),
  +                        provider_environment_variable,
  +                        "default_{}".format(provider),
                       ),
                   ),
               )
  @@ -59,8 +67,13 @@
   
   
   def _load_meter_provider(provider: str) -> "MeterProvider":
  -    return cast("MeterProvider", _load_provider(provider))
  +    return cast(
  +        "MeterProvider", _load_provider(OTEL_PYTHON_METER_PROVIDER, provider),
  +    )
   
   
   def _load_trace_provider(provider: str) -> "TracerProvider":
  -    return cast("TracerProvider", _load_provider(provider))
  +    return cast(
  +        "TracerProvider",
  +        _load_provider(OTEL_PYTHON_TRACER_PROVIDER, provider),
  +    )
  
verification_info: {"golden_diff": "diff --git a/opentelemetry-api/src/opentelemetry/environment_variables/__init__.py b/opentelemetry-api/src/opentelemetry/environment_variables/__init__.py\n--- a/opentelemetry-api/src/opentelemetry/environment_variables/__init__.py\n+++ b/opentelemetry-api/src/opentelemetry/environment_variables/__init__.py\n@@ -19,3 +19,5 @@\n OTEL_PYTHON_SERVICE_NAME = \"OTEL_PYTHON_SERVICE_NAME\"\n OTEL_TRACE_EXPORTER = \"OTEL_TRACE_EXPORTER\"\n OTEL_METRICS_EXPORTER = \"OTEL_METRICS_EXPORTER\"\n+OTEL_PYTHON_TRACER_PROVIDER = \"OTEL_PYTHON_TRACER_PROVIDER\"\n+OTEL_PYTHON_METER_PROVIDER = \"OTEL_PYTHON_METER_PROVIDER\"\ndiff --git a/opentelemetry-api/src/opentelemetry/util/__init__.py b/opentelemetry-api/src/opentelemetry/util/__init__.py\n--- a/opentelemetry-api/src/opentelemetry/util/__init__.py\n+++ b/opentelemetry-api/src/opentelemetry/util/__init__.py\n@@ -19,6 +19,11 @@\n \n from pkg_resources import iter_entry_points\n \n+from opentelemetry.environment_variables import (\n+    OTEL_PYTHON_METER_PROVIDER,\n+    OTEL_PYTHON_TRACER_PROVIDER,\n+)\n+\n if TYPE_CHECKING:\n     from opentelemetry.metrics import MeterProvider\n     from opentelemetry.trace import TracerProvider\n@@ -39,7 +44,9 @@\n         return int(time.time() * 1e9)\n \n \n-def _load_provider(provider: str) -> Provider:\n+def _load_provider(\n+    provider_environment_variable: str, provider: str\n+) -> Provider:\n     try:\n         entry_point = next(\n             iter_entry_points(\n@@ -47,7 +54,8 @@\n                 name=cast(\n                     str,\n                     environ.get(\n-                        provider.upper(), \"default_{}\".format(provider),\n+                        provider_environment_variable,\n+                        \"default_{}\".format(provider),\n                     ),\n                 ),\n             )\n@@ -59,8 +67,13 @@\n \n \n def _load_meter_provider(provider: str) -> \"MeterProvider\":\n-    return cast(\"MeterProvider\", _load_provider(provider))\n+    return cast(\n+        \"MeterProvider\", _load_provider(OTEL_PYTHON_METER_PROVIDER, provider),\n+    )\n \n \n def _load_trace_provider(provider: str) -> \"TracerProvider\":\n-    return cast(\"TracerProvider\", _load_provider(provider))\n+    return cast(\n+        \"TracerProvider\",\n+        _load_provider(OTEL_PYTHON_TRACER_PROVIDER, provider),\n+    )\n", "issue": "Tracer and Meter provider lack environment variables\nNow that `Configuration` has been removed, both providers should use consistent environment variables.\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\nOTEL_PROPAGATORS = \"OTEL_PROPAGATORS\"\nOTEL_PYTHON_CONTEXT = \"OTEL_PYTHON_CONTEXT\"\nOTEL_PYTHON_DISABLED_INSTRUMENTATIONS = \"OTEL_PYTHON_DISABLED_INSTRUMENTATIONS\"\nOTEL_PYTHON_IDS_GENERATOR = \"OTEL_PYTHON_IDS_GENERATOR\"\nOTEL_PYTHON_SERVICE_NAME = \"OTEL_PYTHON_SERVICE_NAME\"\nOTEL_TRACE_EXPORTER = \"OTEL_TRACE_EXPORTER\"\nOTEL_METRICS_EXPORTER = \"OTEL_METRICS_EXPORTER\"\n", "path": "opentelemetry-api/src/opentelemetry/environment_variables/__init__.py"}, {"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\nimport time\nfrom logging import getLogger\nfrom os import environ\nfrom typing import TYPE_CHECKING, Union, cast\n\nfrom pkg_resources import iter_entry_points\n\nif TYPE_CHECKING:\n    from opentelemetry.metrics import MeterProvider\n    from opentelemetry.trace import TracerProvider\n\nProvider = Union[\"TracerProvider\", \"MeterProvider\"]\n\nlogger = getLogger(__name__)\n\n# Since we want API users to be able to provide timestamps,\n# this needs to be in the API.\n\ntry:\n    time_ns = time.time_ns\n# Python versions < 3.7\nexcept AttributeError:\n\n    def time_ns() -> int:\n        return int(time.time() * 1e9)\n\n\ndef _load_provider(provider: str) -> Provider:\n    try:\n        entry_point = next(\n            iter_entry_points(\n                \"opentelemetry_{}\".format(provider),\n                name=cast(\n                    str,\n                    environ.get(\n                        provider.upper(), \"default_{}\".format(provider),\n                    ),\n                ),\n            )\n        )\n        return cast(Provider, entry_point.load()(),)\n    except Exception:  # pylint: disable=broad-except\n        logger.error(\"Failed to load configured provider %s\", provider)\n        raise\n\n\ndef _load_meter_provider(provider: str) -> \"MeterProvider\":\n    return cast(\"MeterProvider\", _load_provider(provider))\n\n\ndef _load_trace_provider(provider: str) -> \"TracerProvider\":\n    return cast(\"TracerProvider\", _load_provider(provider))\n", "path": "opentelemetry-api/src/opentelemetry/util/__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\nOTEL_PROPAGATORS = \"OTEL_PROPAGATORS\"\nOTEL_PYTHON_CONTEXT = \"OTEL_PYTHON_CONTEXT\"\nOTEL_PYTHON_DISABLED_INSTRUMENTATIONS = \"OTEL_PYTHON_DISABLED_INSTRUMENTATIONS\"\nOTEL_PYTHON_IDS_GENERATOR = \"OTEL_PYTHON_IDS_GENERATOR\"\nOTEL_PYTHON_SERVICE_NAME = \"OTEL_PYTHON_SERVICE_NAME\"\nOTEL_TRACE_EXPORTER = \"OTEL_TRACE_EXPORTER\"\nOTEL_METRICS_EXPORTER = \"OTEL_METRICS_EXPORTER\"\nOTEL_PYTHON_TRACER_PROVIDER = \"OTEL_PYTHON_TRACER_PROVIDER\"\nOTEL_PYTHON_METER_PROVIDER = \"OTEL_PYTHON_METER_PROVIDER\"\n", "path": "opentelemetry-api/src/opentelemetry/environment_variables/__init__.py"}, {"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\nimport time\nfrom logging import getLogger\nfrom os import environ\nfrom typing import TYPE_CHECKING, Union, cast\n\nfrom pkg_resources import iter_entry_points\n\nfrom opentelemetry.environment_variables import (\n    OTEL_PYTHON_METER_PROVIDER,\n    OTEL_PYTHON_TRACER_PROVIDER,\n)\n\nif TYPE_CHECKING:\n    from opentelemetry.metrics import MeterProvider\n    from opentelemetry.trace import TracerProvider\n\nProvider = Union[\"TracerProvider\", \"MeterProvider\"]\n\nlogger = getLogger(__name__)\n\n# Since we want API users to be able to provide timestamps,\n# this needs to be in the API.\n\ntry:\n    time_ns = time.time_ns\n# Python versions < 3.7\nexcept AttributeError:\n\n    def time_ns() -> int:\n        return int(time.time() * 1e9)\n\n\ndef _load_provider(\n    provider_environment_variable: str, provider: str\n) -> Provider:\n    try:\n        entry_point = next(\n            iter_entry_points(\n                \"opentelemetry_{}\".format(provider),\n                name=cast(\n                    str,\n                    environ.get(\n                        provider_environment_variable,\n                        \"default_{}\".format(provider),\n                    ),\n                ),\n            )\n        )\n        return cast(Provider, entry_point.load()(),)\n    except Exception:  # pylint: disable=broad-except\n        logger.error(\"Failed to load configured provider %s\", provider)\n        raise\n\n\ndef _load_meter_provider(provider: str) -> \"MeterProvider\":\n    return cast(\n        \"MeterProvider\", _load_provider(OTEL_PYTHON_METER_PROVIDER, provider),\n    )\n\n\ndef _load_trace_provider(provider: str) -> \"TracerProvider\":\n    return cast(\n        \"TracerProvider\",\n        _load_provider(OTEL_PYTHON_TRACER_PROVIDER, provider),\n    )\n", "path": "opentelemetry-api/src/opentelemetry/util/__init__.py"}]}