Search in sources :

Example 1 with ReportPointAddPrefixTransformer

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

the class PushAgent method startOpenTsdbListener.

protected void startOpenTsdbListener(final String strPort) {
    if (prefix != null && !prefix.isEmpty()) {
        preprocessors.forPort(strPort).forReportPoint().addTransformer(new ReportPointAddPrefixTransformer(prefix));
    }
    preprocessors.forPort(strPort).forReportPoint().addFilter(new ReportPointTimestampInRangeFilter(dataBackfillCutoffHours, dataPrefillCutoffHours));
    final int port = Integer.parseInt(strPort);
    final PostPushDataTimedTask[] flushTasks = getFlushTasks(strPort);
    ChannelInitializer initializer = new ChannelInitializer<SocketChannel>() {

        @Override
        public void initChannel(SocketChannel ch) throws Exception {
            final ChannelHandler handler = new OpenTSDBPortUnificationHandler(new OpenTSDBDecoder("unknown", customSourceTags), new PointHandlerImpl(strPort, pushValidationLevel, pushBlockedSamples, flushTasks), preprocessors.forPort(strPort));
            ChannelPipeline pipeline = ch.pipeline();
            pipeline.addLast(new PlainTextOrHttpFrameDecoder(handler));
        }
    };
    startAsManagedThread(new TcpIngester(initializer, port).withChildChannelOptions(childChannelOptions), "listener-plaintext-opentsdb-" + port);
}
Also used : SocketChannel(io.netty.channel.socket.SocketChannel) QueuingChannelHandler(com.wavefront.agent.histogram.QueuingChannelHandler) ChannelHandler(io.netty.channel.ChannelHandler) ChannelPipeline(io.netty.channel.ChannelPipeline) ReportPointAddPrefixTransformer(com.wavefront.agent.preprocessor.ReportPointAddPrefixTransformer) ReportPointTimestampInRangeFilter(com.wavefront.agent.preprocessor.ReportPointTimestampInRangeFilter) ChannelInitializer(io.netty.channel.ChannelInitializer) OpenTSDBDecoder(com.wavefront.ingester.OpenTSDBDecoder) TcpIngester(com.wavefront.ingester.TcpIngester)

Example 2 with ReportPointAddPrefixTransformer

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

the class PushAgent method startPickleListener.

protected void startPickleListener(String strPort, GraphiteFormatter formatter) {
    if (prefix != null && !prefix.isEmpty()) {
        preprocessors.forPort(strPort).forReportPoint().addTransformer(new ReportPointAddPrefixTransformer(prefix));
    }
    preprocessors.forPort(strPort).forReportPoint().addFilter(new ReportPointTimestampInRangeFilter(dataBackfillCutoffHours, dataPrefillCutoffHours));
    int port = Integer.parseInt(strPort);
    // Set up a custom handler
    ChannelHandler handler = new ChannelByteArrayHandler(new PickleProtocolDecoder("unknown", customSourceTags, formatter.getMetricMangler(), port), new PointHandlerImpl(strPort, pushValidationLevel, pushBlockedSamples, getFlushTasks(strPort)), preprocessors.forPort(strPort));
    // to the decoder.
    class FrameDecoderFactoryImpl implements StreamIngester.FrameDecoderFactory {

        @Override
        public ChannelInboundHandler getDecoder() {
            return new LengthFieldBasedFrameDecoder(ByteOrder.BIG_ENDIAN, 1000000, 0, 4, 0, 4, false);
        }
    }
    startAsManagedThread(new StreamIngester(new FrameDecoderFactoryImpl(), handler, port).withChildChannelOptions(childChannelOptions), "listener-binary-pickle-" + port);
}
Also used : StreamIngester(com.wavefront.ingester.StreamIngester) ReportPointAddPrefixTransformer(com.wavefront.agent.preprocessor.ReportPointAddPrefixTransformer) PickleProtocolDecoder(com.wavefront.ingester.PickleProtocolDecoder) ReportPointTimestampInRangeFilter(com.wavefront.agent.preprocessor.ReportPointTimestampInRangeFilter) QueuingChannelHandler(com.wavefront.agent.histogram.QueuingChannelHandler) ChannelHandler(io.netty.channel.ChannelHandler) LengthFieldBasedFrameDecoder(io.netty.handler.codec.LengthFieldBasedFrameDecoder)

