From e2685358df608e5ef4b0a40d00ba081720a8d6a6 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:45:04 +0200 Subject: [PATCH] DPL: disable cpu_usage_fraction for proxies --- Framework/Core/src/CommonServices.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Framework/Core/src/CommonServices.cxx b/Framework/Core/src/CommonServices.cxx index 028ed6e8e6806..ddaaa81090769 100644 --- a/Framework/Core/src/CommonServices.cxx +++ b/Framework/Core/src/CommonServices.cxx @@ -43,6 +43,7 @@ #include "Framework/DeviceState.h" #include "Framework/DeviceConfig.h" #include "Framework/DefaultsHelpers.h" +#include "Framework/Signpost.h" #include "TextDriverClient.h" #include "WSDriverClient.h" @@ -83,6 +84,7 @@ using Value = o2::monitoring::tags::Value; O2_DECLARE_DYNAMIC_LOG(data_processor_context); O2_DECLARE_DYNAMIC_LOG(stream_context); O2_DECLARE_DYNAMIC_LOG(async_queue); +O2_DECLARE_DYNAMIC_LOG(policies); namespace o2::framework { @@ -849,6 +851,16 @@ o2::framework::ServiceSpec CommonServices::dataProcessingStats() if (deploymentMode != DeploymentMode::OnlineDDS && deploymentMode != DeploymentMode::OnlineECS && deploymentMode != DeploymentMode::OnlineAUX && deploymentMode != DeploymentMode::FST) { arrowAndResourceLimitingMetrics = true; } + // Input proxies should not report cpu_usage_fraction, + // because of the rate limiting which biases the measurement. + auto& spec = services.get(); + bool enableCPUUsageFraction = true; + auto isProxy = [](DataProcessorLabel const& label) -> bool { return label == DataProcessorLabel{"input-proxy"}; }; + if (std::find_if(spec.labels.begin(), spec.labels.end(), isProxy) != spec.labels.end()) { + O2_SIGNPOST_ID_GENERATE(mid, policies); + O2_SIGNPOST_EVENT_EMIT(policies, mid, "metrics", "Disabling cpu_usage_fraction metric for proxy %{public}s", spec.name.c_str()); + enableCPUUsageFraction = false; + } std::vector metrics = { MetricSpec{.name = "errors", @@ -932,6 +944,7 @@ o2::framework::ServiceSpec CommonServices::dataProcessingStats() .maxRefreshLatency = onlineRefreshLatency, .sendInitialValue = true}, MetricSpec{.name = "cpu_usage_fraction", + .enabled = enableCPUUsageFraction, .metricId = (int)ProcessingStatsId::CPU_USAGE_FRACTION, .kind = Kind::Rate, .scope = Scope::Online,