public void Remove(string name, MetricTags tags) { var key = MetricIdentifier.Calculate(name, tags.Tags); MetricMeta m; this.metrics.TryRemove(key, out m); EventMetricsCleaner.RemoveEvent(key); }
public void RemoveEvent_RemovesEventFromAllReports() { ResetCleaner(); var registry = new DefaultMetricsRegistry(); registry.Event(MetricName, () => { return(new EventMetric()); }, MetricTags.None); var reportIndex1 = EventMetricsCleaner.RegisterReport(new TimeSpan(0, 0, 0, 60)); var reportIndex2 = EventMetricsCleaner.RegisterReport(new TimeSpan(0, 0, 0, 60)); EventMetricsCleaner.UpdateTotalReportedEvents(reportIndex1, registry.DataProvider.Events); EventMetricsCleaner.UpdateTotalReportedEvents(reportIndex2, registry.DataProvider.Events); EventMetricsCleaner.RemoveEvent(metricNameTypeTags); GetReportsEventCount(reportIndex1).Should().Be(0); GetReportsEventCount(reportIndex2).Should().Be(0); }