Skip to content

Commit

Permalink
DPL: disable cpu_usage_fraction for proxies
Browse files Browse the repository at this point in the history
  • Loading branch information
ktf committed Apr 24, 2024
1 parent b005a9d commit e268535
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Framework/Core/src/CommonServices.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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<DeviceSpec const>();
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<DataProcessingStats::MetricSpec> metrics = {
MetricSpec{.name = "errors",
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit e268535

Please sign in to comment.