Search in sources :

Example 1 with HealthCheckManagerImpl

use of com.wavefront.agent.channel.HealthCheckManagerImpl in project java by wavefrontHQ.

the class PushAgentTest method testWavefrontUnifiedPortHandlerPlaintextOverHttp.

@Test
public void testWavefrontUnifiedPortHandlerPlaintextOverHttp() throws Exception {
    port = findAvailablePort(2888);
    int securePort = findAvailablePort(2889);
    int healthCheckPort = findAvailablePort(8881);
    proxy.proxyConfig.privateCertPath = getClass().getClassLoader().getResource("demo.cert").getPath();
    proxy.proxyConfig.privateKeyPath = getClass().getClassLoader().getResource("demo.key").getPath();
    proxy.proxyConfig.tlsPorts = "1,23 , 4,   , " + securePort + "  ,6";
    proxy.initSslContext();
    proxy.proxyConfig.pushListenerPorts = port + "," + securePort;
    proxy.proxyConfig.httpHealthCheckPath = "/health";
    proxy.proxyConfig.httpHealthCheckPorts = String.valueOf(healthCheckPort);
    proxy.proxyConfig.httpHealthCheckAllPorts = true;
    proxy.healthCheckManager = new HealthCheckManagerImpl(proxy.proxyConfig);
    SpanSampler sampler = new SpanSampler(new RateSampler(1.0D), () -> null);
    proxy.startGraphiteListener(String.valueOf(port), mockHandlerFactory, null, sampler);
    proxy.startGraphiteListener(String.valueOf(securePort), mockHandlerFactory, null, sampler);
    proxy.startHealthCheckListener(healthCheckPort);
    waitUntilListenerIsOnline(port);
    waitUntilListenerIsOnline(securePort);
    reset(mockPointHandler);
    mockPointHandler.report(ReportPoint.newBuilder().setTable("dummy").setMetric("metric3.test").setHost("test1").setTimestamp(startTime * 1000).setValue(0.0d).build());
    expectLastCall();
    mockPointHandler.report(ReportPoint.newBuilder().setTable("dummy").setMetric("metric3.test").setHost("test2").setTimestamp((startTime + 1) * 1000).setValue(1.0d).build());
    expectLastCall();
    mockPointHandler.report(ReportPoint.newBuilder().setTable("dummy").setMetric("metric3.test").setHost("test3").setTimestamp((startTime + 2) * 1000).setValue(2.0d).build());
    expectLastCall();
    replay(mockPointHandler);
    // try http connection
    String payloadStr = "metric3.test 0 " + startTime + " source=test1\n" + "metric3.test 1 " + (startTime + 1) + " source=test2\n" + "metric3.test 2 " + (startTime + 2) + // note the lack of newline at the end!
    " source=test3";
    assertEquals(202, httpPost("http://localhost:" + port, payloadStr));
    assertEquals(200, httpGet("http://localhost:" + port + "/health"));
    assertEquals(202, httpGet("http://localhost:" + port + "/health2"));
    assertEquals(200, httpGet("http://localhost:" + healthCheckPort + "/health"));
    assertEquals(404, httpGet("http://localhost:" + healthCheckPort + "/health2"));
    verify(mockPointHandler);
    // secure test
    reset(mockPointHandler);
    mockPointHandler.report(ReportPoint.newBuilder().setTable("dummy").setMetric("metric3.test").setHost("test4").setTimestamp(startTime * 1000).setValue(0.0d).build());
    expectLastCall();
    mockPointHandler.report(ReportPoint.newBuilder().setTable("dummy").setMetric("metric3.test").setHost("test5").setTimestamp((startTime + 1) * 1000).setValue(1.0d).build());
    expectLastCall();
    mockPointHandler.report(ReportPoint.newBuilder().setTable("dummy").setMetric("metric3.test").setHost("test6").setTimestamp((startTime + 2) * 1000).setValue(2.0d).build());
    expectLastCall();
    replay(mockPointHandler);
    // try http connection
    payloadStr = "metric3.test 0 " + startTime + " source=test4\n" + "metric3.test 1 " + (startTime + 1) + " source=test5\n" + "metric3.test 2 " + (startTime + 2) + // note the lack of newline at the end!
    " source=test6";
    assertEquals(202, httpPost("https://localhost:" + securePort, payloadStr));
    verify(mockPointHandler);
}
Also used : RateSampler(com.wavefront.sdk.entities.tracing.sampling.RateSampler) SpanSampler(com.wavefront.agent.sampler.SpanSampler) EasyMock.anyString(org.easymock.EasyMock.anyString) HealthCheckManagerImpl(com.wavefront.agent.channel.HealthCheckManagerImpl) ReportPoint(wavefront.report.ReportPoint) Test(org.junit.Test)

Example 2 with HealthCheckManagerImpl

use of com.wavefront.agent.channel.HealthCheckManagerImpl in project java by wavefrontHQ.

the class PushAgent method startListeners.

@Override
protected void startListeners() throws Exception {
    blockedPointsLogger = Logger.getLogger(proxyConfig.getBlockedPointsLoggerName());
    blockedHistogramsLogger = Logger.getLogger(proxyConfig.getBlockedHistogramsLoggerName());
    blockedSpansLogger = Logger.getLogger(proxyConfig.getBlockedSpansLoggerName());
    if (proxyConfig.getSoLingerTime() >= 0) {
        childChannelOptions.put(ChannelOption.SO_LINGER, proxyConfig.getSoLingerTime());
    }
    hostnameResolver = new CachingHostnameLookupResolver(proxyConfig.isDisableRdnsLookup(), ExpectedAgentMetric.RDNS_CACHE_SIZE.metricName);
    if (proxyConfig.isSqsQueueBuffer()) {
        taskQueueFactory = new SQSQueueFactoryImpl(proxyConfig.getSqsQueueNameTemplate(), proxyConfig.getSqsQueueRegion(), proxyConfig.getSqsQueueIdentifier(), proxyConfig.isPurgeBuffer());
    } else {
        taskQueueFactory = new TaskQueueFactoryImpl(proxyConfig.getBufferFile(), proxyConfig.isPurgeBuffer(), proxyConfig.isDisableBufferSharding(), proxyConfig.getBufferShardSize());
    }
    remoteHostAnnotator = new SharedGraphiteHostAnnotator(proxyConfig.getCustomSourceTags(), hostnameResolver);
    queueingFactory = new QueueingFactoryImpl(apiContainer, agentId, taskQueueFactory, entityProps);
    senderTaskFactory = new SenderTaskFactoryImpl(apiContainer, agentId, taskQueueFactory, queueingFactory, entityProps);
    if (proxyConfig.isHistogramPassthroughRecompression()) {
        histogramRecompressor = new HistogramRecompressor(() -> entityProps.getGlobalProperties().getHistogramStorageAccuracy());
    }
    handlerFactory = new ReportableEntityHandlerFactoryImpl(senderTaskFactory, proxyConfig.getPushBlockedSamples(), validationConfiguration, blockedPointsLogger, blockedHistogramsLogger, blockedSpansLogger, histogramRecompressor, entityProps);
    if (proxyConfig.isTrafficShaping()) {
        new TrafficShapingRateLimitAdjuster(entityProps, proxyConfig.getTrafficShapingWindowSeconds(), proxyConfig.getTrafficShapingHeadroom()).start();
    }
    healthCheckManager = new HealthCheckManagerImpl(proxyConfig);
    tokenAuthenticator = configureTokenAuthenticator();
    shutdownTasks.add(() -> senderTaskFactory.shutdown());
    shutdownTasks.add(() -> senderTaskFactory.drainBuffersToQueue(null));
    // sampler for spans
    rateSampler.setSamplingRate(entityProps.getGlobalProperties().getTraceSamplingRate());
    Sampler durationSampler = SpanSamplerUtils.getDurationSampler(proxyConfig.getTraceSamplingDuration());
    List<Sampler> samplers = SpanSamplerUtils.fromSamplers(rateSampler, durationSampler);
    SpanSampler spanSampler = new SpanSampler(new CompositeSampler(samplers), () -> entityProps.getGlobalProperties().getActiveSpanSamplingPolicies());
    if (proxyConfig.getAdminApiListenerPort() > 0) {
        startAdminListener(proxyConfig.getAdminApiListenerPort());
    }
    csvToList(proxyConfig.getHttpHealthCheckPorts()).forEach(strPort -> startHealthCheckListener(Integer.parseInt(strPort)));
    csvToList(proxyConfig.getPushListenerPorts()).forEach(strPort -> {
        startGraphiteListener(strPort, handlerFactory, remoteHostAnnotator, spanSampler);
        logger.info("listening on port: " + strPort + " for Wavefront metrics");
    });
    csvToList(proxyConfig.getDeltaCountersAggregationListenerPorts()).forEach(strPort -> {
        startDeltaCounterListener(strPort, remoteHostAnnotator, senderTaskFactory, spanSampler);
        logger.info("listening on port: " + strPort + " for Wavefront delta counter metrics");
    });
    {
        // Histogram bootstrap.
        List<String> histMinPorts = csvToList(proxyConfig.getHistogramMinuteListenerPorts());
        List<String> histHourPorts = csvToList(proxyConfig.getHistogramHourListenerPorts());
        List<String> histDayPorts = csvToList(proxyConfig.getHistogramDayListenerPorts());
        List<String> histDistPorts = csvToList(proxyConfig.getHistogramDistListenerPorts());
        int activeHistogramAggregationTypes = (histDayPorts.size() > 0 ? 1 : 0) + (histHourPorts.size() > 0 ? 1 : 0) + (histMinPorts.size() > 0 ? 1 : 0) + (histDistPorts.size() > 0 ? 1 : 0);
        if (activeHistogramAggregationTypes > 0) {
            /*Histograms enabled*/
            histogramExecutor = Executors.newScheduledThreadPool(1 + activeHistogramAggregationTypes, new NamedThreadFactory("histogram-service"));
            histogramFlushExecutor = Executors.newScheduledThreadPool(Runtime.getRuntime().availableProcessors() / 2, new NamedThreadFactory("histogram-flush"));
            managedExecutors.add(histogramExecutor);
            managedExecutors.add(histogramFlushExecutor);
            File baseDirectory = new File(proxyConfig.getHistogramStateDirectory());
            // Central dispatch
            ReportableEntityHandler<ReportPoint, String> pointHandler = handlerFactory.getHandler(HandlerKey.of(ReportableEntityType.HISTOGRAM, "histogram_ports"));
            startHistogramListeners(histMinPorts, pointHandler, remoteHostAnnotator, Granularity.MINUTE, proxyConfig.getHistogramMinuteFlushSecs(), proxyConfig.isHistogramMinuteMemoryCache(), baseDirectory, proxyConfig.getHistogramMinuteAccumulatorSize(), proxyConfig.getHistogramMinuteAvgKeyBytes(), proxyConfig.getHistogramMinuteAvgDigestBytes(), proxyConfig.getHistogramMinuteCompression(), proxyConfig.isHistogramMinuteAccumulatorPersisted(), spanSampler);
            startHistogramListeners(histHourPorts, pointHandler, remoteHostAnnotator, Granularity.HOUR, proxyConfig.getHistogramHourFlushSecs(), proxyConfig.isHistogramHourMemoryCache(), baseDirectory, proxyConfig.getHistogramHourAccumulatorSize(), proxyConfig.getHistogramHourAvgKeyBytes(), proxyConfig.getHistogramHourAvgDigestBytes(), proxyConfig.getHistogramHourCompression(), proxyConfig.isHistogramHourAccumulatorPersisted(), spanSampler);
            startHistogramListeners(histDayPorts, pointHandler, remoteHostAnnotator, Granularity.DAY, proxyConfig.getHistogramDayFlushSecs(), proxyConfig.isHistogramDayMemoryCache(), baseDirectory, proxyConfig.getHistogramDayAccumulatorSize(), proxyConfig.getHistogramDayAvgKeyBytes(), proxyConfig.getHistogramDayAvgDigestBytes(), proxyConfig.getHistogramDayCompression(), proxyConfig.isHistogramDayAccumulatorPersisted(), spanSampler);
            startHistogramListeners(histDistPorts, pointHandler, remoteHostAnnotator, null, proxyConfig.getHistogramDistFlushSecs(), proxyConfig.isHistogramDistMemoryCache(), baseDirectory, proxyConfig.getHistogramDistAccumulatorSize(), proxyConfig.getHistogramDistAvgKeyBytes(), proxyConfig.getHistogramDistAvgDigestBytes(), proxyConfig.getHistogramDistCompression(), proxyConfig.isHistogramDistAccumulatorPersisted(), spanSampler);
        }
    }
    if (StringUtils.isNotBlank(proxyConfig.getGraphitePorts()) || StringUtils.isNotBlank(proxyConfig.getPicklePorts())) {
        if (tokenAuthenticator.authRequired()) {
            logger.warning("Graphite mode is not compatible with HTTP authentication, ignoring");
        } else {
            Preconditions.checkNotNull(proxyConfig.getGraphiteFormat(), "graphiteFormat must be supplied to enable graphite support");
            Preconditions.checkNotNull(proxyConfig.getGraphiteDelimiters(), "graphiteDelimiters must be supplied to enable graphite support");
            GraphiteFormatter graphiteFormatter = new GraphiteFormatter(proxyConfig.getGraphiteFormat(), proxyConfig.getGraphiteDelimiters(), proxyConfig.getGraphiteFieldsToRemove());
            csvToList(proxyConfig.getGraphitePorts()).forEach(strPort -> {
                preprocessors.getSystemPreprocessor(strPort).forPointLine().addTransformer(0, graphiteFormatter);
                startGraphiteListener(strPort, handlerFactory, null, spanSampler);
                logger.info("listening on port: " + strPort + " for graphite metrics");
            });
            csvToList(proxyConfig.getPicklePorts()).forEach(strPort -> startPickleListener(strPort, handlerFactory, graphiteFormatter));
        }
    }
    csvToList(proxyConfig.getOpentsdbPorts()).forEach(strPort -> startOpenTsdbListener(strPort, handlerFactory));
    if (proxyConfig.getDataDogJsonPorts() != null) {
        HttpClient httpClient = HttpClientBuilder.create().useSystemProperties().setUserAgent(proxyConfig.getHttpUserAgent()).setConnectionTimeToLive(1, TimeUnit.MINUTES).setMaxConnPerRoute(100).setMaxConnTotal(100).setRetryHandler(new DefaultHttpRequestRetryHandler(proxyConfig.getHttpAutoRetries(), true)).setDefaultRequestConfig(RequestConfig.custom().setContentCompressionEnabled(true).setRedirectsEnabled(true).setConnectTimeout(proxyConfig.getHttpConnectTimeout()).setConnectionRequestTimeout(proxyConfig.getHttpConnectTimeout()).setSocketTimeout(proxyConfig.getHttpRequestTimeout()).build()).build();
        csvToList(proxyConfig.getDataDogJsonPorts()).forEach(strPort -> startDataDogListener(strPort, handlerFactory, httpClient));
    }
    csvToList(proxyConfig.getTraceListenerPorts()).forEach(strPort -> startTraceListener(strPort, handlerFactory, spanSampler));
    csvToList(proxyConfig.getCustomTracingListenerPorts()).forEach(strPort -> startCustomTracingListener(strPort, handlerFactory, new InternalProxyWavefrontClient(handlerFactory, strPort), spanSampler));
    csvToList(proxyConfig.getTraceJaegerListenerPorts()).forEach(strPort -> {
        PreprocessorRuleMetrics ruleMetrics = new PreprocessorRuleMetrics(Metrics.newCounter(new TaggedMetricName("point.spanSanitize", "count", "port", strPort)), null, null);
        preprocessors.getSystemPreprocessor(strPort).forSpan().addTransformer(new SpanSanitizeTransformer(ruleMetrics));
        startTraceJaegerListener(strPort, handlerFactory, new InternalProxyWavefrontClient(handlerFactory, strPort), spanSampler);
    });
    csvToList(proxyConfig.getTraceJaegerGrpcListenerPorts()).forEach(strPort -> {
        PreprocessorRuleMetrics ruleMetrics = new PreprocessorRuleMetrics(Metrics.newCounter(new TaggedMetricName("point.spanSanitize", "count", "port", strPort)), null, null);
        preprocessors.getSystemPreprocessor(strPort).forSpan().addTransformer(new SpanSanitizeTransformer(ruleMetrics));
        startTraceJaegerGrpcListener(strPort, handlerFactory, new InternalProxyWavefrontClient(handlerFactory, strPort), spanSampler);
    });
    csvToList(proxyConfig.getTraceJaegerHttpListenerPorts()).forEach(strPort -> {
        PreprocessorRuleMetrics ruleMetrics = new PreprocessorRuleMetrics(Metrics.newCounter(new TaggedMetricName("point.spanSanitize", "count", "port", strPort)), null, null);
        preprocessors.getSystemPreprocessor(strPort).forSpan().addTransformer(new SpanSanitizeTransformer(ruleMetrics));
        startTraceJaegerHttpListener(strPort, handlerFactory, new InternalProxyWavefrontClient(handlerFactory, strPort), spanSampler);
    });
    csvToList(proxyConfig.getTraceZipkinListenerPorts()).forEach(strPort -> {
        PreprocessorRuleMetrics ruleMetrics = new PreprocessorRuleMetrics(Metrics.newCounter(new TaggedMetricName("point.spanSanitize", "count", "port", strPort)), null, null);
        preprocessors.getSystemPreprocessor(strPort).forSpan().addTransformer(new SpanSanitizeTransformer(ruleMetrics));
        startTraceZipkinListener(strPort, handlerFactory, new InternalProxyWavefrontClient(handlerFactory, strPort), spanSampler);
    });
    csvToList(proxyConfig.getPushRelayListenerPorts()).forEach(strPort -> startRelayListener(strPort, handlerFactory, remoteHostAnnotator));
    csvToList(proxyConfig.getJsonListenerPorts()).forEach(strPort -> startJsonListener(strPort, handlerFactory));
    csvToList(proxyConfig.getWriteHttpJsonListenerPorts()).forEach(strPort -> startWriteHttpJsonListener(strPort, handlerFactory));
    // Logs ingestion.
    if (proxyConfig.getFilebeatPort() > 0 || proxyConfig.getRawLogsPort() > 0) {
        if (loadLogsIngestionConfig() != null) {
            logger.info("Initializing logs ingestion");
            try {
                final LogsIngester logsIngester = new LogsIngester(handlerFactory, this::loadLogsIngestionConfig, proxyConfig.getPrefix());
                logsIngester.start();
                if (proxyConfig.getFilebeatPort() > 0) {
                    startLogsIngestionListener(proxyConfig.getFilebeatPort(), logsIngester);
                }
                if (proxyConfig.getRawLogsPort() > 0) {
                    startRawLogsIngestionListener(proxyConfig.getRawLogsPort(), logsIngester);
                }
            } catch (ConfigurationException e) {
                logger.log(Level.SEVERE, "Cannot start logsIngestion", e);
            }
        } else {
            logger.warning("Cannot start logsIngestion: invalid configuration or no config specified");
        }
    }
    setupMemoryGuard();
}
Also used : DefaultHttpRequestRetryHandler(org.apache.http.impl.client.DefaultHttpRequestRetryHandler) SharedGraphiteHostAnnotator(com.wavefront.agent.channel.SharedGraphiteHostAnnotator) CompositeSampler(com.wavefront.sdk.entities.tracing.sampling.CompositeSampler) TaggedMetricName(com.wavefront.common.TaggedMetricName) ReportableEntityHandler(com.wavefront.agent.handlers.ReportableEntityHandler) ReportableEntityHandlerFactoryImpl(com.wavefront.agent.handlers.ReportableEntityHandlerFactoryImpl) DelegatingReportableEntityHandlerFactoryImpl(com.wavefront.agent.handlers.DelegatingReportableEntityHandlerFactoryImpl) PreprocessorRuleMetrics(com.wavefront.agent.preprocessor.PreprocessorRuleMetrics) ConfigurationException(com.wavefront.agent.config.ConfigurationException) HistogramRecompressor(com.wavefront.agent.histogram.HistogramRecompressor) ArrayList(java.util.ArrayList) Utils.csvToList(com.wavefront.common.Utils.csvToList) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) HealthCheckManagerImpl(com.wavefront.agent.channel.HealthCheckManagerImpl) LogsIngester(com.wavefront.agent.logsharvesting.LogsIngester) TaskQueueFactoryImpl(com.wavefront.agent.queueing.TaskQueueFactoryImpl) GraphiteFormatter(com.wavefront.agent.formatter.GraphiteFormatter) NamedThreadFactory(com.wavefront.common.NamedThreadFactory) SpanSampler(com.wavefront.agent.sampler.SpanSampler) SQSQueueFactoryImpl(com.wavefront.agent.queueing.SQSQueueFactoryImpl) TrafficShapingRateLimitAdjuster(com.wavefront.agent.handlers.TrafficShapingRateLimitAdjuster) QueueingFactoryImpl(com.wavefront.agent.queueing.QueueingFactoryImpl) CachingHostnameLookupResolver(com.wavefront.agent.channel.CachingHostnameLookupResolver) SenderTaskFactoryImpl(com.wavefront.agent.handlers.SenderTaskFactoryImpl) CompositeSampler(com.wavefront.sdk.entities.tracing.sampling.CompositeSampler) SpanSampler(com.wavefront.agent.sampler.SpanSampler) Sampler(com.wavefront.sdk.entities.tracing.sampling.Sampler) RateSampler(com.wavefront.sdk.entities.tracing.sampling.RateSampler) HttpClient(org.apache.http.client.HttpClient) SpanSanitizeTransformer(com.wavefront.agent.preprocessor.SpanSanitizeTransformer) File(java.io.File) InternalProxyWavefrontClient(com.wavefront.agent.handlers.InternalProxyWavefrontClient)

Example 3 with HealthCheckManagerImpl

use of com.wavefront.agent.channel.HealthCheckManagerImpl in project java by wavefrontHQ.

the class PushAgentTest method testHealthCheckAdminPorts.

@Test
public void testHealthCheckAdminPorts() throws Exception {
    port = findAvailablePort(2888);
    int port2 = findAvailablePort(3888);
    int port3 = findAvailablePort(4888);
    int port4 = findAvailablePort(5888);
    int adminPort = findAvailablePort(6888);
    proxy.proxyConfig.pushListenerPorts = port + "," + port2 + "," + port3 + "," + port4;
    proxy.proxyConfig.adminApiListenerPort = adminPort;
    proxy.proxyConfig.httpHealthCheckPath = "/health";
    proxy.proxyConfig.httpHealthCheckAllPorts = true;
    proxy.proxyConfig.httpHealthCheckFailStatusCode = 403;
    proxy.healthCheckManager = new HealthCheckManagerImpl(proxy.proxyConfig);
    SpanSampler sampler = new SpanSampler(new RateSampler(1.0D), () -> null);
    proxy.startGraphiteListener(String.valueOf(port), mockHandlerFactory, null, sampler);
    proxy.startGraphiteListener(String.valueOf(port2), mockHandlerFactory, null, sampler);
    proxy.startGraphiteListener(String.valueOf(port3), mockHandlerFactory, null, sampler);
    proxy.startGraphiteListener(String.valueOf(port4), mockHandlerFactory, null, sampler);
    proxy.startAdminListener(adminPort);
    waitUntilListenerIsOnline(adminPort);
    assertEquals(404, httpGet("http://localhost:" + adminPort + "/"));
    assertEquals(200, httpGet("http://localhost:" + port + "/health"));
    assertEquals(200, httpGet("http://localhost:" + port2 + "/health"));
    assertEquals(200, httpGet("http://localhost:" + port3 + "/health"));
    assertEquals(200, httpGet("http://localhost:" + port4 + "/health"));
    assertEquals(202, httpGet("http://localhost:" + port + "/health2"));
    assertEquals(400, httpGet("http://localhost:" + adminPort + "/status"));
    assertEquals(405, httpPost("http://localhost:" + adminPort + "/status", ""));
    assertEquals(404, httpGet("http://localhost:" + adminPort + "/status/somethingelse"));
    assertEquals(200, httpGet("http://localhost:" + adminPort + "/status/" + port));
    assertEquals(200, httpGet("http://localhost:" + adminPort + "/status/" + port2));
    assertEquals(200, httpGet("http://localhost:" + adminPort + "/status/" + port3));
    assertEquals(200, httpGet("http://localhost:" + adminPort + "/status/" + port4));
    assertEquals(405, httpGet("http://localhost:" + adminPort + "/disable"));
    assertEquals(405, httpGet("http://localhost:" + adminPort + "/enable"));
    assertEquals(405, httpGet("http://localhost:" + adminPort + "/disable/" + port));
    assertEquals(405, httpGet("http://localhost:" + adminPort + "/enable/" + port));
    // disabling port and port3
    assertEquals(200, httpPost("http://localhost:" + adminPort + "/disable/" + port, ""));
    assertEquals(200, httpPost("http://localhost:" + adminPort + "/disable/" + port3, ""));
    assertEquals(503, httpGet("http://localhost:" + adminPort + "/status/" + port));
    assertEquals(200, httpGet("http://localhost:" + adminPort + "/status/" + port2));
    assertEquals(503, httpGet("http://localhost:" + adminPort + "/status/" + port3));
    assertEquals(200, httpGet("http://localhost:" + adminPort + "/status/" + port4));
    assertEquals(403, httpGet("http://localhost:" + port + "/health"));
    assertEquals(200, httpGet("http://localhost:" + port2 + "/health"));
    assertEquals(403, httpGet("http://localhost:" + port3 + "/health"));
    assertEquals(200, httpGet("http://localhost:" + port4 + "/health"));
    // disable all
    assertEquals(200, httpPost("http://localhost:" + adminPort + "/disable", ""));
    assertEquals(503, httpGet("http://localhost:" + adminPort + "/status/" + port));
    assertEquals(503, httpGet("http://localhost:" + adminPort + "/status/" + port2));
    assertEquals(503, httpGet("http://localhost:" + adminPort + "/status/" + port3));
    assertEquals(503, httpGet("http://localhost:" + adminPort + "/status/" + port4));
    assertEquals(403, httpGet("http://localhost:" + port + "/health"));
    assertEquals(403, httpGet("http://localhost:" + port2 + "/health"));
    assertEquals(403, httpGet("http://localhost:" + port3 + "/health"));
    assertEquals(403, httpGet("http://localhost:" + port4 + "/health"));
    // enable port3 and port4
    assertEquals(200, httpPost("http://localhost:" + adminPort + "/enable/" + port3, ""));
    assertEquals(200, httpPost("http://localhost:" + adminPort + "/enable/" + port4, ""));
    assertEquals(503, httpGet("http://localhost:" + adminPort + "/status/" + port));
    assertEquals(503, httpGet("http://localhost:" + adminPort + "/status/" + port2));
    assertEquals(200, httpGet("http://localhost:" + adminPort + "/status/" + port3));
    assertEquals(200, httpGet("http://localhost:" + adminPort + "/status/" + port4));
    assertEquals(403, httpGet("http://localhost:" + port + "/health"));
    assertEquals(403, httpGet("http://localhost:" + port2 + "/health"));
    assertEquals(200, httpGet("http://localhost:" + port3 + "/health"));
    assertEquals(200, httpGet("http://localhost:" + port4 + "/health"));
    // enable all
    // enable port3 and port4
    assertEquals(200, httpPost("http://localhost:" + adminPort + "/enable", ""));
    assertEquals(200, httpGet("http://localhost:" + adminPort + "/status/" + port));
    assertEquals(200, httpGet("http://localhost:" + adminPort + "/status/" + port2));
    assertEquals(200, httpGet("http://localhost:" + adminPort + "/status/" + port3));
    assertEquals(200, httpGet("http://localhost:" + adminPort + "/status/" + port4));
    assertEquals(200, httpGet("http://localhost:" + port + "/health"));
    assertEquals(200, httpGet("http://localhost:" + port2 + "/health"));
    assertEquals(200, httpGet("http://localhost:" + port3 + "/health"));
    assertEquals(200, httpGet("http://localhost:" + port4 + "/health"));
}
Also used : RateSampler(com.wavefront.sdk.entities.tracing.sampling.RateSampler) SpanSampler(com.wavefront.agent.sampler.SpanSampler) HealthCheckManagerImpl(com.wavefront.agent.channel.HealthCheckManagerImpl) ReportPoint(wavefront.report.ReportPoint) Test(org.junit.Test)

Aggregations

HealthCheckManagerImpl (com.wavefront.agent.channel.HealthCheckManagerImpl)3 SpanSampler (com.wavefront.agent.sampler.SpanSampler)3 RateSampler (com.wavefront.sdk.entities.tracing.sampling.RateSampler)3 Test (org.junit.Test)2 ReportPoint (wavefront.report.ReportPoint)2 ImmutableList (com.google.common.collect.ImmutableList)1 CachingHostnameLookupResolver (com.wavefront.agent.channel.CachingHostnameLookupResolver)1 SharedGraphiteHostAnnotator (com.wavefront.agent.channel.SharedGraphiteHostAnnotator)1 ConfigurationException (com.wavefront.agent.config.ConfigurationException)1 GraphiteFormatter (com.wavefront.agent.formatter.GraphiteFormatter)1 DelegatingReportableEntityHandlerFactoryImpl (com.wavefront.agent.handlers.DelegatingReportableEntityHandlerFactoryImpl)1 InternalProxyWavefrontClient (com.wavefront.agent.handlers.InternalProxyWavefrontClient)1 ReportableEntityHandler (com.wavefront.agent.handlers.ReportableEntityHandler)1 ReportableEntityHandlerFactoryImpl (com.wavefront.agent.handlers.ReportableEntityHandlerFactoryImpl)1 SenderTaskFactoryImpl (com.wavefront.agent.handlers.SenderTaskFactoryImpl)1 TrafficShapingRateLimitAdjuster (com.wavefront.agent.handlers.TrafficShapingRateLimitAdjuster)1 HistogramRecompressor (com.wavefront.agent.histogram.HistogramRecompressor)1 LogsIngester (com.wavefront.agent.logsharvesting.LogsIngester)1 PreprocessorRuleMetrics (com.wavefront.agent.preprocessor.PreprocessorRuleMetrics)1 SpanSanitizeTransformer (com.wavefront.agent.preprocessor.SpanSanitizeTransformer)1