public List < InMemoryHistoryNode > getMetrics ( final String metricName , final Date from , final Date to , final Boolean useStats ) throws ClassCastException { final LinkedList < InMemoryHistoryNode > selectedLists = new LinkedList <> ( ) ; if ( this . historyListMapping . containsKey ( metricName ) ) { logger . debug ( "selecting snapshots within time frame" ) ; synchronized ( this . historyListMapping . get ( metricName ) ) { for ( final InMemoryHistoryNode node : this . historyListMapping . get ( metricName ) ) { if ( node . getTimestamp ( ) . after ( from ) && node . getTimestamp ( ) . before ( to ) ) { selectedLists . add ( node ) ; } if ( node . getTimestamp ( ) . after ( to ) ) { break ; } } } // selecting nodes if num of nodes > numInstances if ( useStats ) { statBasedSelectMetricHistory ( selectedLists ) ; } else { generalSelectMetricHistory ( selectedLists ) ; } } cleanUsingTime ( metricName , new Date ( ) ) ; return selectedLists ; }
Get snapshots for a given metric at a given time