use of com.wavefront.ingester.StringLineIngester in project java by wavefrontHQ.
the class PushAgent method startCustomListener.
/**
* Registers a custom point handler on a particular port.
*
* @param strPort The port to listen on.
* @param decoder The decoder to use.
* @param pointHandler The handler to handle parsed ReportPoints.
* @param preprocessor Pre-processor (predicates and transform functions) for every point
*/
protected void startCustomListener(String strPort, Decoder<String> decoder, PointHandler pointHandler, @Nullable PointPreprocessor preprocessor) {
int port = Integer.parseInt(strPort);
ChannelHandler channelHandler = new ChannelStringHandler(decoder, pointHandler, preprocessor);
startAsManagedThread(new StringLineIngester(channelHandler, port).withChildChannelOptions(childChannelOptions), null);
}
use of com.wavefront.ingester.StringLineIngester 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