public SpanTracer(SpanCollector spanCollector, ServiceEndpoint zipkinEndpoint, IEnumerable <string> zipkinNotToBeDisplayedDomainList, Uri domain) { if (spanCollector == null) { throw new ArgumentNullException(nameof(spanCollector)); } if (zipkinEndpoint == null) { throw new ArgumentNullException(nameof(zipkinEndpoint)); } if (zipkinNotToBeDisplayedDomainList == null) { throw new ArgumentNullException(nameof(zipkinNotToBeDisplayedDomainList)); } if (domain == null) { throw new ArgumentNullException(nameof(domain)); } this.spanCollector = spanCollector; this.zipkinEndpoint = zipkinEndpoint; this.zipkinNotToBeDisplayedDomainList = zipkinNotToBeDisplayedDomainList; var domainHost = domain.Host; this.serviceName = CleanServiceName(domainHost); }
public static SpanCollector GetInstance(Uri uri, uint maxProcessorBatchSize, ILog logger) { if (instance == null) { instance = new SpanCollector(uri, maxProcessorBatchSize, logger); instance.Start(); } return(instance); }
static SpanCollector GetInstance(Uri uri, uint maxProcessorBatchSize) { SyncHelper.ExecuteSafely(syncObj, () => instance == null, () => { instance = new SpanCollector(uri, maxProcessorBatchSize); }); return(instance); }
public ZipkinClient(ILog logger, IZipkinConfig zipkinConfig, IOwinContext context, SpanCollector collector = null) { if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (zipkinConfig == null) { throw new ArgumentNullException(nameof(zipkinConfig)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } var traceProvider = new TraceProvider(zipkinConfig, context); IsTraceOn = !zipkinConfig.Bypass(context.Request) && IsTraceProviderSamplingOn(traceProvider); if (!IsTraceOn) { return; } zipkinConfig.Validate(); ZipkinConfig = zipkinConfig; this.logger = logger; try { spanCollector = collector ?? SpanCollector.GetInstance( zipkinConfig.ZipkinBaseUri, zipkinConfig.SpanProcessorBatchSize, logger); spanTracer = new SpanTracer( spanCollector, new ServiceEndpoint(), zipkinConfig.NotToBeDisplayedDomainList, zipkinConfig.Domain); TraceProvider = traceProvider; } catch (Exception ex) { logger.Error("Error Building Zipkin Client Provider", ex); IsTraceOn = false; } }