private void Consumer()
        {
            foreach (var consumingItem in _blockingCollection.GetConsumingEnumerable())
            {
                switch (consumingItem)
                {
                case Span span:
                    _sender.SendSpanAsync(new[] { span }, _cancellationTokenSource.Token);
                    break;

                default:
                    throw new NotSupportedException();
                }
            }
        }
 public async Task Accept(IEnumerable <IDispatchable> dispatchables)
 {
     foreach (var block in dispatchables.Chunked(DefaultChunked))
     {
         try
         {
             await _butterflySender.SendSpanAsync(block.Select(x => x.RawInstance).OfType <Span>().ToArray());
         }
         catch (Exception exception)
         {
             foreach (var item in block)
             {
                 item.State = SendState.Untreated;
                 item.Error();
             }
             _logger.Error("Flush span to collector error.", exception);
         }
     }
 }