private void reportGauge ( String name , Gauge gauge ) { String prefixedName = prefix ( name ) ; Object value = gauge . getValue ( ) ; if ( value instanceof Number ) { if ( ! snapshots . hasDescriptor ( prefixedName ) ) { snapshots . setDescriptor ( prefixedName , MetricItem . Builder . create ( ) . count ( "gauge" ) . build ( ) ) ; } long timestamp = getTimestamp ( ) ; snapshots . addSnapshot ( prefixedName , timestamp , ( Map ) map ( "gauge" , value ) ) ; } }
Report a gauge using the field gauge . Only numeric values are used .