Ejemplo n.º 1
0
        private bool GetSampled(ICarrier carrier, string operationName)
        {
            if (carrier.HasValue && carrier.Sampled.HasValue)
            {
                return(carrier.Sampled.Value);
            }

            SamplingContext samplingContext;

            if (carrier.HasValue)
            {
                samplingContext = new SamplingContext(operationName, carrier.NetworkAddress, carrier.EntryEndpoint, carrier.ParentEndpoint);
            }
            else
            {
                samplingContext = new SamplingContext(operationName, default(string), default(string), default(string));
            }

            var sampler = _samplerChainBuilder.Build();

            return(sampler(samplingContext));
        }