RuntimeException errorStoringSpans ( List < Span > spans , Throwable e ) { metrics . incrementSpansDropped ( spans . size ( ) ) ; // The exception could be related to a span being huge. Instead of filling logs, // print trace id, span id pairs StringBuilder msg = appendSpanIds ( spans , new StringBuilder ( "Cannot store spans " ) ) ; return doError ( msg . toString ( ) , e ) ; }
When storing spans an exception can be raised before or after the fact . This adds context of span ids to give logs more relevance .