|
43 | 43 | #include "Framework/DeviceState.h" |
44 | 44 | #include "Framework/DeviceConfig.h" |
45 | 45 | #include "Framework/DefaultsHelpers.h" |
| 46 | +#include "Framework/Signpost.h" |
46 | 47 |
|
47 | 48 | #include "TextDriverClient.h" |
48 | 49 | #include "WSDriverClient.h" |
@@ -83,6 +84,7 @@ using Value = o2::monitoring::tags::Value; |
83 | 84 | O2_DECLARE_DYNAMIC_LOG(data_processor_context); |
84 | 85 | O2_DECLARE_DYNAMIC_LOG(stream_context); |
85 | 86 | O2_DECLARE_DYNAMIC_LOG(async_queue); |
| 87 | +O2_DECLARE_DYNAMIC_LOG(policies); |
86 | 88 |
|
87 | 89 | namespace o2::framework |
88 | 90 | { |
@@ -849,6 +851,16 @@ o2::framework::ServiceSpec CommonServices::dataProcessingStats() |
849 | 851 | if (deploymentMode != DeploymentMode::OnlineDDS && deploymentMode != DeploymentMode::OnlineECS && deploymentMode != DeploymentMode::OnlineAUX && deploymentMode != DeploymentMode::FST) { |
850 | 852 | arrowAndResourceLimitingMetrics = true; |
851 | 853 | } |
| 854 | + // Input proxies should not report cpu_usage_fraction, |
| 855 | + // because of the rate limiting which biases the measurement. |
| 856 | + auto& spec = services.get<DeviceSpec const>(); |
| 857 | + bool enableCPUUsageFraction = true; |
| 858 | + auto isProxy = [](DataProcessorLabel const& label) -> bool { return label == DataProcessorLabel{"input-proxy"}; }; |
| 859 | + if (std::find_if(spec.labels.begin(), spec.labels.end(), isProxy) != spec.labels.end()) { |
| 860 | + O2_SIGNPOST_ID_GENERATE(mid, policies); |
| 861 | + O2_SIGNPOST_EVENT_EMIT(policies, mid, "metrics", "Disabling cpu_usage_fraction metric for proxy %{public}s", spec.name.c_str()); |
| 862 | + enableCPUUsageFraction = false; |
| 863 | + } |
852 | 864 |
|
853 | 865 | std::vector<DataProcessingStats::MetricSpec> metrics = { |
854 | 866 | MetricSpec{.name = "errors", |
@@ -932,6 +944,7 @@ o2::framework::ServiceSpec CommonServices::dataProcessingStats() |
932 | 944 | .maxRefreshLatency = onlineRefreshLatency, |
933 | 945 | .sendInitialValue = true}, |
934 | 946 | MetricSpec{.name = "cpu_usage_fraction", |
| 947 | + .enabled = enableCPUUsageFraction, |
935 | 948 | .metricId = (int)ProcessingStatsId::CPU_USAGE_FRACTION, |
936 | 949 | .kind = Kind::Rate, |
937 | 950 | .scope = Scope::Online, |
|
0 commit comments