diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py index 7b39c552847..dec35b6c17d 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py @@ -215,8 +215,9 @@ def merge(self, other: "Resource") -> "Resource": elif self.schema_url == other.schema_url: schema_url = other.schema_url else: - raise ValueError( - "The Schema URL of the old and updating resources are not empty and are different" + schema_url = "merge-conflict" + logger.error( + "Failed to merge resources: The Schema URL of the old and updating resources are not empty and are different" ) return Resource(merged_attributes, schema_url) diff --git a/opentelemetry-sdk/tests/resources/test_resources.py b/opentelemetry-sdk/tests/resources/test_resources.py index 032af4d6853..b31c84e71d6 100644 --- a/opentelemetry-sdk/tests/resources/test_resources.py +++ b/opentelemetry-sdk/tests/resources/test_resources.py @@ -17,6 +17,7 @@ import os import unittest from unittest import mock +from logging import ERROR from opentelemetry.sdk import resources @@ -143,7 +144,7 @@ def test_resource_merge(self): left = resources.Resource.create({}, schema_urls[0]) right = resources.Resource.create({}, schema_urls[1]) - with self.assertRaises(ValueError): + with self.assertLogs(level=ERROR): left.merge(right) def test_resource_merge_empty_string(self):