Fix default discovery crash on Windows #5202
Merged
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.
Replaces #5162
Description:
A bad default on the OTel
docker_host
(just fixed upstream, see open-telemetry/opentelemetry-collector-contrib#34358) exposed that if a observer extension fails toStart
the discovery code still callsListAndWatch
what causes a panic.Details: the Start of the observer is called via internal/confmapprovider/discovery, but if Start fails it logs a warning and proceeds with the execution. Later internal/receiver/discoveryreceiver uses the host.GetExtensions() and the observer is there since it was created successfully (it did fail to start in a step that the host doesn't have visibility). The extension is cast to an observer.Observable and a go routine calling ListAndWatch is launched, but, then the private that it needs to run are nil because the start failed and then panic.
Right now I am removing the
docker_observer
from Windows, but, it would be re-enabled as soon as we have it fixed on upstream.Jira:
https://splunk.atlassian.net/browse/OTL-2883
Testing:
Added 2 new tests and validated manually.
Documentation:
N/A