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);
}
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);
}
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);
}
}
Aggregations