From 4bfa280ec0c6228513c6a00edeb36e364f5e9b21 Mon Sep 17 00:00:00 2001 From: Raphael Manke Date: Mon, 9 Feb 2026 20:48:28 +0100 Subject: [PATCH 1/5] feat(lambda): read cloud.account.id from symlink in Lambda resource detector Read /tmp/.otel-account-id via os.readlink() and set the cloud.account.id resource attribute when the symlink exists. Silently skip when the symlink is absent (OSError caught). --- .../sdk/extension/aws/resource/_lambda.py | 47 ++++--- .../tests/resource/test__lambda.py | 115 ++++++++++++++++++ 2 files changed, 143 insertions(+), 19 deletions(-) diff --git a/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/resource/_lambda.py b/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/resource/_lambda.py index 6f8fe68048..9b40afe1f0 100644 --- a/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/resource/_lambda.py +++ b/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/resource/_lambda.py @@ -13,6 +13,7 @@ # limitations under the License. import logging +import os from os import environ from opentelemetry.sdk.resources import Resource, ResourceDetector @@ -24,6 +25,8 @@ logger = logging.getLogger(__name__) +_ACCOUNT_ID_SYMLINK_PATH = "/tmp/.otel-account-id" + class AwsLambdaResourceDetector(ResourceDetector): """Detects attribute values only available when the app is running on AWS @@ -34,25 +37,31 @@ class AwsLambdaResourceDetector(ResourceDetector): def detect(self) -> "Resource": try: - return Resource( - { - ResourceAttributes.CLOUD_PROVIDER: CloudProviderValues.AWS.value, - ResourceAttributes.CLOUD_PLATFORM: CloudPlatformValues.AWS_LAMBDA.value, - ResourceAttributes.CLOUD_REGION: environ["AWS_REGION"], - ResourceAttributes.FAAS_NAME: environ[ - "AWS_LAMBDA_FUNCTION_NAME" - ], - ResourceAttributes.FAAS_VERSION: environ[ - "AWS_LAMBDA_FUNCTION_VERSION" - ], - ResourceAttributes.FAAS_INSTANCE: environ[ - "AWS_LAMBDA_LOG_STREAM_NAME" - ], - ResourceAttributes.FAAS_MAX_MEMORY: int( - environ["AWS_LAMBDA_FUNCTION_MEMORY_SIZE"] - ), - } - ) + attributes = { + ResourceAttributes.CLOUD_PROVIDER: CloudProviderValues.AWS.value, + ResourceAttributes.CLOUD_PLATFORM: CloudPlatformValues.AWS_LAMBDA.value, + ResourceAttributes.CLOUD_REGION: environ["AWS_REGION"], + ResourceAttributes.FAAS_NAME: environ[ + "AWS_LAMBDA_FUNCTION_NAME" + ], + ResourceAttributes.FAAS_VERSION: environ[ + "AWS_LAMBDA_FUNCTION_VERSION" + ], + ResourceAttributes.FAAS_INSTANCE: environ[ + "AWS_LAMBDA_LOG_STREAM_NAME" + ], + ResourceAttributes.FAAS_MAX_MEMORY: int( + environ["AWS_LAMBDA_FUNCTION_MEMORY_SIZE"] + ), + } + + try: + account_id = os.readlink(_ACCOUNT_ID_SYMLINK_PATH) + attributes[ResourceAttributes.CLOUD_ACCOUNT_ID] = account_id + except OSError: + pass + + return Resource(attributes) # pylint: disable=broad-except except Exception as exception: if self.raise_on_error: diff --git a/sdk-extension/opentelemetry-sdk-extension-aws/tests/resource/test__lambda.py b/sdk-extension/opentelemetry-sdk-extension-aws/tests/resource/test__lambda.py index e183525e49..02b75f804f 100644 --- a/sdk-extension/opentelemetry-sdk-extension-aws/tests/resource/test__lambda.py +++ b/sdk-extension/opentelemetry-sdk-extension-aws/tests/resource/test__lambda.py @@ -12,12 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import tempfile import unittest from collections import OrderedDict from unittest.mock import patch from opentelemetry.sdk.extension.aws.resource._lambda import ( # pylint: disable=no-name-in-module AwsLambdaResourceDetector, + _ACCOUNT_ID_SYMLINK_PATH, ) from opentelemetry.semconv.resource import ( CloudPlatformValues, @@ -61,3 +64,115 @@ def test_simple_create(self): self.assertDictEqual( actual.attributes.copy(), OrderedDict(MockLambdaResourceAttributes) ) + + @patch.dict( + "os.environ", + { + "AWS_REGION": MockLambdaResourceAttributes[ + ResourceAttributes.CLOUD_REGION + ], + "AWS_LAMBDA_FUNCTION_NAME": MockLambdaResourceAttributes[ + ResourceAttributes.FAAS_NAME + ], + "AWS_LAMBDA_FUNCTION_VERSION": MockLambdaResourceAttributes[ + ResourceAttributes.FAAS_VERSION + ], + "AWS_LAMBDA_LOG_STREAM_NAME": MockLambdaResourceAttributes[ + ResourceAttributes.FAAS_INSTANCE + ], + "AWS_LAMBDA_FUNCTION_MEMORY_SIZE": f"{MockLambdaResourceAttributes[ResourceAttributes.FAAS_MAX_MEMORY]}", + }, + clear=True, + ) + def test_account_id_from_symlink(self): + """When the account ID symlink exists, cloud.account.id is set.""" + symlink_path = None + try: + tmpdir = tempfile.mkdtemp() + symlink_path = os.path.join(tmpdir, ".otel-account-id") + os.symlink("123456789012", symlink_path) + with patch( + "opentelemetry.sdk.extension.aws.resource._lambda._ACCOUNT_ID_SYMLINK_PATH", + symlink_path, + ): + actual = AwsLambdaResourceDetector().detect() + self.assertEqual( + actual.attributes[ResourceAttributes.CLOUD_ACCOUNT_ID], + "123456789012", + ) + finally: + if symlink_path and os.path.islink(symlink_path): + os.unlink(symlink_path) + if tmpdir: + os.rmdir(tmpdir) + + @patch.dict( + "os.environ", + { + "AWS_REGION": MockLambdaResourceAttributes[ + ResourceAttributes.CLOUD_REGION + ], + "AWS_LAMBDA_FUNCTION_NAME": MockLambdaResourceAttributes[ + ResourceAttributes.FAAS_NAME + ], + "AWS_LAMBDA_FUNCTION_VERSION": MockLambdaResourceAttributes[ + ResourceAttributes.FAAS_VERSION + ], + "AWS_LAMBDA_LOG_STREAM_NAME": MockLambdaResourceAttributes[ + ResourceAttributes.FAAS_INSTANCE + ], + "AWS_LAMBDA_FUNCTION_MEMORY_SIZE": f"{MockLambdaResourceAttributes[ResourceAttributes.FAAS_MAX_MEMORY]}", + }, + clear=True, + ) + def test_account_id_missing_symlink(self): + """When the symlink does not exist, cloud.account.id is absent and no exception is raised.""" + with patch( + "opentelemetry.sdk.extension.aws.resource._lambda._ACCOUNT_ID_SYMLINK_PATH", + "/tmp/.otel-account-id-nonexistent", + ): + actual = AwsLambdaResourceDetector().detect() + self.assertNotIn( + ResourceAttributes.CLOUD_ACCOUNT_ID, actual.attributes + ) + + @patch.dict( + "os.environ", + { + "AWS_REGION": MockLambdaResourceAttributes[ + ResourceAttributes.CLOUD_REGION + ], + "AWS_LAMBDA_FUNCTION_NAME": MockLambdaResourceAttributes[ + ResourceAttributes.FAAS_NAME + ], + "AWS_LAMBDA_FUNCTION_VERSION": MockLambdaResourceAttributes[ + ResourceAttributes.FAAS_VERSION + ], + "AWS_LAMBDA_LOG_STREAM_NAME": MockLambdaResourceAttributes[ + ResourceAttributes.FAAS_INSTANCE + ], + "AWS_LAMBDA_FUNCTION_MEMORY_SIZE": f"{MockLambdaResourceAttributes[ResourceAttributes.FAAS_MAX_MEMORY]}", + }, + clear=True, + ) + def test_account_id_preserves_leading_zeros(self): + """Leading zeros in the account ID are preserved (treated as string).""" + symlink_path = None + try: + tmpdir = tempfile.mkdtemp() + symlink_path = os.path.join(tmpdir, ".otel-account-id") + os.symlink("000123456789", symlink_path) + with patch( + "opentelemetry.sdk.extension.aws.resource._lambda._ACCOUNT_ID_SYMLINK_PATH", + symlink_path, + ): + actual = AwsLambdaResourceDetector().detect() + self.assertEqual( + actual.attributes[ResourceAttributes.CLOUD_ACCOUNT_ID], + "000123456789", + ) + finally: + if symlink_path and os.path.islink(symlink_path): + os.unlink(symlink_path) + if tmpdir: + os.rmdir(tmpdir) From c57e1095af53992119331345b702325d8888dbcd Mon Sep 17 00:00:00 2001 From: Raphael Manke Date: Mon, 9 Feb 2026 21:54:29 +0100 Subject: [PATCH 2/5] docs: add CHANGELOG entry for cloud.account.id symlink --- CHANGELOG.md | 2 ++ sdk-extension/opentelemetry-sdk-extension-aws/CHANGELOG.md | 3 +++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f649e3886..12356bebc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- `opentelemetry-sdk-extension-aws`: Read `cloud.account.id` from symlink created by the OTel Lambda Extension in the Lambda resource detector + ([#4183](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4183)) - `opentelemetry-instrumentation-asgi`: Add exemplars for `http.server.request.duration` and `http.server.duration` metrics ([#3739](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3739)) - `opentelemetry-instrumentation-wsgi`: Add exemplars for `http.server.request.duration` and `http.server.duration` metrics diff --git a/sdk-extension/opentelemetry-sdk-extension-aws/CHANGELOG.md b/sdk-extension/opentelemetry-sdk-extension-aws/CHANGELOG.md index a66805003c..1ffc86373d 100644 --- a/sdk-extension/opentelemetry-sdk-extension-aws/CHANGELOG.md +++ b/sdk-extension/opentelemetry-sdk-extension-aws/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +- Read `cloud.account.id` from symlink created by the OTel Lambda Extension in the Lambda resource detector + ([#4183](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4183)) + ## Version 2.1.0 (2024-12-24) - Make ec2 resource detector silent when loaded outside AWS From b3c30e8ecd261898c3bff90ac3609394d9571a90 Mon Sep 17 00:00:00 2001 From: Raphael Manke Date: Wed, 18 Feb 2026 07:30:13 +0100 Subject: [PATCH 3/5] Rename symlink to .otel-aws-account-id --- .../src/opentelemetry/sdk/extension/aws/resource/_lambda.py | 2 +- .../tests/resource/test__lambda.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/resource/_lambda.py b/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/resource/_lambda.py index 9b40afe1f0..4182ec66ac 100644 --- a/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/resource/_lambda.py +++ b/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/resource/_lambda.py @@ -25,7 +25,7 @@ logger = logging.getLogger(__name__) -_ACCOUNT_ID_SYMLINK_PATH = "/tmp/.otel-account-id" +_ACCOUNT_ID_SYMLINK_PATH = "/tmp/.otel-aws-account-id" class AwsLambdaResourceDetector(ResourceDetector): diff --git a/sdk-extension/opentelemetry-sdk-extension-aws/tests/resource/test__lambda.py b/sdk-extension/opentelemetry-sdk-extension-aws/tests/resource/test__lambda.py index 02b75f804f..9d4c36c83a 100644 --- a/sdk-extension/opentelemetry-sdk-extension-aws/tests/resource/test__lambda.py +++ b/sdk-extension/opentelemetry-sdk-extension-aws/tests/resource/test__lambda.py @@ -89,7 +89,7 @@ def test_account_id_from_symlink(self): symlink_path = None try: tmpdir = tempfile.mkdtemp() - symlink_path = os.path.join(tmpdir, ".otel-account-id") + symlink_path = os.path.join(tmpdir, ".otel-aws-account-id") os.symlink("123456789012", symlink_path) with patch( "opentelemetry.sdk.extension.aws.resource._lambda._ACCOUNT_ID_SYMLINK_PATH", @@ -129,7 +129,7 @@ def test_account_id_missing_symlink(self): """When the symlink does not exist, cloud.account.id is absent and no exception is raised.""" with patch( "opentelemetry.sdk.extension.aws.resource._lambda._ACCOUNT_ID_SYMLINK_PATH", - "/tmp/.otel-account-id-nonexistent", + "/tmp/.otel-aws-account-id-nonexistent", ): actual = AwsLambdaResourceDetector().detect() self.assertNotIn( @@ -160,7 +160,7 @@ def test_account_id_preserves_leading_zeros(self): symlink_path = None try: tmpdir = tempfile.mkdtemp() - symlink_path = os.path.join(tmpdir, ".otel-account-id") + symlink_path = os.path.join(tmpdir, ".otel-aws-account-id") os.symlink("000123456789", symlink_path) with patch( "opentelemetry.sdk.extension.aws.resource._lambda._ACCOUNT_ID_SYMLINK_PATH", From 0f57fbccfba1c6d38f9ffaa893cbb8db996d5da8 Mon Sep 17 00:00:00 2001 From: Raphael Manke Date: Wed, 18 Feb 2026 07:37:36 +0100 Subject: [PATCH 4/5] Use pytest tmp_path fixture instead of manual tempfile cleanup --- .../tests/resource/test__lambda.py | 178 ++++++------------ 1 file changed, 53 insertions(+), 125 deletions(-) diff --git a/sdk-extension/opentelemetry-sdk-extension-aws/tests/resource/test__lambda.py b/sdk-extension/opentelemetry-sdk-extension-aws/tests/resource/test__lambda.py index 9d4c36c83a..ad19b7e6b8 100644 --- a/sdk-extension/opentelemetry-sdk-extension-aws/tests/resource/test__lambda.py +++ b/sdk-extension/opentelemetry-sdk-extension-aws/tests/resource/test__lambda.py @@ -13,11 +13,12 @@ # limitations under the License. import os -import tempfile import unittest from collections import OrderedDict from unittest.mock import patch +import pytest + from opentelemetry.sdk.extension.aws.resource._lambda import ( # pylint: disable=no-name-in-module AwsLambdaResourceDetector, _ACCOUNT_ID_SYMLINK_PATH, @@ -38,25 +39,19 @@ ResourceAttributes.FAAS_MAX_MEMORY: 128, } +MOCK_LAMBDA_ENV = { + "AWS_REGION": MockLambdaResourceAttributes[ResourceAttributes.CLOUD_REGION], + "AWS_LAMBDA_FUNCTION_NAME": MockLambdaResourceAttributes[ResourceAttributes.FAAS_NAME], + "AWS_LAMBDA_FUNCTION_VERSION": MockLambdaResourceAttributes[ResourceAttributes.FAAS_VERSION], + "AWS_LAMBDA_LOG_STREAM_NAME": MockLambdaResourceAttributes[ResourceAttributes.FAAS_INSTANCE], + "AWS_LAMBDA_FUNCTION_MEMORY_SIZE": f"{MockLambdaResourceAttributes[ResourceAttributes.FAAS_MAX_MEMORY]}", +} + class AwsLambdaResourceDetectorTest(unittest.TestCase): @patch.dict( "os.environ", - { - "AWS_REGION": MockLambdaResourceAttributes[ - ResourceAttributes.CLOUD_REGION - ], - "AWS_LAMBDA_FUNCTION_NAME": MockLambdaResourceAttributes[ - ResourceAttributes.FAAS_NAME - ], - "AWS_LAMBDA_FUNCTION_VERSION": MockLambdaResourceAttributes[ - ResourceAttributes.FAAS_VERSION - ], - "AWS_LAMBDA_LOG_STREAM_NAME": MockLambdaResourceAttributes[ - ResourceAttributes.FAAS_INSTANCE - ], - "AWS_LAMBDA_FUNCTION_MEMORY_SIZE": f"{MockLambdaResourceAttributes[ResourceAttributes.FAAS_MAX_MEMORY]}", - }, + MOCK_LAMBDA_ENV, clear=True, ) def test_simple_create(self): @@ -65,114 +60,47 @@ def test_simple_create(self): actual.attributes.copy(), OrderedDict(MockLambdaResourceAttributes) ) - @patch.dict( - "os.environ", - { - "AWS_REGION": MockLambdaResourceAttributes[ - ResourceAttributes.CLOUD_REGION - ], - "AWS_LAMBDA_FUNCTION_NAME": MockLambdaResourceAttributes[ - ResourceAttributes.FAAS_NAME - ], - "AWS_LAMBDA_FUNCTION_VERSION": MockLambdaResourceAttributes[ - ResourceAttributes.FAAS_VERSION - ], - "AWS_LAMBDA_LOG_STREAM_NAME": MockLambdaResourceAttributes[ - ResourceAttributes.FAAS_INSTANCE - ], - "AWS_LAMBDA_FUNCTION_MEMORY_SIZE": f"{MockLambdaResourceAttributes[ResourceAttributes.FAAS_MAX_MEMORY]}", - }, - clear=True, - ) - def test_account_id_from_symlink(self): - """When the account ID symlink exists, cloud.account.id is set.""" - symlink_path = None - try: - tmpdir = tempfile.mkdtemp() - symlink_path = os.path.join(tmpdir, ".otel-aws-account-id") - os.symlink("123456789012", symlink_path) - with patch( - "opentelemetry.sdk.extension.aws.resource._lambda._ACCOUNT_ID_SYMLINK_PATH", - symlink_path, - ): - actual = AwsLambdaResourceDetector().detect() - self.assertEqual( - actual.attributes[ResourceAttributes.CLOUD_ACCOUNT_ID], - "123456789012", - ) - finally: - if symlink_path and os.path.islink(symlink_path): - os.unlink(symlink_path) - if tmpdir: - os.rmdir(tmpdir) - @patch.dict( - "os.environ", - { - "AWS_REGION": MockLambdaResourceAttributes[ - ResourceAttributes.CLOUD_REGION - ], - "AWS_LAMBDA_FUNCTION_NAME": MockLambdaResourceAttributes[ - ResourceAttributes.FAAS_NAME - ], - "AWS_LAMBDA_FUNCTION_VERSION": MockLambdaResourceAttributes[ - ResourceAttributes.FAAS_VERSION - ], - "AWS_LAMBDA_LOG_STREAM_NAME": MockLambdaResourceAttributes[ - ResourceAttributes.FAAS_INSTANCE - ], - "AWS_LAMBDA_FUNCTION_MEMORY_SIZE": f"{MockLambdaResourceAttributes[ResourceAttributes.FAAS_MAX_MEMORY]}", - }, - clear=True, - ) - def test_account_id_missing_symlink(self): - """When the symlink does not exist, cloud.account.id is absent and no exception is raised.""" - with patch( - "opentelemetry.sdk.extension.aws.resource._lambda._ACCOUNT_ID_SYMLINK_PATH", - "/tmp/.otel-aws-account-id-nonexistent", - ): - actual = AwsLambdaResourceDetector().detect() - self.assertNotIn( - ResourceAttributes.CLOUD_ACCOUNT_ID, actual.attributes - ) +@pytest.fixture +def account_id_symlink(tmp_path): + """Create a symlink at a temporary path and patch the detector to use it.""" + def _create(account_id): + symlink_path = tmp_path / ".otel-aws-account-id" + os.symlink(account_id, symlink_path) + return str(symlink_path) + return _create - @patch.dict( - "os.environ", - { - "AWS_REGION": MockLambdaResourceAttributes[ - ResourceAttributes.CLOUD_REGION - ], - "AWS_LAMBDA_FUNCTION_NAME": MockLambdaResourceAttributes[ - ResourceAttributes.FAAS_NAME - ], - "AWS_LAMBDA_FUNCTION_VERSION": MockLambdaResourceAttributes[ - ResourceAttributes.FAAS_VERSION - ], - "AWS_LAMBDA_LOG_STREAM_NAME": MockLambdaResourceAttributes[ - ResourceAttributes.FAAS_INSTANCE - ], - "AWS_LAMBDA_FUNCTION_MEMORY_SIZE": f"{MockLambdaResourceAttributes[ResourceAttributes.FAAS_MAX_MEMORY]}", - }, - clear=True, - ) - def test_account_id_preserves_leading_zeros(self): - """Leading zeros in the account ID are preserved (treated as string).""" - symlink_path = None - try: - tmpdir = tempfile.mkdtemp() - symlink_path = os.path.join(tmpdir, ".otel-aws-account-id") - os.symlink("000123456789", symlink_path) - with patch( - "opentelemetry.sdk.extension.aws.resource._lambda._ACCOUNT_ID_SYMLINK_PATH", - symlink_path, - ): - actual = AwsLambdaResourceDetector().detect() - self.assertEqual( - actual.attributes[ResourceAttributes.CLOUD_ACCOUNT_ID], - "000123456789", - ) - finally: - if symlink_path and os.path.islink(symlink_path): - os.unlink(symlink_path) - if tmpdir: - os.rmdir(tmpdir) + +@patch.dict("os.environ", MOCK_LAMBDA_ENV, clear=True) +def test_account_id_from_symlink(account_id_symlink): + """When the account ID symlink exists, cloud.account.id is set.""" + symlink_path = account_id_symlink("123456789012") + with patch( + "opentelemetry.sdk.extension.aws.resource._lambda._ACCOUNT_ID_SYMLINK_PATH", + symlink_path, + ): + actual = AwsLambdaResourceDetector().detect() + assert actual.attributes[ResourceAttributes.CLOUD_ACCOUNT_ID] == "123456789012" + + +@patch.dict("os.environ", MOCK_LAMBDA_ENV, clear=True) +def test_account_id_missing_symlink(): + """When the symlink does not exist, cloud.account.id is absent and no exception is raised.""" + with patch( + "opentelemetry.sdk.extension.aws.resource._lambda._ACCOUNT_ID_SYMLINK_PATH", + "/tmp/.otel-aws-account-id-nonexistent", + ): + actual = AwsLambdaResourceDetector().detect() + assert ResourceAttributes.CLOUD_ACCOUNT_ID not in actual.attributes + + +@patch.dict("os.environ", MOCK_LAMBDA_ENV, clear=True) +def test_account_id_preserves_leading_zeros(account_id_symlink): + """Leading zeros in the account ID are preserved (treated as string).""" + symlink_path = account_id_symlink("000123456789") + with patch( + "opentelemetry.sdk.extension.aws.resource._lambda._ACCOUNT_ID_SYMLINK_PATH", + symlink_path, + ): + actual = AwsLambdaResourceDetector().detect() + assert actual.attributes[ResourceAttributes.CLOUD_ACCOUNT_ID] == "000123456789" From 6e880c9e24f41502c7a7b4bc947d0a1e3b7fd770 Mon Sep 17 00:00:00 2001 From: Raphael Manke Date: Wed, 18 Feb 2026 07:52:00 +0100 Subject: [PATCH 5/5] Add debug log when cloud.account.id symlink is not available --- .../src/opentelemetry/sdk/extension/aws/resource/_lambda.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/resource/_lambda.py b/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/resource/_lambda.py index 4182ec66ac..ff0f95076a 100644 --- a/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/resource/_lambda.py +++ b/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/resource/_lambda.py @@ -59,7 +59,7 @@ def detect(self) -> "Resource": account_id = os.readlink(_ACCOUNT_ID_SYMLINK_PATH) attributes[ResourceAttributes.CLOUD_ACCOUNT_ID] = account_id except OSError: - pass + logger.debug("cloud.account.id not available via symlink") return Resource(attributes) # pylint: disable=broad-except