Add ability to call diagnostics with V2 protocol and add defaults.#39
Add ability to call diagnostics with V2 protocol and add defaults.#39blakerouse merged 3 commits intoelastic:mainfrom
Conversation
cmacknz
left a comment
There was a problem hiding this comment.
A few minor comments, mostly LGTM.
We will need to have everyone update their agent client version for this to work, we'll need follow up TODOs for this.
|
|
||
| // unit hooks after client hooks; allows unit specific to override client hooks | ||
| unit.dmx.RLock() | ||
| for n, d := range unit.diagHooks { |
There was a problem hiding this comment.
Is there a reason not to do this in the same lock protected block as for n, d := range c.diagHooks above? I assume it is intentionally the same mutex for both maps?
It's not incorrect I just wanted to double check the intent here.
There was a problem hiding this comment.
Different lock is used because each unit can have its own hooks and can be registered at any time. So we need to have a unique lock per unit for hook registration.
Co-authored-by: Craig MacKenzie <craig.mackenzie@elastic.co>
cmacknz
left a comment
There was a problem hiding this comment.
LGTM, leave this up for a day or so to give the others time to review. They may find something I can't see.
Overview
Completes the TODO for supporting the new diagnostics for the V2 protocol. With this change any component that uses the client gets all the defaults from the runtime/pprof included.
The client can have diagnostics that each unit will inherit and then each unit can define its own diagnostic as well.
Elastic Agent will call this per unit to provide all the diagnostics information for the running components unit.