What changed?
Create a dedicated worker usage collector
Move hardware usage emitting functionality from base worker to the worker usage collector
Why?
We want to create a separate component responsible for collecting worker usage rather than a huge code block in the base worker.
How did you test it?
Tested locally as well as tested in staging env to ensure metrics consistency and no goroutine leak.
Potential risks
Instead of using Sync.Once to ensure the goroutine is run once per host, we move the hardware emitting to decision worker only as the Sync.Once might cause test timeout as it would keep other goroutine wait until the current one returns. So if a host does not have decision worker (impossible at the moment), it's hardware metrics won't be emitted.
What changed? Create a dedicated worker usage collector Move hardware usage emitting functionality from base worker to the worker usage collector
Why? We want to create a separate component responsible for collecting worker usage rather than a huge code block in the base worker.
How did you test it? Tested locally as well as tested in staging env to ensure metrics consistency and no goroutine leak.
Potential risks Instead of using Sync.Once to ensure the goroutine is run once per host, we move the hardware emitting to decision worker only as the Sync.Once might cause test timeout as it would keep other goroutine wait until the current one returns. So if a host does not have decision worker (impossible at the moment), it's hardware metrics won't be emitted.