Repository navigation
Conversation
create_resource runs before configure_sdk builds the tracer, meter and logger providers and before it sets the propagator, and _run_detectors let a ConfigurationError out of load_entry_point. A configuration file naming a detector whose package is not installed, such as container with no opentelemetry-resource-detector-container on the path, therefore cost the application traces, metrics, logs and propagation, and not only the attributes that detector would have added. Each requested detector now runs under a handler. A detector that cannot be loaded logs a warning naming it, one that raises inside detect() logs an exception, and the detectors after it still run. This is what configure_instrumentation already does for an absent instrumentor. The two tests that asserted the ConfigurationError reaching the caller now assert the warning and the resource that is still returned.
One test drives a detector whose entry point loads and whose detect() raises, which load_entry_point never sees, and asserts the resource still carries the SDK defaults. The other lists container ahead of host with no container package installed, and asserts host.name is still detected.
This was referenced Nov 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was broken
_run_detectorsinopentelemetry-configuration/src/opentelemetry/configuration/_resource.pycalledload_entry_pointwith nothing around it, andload_entry_pointraisesConfigurationErrorwhen the named entry point is not registered.configure_sdkcallscreate_resourcebefore it builds the tracer, meter and logger providers and before it sets the propagator, so that exception escapedconfigure_sdkand left the whole SDK unconfigured.For example, on a host without
opentelemetry-resource-detector-containerinstalled, the configuration file below is enough to trigger the failure:containeris a first-class schema field under$defs.ExperimentalResourceDetector, so a configuration file copied from the schema or from another language's example reaches the same failure. A detector whose entry point loads and whosedetect()then raises escapedconfigure_sdkthe same way, andload_entry_pointnever sees that one at all.What changed
Every detector in a detector entry now runs under a handler.
ConfigurationErrorlogs a warning naming the detector,_run_detectorslogs any other exception through_logger.exception, and the detectors listed after the failing one still run.configure_instrumentationalready handles an absent instrumentor that way, so the two paths now agree._run_detectorscollects the dataclass fields andadditional_propertiesinto one list before the loop. That keeps the handler in one place and preserves the order the two previous loops ran in.Verification
pytest opentelemetry-configuration/testspasses, 453 tests and 46 subtests, against the pinnedtest-requirements.txt.pylintrates_resource.py10.00/10, andruff checkandruff format --checkpass on both changed files.Two tests that asserted the
ConfigurationErrorreaching the caller now assert the warning and the resource thatcreate_resourcestill returns. Three tests are new: a missing package, a detector raising fromdetect(), andcontainerlisted ahead ofhostwith no container package installed, wherehost.nameis still detected.Downstream
Reported as dash0hq/opentelemetry-python-distribution#145, which vendors this package through
scripts/vendor_configuration.py.