From 0936a195ad87688138a03977d8fcafa5ab62eef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Cser=C3=A9p?= Date: Tue, 26 Mar 2024 08:09:14 +0100 Subject: [PATCH] Include metrics in the returned result for path based C++ metrics endpoints. --- plugins/cpp_metrics/service/src/cppmetricsservice.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/cpp_metrics/service/src/cppmetricsservice.cpp b/plugins/cpp_metrics/service/src/cppmetricsservice.cpp index 929435995..4aa9b5c4c 100644 --- a/plugins/cpp_metrics/service/src/cppmetricsservice.cpp +++ b/plugins/cpp_metrics/service/src/cppmetricsservice.cpp @@ -149,8 +149,12 @@ void CppMetricsServiceHandler::getCppAstNodeMetricsForPath( { metricsAstNode.type = static_cast(metric.type); metricsAstNode.value = metric.value; + metrics.push_back(metricsAstNode); } + if (metrics.empty()) + continue; + CppAllMetricsAstNode nodeMetric; nodeMetric.id = std::to_string(node.id); nodeMetric.metrics = metrics; @@ -191,8 +195,12 @@ void CppMetricsServiceHandler::getCppFileMetricsForPath( { metricsModule.type = static_cast(metric.type); metricsModule.value = metric.value; + metrics.push_back(metricsModule); } + if (metrics.empty()) + continue; + CppAllMetricsModule nodeMetric; nodeMetric.id = std::to_string(file.id); nodeMetric.metrics = metrics;