Add profiling for worker metrics collecting.
During experiment it was calculated that average time of metrics collection is 2-3 ms.
Also rename thread name to `collect-local-resources`.
@@ -74,6 +74,7 @@ public class CollectLocalResourceUsage extends Thread {
boolean collectLoadAverage,
boolean collectSystemNetworkUsage,
boolean collectResourceManagerEstimation) {
+ super("collect-local-resources");
this.bugReporter = checkNotNull(bugReporter);
this.collectWorkerDataInProfiler = collectWorkerDataInProfiler;
this.workerMetricsCollector = workerMetricsCollector;
@@ -174,6 +175,7 @@ public class CollectLocalResourceUsage extends Thread {
int workerMemoryUsageMb = 0;
if (collectWorkerDataInProfiler) {
+ try (SilentCloseable c = Profiler.instance().profile("Worker metrics collection")) {
workerMemoryUsageMb =
this.workerMetricsCollector.collectMetrics().stream()
.map(WorkerMetric::getWorkerStat)
@@ -182,6 +184,7 @@ public class CollectLocalResourceUsage extends Thread {
.sum()
/ 1024;
}
+ }
double loadAverage = 0;
if (collectLoadAverage) {
loadAverage = osBean.getSystemLoadAverage();
