class SpanContext {

    public void endSpan(Span span) {
        if (spans.isEmpty()) {
            SpanHelper.LOG.warning("Ending span " + span.getName() + ":" + span.getSpanId() + " when no spans exist in SpanContext");
        }
        Span poppedSpan = spans.pop();

        int extraPops = 0;
        while (!Objects.equals(poppedSpan, span)) {
            extraPops++;
            poppedSpan = spans.pop();
        }

        if (extraPops > 0) {
            SpanHelper.LOG.warning("Popped " + extraPops + " unclosed Spans");
        }
    }

      SpanContext();

}