com.wavefront.ingester.ReportLogDecoder Maven / Gradle / Ivy
The newest version!
package com.wavefront.ingester;
import wavefront.report.ReportLog;
import javax.annotation.Nullable;
import java.util.List;
import java.util.function.Supplier;
public class ReportLogDecoder implements ReportableEntityDecoder {
private static final AbstractIngesterFormatter FORMAT =
ReportLogIngesterFormatter.newBuilder().build();
private final Supplier hostNameSupplier;
private List customSourceTags;
private List customLogTimestampTags;
private List customLogMessageTags;
private List customApplicationTags;
private List customServiceTags;
private List customLevelTags;
private List customExceptionTags;
public ReportLogDecoder(@Nullable Supplier hostNameSupplier,
List customSourceTags, List customLogTimestampTags, List customLogMessageTags,
List customApplicationTags, List customServiceTags) {
this.hostNameSupplier = hostNameSupplier;
this.customSourceTags = customSourceTags;
this.customLogTimestampTags = customLogTimestampTags;
this.customLogMessageTags = customLogMessageTags;
this.customApplicationTags = customApplicationTags;
this.customServiceTags = customServiceTags;
}
public ReportLogDecoder(@Nullable Supplier hostNameSupplier,
List customSourceTags, List customLogTimestampTags, List customLogMessageTags,
List customApplicationTags, List customServiceTags,
List customLevelTags, List customExceptionTags) {
this.hostNameSupplier = hostNameSupplier;
this.customSourceTags = customSourceTags;
this.customLogTimestampTags = customLogTimestampTags;
this.customLogMessageTags = customLogMessageTags;
this.customApplicationTags = customApplicationTags;
this.customServiceTags = customServiceTags;
this.customLevelTags = customLevelTags;
this.customExceptionTags = customExceptionTags;
}
@Override
public void decode(String msg, List out, String customerId, @Nullable IngesterContext ctx) {
ReportLog log = FORMAT.drive(msg, hostNameSupplier, "default", customSourceTags, customLogTimestampTags,
customLogMessageTags, customApplicationTags, customServiceTags, customLevelTags, customExceptionTags, ctx);
if (out != null) {
out.add(log);
}
}
}