-
Notifications
You must be signed in to change notification settings - Fork 813
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
[JMX SD] Wraps the jmx_state get call in try catch #3461
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return
isn't in the right line :)
agent.py
Outdated
try: | ||
jmx_state = self.supervisor_proxy.supervisor.getProcessInfo(JMX_SUPERVISOR_ENTRY) | ||
log.debug("Current JMX check state: %s", jmx_state['statename']) | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want the return
inside the except block instead of here, otherwise we'll be skipping the rest of the method when everything is fine, and not the opposite.
agent.py
Outdated
log.debug("Current JMX check state: %s", jmx_state['statename']) | ||
return | ||
except Exception as e: | ||
log.exception("Unable to get JMXFetch process state from supervisor: %s", e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also fit this: "cannot submit JMX auto-discovery configurations" into the message somehow?
18fafc1
to
4d1f7b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! 👍
Any idea when this PR will be released? |
Sorry for the late answer @ipfaffy: this PR will be released with 5.17 (target release date August 28) |
Note: Please remember to review the Datadog Contribution Guidelines
if you have not yet done so.
What does this PR do?
This PR wraps the jmx_state get line that pulls in the information about the JMXFetch process from supervisor in a try/except block.
Motivation
There have been a few cases where this line throws an exception due to a broken pipe, which causes the Agent to crash since its uncaught. Example stacktrace:
While this won't resolve the issue of there being a broken pipe, it will allow the Agent to continue running.
Testing Guidelines
An overview on testing
is available in our contribution guidelines.
Additional Notes
Anything else we should know when reviewing?