public bool Invoke(SamplingContext samplingContext, Sampler next) { if (!_sample_on) { return(next(samplingContext)); } return(_idx.Increment() <= _samplePer3Secs && next(samplingContext)); }
public bool Invoke(SamplingContext samplingContext, Sampler next) { if (_ignoreUrlList.Any(b => samplingContext.OperationName.ToLower().Contains(b))) { return(false); } return(next(samplingContext)); }
public bool Invoke(SamplingContext samplingContext, Sampler next) { if (!_sample_on) { return(next(samplingContext)); } var r = _random.Next(10000); return(r <= _samplingRate && next(samplingContext)); }
private bool GetSampled(SegmentContext parentSegmentContext, string operationName, StringOrIntValue peer = default(StringOrIntValue)) { if (parentSegmentContext != null) { return(parentSegmentContext.Sampled); } var sampledContext = new SamplingContext(operationName, peer, new StringOrIntValue(operationName), default(StringOrIntValue)); var sampler = _samplerChainBuilder.Build(); return(sampler(sampledContext)); }
public bool Invoke(SamplingContext samplingContext, Sampler next) { if (!_sample_on) { return(next(samplingContext)); } foreach (var pattern in _ignorePaths) { if (FastPathMatcher.Match(pattern, samplingContext.OperationName)) { return(false); } } return(next(samplingContext)); }
/// <summary> /// /// </summary> /// <param name="samplingContext"></param> /// <param name="next"></param> /// <returns>true:监听;false:忽略监听</returns> public bool Invoke(SamplingContext samplingContext, Sampler next) { try { if (string.IsNullOrEmpty(samplingContext.OperationName)) { return(false); } var urls = new List <IgnoresUrl>(); _configuration.GetSection("SkyWalking:Ignores").Bind(urls); if (urls != null && urls.Count > 0) { foreach (var item in urls) { if (string.IsNullOrEmpty(item.Urls)) { continue; } var isContains = item.Urls.ToLower().Split(',').ToList().Exists(a => samplingContext.OperationName.ToLower().Contains(a)); if (isContains) { return(false); } } } var result = next(samplingContext); return(result); } catch (Exception ex) { _logger.Error(ex, $"SkyWalking链路追踪异常 OperationName:{samplingContext?.OperationName}"); return(false); } }
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(StringOrIntValue), default(StringOrIntValue), default(StringOrIntValue)); } var sampler = _samplerChainBuilder.Build(); return(sampler(samplingContext)); }
public bool Invoke(SamplingContext samplingContext, Sampler next) { return(next(samplingContext)); }