private void reportOnCollector ( ) { for ( final Counter counter : collector . getCounters ( ) ) { if ( ! counter . isDisplayed ( ) ) { continue ; } final List < CounterRequest > requests = counter . getRequests ( ) ; long hits = 0 ; long duration = 0 ; long errors = 0 ; for ( final CounterRequest cr : requests ) { hits += cr . getHits ( ) ; duration += cr . getDurationsSum ( ) ; errors += cr . getSystemErrors ( ) ; } final String sanitizedName = sanitizeName ( counter . getName ( ) ) ; printLong ( MetricType . COUNTER , sanitizedName + "_hits_count" , "javamelody counter" , hits ) ; if ( ! counter . isErrorCounter ( ) || counter . isJobCounter ( ) ) { // errors has no sense for the error and log counters printLong ( MetricType . COUNTER , sanitizedName + "_errors_count" , "javamelody counter" , errors ) ; } if ( duration >= 0 ) { // duration is negative and has no sense for the log counter printLong ( MetricType . COUNTER , sanitizedName + "_duration_millis" , "javamelody counter" , duration ) ; } } }
Reports on hits errors and duration sum for all counters in the collector .