Search in sources :

Example 1 with SpanAddAnnotationIfNotExistsTransformer

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

the class PushAgentTest method setUserPreprocessorForTraceDerivedREDMetrics.

private void setUserPreprocessorForTraceDerivedREDMetrics(int port) {
    ReportableEntityPreprocessor preprocessor = new ReportableEntityPreprocessor();
    PreprocessorRuleMetrics preprocessorRuleMetrics = new PreprocessorRuleMetrics(null, null, null);
    preprocessor.forSpan().addTransformer(new SpanAddAnnotationIfNotExistsTransformer("application", PREPROCESSED_APPLICATION_TAG_VALUE, x -> true, preprocessorRuleMetrics));
    preprocessor.forSpan().addTransformer(new SpanAddAnnotationIfNotExistsTransformer("service", PREPROCESSED_SERVICE_TAG_VALUE, x -> true, preprocessorRuleMetrics));
    preprocessor.forSpan().addTransformer(new SpanAddAnnotationIfNotExistsTransformer("cluster", PREPROCESSED_CLUSTER_TAG_VALUE, x -> true, preprocessorRuleMetrics));
    preprocessor.forSpan().addTransformer(new SpanAddAnnotationIfNotExistsTransformer("shard", PREPROCESSED_SHARD_TAG_VALUE, x -> true, preprocessorRuleMetrics));
    preprocessor.forSpan().addTransformer(new SpanReplaceRegexTransformer("sourceName", "^test.*", PREPROCESSED_SOURCE_VALUE, null, null, false, x -> true, preprocessorRuleMetrics));
    Map<String, ReportableEntityPreprocessor> userPreprocessorMap = new HashMap<>();
    userPreprocessorMap.put(String.valueOf(port), preprocessor);
    proxy.preprocessors.userPreprocessors = userPreprocessorMap;
}
Also used : PreprocessorRuleMetrics(com.wavefront.agent.preprocessor.PreprocessorRuleMetrics) QueueingReason(com.wavefront.agent.data.QueueingReason) MockReportableEntityHandlerFactory(com.wavefront.agent.handlers.MockReportableEntityHandlerFactory) HttpPost(org.apache.http.client.methods.HttpPost) SSLContext(javax.net.ssl.SSLContext) TestUtils.httpPost(com.wavefront.agent.TestUtils.httpPost) TrustManager(javax.net.ssl.TrustManager) ReportEvent(wavefront.report.ReportEvent) TestUtils.findAvailablePort(com.wavefront.agent.TestUtils.findAvailablePort) StatusLine(org.apache.http.StatusLine) SecureRandom(java.security.SecureRandom) APPLICATION_TAG_KEY(com.wavefront.sdk.common.Constants.APPLICATION_TAG_KEY) DurationSampler(com.wavefront.sdk.entities.tracing.sampling.DurationSampler) ReportableEntityHandler(com.wavefront.agent.handlers.ReportableEntityHandler) EasyMock.reset(org.easymock.EasyMock.reset) After(org.junit.After) Map(java.util.Map) HandlerKey(com.wavefront.agent.handlers.HandlerKey) ReportPoint(wavefront.report.ReportPoint) TestUtils.getResource(com.wavefront.agent.TestUtils.getResource) Assert.fail(org.junit.Assert.fail) TestUtils.verifyWithTimeout(com.wavefront.agent.TestUtils.verifyWithTimeout) HEART_BEAT_METRIC(com.wavefront.sdk.common.Constants.HEART_BEAT_METRIC) EasyMock.eq(org.easymock.EasyMock.eq) SpanAddAnnotationIfNotExistsTransformer(com.wavefront.agent.preprocessor.SpanAddAnnotationIfNotExistsTransformer) HealthCheckManagerImpl(com.wavefront.agent.channel.HealthCheckManagerImpl) SHARD_TAG_KEY(com.wavefront.sdk.common.Constants.SHARD_TAG_KEY) SenderTask(com.wavefront.agent.handlers.SenderTask) ImmutableMap(com.google.common.collect.ImmutableMap) Collection(java.util.Collection) ReportableEntityPreprocessor(com.wavefront.agent.preprocessor.ReportableEntityPreprocessor) StringEntity(org.apache.http.entity.StringEntity) UUID(java.util.UUID) Span(wavefront.report.Span) Logger(java.util.logging.Logger) NotThreadSafe(net.jcip.annotations.NotThreadSafe) SSLSocketFactory(javax.net.ssl.SSLSocketFactory) SourceTag(com.wavefront.dto.SourceTag) SocketFactory(javax.net.SocketFactory) ReportableEntityType(com.wavefront.data.ReportableEntityType) AgentConfiguration(com.wavefront.api.agent.AgentConfiguration) List(java.util.List) SERVICE_TAG_KEY(com.wavefront.sdk.common.Constants.SERVICE_TAG_KEY) Assert.assertFalse(org.junit.Assert.assertFalse) GZIPOutputStream(java.util.zip.GZIPOutputStream) CLUSTER_TAG_KEY(com.wavefront.sdk.common.Constants.CLUSTER_TAG_KEY) SourceTagAction(wavefront.report.SourceTagAction) Annotation(wavefront.report.Annotation) PreprocessorRuleMetrics(com.wavefront.agent.preprocessor.PreprocessorRuleMetrics) Socket(java.net.Socket) BeforeClass(org.junit.BeforeClass) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ReportSourceTag(wavefront.report.ReportSourceTag) SpanSampler(com.wavefront.agent.sampler.SpanSampler) HashMap(java.util.HashMap) SpanLogs(wavefront.report.SpanLogs) SourceOperationType(wavefront.report.SourceOperationType) BufferedOutputStream(java.io.BufferedOutputStream) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) Event(com.wavefront.dto.Event) HttpClient(org.apache.http.client.HttpClient) EasyMock.replay(org.easymock.EasyMock.replay) EasyMock.startsWith(org.easymock.EasyMock.startsWith) NaiveTrustManager(com.wavefront.agent.tls.NaiveTrustManager) TestUtils.httpGet(com.wavefront.agent.TestUtils.httpGet) Nonnull(javax.annotation.Nonnull) Before(org.junit.Before) EasyMock.anyObject(org.easymock.EasyMock.anyObject) Capture(org.easymock.Capture) HttpsURLConnection(javax.net.ssl.HttpsURLConnection) SenderTaskFactory(com.wavefront.agent.handlers.SenderTaskFactory) EasyMock.anyString(org.easymock.EasyMock.anyString) WavefrontSender(com.wavefront.sdk.common.WavefrontSender) TestUtils.gzippedHttpPost(com.wavefront.agent.TestUtils.gzippedHttpPost) Assert.assertTrue(org.junit.Assert.assertTrue) AssertionFailedError(junit.framework.AssertionFailedError) Test(org.junit.Test) DeltaCounterAccumulationHandlerImpl(com.wavefront.agent.handlers.DeltaCounterAccumulationHandlerImpl) EasyMock(org.easymock.EasyMock) EasyMock.expect(org.easymock.EasyMock.expect) SpanLog(wavefront.report.SpanLog) KeyManager(javax.net.ssl.KeyManager) EasyMock.expectLastCall(org.easymock.EasyMock.expectLastCall) RateSampler(com.wavefront.sdk.entities.tracing.sampling.RateSampler) CaptureType(org.easymock.CaptureType) ReportableEntityHandlerFactory(com.wavefront.agent.handlers.ReportableEntityHandlerFactory) TestUtils.waitUntilListenerIsOnline(com.wavefront.agent.TestUtils.waitUntilListenerIsOnline) EasyMock.anyLong(org.easymock.EasyMock.anyLong) HttpResponse(org.apache.http.HttpResponse) EasyMock.verify(org.easymock.EasyMock.verify) Histogram(wavefront.report.Histogram) HistogramType(wavefront.report.HistogramType) Assert.assertEquals(org.junit.Assert.assertEquals) SpanReplaceRegexTransformer(com.wavefront.agent.preprocessor.SpanReplaceRegexTransformer) ReportableEntityPreprocessor(com.wavefront.agent.preprocessor.ReportableEntityPreprocessor) HashMap(java.util.HashMap) SpanAddAnnotationIfNotExistsTransformer(com.wavefront.agent.preprocessor.SpanAddAnnotationIfNotExistsTransformer) EasyMock.anyString(org.easymock.EasyMock.anyString) SpanReplaceRegexTransformer(com.wavefront.agent.preprocessor.SpanReplaceRegexTransformer)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 TestUtils.findAvailablePort (com.wavefront.agent.TestUtils.findAvailablePort)1 TestUtils.getResource (com.wavefront.agent.TestUtils.getResource)1 TestUtils.gzippedHttpPost (com.wavefront.agent.TestUtils.gzippedHttpPost)1 TestUtils.httpGet (com.wavefront.agent.TestUtils.httpGet)1 TestUtils.httpPost (com.wavefront.agent.TestUtils.httpPost)1 TestUtils.verifyWithTimeout (com.wavefront.agent.TestUtils.verifyWithTimeout)1 TestUtils.waitUntilListenerIsOnline (com.wavefront.agent.TestUtils.waitUntilListenerIsOnline)1 HealthCheckManagerImpl (com.wavefront.agent.channel.HealthCheckManagerImpl)1 QueueingReason (com.wavefront.agent.data.QueueingReason)1 DeltaCounterAccumulationHandlerImpl (com.wavefront.agent.handlers.DeltaCounterAccumulationHandlerImpl)1 HandlerKey (com.wavefront.agent.handlers.HandlerKey)1 MockReportableEntityHandlerFactory (com.wavefront.agent.handlers.MockReportableEntityHandlerFactory)1 ReportableEntityHandler (com.wavefront.agent.handlers.ReportableEntityHandler)1 ReportableEntityHandlerFactory (com.wavefront.agent.handlers.ReportableEntityHandlerFactory)1 SenderTask (com.wavefront.agent.handlers.SenderTask)1 SenderTaskFactory (com.wavefront.agent.handlers.SenderTaskFactory)1 PreprocessorRuleMetrics (com.wavefront.agent.preprocessor.PreprocessorRuleMetrics)1 ReportableEntityPreprocessor (com.wavefront.agent.preprocessor.ReportableEntityPreprocessor)1