From 1160c321f5fadaca3b81c0940bd06cf6ebdb700f Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Thu, 19 Dec 2024 15:56:38 +0100 Subject: [PATCH] Fix creation of resources in _detector We should create a Resource instance and not use Resource.create because if we set OTEL_EXPERIMENTAL_RESOURCE_DETECTORS we will go into an infinite loop trying to load and instantiate all the resources detectors. Fix #363 --- .../resourcedetector/gcp_resource_detector/_detector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opentelemetry-resourcedetector-gcp/src/opentelemetry/resourcedetector/gcp_resource_detector/_detector.py b/opentelemetry-resourcedetector-gcp/src/opentelemetry/resourcedetector/gcp_resource_detector/_detector.py index 9bbcaf6d..2fea9514 100644 --- a/opentelemetry-resourcedetector-gcp/src/opentelemetry/resourcedetector/gcp_resource_detector/_detector.py +++ b/opentelemetry-resourcedetector-gcp/src/opentelemetry/resourcedetector/gcp_resource_detector/_detector.py @@ -129,7 +129,7 @@ def _gae_resource() -> Resource: def _make_resource(attrs: Mapping[str, AttributeValue]) -> Resource: - return Resource.create( + return Resource( { ResourceAttributes.CLOUD_PROVIDER: "gcp", ResourceAttributes.CLOUD_ACCOUNT_ID: _metadata.get_metadata()[