public override IList <ISpanData> GetErrorSampledSpans(ISampledSpanStoreErrorFilter filter)
        {
            int numSpansToReturn   = filter.MaxSpansToReturn == 0 ? MAX_PER_SPAN_NAME_SAMPLES : filter.MaxSpansToReturn;
            IList <SpanBase> spans = new List <SpanBase>();

            // Try to not keep the lock to much, do the SpanImpl -> SpanData conversion outside the lock.
            lock (samples) {
                PerSpanNameSamples perSpanNameSamples = samples[filter.SpanName];
                if (perSpanNameSamples != null)
                {
                    spans = perSpanNameSamples.GetErrorSamples(filter.CanonicalCode, numSpansToReturn);
                }
            }
            List <ISpanData> ret = new List <ISpanData>(spans.Count);

            foreach (SpanBase span in spans)
            {
                ret.Add(span.ToSpanData());
            }
            return(ret.AsReadOnly());
        }
        /// <inheritdoc/>
        public override IEnumerable <SpanData> GetErrorSampledSpans(ISampledSpanStoreErrorFilter filter)
        {
            int numSpansToReturn         = filter.MaxSpansToReturn == 0 ? MaxPerSpanNameSamples : filter.MaxSpansToReturn;
            IEnumerable <SpanBase> spans = Enumerable.Empty <SpanBase>();

            // Try to not keep the lock to much, do the SpanImpl -> SpanData conversion outside the lock.
            lock (this.samples)
            {
                PerSpanNameSamples perSpanNameSamples = this.samples[filter.SpanName];
                if (perSpanNameSamples != null)
                {
                    spans = perSpanNameSamples.GetErrorSamples(filter.CanonicalCode, numSpansToReturn);
                }
            }

            List <SpanData> ret = new List <SpanData>(spans.Count());

            foreach (SpanBase span in spans)
            {
                ret.Add(span.ToSpanData());
            }

            return(ret.AsReadOnly());
        }