Search in sources :

Example 1 with NoMetricsFilter

use of com.yahoo.logserver.filter.NoMetricsFilter in project vespa by vespa-engine.

the class LogFilterManagerTestCase method testSystemFilters.

@Test
public void testSystemFilters() {
    LogFilter f;
    f = LogFilterManager.getLogFilter("system.allevents");
    assertNotNull(f);
    assertTrue(f instanceof LevelFilter);
    f = LogFilterManager.getLogFilter("system.metricsevents");
    assertNotNull(f);
    assertTrue(f instanceof MetricsFilter);
    f = LogFilterManager.getLogFilter("system.nometricsevents");
    assertNotNull(f);
    assertTrue(f instanceof NoMetricsFilter);
    f = LogFilterManager.getLogFilter("system.all");
    assertNotNull(f);
    assertTrue(f instanceof NullFilter);
    f = LogFilterManager.getLogFilter("system.mute");
    assertNotNull(f);
    assertTrue(f instanceof MuteFilter);
    assertTrue(f == MuteFilter.getInstance());
}
Also used : LevelFilter(com.yahoo.logserver.filter.LevelFilter) NoMetricsFilter(com.yahoo.logserver.filter.NoMetricsFilter) MuteFilter(com.yahoo.logserver.filter.MuteFilter) NullFilter(com.yahoo.logserver.filter.NullFilter) LogFilter(com.yahoo.logserver.filter.LogFilter) MetricsFilter(com.yahoo.logserver.filter.MetricsFilter) NoMetricsFilter(com.yahoo.logserver.filter.NoMetricsFilter)

Example 2 with NoMetricsFilter

use of com.yahoo.logserver.filter.NoMetricsFilter in project vespa by vespa-engine.

the class NoMetricsFilterTestCase method testValueEvents.

@Test
public void testValueEvents() throws InvalidLogFormatException, IOException {
    NoMetricsFilter filter = new NoMetricsFilter();
    MetricsFilter metricsFilter = new MetricsFilter();
    String filename = "src/test/files/value-events.txt";
    BufferedReader br = new BufferedReader(new FileReader(filename));
    for (String line = br.readLine(); line != null; line = br.readLine()) {
        LogMessage m = LogMessage.parseNativeFormat(line);
        assertNotNull(m);
        try {
            Event event = m.getEvent();
            assertNotNull(event);
        } catch (MalformedEventException e) {
            fail();
        }
        if (filter.isLoggable(m)) {
            fail();
        } else {
            assertTrue(true);
        }
        if (metricsFilter.isLoggable(m)) {
            assertTrue(true);
        } else {
            fail();
        }
    }
}
Also used : NoMetricsFilter(com.yahoo.logserver.filter.NoMetricsFilter) LogMessage(com.yahoo.log.LogMessage) MalformedEventException(com.yahoo.log.event.MalformedEventException) BufferedReader(java.io.BufferedReader) Event(com.yahoo.log.event.Event) FileReader(java.io.FileReader) MetricsFilter(com.yahoo.logserver.filter.MetricsFilter) NoMetricsFilter(com.yahoo.logserver.filter.NoMetricsFilter)

Aggregations

MetricsFilter (com.yahoo.logserver.filter.MetricsFilter)2 NoMetricsFilter (com.yahoo.logserver.filter.NoMetricsFilter)2 LogMessage (com.yahoo.log.LogMessage)1 Event (com.yahoo.log.event.Event)1 MalformedEventException (com.yahoo.log.event.MalformedEventException)1 LevelFilter (com.yahoo.logserver.filter.LevelFilter)1 LogFilter (com.yahoo.logserver.filter.LogFilter)1 MuteFilter (com.yahoo.logserver.filter.MuteFilter)1 NullFilter (com.yahoo.logserver.filter.NullFilter)1 BufferedReader (java.io.BufferedReader)1 FileReader (java.io.FileReader)1