-
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
Ensure pprof endpoint is listening on startup #17028
Ensure pprof endpoint is listening on startup #17028
Conversation
pprof HTTP endpoint was being initialized asynchronously. In tests we have found that sometimes after Metricbeat has started, it fails to connect to the pprof endpoint. This can happen if the server is not listening before the rest of the beat is initialized. This change ensures that the listener for this endpoint is started before continuing with the rest of the initialization. Some comments and error messages have been polished.
Pinging @elastic/integrations (Team:Integrations) |
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.
lgtm!
@blakerouse sorry, I have added a couple more changes, could you please take another look? Doing some tests I found that fatal errors in this code were not being logged, I think that because of the use of I have also added a changelog entry because before this change if httpprof couldn't be started it was being mostly ignored (it only logged something like this at the info level):
|
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.
I think the goal is to move away from the global logger, shouldn't log.NewLogger
be used instead of the global logp
logger?
Yes, you are right. I have tried to do it, but this package is formed of global methods called from beat initialization code, that is still using the global logger. |
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.
Agree that creating a logger for each function is rather weird, but no real other alternative.
pprof HTTP endpoint was being initialized asynchronously. In tests we have found that sometimes after Metricbeat has started, it fails to connect to the pprof endpoint. This can happen if the server is not listening before the rest of the beat is initialized. This change ensures that the listener for this endpoint is started before continuing with the rest of the initialization. Some comments and error messages have been polished. (cherry picked from commit efdab6f)
…tup (#17081) pprof HTTP endpoint was being initialized asynchronously. In tests we have found that sometimes after Metricbeat has started, it fails to connect to the pprof endpoint. This can happen if the server is not listening before the rest of the beat is initialized. This change ensures that the listener for this endpoint is started before continuing with the rest of the initialization. Some comments and error messages have been polished. (cherry picked from commit efdab6f)
pprof HTTP endpoint was being initialized asynchronously. In tests we
have found that sometimes after Metricbeat has started, it fails to
connect to the pprof endpoint. This can happen if the server is not
listening before the rest of the beat is initialized.
This change ensures that the listener for this endpoint is started
before continuing with the rest of the initialization. This should reduce
flakiness of tests that depend on these endpoint (
test_stats
tests).Some comments and error messages have been polished.