Example 3 with ReportPointAddPrefixTransformer

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

the class PushAgent method startGraphiteListener.

protected void startGraphiteListener(String strPort, boolean withCustomFormatter) {
    int port = Integer.parseInt(strPort);
    if (prefix != null && !prefix.isEmpty()) {
        preprocessors.forPort(strPort).forReportPoint().addTransformer(new ReportPointAddPrefixTransformer(prefix));
    }
    preprocessors.forPort(strPort).forReportPoint().addFilter(new ReportPointTimestampInRangeFilter(dataBackfillCutoffHours, dataPrefillCutoffHours));
    // Add a metadatahandler, to handle @SourceTag, @SourceDescription, etc.
    SourceTagHandler metadataHandler = new SourceTagHandlerImpl(getSourceTagFlushTasks(port));
    // Set up a custom graphite handler, with no formatter
    ChannelHandler graphiteHandler = new ChannelStringHandler(new GraphiteDecoder("unknown", customSourceTags), new PointHandlerImpl(strPort, pushValidationLevel, pushBlockedSamples, getFlushTasks(strPort)), preprocessors.forPort(strPort), metadataHandler);
    if (!withCustomFormatter) {
        List<Function<Channel, ChannelHandler>> handler = Lists.newArrayList(1);
        handler.add(input -> {
            SocketChannel ch = (SocketChannel) input;
            if (ch != null && ch.remoteAddress() != null) {
                return new GraphiteHostAnnotator(disableRdnsLookup ? ch.remoteAddress().getAddress().getHostAddress() : reverseDnsCache.get(ch.remoteAddress().getAddress()), customSourceTags);
            }
            return new GraphiteHostAnnotator("unknown", customSourceTags);
        });
        startAsManagedThread(new StringLineIngester(handler, graphiteHandler, port).withChildChannelOptions(childChannelOptions), "listener-plaintext-wavefront-" + port);
    } else {
        startAsManagedThread(new StringLineIngester(graphiteHandler, port).withChildChannelOptions(childChannelOptions), "Listener-plaintext-graphite-" + port);
    }
}
Also used : SocketChannel(io.netty.channel.socket.SocketChannel) GraphiteHostAnnotator(com.wavefront.ingester.GraphiteHostAnnotator) QueuingChannelHandler(com.wavefront.agent.histogram.QueuingChannelHandler) ChannelHandler(io.netty.channel.ChannelHandler) Function(com.google.common.base.Function) ReportPointAddPrefixTransformer(com.wavefront.agent.preprocessor.ReportPointAddPrefixTransformer) StringLineIngester(com.wavefront.ingester.StringLineIngester) ReportPointTimestampInRangeFilter(com.wavefront.agent.preprocessor.ReportPointTimestampInRangeFilter) GraphiteDecoder(com.wavefront.ingester.GraphiteDecoder)

Aggregations

QueuingChannelHandler (com.wavefront.agent.histogram.QueuingChannelHandler)3 ReportPointAddPrefixTransformer (com.wavefront.agent.preprocessor.ReportPointAddPrefixTransformer)3 ReportPointTimestampInRangeFilter (com.wavefront.agent.preprocessor.ReportPointTimestampInRangeFilter)3 ChannelHandler (io.netty.channel.ChannelHandler)3 SocketChannel (io.netty.channel.socket.SocketChannel)2 Function (com.google.common.base.Function)1 GraphiteDecoder (com.wavefront.ingester.GraphiteDecoder)1 GraphiteHostAnnotator (com.wavefront.ingester.GraphiteHostAnnotator)1 OpenTSDBDecoder (com.wavefront.ingester.OpenTSDBDecoder)1 PickleProtocolDecoder (com.wavefront.ingester.PickleProtocolDecoder)1 StreamIngester (com.wavefront.ingester.StreamIngester)1 StringLineIngester (com.wavefront.ingester.StringLineIngester)1 TcpIngester (com.wavefront.ingester.TcpIngester)1 ChannelInitializer (io.netty.channel.ChannelInitializer)1 ChannelPipeline (io.netty.channel.ChannelPipeline)1 LengthFieldBasedFrameDecoder (io.netty.handler.codec.LengthFieldBasedFrameDecoder)1