-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Autodiscover] Check if runner is already running before starting again #18564
[Autodiscover] Check if runner is already running before starting again #18564
Conversation
Signed-off-by: chrismark <chrismarkou92@gmail.com>
Pinging @elastic/integrations (Team:Integrations) |
Pinging @elastic/integrations-platforms (Team:Platforms) |
ey @ChrsMark I think the docker-compose project is missing in the description? |
Also, could you add some tests? this code is quite critical as it's heavily used by autodiscover and config reload |
👍 Added |
💚 Build SucceededExpand to view the summary
Build stats
Test stats 🧪
Steps errorsExpand to view the steps failures
|
Signed-off-by: chrismark <chrismarkou92@gmail.com>
Signed-off-by: chrismark <chrismarkou92@gmail.com>
Signed-off-by: chrismark <chrismarkou92@gmail.com>
Wondering if this has side effects in other parts of the project since I see some Filebeat's tests failing at some CI runs: https://travis-ci.org/github/elastic/beats/jobs/687374263#L736 This change seems sane for autodiscover but not sure if the same goes for other parts that utilise this functionality 🤔 . |
jenkins, test this again please |
Signed-off-by: chrismark <chrismarkou92@gmail.com>
💔 Tests FailedExpand to view the summary
Build stats
Test stats 🧪
Test errorsExpand to view the tests failures
--------------------- >> end captured stdout << ---------------------- Steps errorsExpand to view the steps failures
Log outputExpand to view the last 100 lines of log output
|
…in (elastic#18564) (cherry picked from commit b0f7ae7)
…in (elastic#18564) (cherry picked from commit b0f7ae7)
What does this PR do?
This PR fixes runner reload so as not to start a new runner if a runner for the same configuration is already running. This can happen in Autodiscover if we have a container queued for termination and a new one with the very same configuration. This will lead into having 2 identical configurations in reload. The first one will be skipped but the second one will create new runner while the previous is still running. This is the tricky
if/else
block that cause this problem when we have 2 identical configurations:beats/libbeat/cfgfile/list.go
Line 73 in e990740
For more information check the related Discuss topic: https://discuss.elastic.co/t/multiple-monitoring-cycles-after-recreating-docker-image/231565/9
Why is it important?
In case of autodiscovery catches a new start event will try to start a new runner without checking if a runner is already running. This will lead in overriding the in list of runner the old one with the new one without stoping the old one. The result will be to have 2 runners running (one will be orphan and untracked).
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally
./metricbeat -e -d "module,autodiscover"
docker-compose up -d
There is no:
2020-05-15T08:25:01.563Z DEBUG [module] module/wrapper.go:127 Starting Wrapper[name=prometheus, len(metricSetWrappers)=1]
And there is:
Related issues
Discuss: https://discuss.elastic.co/t/multiple-monitoring-cycles-after-recreating-docker-image/231565/9
This might solve #12011 too.