@@ -78,18 +78,24 @@ public AggregateMeasureComputer(String languageKey, String languagePropsKey) {
7878 private static void compute (MeasureComputerContext context , String metricKey ) {
7979 final Component component = context .getComponent ();
8080 if (component .getType () == Component .Type .FILE ) {
81- LOG . debug ( "Component {}: FILE doesn't required an aggregation" , component . getKey ());
81+ // FILE doesn't required any aggregation. Relevant metrics should be provided by the sensor.
8282 return ;
8383 }
8484 final Measure existingMeasure = context .getMeasure (metricKey );
8585 if (existingMeasure != null ) {
86+ // For all other component types (e.g. PROJECT, MODULE, DIRECTORY) the
87+ // measurement <metricKey> should not be calculated manually (e.g. in the sensors).
88+ // Otherwise there is a chance, that your custom calculation won't work properly for
89+ // multi-module projects.
8690 LOG .debug ("Component {}: measure {} already calculated, value = {}" , component .getKey (), metricKey ,
8791 existingMeasure .getIntValue ());
8892 return ;
8993 }
9094 Iterable <Measure > childrenMeasures = context .getChildrenMeasures (metricKey );
9195 if (childrenMeasures == null || !childrenMeasures .iterator ().hasNext ()) {
92- LOG .debug ("Component {}: measure {} is not set for children" , component .getKey (), metricKey );
96+ // There is always a chance, that required metrics were not calculated for this particular component
97+ // (e.g. one of modules in a multi-module project doesn't contain any C/C++ data at all).
98+ // So don't complain about the missing data, but just ignore such components.
9399 return ;
94100 }
95101 int aggregation = 0 ;
@@ -98,7 +104,7 @@ private static void compute(MeasureComputerContext context, String metricKey) {
98104 aggregation += childMeasure .getIntValue ();
99105 }
100106 }
101- LOG .info ("Component {}: add measure {}, value {}" , component .getKey (), metricKey , aggregation );
107+ LOG .debug ("Component {}: add measure {}, value {}" , component .getKey (), metricKey , aggregation );
102108 context .addMeasure (metricKey , aggregation );
103109 }
104110
0 commit comments