Skip to content
This repository has been archived by the owner on Dec 23, 2023. It is now read-only.

Commit

Permalink
Handle IllegalArgumentException due to skipped SpanStartEvent (#1809)
Browse files Browse the repository at this point in the history
  • Loading branch information
saiya committed Apr 11, 2019
1 parent 4bc39b6 commit 8b886b0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ public void process() {
spanExporter.addSpan(span);
}
if (runningSpanStore != null) {
runningSpanStore.onEnd(span);
try {
// Note that corresponding SpanStartEvent / onStart(span) might not have called if queue was full.
runningSpanStore.onEnd(span);
} catch (IllegalArgumentException e) {} // Span was not in the running span list
}
if (sampledSpanStore != null) {
sampledSpanStore.considerForSampling(span);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void onStart(RecordEventsSpanImpl span) {

@Override
public void onEnd(RecordEventsSpanImpl span) {
runningSpans.removeElement(span);
runningSpans.removeElement(span); // Throws IllegalArgumentException if given span is not in the list
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ static RunningSpanStoreImpl getNoopRunningSpanStoreImpl() {
* Removes the {@code Span} from the running spans list when the {@code Span} ends.
*
* @param span the {@code Span} that ended.
* @throws IllegalArgumentException Given span is not started.
*/
public abstract void onEnd(RecordEventsSpanImpl span);

Expand Down

0 comments on commit 8b886b0

Please sign in to comment.