Skip to content
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

JMXFetch cycle management on Windows #5309

Merged
merged 2 commits into from
Apr 17, 2020

Conversation

albertvaka
Copy link
Contributor

What does this PR do?

Ports the lifecycle management code to Windows. No code changes were needed, since the Linux/Mac code seems to work fine on Windows too.

Motivation

If JMXFetch crashed on Windows it was not restarted.

@albertvaka albertvaka added this to the 7.20.0 milestone Apr 9, 2020
@albertvaka albertvaka requested a review from a team as a code owner April 9, 2020 13:29
@albertvaka albertvaka force-pushed the albertvaka/jmx-windows-lifecycle branch from 3ab1338 to 6e72a8d Compare April 16, 2020 08:54
Copy link
Contributor

@prognant prognant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While going over the jmxfetch.go file I noticed the Up() function here https://github.com/DataDog/datadog-agent/blob/master/pkg/jmxfetch/jmxfetch.go#L306-L318, I'm not sure it's used anymore, as there is an internal heartbeat logic.
I guess we can remove it if it's useless (and if that's not the case it should probably be updated).

@@ -30,10 +29,6 @@ func (r *runner) initRunner() {
func (r *runner) startRunner() error {

lifecycleMgmt := true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason to keep the start(bool) vs just start() method ?

Copy link
Member

@truthbk truthbk Apr 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good question. I guess the only reason would be to keep it around is if we want to make it configurable via a user-facing (maybe hidden) config option.

I'm fine with removing the argument.

Copy link
Contributor Author

@albertvaka albertvaka Apr 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a reason actually: when the restart logic triggers, it calls the same start function but passing false [1]. That's because the thread running the restart logic will continue running and we don't want to start another one.

[1] https://github.com/DataDog/datadog-agent/pull/5309/files#diff-7389c2caae3e69d2d88fd7cf12dc8792R152

@prognant prognant self-requested a review April 16, 2020 13:28
Copy link
Member

@truthbk truthbk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see the code works on windows too! Just echoing @prognant question, otherwise 🚀

@albertvaka albertvaka merged commit 61bdb6b into master Apr 17, 2020
@albertvaka albertvaka deleted the albertvaka/jmx-windows-lifecycle branch April 17, 2020 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants