Search in sources :

Example 1 with RawLogsIngesterPortUnificationHandler

use of com.wavefront.agent.listeners.RawLogsIngesterPortUnificationHandler in project java by wavefrontHQ.

the class PushAgent method startRawLogsIngestionListener.

@VisibleForTesting
protected void startRawLogsIngestionListener(int port, LogsIngester logsIngester) {
    String strPort = String.valueOf(port);
    if (proxyConfig.isHttpHealthCheckAllPorts())
        healthCheckManager.enableHealthcheck(port);
    ChannelHandler channelHandler = new RawLogsIngesterPortUnificationHandler(strPort, logsIngester, hostnameResolver, tokenAuthenticator, healthCheckManager, preprocessors.get(strPort));
    startAsManagedThread(port, new TcpIngester(createInitializer(channelHandler, port, proxyConfig.getRawLogsMaxReceivedLength(), proxyConfig.getRawLogsHttpBufferSize(), proxyConfig.getListenerIdleConnectionTimeout(), getSslContext(strPort), getCorsConfig(strPort)), port).withChildChannelOptions(childChannelOptions), "listener-logs-raw-" + port);
    logger.info("listening on port: " + strPort + " for raw logs");
}
Also used : RawLogsIngesterPortUnificationHandler(com.wavefront.agent.listeners.RawLogsIngesterPortUnificationHandler) ChannelHandler(io.netty.channel.ChannelHandler) TcpIngester(com.wavefront.ingester.TcpIngester) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 2 with RawLogsIngesterPortUnificationHandler

use of com.wavefront.agent.listeners.RawLogsIngesterPortUnificationHandler in project java by wavefrontHQ.

the class LogsIngesterTest method setup.

private void setup(LogsIngestionConfig config) throws IOException, GrokException, ConfigurationException {
    logsIngestionConfig = config;
    // HACK: Never call flush automatically.
    logsIngestionConfig.aggregationIntervalSeconds = 10000;
    logsIngestionConfig.verifyAndInit();
    mockPointHandler = createMock(ReportableEntityHandler.class);
    mockHistogramHandler = createMock(ReportableEntityHandler.class);
    mockFactory = createMock(ReportableEntityHandlerFactory.class);
    expect((ReportableEntityHandler) mockFactory.getHandler(HandlerKey.of(ReportableEntityType.POINT, "logs-ingester"))).andReturn(mockPointHandler).anyTimes();
    expect((ReportableEntityHandler) mockFactory.getHandler(HandlerKey.of(ReportableEntityType.HISTOGRAM, "logs-ingester"))).andReturn(mockHistogramHandler).anyTimes();
    replay(mockFactory);
    logsIngesterUnderTest = new LogsIngester(mockFactory, () -> logsIngestionConfig, null, now::get, nanos::get);
    logsIngesterUnderTest.start();
    filebeatIngesterUnderTest = new FilebeatIngester(logsIngesterUnderTest, now::get);
    rawLogsIngesterUnderTest = new RawLogsIngesterPortUnificationHandler("12345", logsIngesterUnderTest, x -> "testHost", TokenAuthenticatorBuilder.create().build(), new NoopHealthCheckManager(), null);
}
Also used : RawLogsIngesterPortUnificationHandler(com.wavefront.agent.listeners.RawLogsIngesterPortUnificationHandler) ReportableEntityHandler(com.wavefront.agent.handlers.ReportableEntityHandler) EasyMock.reset(org.easymock.EasyMock.reset) Map(java.util.Map) After(org.junit.After) HandlerKey(com.wavefront.agent.handlers.HandlerKey) ReportPoint(wavefront.report.ReportPoint) GrokException(oi.thekraken.grok.api.exception.GrokException) LogsIngestionConfig(com.wavefront.agent.config.LogsIngestionConfig) ImmutableMap(com.google.common.collect.ImmutableMap) InetSocketAddress(java.net.InetSocketAddress) Matchers.instanceOf(org.hamcrest.Matchers.instanceOf) ReportableEntityType(com.wavefront.data.ReportableEntityType) List(java.util.List) Matchers.contains(org.hamcrest.Matchers.contains) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) Matchers.equalTo(org.hamcrest.Matchers.equalTo) PointMatchers(com.wavefront.agent.PointMatchers) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) MetricMatcher(com.wavefront.agent.config.MetricMatcher) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) Lists(com.google.common.collect.Lists) ImmutableList(com.google.common.collect.ImmutableList) RawLogsIngesterPortUnificationHandler(com.wavefront.agent.listeners.RawLogsIngesterPortUnificationHandler) YAMLFactory(com.fasterxml.jackson.dataformat.yaml.YAMLFactory) Matchers.lessThan(org.hamcrest.Matchers.lessThan) Matchers.hasSize(org.hamcrest.Matchers.hasSize) ConfigurationException(com.wavefront.agent.config.ConfigurationException) EasyMock.replay(org.easymock.EasyMock.replay) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) EasyMock.createMock(org.easymock.EasyMock.createMock) TokenAuthenticatorBuilder(com.wavefront.agent.auth.TokenAuthenticatorBuilder) MetricConstants(com.wavefront.common.MetricConstants) Capture(org.easymock.Capture) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) IOException(java.io.IOException) Test(org.junit.Test) EasyMock(org.easymock.EasyMock) EasyMock.expect(org.easymock.EasyMock.expect) Maps(com.google.common.collect.Maps) File(java.io.File) Message(org.logstash.beats.Message) Consumer(java.util.function.Consumer) Channel(io.netty.channel.Channel) EasyMock.expectLastCall(org.easymock.EasyMock.expectLastCall) AtomicLong(java.util.concurrent.atomic.AtomicLong) Matchers.emptyIterable(org.hamcrest.Matchers.emptyIterable) CaptureType(org.easymock.CaptureType) ReportableEntityHandlerFactory(com.wavefront.agent.handlers.ReportableEntityHandlerFactory) NoopHealthCheckManager(com.wavefront.agent.channel.NoopHealthCheckManager) EasyMock.verify(org.easymock.EasyMock.verify) Histogram(wavefront.report.Histogram) NoopHealthCheckManager(com.wavefront.agent.channel.NoopHealthCheckManager) ReportableEntityHandler(com.wavefront.agent.handlers.ReportableEntityHandler) ReportableEntityHandlerFactory(com.wavefront.agent.handlers.ReportableEntityHandlerFactory)

Aggregations

RawLogsIngesterPortUnificationHandler (com.wavefront.agent.listeners.RawLogsIngesterPortUnificationHandler)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 YAMLFactory (com.fasterxml.jackson.dataformat.yaml.YAMLFactory)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 Lists (com.google.common.collect.Lists)1 Maps (com.google.common.collect.Maps)1 PointMatchers (com.wavefront.agent.PointMatchers)1 TokenAuthenticatorBuilder (com.wavefront.agent.auth.TokenAuthenticatorBuilder)1 NoopHealthCheckManager (com.wavefront.agent.channel.NoopHealthCheckManager)1 ConfigurationException (com.wavefront.agent.config.ConfigurationException)1 LogsIngestionConfig (com.wavefront.agent.config.LogsIngestionConfig)1 MetricMatcher (com.wavefront.agent.config.MetricMatcher)1 HandlerKey (com.wavefront.agent.handlers.HandlerKey)1 ReportableEntityHandler (com.wavefront.agent.handlers.ReportableEntityHandler)1 ReportableEntityHandlerFactory (com.wavefront.agent.handlers.ReportableEntityHandlerFactory)1 MetricConstants (com.wavefront.common.MetricConstants)1 ReportableEntityType (com.wavefront.data.ReportableEntityType)1 TcpIngester (com.wavefront.ingester.TcpIngester)1