private synchronized void removeOldMetrics() { registry.removeMatching(new MetricFilter() { @Override public boolean matches(String name, Metric metric) { return name.startsWith("drill.allocator."); } }); }
public static void resetMetrics() { RegistryHolder.REGISTRY.removeMatching(MetricFilter.ALL); RegistryHolder.registerSystemMetrics(); }
public void removeAll(MetricSet metrics) { //Could be replaced when metrics support remove all functions // https://github.com/dropwizard/metrics/pull/1280 Map<String, Metric> nameToMetric = metrics.getMetrics(); registry.removeMatching((name, metric) -> nameToMetric.containsKey(name)); }
@Override protected void shutDown() throws Exception { eventBus.unregister(this); metricRegistry.removeMatching((name, metric) -> name.startsWith(name(ConfigurationService.class, "etag-cache"))); } }
private void resetMetrics() { MetricManager.INSTANCE.getRegistry().removeMatching(MetricFilter.ALL); }
@Subscribe public void handlePipelineChanges(PipelinesChangedEvent event) { event.deletedPipelineIds().forEach(id -> { log.debug("Invalidated pipeline {}", id); metricRegistry.removeMatching((name, metric) -> name.startsWith(name(Pipeline.class, id))); }); event.updatedPipelineIds().forEach(id -> log.debug("Refreshing pipeline {}", id)); scheduler.schedule(() -> serverEventBus.post(reloadAndSave()), 0, TimeUnit.SECONDS); }
@Subscribe public void handleRuleChanges(RulesChangedEvent event) { event.deletedRuleIds().forEach(id -> { log.debug("Invalidated rule {}", id); metricRegistry.removeMatching((name, metric) -> name.startsWith(name(Rule.class, id))); }); event.updatedRuleIds().forEach(id -> log.debug("Refreshing rule {}", id)); scheduler.schedule(() -> serverEventBus.post(reloadAndSave()), 0, TimeUnit.SECONDS); }
private void resetMetrics() { MetricManager.INSTANCE.getRegistry().removeMatching(MetricFilter.ALL); }
@AssistedInject public State(@Assisted ImmutableMap<String, Pipeline> currentPipelines, @Assisted ImmutableSetMultimap<String, Pipeline> streamPipelineConnections, MetricRegistry metricRegistry, @Named("processbuffer_processors") int processorCount, @Named("cached_stageiterators") boolean cachedIterators) { this.currentPipelines = currentPipelines; this.streamPipelineConnections = streamPipelineConnections; this.cachedIterators = cachedIterators; cache = CacheBuilder.newBuilder() .concurrencyLevel(processorCount) .recordStats() .build(new CacheLoader<Set<Pipeline>, StageIterator.Configuration>() { @Override public StageIterator.Configuration load(@Nonnull Set<Pipeline> pipelines) throws Exception { return new StageIterator.Configuration(pipelines); } }); // we have to remove the metrics, because otherwise we leak references to the cache (and the register call with throw) metricRegistry.removeMatching((name, metric) -> name.startsWith(name(PipelineInterpreter.class, "stage-cache"))); MetricUtils.safelyRegisterAll(metricRegistry, new CacheStatsSet(name(PipelineInterpreter.class, "stage-cache"), cache)); }
<C extends Configuration> void createCache(final CacheManager cacheManager, final String cacheName, final C configuration) { // Make sure we start from a clean state - this is mainly useful for tests cacheManager.destroyCache(cacheName); final Cache cache = cacheManager.createCache(cacheName, configuration); Preconditions.checkState(!cache.isClosed(), "Cache '%s' should not be closed", cacheName); // Re-create the metrics to support dynamically created caches (e.g. for Shiro) metricRegistry.removeMatching(new MetricFilter() { @Override public boolean matches(final String name, final Metric metric) { return name != null && name.startsWith(PROP_METRIC_REG_JCACHE_STATISTICS); } }); metricRegistry.register(PROP_METRIC_REG_JCACHE_STATISTICS, new JCacheGaugeSet()); } }
public synchronized void removeAllMetrics() { getRegistry().removeMatching((s, metric) -> true); }
@After public void tearDown() { registry.removeMatching(MetricFilter.ALL); } }
MetricManager.INSTANCE.getRegistry().removeMatching((s, metric) -> s.contains(session));
/** * Removes all Metrics that match a given filter. * * @param filter filter to use to select the Metrics to remove. */ @Override public void removeMatching(final MetricFilter filter) { metricsRegistry.removeMatching(filter); }
public static void resetMetrics(){ RegistryHolder.REGISTRY.removeMatching(new MetricFilter(){ @Override public boolean matches(String name, Metric metric) { return true; }}); RegistryHolder.registerSysStats(); }
@Override public void close() { LOGGER.debug("Closing monitor (all metrics will be removed from the underlying registry)"); registry.removeMatching(MetricFilter.ALL); }
@Override public void close() throws Exception { final String prefix = MetricRegistry.name(module.getId()); metrics.removeMatching(new MetricFilter() { @Override public boolean matches(String name, Metric metric) { return name.startsWith(prefix); } }); } }
@Override public void close() throws Exception { final String prefix = MetricRegistry.name(module.getId()); metrics.removeMatching(new MetricFilter() { @Override public boolean matches(String name, Metric metric) { return name.startsWith(prefix); } }); } }
public static void removeAll( final Class<?> clz ) { registry().removeMatching( ( name, metric ) -> name.startsWith( clz.getName() + "." ) ); }
@BeforeMethod(groups = "slow") public void beforeMethod() throws Exception { embeddedDB.cleanupAllTables(); clock.resetDeltaFromReality(); metricRegistry.removeMatching(MetricFilter.ALL); }