use of com.kixeye.chassis.support.metrics.MetricFilter in project chassis by Kixeye.
the class MetricFilterTest method patternMatchMultipleMetricsWithStatsFilter.
@Test
public void patternMatchMultipleMetricsWithStatsFilter() {
MetricFilter filter = new MetricFilter("MyMetric1=com.[a-zA-Z0-9]*.MyMetric1:5m,MyMetric2=com.[a-zA-Z0-9]*.MyMetric2:5m");
Assert.assertTrue(filter.matches("com.kixeye.MyMetric1", new Metric() {
}));
Assert.assertTrue(filter.matches("com.kixeye.MyMetric2", new Metric() {
}));
Assert.assertFalse(filter.matches("com.kixeye.MyMetric3", new Metric() {
}));
Assert.assertNotNull(filter.getMatchingMetricDescriptor("com.kixeye.MyMetric1", Stat.RATE_5_MINUTE));
Assert.assertNull(filter.getMatchingMetricDescriptor("com.kixeye.MyMetric1", Stat.RATE_15_MINUTE));
Assert.assertNull(filter.getMatchingMetricDescriptor("com.kixeye.MyMetric1", Stat.ALL));
Assert.assertNotNull(filter.getMatchingMetricDescriptor("com.kixeye.MyMetric2", Stat.RATE_5_MINUTE));
Assert.assertNull(filter.getMatchingMetricDescriptor("com.kixeye.MyMetric2", Stat.RATE_15_MINUTE));
Assert.assertNull(filter.getMatchingMetricDescriptor("com.kixeye.MyMetric2", Stat.ALL));
Assert.assertNull(filter.getMatchingMetricDescriptor("com.kixeye.MyMetric3", Stat.RATE_5_MINUTE));
Assert.assertNull(filter.getMatchingMetricDescriptor("com.kixeye.MyMetric3", Stat.RATE_15_MINUTE));
Assert.assertNull(filter.getMatchingMetricDescriptor("com.kixeye.MyMetric3", Stat.ALL));
}
use of com.kixeye.chassis.support.metrics.MetricFilter in project chassis by Kixeye.
the class MetricFilterTest method matchesAsterix.
@Test
public void matchesAsterix() {
MetricFilter filter = new MetricFilter("*");
Assert.assertTrue(filter.matches("mymetric", new Metric() {
}));
}
use of com.kixeye.chassis.support.metrics.MetricFilter in project chassis by Kixeye.
the class MetricFilterTest method patternMatchSingleMetric.
@Test
public void patternMatchSingleMetric() {
MetricFilter filter = new MetricFilter("MyMetric=com.[a-zA-Z0-9]*.MyMetric");
Assert.assertTrue(filter.matches("com.kixeye.MyMetric", new Metric() {
}));
}
use of com.kixeye.chassis.support.metrics.MetricFilter in project chassis by Kixeye.
the class MetricFilterTest method exactMatchMultipleMetrics.
@Test
public void exactMatchMultipleMetrics() {
MetricFilter filter = new MetricFilter("MyMetric1=com.kixeye.MyMetric1,MyMetric2=com.kixeye.MyMetric2");
Assert.assertTrue(filter.matches("com.kixeye.MyMetric1", new Metric() {
}));
Assert.assertTrue(filter.matches("com.kixeye.MyMetric2", new Metric() {
}));
Assert.assertFalse(filter.matches("com.kixeye.MyMetric3", new Metric() {
}));
}
use of com.kixeye.chassis.support.metrics.MetricFilter in project chassis by Kixeye.
the class MetricsCloudWatchConfigurationTest method testUpdateFilter.
@Test
public void testUpdateFilter() {
MetricFilter filter = metricsCloudWatchConfiguration.getReporter().getFilter();
Assert.assertEquals("foo=bar", filter.getStringValue());
ConfigurationManager.getConfigInstance().setProperty(removePlaceholder(MetricsCloudWatchReporter.METRICS_AWS_FILTER_PROPERTY_NAME), "foo=baz");
Assert.assertNotEquals(filter, metricsCloudWatchConfiguration.getReporter().getFilter());
Assert.assertEquals("foo=baz", metricsCloudWatchConfiguration.getReporter().getFilter().getStringValue());
}
Aggregations