Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove noisy warnings when Jenkins recovers from a crash #997

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,14 @@
.ifPresentOrElse(
FlowNodeMonitoringAction::purgeSpanAndCloseAssociatedScopes,
() -> {
String msg = "span not found to be purged: " + OtelUtils.toDebugString(span) +
" ending " + OtelUtils.toDebugString(startSpanNode) + " in " + run;
if (STRICT_MODE) {
throw new IllegalStateException(msg);
} else {
LOGGER.log(Level.WARNING, msg);
if (!Objects.equals(span, Span.getInvalid())) { // recovery of a previous error, skip the invalid span

Check warning on line 189 in src/main/java/io/jenkins/plugins/opentelemetry/job/OtelTraceService.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 189 is not covered by tests
String msg = "span not found to be purged: " + OtelUtils.toDebugString(span) +
" ending " + OtelUtils.toDebugString(startSpanNode) + " in " + run;
if (STRICT_MODE) {
throw new IllegalStateException(msg);
} else {
LOGGER.log(Level.WARNING, msg);
}
}
});
}
Expand All @@ -205,8 +207,11 @@
.reverse()
.stream()
.filter(buildStepMonitoringAction -> Objects.equals(buildStepMonitoringAction.getSpanId(), span.getSpanContext().getSpanId()))
.findFirst().ifPresentOrElse(BuildStepMonitoringAction::purgeSpanAndCloseAssociatedScopes, () -> {
throw new IllegalStateException("span not found to be purged: " + span + " for " + buildStep);
.findFirst()
.ifPresentOrElse(BuildStepMonitoringAction::purgeSpanAndCloseAssociatedScopes, () -> {
if (!Objects.equals(span, Span.getInvalid())) { // recovery of a previous error, skip the invalid span

Check warning on line 212 in src/main/java/io/jenkins/plugins/opentelemetry/job/OtelTraceService.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 212 is not covered by tests
throw new IllegalStateException("span not found to be purged: " + span + " for " + buildStep);
}
});
}

Expand Down
Loading