Skip to content

Commit 21a4758

Browse files
committed
register available_managed_shm metric only for readout-proxy
1 parent 3486413 commit 21a4758

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Framework/Core/src/CommonServices.cxx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,8 +768,11 @@ auto sendRelayerMetrics(ServiceRegistryRef registry, DataProcessingStats& stats)
768768
using namespace fair::mq::shmem;
769769
auto& spec = registry.get<DeviceSpec const>();
770770

771+
auto hasMetric = [&runningWorkflow](const DataProcessingStats::MetricSpec& metric) -> bool {
772+
return metric.metricId == static_cast<int>(ProcessingStatsId::AVAILABLE_MANAGED_SHM_BASE) + (runningWorkflow.shmSegmentId % 512);
773+
};
771774
// FIXME: Ugly, but we do it only every 5 seconds...
772-
if (spec.name == "readout-proxy") {
775+
if (std::find_if(stats.metricSpecs.begin(), stats.metricSpecs.end(), hasMetric) != stats.metricSpecs.end()) {
773776
auto device = registry.get<RawDeviceService>().device();
774777
long freeMemory = -1;
775778
try {
@@ -1105,6 +1108,9 @@ o2::framework::ServiceSpec CommonServices::dataProcessingStats()
11051108
.sendInitialValue = true}};
11061109

11071110
for (auto& metric : metrics) {
1111+
if (metric.metricId == (int)ProcessingStatsId::AVAILABLE_MANAGED_SHM_BASE + (runningWorkflow.shmSegmentId % 512) && spec.name.compare("readout-proxy") != 0) {
1112+
continue;
1113+
}
11081114
stats->registerMetric(metric);
11091115
}
11101116

0 commit comments

Comments
 (0)