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(); } }
Map<String, MetricsDuration> map = new HashMap<String, MetricsDuration>(); Queue<MetricsSnapshotInterface> metrics = MetricsRegistry.getInstance().getSnapshotList( logChannelId );
List<MetricsDuration> durations = new ArrayList<MetricsDuration>(); Queue<MetricsSnapshotInterface> metrics = MetricsRegistry.getInstance().getSnapshotList( logChannelId ); MetricsSnapshotInterface start = null;
for ( String logChannelId : logChannelIds ) { Queue<MetricsSnapshotInterface> snapshotList = MetricsRegistry.getInstance().getSnapshotLists().get( logChannelId ); if ( snapshotList != null ) { Iterator<MetricsSnapshotInterface> iterator = snapshotList.iterator(); MetricsRegistry.getInstance().getSnapshotMaps().get( logChannelId ); if ( snapshotMap != null ) { synchronized ( snapshotMap ) {
void cleanUp() { KettleClientEnvironment.reset(); PluginRegistry.getInstance().reset(); MetricsRegistry.getInstance().reset(); ExtensionPointMap.getInstance().reset(); if ( KettleLogStore.isInitialized() ) { KettleLogStore.getInstance().reset(); } KettleLogStore.setLogChannelInterfaceFactory( new LogChannelFactory() ); if ( Props.isInitialized() ) { Props.getInstance().reset(); } KettleVFS.getInstance().reset(); XMLHandlerCache.getInstance().clear(); ValueMetaFactory.pluginRegistry = PluginRegistry.getInstance(); // under no circumstance reset the LoggingRegistry // LoggingRegistry.getInstance().reset(); }