Skip to content

Commit

Permalink
SpanHolder.postStop do not send if span list is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
levkhomich committed Dec 28, 2014
1 parent 9c473af commit 9c8eff8
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,17 @@ private[tracing] class SpanHolder(transport: TTransport) extends Actor with Acto
spans.keys.foreach(id =>
enqueue(id, cancelJob = true)
)
Try {
client.Log(nextBatch.map(spanToLogEntry))
if (transport.isOpen) {
transport.close()
if (!nextBatch.isEmpty) {
Try {
client.Log(nextBatch.map(spanToLogEntry))
if (transport.isOpen) {
transport.close()
}
} recover {
case e =>
handleSubmissionError(e)
log.error(s"Zipkin collector is unavailable. Failed to send ${nextBatch.size} spans during postStop.")
}
} recover {
case e =>
handleSubmissionError(e)
log.error(s"Zipkin collector is unavailable. Failed to send ${nextBatch.size} spans during postStop.")
}
super.postStop()
}
Expand Down

0 comments on commit 9c8eff8

Please sign in to comment.