public static List<MetricsSnapshotInterface> getResultsList( Metrics metric ) { List<MetricsSnapshotInterface> snapshots = new ArrayList<MetricsSnapshotInterface>(); Map<String, Map<String, MetricsSnapshotInterface>> snapshotMaps = MetricsRegistry.getInstance().getSnapshotMaps(); Iterator<Map<String, MetricsSnapshotInterface>> mapsIterator = snapshotMaps.values().iterator(); while ( mapsIterator.hasNext() ) { Map<String, MetricsSnapshotInterface> map = mapsIterator.next(); Iterator<MetricsSnapshotInterface> snapshotIterator = map.values().iterator(); while ( snapshotIterator.hasNext() ) { MetricsSnapshotInterface snapshot = snapshotIterator.next(); if ( snapshot.getMetric().equals( metric ) ) { snapshots.add( snapshot ); } } } return snapshots; }
public static Long getResult( Metrics metric ) { Map<String, Map<String, MetricsSnapshotInterface>> snapshotMaps = MetricsRegistry.getInstance().getSnapshotMaps(); Iterator<Map<String, MetricsSnapshotInterface>> mapsIterator = snapshotMaps.values().iterator(); while ( mapsIterator.hasNext() ) { Map<String, MetricsSnapshotInterface> map = mapsIterator.next(); Iterator<MetricsSnapshotInterface> snapshotIterator = map.values().iterator(); while ( snapshotIterator.hasNext() ) { MetricsSnapshotInterface snapshot = snapshotIterator.next(); if ( snapshot.getMetric().equals( metric ) ) { return snapshot.getValue(); } } } return null; }
/** * Discard all the lines for the specified log channel id AND all the children. * * @param parentLogChannelId * the parent log channel id to be removed along with all its children. */ public static void discardLines( String parentLogChannelId, boolean includeGeneralMessages ) { LoggingRegistry registry = LoggingRegistry.getInstance(); MetricsRegistry metricsRegistry = MetricsRegistry.getInstance(); List<String> ids = registry.getLogChannelChildren( parentLogChannelId ); // Remove all the rows for these ids // LoggingBuffer bufferAppender = getInstance().appender; // int beforeSize = bufferAppender.size(); for ( String id : ids ) { // Remove it from the central log buffer // bufferAppender.removeChannelFromBuffer( id ); // Also remove the item from the registry. // registry.getMap().remove( id ); metricsRegistry.getSnapshotLists().remove( id ); metricsRegistry.getSnapshotMaps().remove( id ); } // Now discard the general lines if this is required // if ( includeGeneralMessages ) { bufferAppender.removeGeneralMessages(); } }
MetricsRegistry.getInstance().getSnapshotMaps().get( logChannelId ); if ( snapshotMap != null ) { synchronized ( snapshotMap ) {