use of org.apache.samza.diagnostics.DiagnosticsExceptionEvent in project samza by apache.
the class TestMetricsSnapshotSerdeV2 method metricsSnapshot.
private static MetricsSnapshot metricsSnapshot(Exception exception, boolean includeSamzaEpochId) {
MetricsHeader metricsHeader;
if (includeSamzaEpochId) {
metricsHeader = new MetricsHeader("jobName", "i001", "container 0", "test container ID", Optional.of("epoch-123"), "source", "300.14.25.1", "1", "1", 1, 1);
} else {
metricsHeader = new MetricsHeader("jobName", "i001", "container 0", "test container ID", "source", "300.14.25.1", "1", "1", 1, 1);
}
BoundedList<DiagnosticsExceptionEvent> boundedList = new BoundedList<>("exceptions");
DiagnosticsExceptionEvent diagnosticsExceptionEvent = new DiagnosticsExceptionEvent(1, exception, new HashMap<>());
boundedList.add(diagnosticsExceptionEvent);
Map<String, Map<String, Object>> metricMessage = new HashMap<>();
Map<String, Object> samzaContainerMetrics = new HashMap<>();
samzaContainerMetrics.put("commit-calls", 1);
metricMessage.put("org.apache.samza.container.SamzaContainerMetrics", samzaContainerMetrics);
Map<String, Object> exceptions = new HashMap<>();
exceptions.put("exceptions", boundedList.getValues());
metricMessage.put("org.apache.samza.exceptions", exceptions);
return new MetricsSnapshot(metricsHeader, new Metrics(metricMessage));
}
use of org.apache.samza.diagnostics.DiagnosticsExceptionEvent in project samza by apache.
the class SimpleDiagnosticsAppender method append.
@Override
protected void append(LoggingEvent loggingEvent) {
try {
// if an event with a non-null throwable is received => exception event
if (loggingEvent.getThrowableInformation() != null) {
DiagnosticsExceptionEvent diagnosticsExceptionEvent = new DiagnosticsExceptionEvent(loggingEvent.timeStamp, loggingEvent.getThrowableInformation().getThrowable(), loggingEvent.getProperties());
diagnosticsManager.addExceptionEvent(diagnosticsExceptionEvent);
}
} catch (Exception e) {
// blanket catch of all exceptions so as to not impact any job
System.err.println("Exception in logging event parsing " + e);
}
}
use of org.apache.samza.diagnostics.DiagnosticsExceptionEvent in project samza by apache.
the class SimpleDiagnosticsAppender method append.
@Override
public void append(LogEvent logEvent) {
try {
// if an event with a non-null throwable is received => exception event
if (logEvent.getThrown() != null) {
DiagnosticsExceptionEvent diagnosticsExceptionEvent = new DiagnosticsExceptionEvent(logEvent.getTimeMillis(), logEvent.getThrown(), logEvent.getContextData().toMap());
diagnosticsManager.addExceptionEvent(diagnosticsExceptionEvent);
}
} catch (Exception e) {
// blanket catch of all exceptions so as to not impact any job
System.err.println("Exception in logevent parsing " + e);
}
}
Aggregations