-
Notifications
You must be signed in to change notification settings - Fork 19
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
Log at debug when completeSpan
methods are used with no active trace
#1016
Log at debug when completeSpan
methods are used with no active trace
#1016
Conversation
Such states suggest that a bug has occurred closing more spans than were opened.
Generate changelog in
|
log.debug( | ||
"Attempted to complete spans when there is no active Trace. This may be the " | ||
+ "result of calling completeSpan more times than startSpan", | ||
new SafeRuntimeException("not a real exception")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also do this on line 656 as well when there is no open span?
private static <T> void completeSpanAndNotifyObservers(
Optional<OpenSpan> openSpan, TagTranslator<? super T> tag, T state, String traceId) {
//noinspection OptionalIsPresent - Avoid lambda allocation in hot paths
if (openSpan.isPresent()) {
Tracer.notifyObservers(toSpan(openSpan.get(), tag, state, traceId));
} else if (log.isDebugEnabled()) {
log.debug(
"Attempted to complete spans when there is no active Trace. This may be the "
+ "result of calling completeSpan more times than startSpan",
new SafeRuntimeException("not a real exception"));
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe that works because Optional<OpenSpan>
isn't necessarily present unless the span is sampled:
tracing-java/tracing/src/main/java/com/palantir/tracing/Trace.java
Lines 251 to 258 in eb41f5d
@Override | |
Optional<OpenSpan> pop() { | |
validateNumberOfSpans(); | |
if (numberOfSpans > 0) { | |
numberOfSpans--; | |
} | |
return Optional.empty(); | |
} |
We clear the current trace when the final span is completed, so I don't think that would give us additional coverage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call
log.debug( | ||
"Attempted to complete spans when there is no active Trace. This may be the " | ||
+ "result of calling completeSpan more times than startSpan", | ||
new SafeRuntimeException("not a real exception")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call
Released 6.17.0 |
Such states suggest that a bug has occurred closing more spans than were opened.
==COMMIT_MSG==
Log at debug when
completeSpan
methods are used with no active trace==COMMIT_MSG==