File tree Expand file tree Collapse file tree 6 files changed +34
-13
lines changed
examples/fork-process-model
src/opentelemetry/sdk/resources Expand file tree Collapse file tree 6 files changed +34
-13
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010- prometheus-exporter: fix labels out of place for data points with different
1111 attribute sets
1212 ([ #4413 ] ( https://github.com/open-telemetry/opentelemetry-python/pull/4413 ) )
13+ - Tolerates exceptions when loading resource detectors via ` OTEL_EXPERIMENTAL_RESOURCE_DETECTORS `
14+ ([ #4373 ] ( https://github.com/open-telemetry/opentelemetry-python/pull/4373 ) )
1315
1416## Version 1.30.0/0.51b0 (2025-02-03)
1517
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ googleapis-common-protos==1.52.0
44grpcio == 1.56.2
55gunicorn == 22.0.0
66itsdangerous == 2.1.2
7- Jinja2 == 3.1.4
7+ Jinja2 == 3.1.5
88MarkupSafe == 2.1.3
99opentelemetry-api == 1.20.0
1010opentelemetry-exporter-otlp == 1.20.0
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ googleapis-common-protos==1.52.0
44grpcio == 1.56.2
55gunicorn == 22.0.0
66itsdangerous == 2.1.2
7- Jinja2 == 3.1.4
7+ Jinja2 == 3.1.5
88MarkupSafe == 2.1.3
99opentelemetry-api == 1.20.0
1010opentelemetry-exporter-otlp == 1.20.0
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ idna==3.7
99importlib-metadata == 6.8.0
1010iniconfig == 2.0.0
1111itsdangerous == 2.1.2
12- Jinja2 == 3.1.4
12+ Jinja2 == 3.1.5
1313MarkupSafe == 2.1.3
1414packaging == 24.0
1515pluggy == 1.3.0
Original file line number Diff line number Diff line change @@ -203,16 +203,23 @@ def create(
203203
204204 resource_detector : str
205205 for resource_detector in otel_experimental_resource_detectors :
206- resource_detectors .append (
207- next (
208- iter (
209- entry_points (
210- group = "opentelemetry_resource_detector" ,
211- name = resource_detector .strip (),
212- ) # type: ignore
213- )
214- ).load ()()
215- )
206+ try :
207+ resource_detectors .append (
208+ next (
209+ iter (
210+ entry_points (
211+ group = "opentelemetry_resource_detector" ,
212+ name = resource_detector .strip (),
213+ ) # type: ignore
214+ )
215+ ).load ()()
216+ )
217+ except Exception : # pylint: disable=broad-exception-caught
218+ logger .exception (
219+ "Failed to load resource detector '%s', skipping" ,
220+ resource_detector ,
221+ )
222+ continue
216223 resource = get_aggregated_resources (
217224 resource_detectors , _DEFAULT_RESOURCE
218225 ).merge (Resource (attributes , schema_url ))
Original file line number Diff line number Diff line change @@ -800,3 +800,15 @@ def test_resource_detector_entry_points_host(self):
800800 resource = Resource ({}).create ()
801801 self .assertIn (HOST_NAME , resource .attributes )
802802 self .assertIn (HOST_ARCH , resource .attributes )
803+
804+ @patch .dict (
805+ environ ,
806+ {OTEL_EXPERIMENTAL_RESOURCE_DETECTORS : "doesnotexist,host" },
807+ clear = True ,
808+ )
809+ def test_resource_detector_entry_points_tolerate_missing_detector (self ):
810+ resource = Resource ({}).create ()
811+ self .assertEqual (
812+ resource .attributes ["telemetry.sdk.language" ], "python"
813+ )
814+ self .assertIn (HOST_NAME , resource .attributes )
You can’t perform that action at this time.
0 commit comments