private CounterMetricFamily fromCounter ( List < Map . Entry < MetricName , Counter > > countersWithSameName ) { final Map . Entry < MetricName , Counter > first = countersWithSameName . get ( 0 ) ; final MetricName firstName = first . getKey ( ) ; final CounterMetricFamily metricFamily = new CounterMetricFamily ( firstName . getName ( ) , getHelpMessage ( firstName , first . getValue ( ) ) , firstName . getTagKeys ( ) ) ; for ( Map . Entry < MetricName , Counter > entry : countersWithSameName ) { metricFamily . addMetric ( entry . getKey ( ) . getTagValues ( ) , entry . getValue ( ) . getCount ( ) ) ; } return metricFamily ; }
Export counter as prometheus counter .