use of org.apache.gobblin.runtime.troubleshooter.Issue in project incubator-gobblin by apache.
the class AutoTroubleshooterLogAppender method append.
@Override
protected void append(LoggingEvent event) {
processedEventCount.incrementAndGet();
Issue issue = convertToIssue(event);
try {
repository.put(issue);
} catch (TroubleshooterException e) {
if (reportedRepositoryError.compareAndSet(false, true)) {
log.warn("Failed to save the issue to the repository", e);
}
}
}
use of org.apache.gobblin.runtime.troubleshooter.Issue in project incubator-gobblin by apache.
the class AutoTroubleshooterLogAppenderTest method canLogException.
@Test
public void canLogException() throws Exception {
Exception exception;
try {
// Throwing exception to get a real stack trace in it
throw new IOException("test exception");
} catch (Exception e) {
exception = e;
}
appender.append(new LoggingEvent(log.getName(), log, System.currentTimeMillis(), Level.ERROR, "test message", exception));
Issue issue = issueRepository.getAll().get(0);
Assert.assertEquals(issue.getSeverity(), IssueSeverity.ERROR);
Assert.assertTrue(issue.getSummary().contains("test message"));
Assert.assertTrue(issue.getSummary().contains("test exception"));
Assert.assertTrue(issue.getCode().length() > 1);
Assert.assertTrue(issue.getDetails().contains("IOException"));
}
use of org.apache.gobblin.runtime.troubleshooter.Issue in project incubator-gobblin by apache.
the class AutoTroubleshooterLogAppenderTest method canLogExceptionWithSpecificErrorCode.
@Test
public void canLogExceptionWithSpecificErrorCode() throws Exception {
Exception exception;
try {
throw new TestException("test exception", "TestCode");
} catch (Exception e) {
exception = e;
}
appender.append(new LoggingEvent(log.getName(), log, System.currentTimeMillis(), Level.ERROR, "test message", exception));
Issue issue = issueRepository.getAll().get(0);
Assert.assertEquals(issue.getSeverity(), IssueSeverity.ERROR);
Assert.assertEquals(issue.getCode(), "TestCode");
}
use of org.apache.gobblin.runtime.troubleshooter.Issue in project incubator-gobblin by apache.
the class AutoTroubleshooterLogAppenderTest method willGetSameErrorCodesForSameStackTraces.
@Test
public void willGetSameErrorCodesForSameStackTraces() throws Exception {
for (int i = 0; i < 5; i++) {
Exception exception;
try {
try {
throw new InvalidOperationException("test inner exception " + i);
} catch (Exception inner) {
throw new IOException("test outer exception " + i, inner);
}
} catch (Exception e) {
exception = e;
}
appender.append(new LoggingEvent(log.getName(), log, System.currentTimeMillis(), Level.ERROR, "test message", exception));
}
List<Issue> issues = issueRepository.getAll();
// all issues should have the same error code and get deduplicated
Assert.assertEquals(issues.size(), 1);
}
use of org.apache.gobblin.runtime.troubleshooter.Issue in project incubator-gobblin by apache.
the class AutomaticTroubleshooterImpl method reportJobIssuesAsEvents.
@Override
public void reportJobIssuesAsEvents(EventSubmitter eventSubmitter) throws TroubleshooterException {
if (config.isDisableEventReporting()) {
log.info("Troubleshooter will not report issues as GobblinTrackingEvents. Remove the following property to re-enable it: " + ConfigurationKeys.TROUBLESHOOTER_DISABLE_EVENT_REPORTING);
return;
}
List<Issue> issues = issueRepository.getAll();
log.info("Reporting troubleshooter issues as Gobblin tracking events. Issue count: " + issues.size());
for (Issue issue : issues) {
IssueEventBuilder eventBuilder = new IssueEventBuilder(IssueEventBuilder.JOB_ISSUE);
eventBuilder.setIssue(issue);
eventSubmitter.submit(eventBuilder);
}
}
Aggregations