Search in sources :

Example 1 with LineBasedAllowFilter

use of com.wavefront.agent.preprocessor.LineBasedAllowFilter in project java by wavefrontHQ.

the class SpanUtilsTest method testSpanLineDataBlockPreprocessor.

@Test
public void testSpanLineDataBlockPreprocessor() {
    Supplier<ReportableEntityPreprocessor> preprocessorSupplier = () -> {
        ReportableEntityPreprocessor preprocessor = new ReportableEntityPreprocessor();
        PreprocessorRuleMetrics preprocessorRuleMetrics = new PreprocessorRuleMetrics(null, null, null);
        preprocessor.forPointLine().addFilter(new LineBasedAllowFilter("^valid.*", preprocessorRuleMetrics));
        preprocessor.forSpan().addFilter(new SpanBlockFilter(SERVICE_TAG_KEY, "^test.*", null, preprocessorRuleMetrics));
        return preprocessor;
    };
    String spanLine = "\"valid.metric\" \"source\"=\"localdev\" " + "\"spanId\"=\"4217104a-690d-4927-baff-d9aa779414c2\" " + "\"traceId\"=\"d5355bf7-fc8d-48d1-b761-75b170f396e0\" " + "\"application\"=\"app\" \"service\"=\"svc\" " + startTime + " 100";
    mockTraceHandler.block(null, spanLine);
    expectLastCall();
    replay(mockTraceHandler, mockTraceSpanLogsHandler);
    preprocessAndHandleSpan(spanLine, spanDecoder, mockTraceHandler, mockTraceHandler::report, preprocessorSupplier, null, span -> true);
    verify(mockTraceHandler);
}
Also used : PreprocessorRuleMetrics(com.wavefront.agent.preprocessor.PreprocessorRuleMetrics) ReportableEntityPreprocessor(com.wavefront.agent.preprocessor.ReportableEntityPreprocessor) LineBasedAllowFilter(com.wavefront.agent.preprocessor.LineBasedAllowFilter) SpanBlockFilter(com.wavefront.agent.preprocessor.SpanBlockFilter) Test(org.junit.Test)

Aggregations

LineBasedAllowFilter (com.wavefront.agent.preprocessor.LineBasedAllowFilter)1 PreprocessorRuleMetrics (com.wavefront.agent.preprocessor.PreprocessorRuleMetrics)1 ReportableEntityPreprocessor (com.wavefront.agent.preprocessor.ReportableEntityPreprocessor)1 SpanBlockFilter (com.wavefront.agent.preprocessor.SpanBlockFilter)1 Test (org.junit.Test)1