/// <summary>Closes the sampler, and any sub-samplers.</summary>
 public void Close()
 {
     lock (_lock)
     {
         DefaultSampler.Close();
         foreach (var sampler in SamplingFilters.Select(f => f.TargetSampler))
         {
             sampler.Close();
         }
     }
 }
        /// <summary>Makes a decision on tracing a span.</summary>
        /// <param name="operation">The operation being executed. (This is not just the HTTP Method)</param>
        /// <param name="id">The ID of the span.</param>
        public SamplingStatus Sample(string operation, TraceId id)
        {
            lock (_lock)
            {
                var context = HttpContextAccessor.HttpContext;

                return(SamplingFilters.Find(f => f.ShouldSample(context.Request))
                       ?.TargetSampler?.Sample(operation, id)
                       ?? DefaultSampler.Sample(operation, id));
            }
        }