Backport of feature - [NET-4005] - [Supportability] Reloadable Configuration - enable_debug into release/1.15.x #17968
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.
Backport
This PR is auto-generated from #17565 to be assessed for backporting due to the inclusion of the label backport/1.15.
🚨
The person who merged in the original PR is:
@absolutelightning
This person should manually cherry-pick the original PR into a new backport PR,
and close this one when the manual backport PR is merged in.
The below text is copied from the body of the original PR.
Description
Making enable_debug a Reloadable Configuration
Summary of customer problem and expectations:
In order to capture pprof to analyze Golang heap, CPU, goroutine, and trace profiling "enable_debug" must be set in the configuration and for it to take effect, Consul process must be restarted. Thereafter the "consul debug" command with the appropriate flags can be run to capture the pprof. Having the ability to apply this update to the configuration through "consul reload" would ensure cluster stability.
What currently happens or is possible:
Currently the Consul process must be restarted for this configuration to take effect.
In this PR - I am making enable_debug a reloadable configuration and adding http handlers before the enableDebug flag check. Earlier we use to check for enable debug and then add http handlers. Now I am adding http handlers and checking for enableDebug and checkACLDisabled() inside the handler when the handler is already attached.
Testing & Reproduction steps
Replicate the issue by -
make dev
./bin/consul agent --config-file=server.json
http://localhost:8500/v1/agent/self
-> observerEnableDebug
is falseenable_debug: true
in the server.json file./bin/consul reload
http://localhost:8500/v1/agent/self
see - EnableDebug flag does not change to trueTesting
make dev
./bin/consul agent --config-file=server.json
http://localhost:8500/v1/agent/self
-> observerEnableDebug
is falseenable_debug: true
in the server.json file./bin/consul reload
http://localhost:8500/v1/agent/self
see - EnableDebug flag changes to true./bin/consul debug -capture pprof
PR Checklist
Overview of commits