private void HandleEndSpan(RabbitMqDurationEvent <ApmSpanScopeParams> evt) { try { if (!_processingQueries.TryRemove(evt.Params.Id, out var span)) { return; } if (evt.Params != null) { foreach (var item in evt.Params.Labels) { span.SetLabel(item.Key, $"{item.Value}"); } } TryFixThreadsCount(span, evt.Duration.TotalMilliseconds); span.Duration = evt.Duration.TotalMilliseconds; span.End(); } catch { } }