Skip to content

Commit

Permalink
Rename environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
ocelotl committed Feb 24, 2023
1 parent 24a92c1 commit 2cef304
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
12 changes: 7 additions & 5 deletions opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,11 +634,13 @@
The :envvar:`OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE` is the client certificate/chain trust for clients private key to use in mTLS communication in PEM format.
"""

_OTEL_RESOURCE_DETECTORS = "_OTEL_RESOURCE_DETECTORS"
OTEL_EXPERIMENTAL_RESOURCE_DETECTORS = "OTEL_EXPERIMENTALRESOURCE_DETECTORS"
"""
.. envvar:: _OTEL_RESOURCE_DETECTORS
.. envvar:: OTEL_EXPERIMENTAL_RESOURCE_DETECTORS
The :envvar:`_OTEL_RESOURCE_DETECTORS` is a comma-separated string of names of
resource detectors. These names must be the same as the names of entry points
for the `opentelemetry-resource-detectors` entry point.
The :envvar:`OTEL_EXPERIMENTAL_RESOURCE_DETECTORS` is a comma-separated string
of names of resource detectors. These names must be the same as the names of
entry points for the `opentelemetry-resource-detectors` entry point. This is an
experimental feature and the name of this variable and its behavior can change
in a non-backwards compatible way.
"""
4 changes: 2 additions & 2 deletions opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

from opentelemetry.attributes import BoundedAttributes
from opentelemetry.sdk.environment_variables import (
_OTEL_RESOURCE_DETECTORS,
OTEL_EXPERIMENTAL_RESOURCE_DETECTORS,
OTEL_RESOURCE_ATTRIBUTES,
OTEL_SERVICE_NAME,
)
Expand Down Expand Up @@ -170,7 +170,7 @@ def create(
resource = _DEFAULT_RESOURCE

for resource_detector in environ.get(
_OTEL_RESOURCE_DETECTORS, "otel"
OTEL_EXPERIMENTAL_RESOURCE_DETECTORS, "otel"
).split(","):

resource = resource.merge(
Expand Down
8 changes: 6 additions & 2 deletions opentelemetry-sdk/tests/resources/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
from unittest.mock import Mock, patch
from urllib import parse

from opentelemetry.sdk.environment_variables import _OTEL_RESOURCE_DETECTORS
from opentelemetry.sdk.environment_variables import (
OTEL_EXPERIMENTAL_RESOURCE_DETECTORS,
)
from opentelemetry.sdk.resources import (
_DEFAULT_RESOURCE,
_EMPTY_RESOURCE,
Expand Down Expand Up @@ -566,7 +568,9 @@ def test_resource_detector_entry_points_default(self):
self.assertEqual(resource.attributes["c"], "d")
self.assertEqual(resource.schema_url, "")

@patch.dict(environ, {_OTEL_RESOURCE_DETECTORS: "mock"}, clear=True)
@patch.dict(
environ, {OTEL_EXPERIMENTAL_RESOURCE_DETECTORS: "mock"}, clear=True
)
@patch(
"opentelemetry.sdk.resources.entry_points",
Mock(
Expand Down

0 comments on commit 2cef304

Please sign in to comment.