use of com.wavefront.agent.PointHandler in project java by wavefrontHQ.
the class PointHandlerDispatcherTest method setup.
@Before
public void setup() {
timeMillis = new AtomicLong(0L);
backingStore = new ConcurrentHashMap<>();
in = new AccumulationCache(backingStore, 0, timeMillis::get);
pointOut = new LinkedList<>();
debugLineOut = new LinkedList<>();
blockedOut = new LinkedList<>();
digestA = new AgentDigest(COMPRESSION, 100L);
digestB = new AgentDigest(COMPRESSION, 1000L);
subject = new PointHandlerDispatcher(in, new PointHandler() {
@Override
public void reportPoint(ReportPoint point, String debugLine) {
pointOut.add(point);
debugLineOut.add(debugLine);
}
@Override
public void reportPoints(List<ReportPoint> points) {
pointOut.addAll(points);
}
@Override
public void handleBlockedPoint(String pointLine) {
blockedOut.add(pointLine);
}
}, timeMillis::get, null);
}
use of com.wavefront.agent.PointHandler in project java by wavefrontHQ.
the class InteractiveLogsTester method interactiveTest.
/**
* Read one line of stdin and print a message to stdout.
*/
public boolean interactiveTest() throws ConfigurationException {
final AtomicBoolean reported = new AtomicBoolean(false);
LogsIngester logsIngester = new LogsIngester(new PointHandler() {
@Override
public void reportPoint(ReportPoint point, @Nullable String debugLine) {
reported.set(true);
System.out.println(PointHandlerImpl.pointToString(point));
}
@Override
public void reportPoints(List<ReportPoint> points) {
for (ReportPoint point : points) reportPoint(point, "");
}
@Override
public void handleBlockedPoint(@Nullable String pointLine) {
System.out.println("Blocked point: " + pointLine);
}
}, logsIngestionConfigSupplier, prefix, System::currentTimeMillis);
String line = stdin.nextLine();
logsIngester.ingestLog(new LogsMessage() {
@Override
public String getLogLine() {
return line;
}
@Override
public String hostOrDefault(String fallbackHost) {
try {
return InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
return "localhost";
}
}
});
logsIngester.flush();
if (!reported.get()) {
System.out.println("Input matched no groks.");
}
return stdin.hasNext();
}
use of com.wavefront.agent.PointHandler in project java by wavefrontHQ.
the class AccumulationTaskTest method setUp.
@Before
public void setUp() throws Exception {
AtomicInteger timeMillis = new AtomicInteger(0);
in = new InMemoryObjectQueue<>();
out = new ConcurrentHashMap<>();
cache = new AccumulationCache(out, 0, timeMillis::get);
badPointsOut = Lists.newArrayList();
PointHandler pointHandler = new PointHandler() {
@Override
public void reportPoint(ReportPoint point, String debugLine) {
throw new UnsupportedOperationException();
}
@Override
public void reportPoints(List<ReportPoint> points) {
throw new UnsupportedOperationException();
}
@Override
public void handleBlockedPoint(String pointLine) {
badPointsOut.add(pointLine);
}
};
eventSubject = new AccumulationTask(in, cache, new GraphiteDecoder("unknown", ImmutableList.of()), pointHandler, Validation.Level.NUMERIC_ONLY, TTL, MINUTE, COMPRESSION);
histoSubject = new AccumulationTask(in, cache, new HistogramDecoder(), pointHandler, Validation.Level.NUMERIC_ONLY, TTL, MINUTE, COMPRESSION);
}
Aggregations