/// <summary> /// Creates an instance of <see cref="Tracer"/>. /// </summary> /// <param name="spanProcessor">Span processor.</param> /// <param name="traceConfig">Trace configuration.</param> /// <param name="binaryFormat">Binary format context propagator.</param> /// <param name="textFormat">Text format context propagator.</param> public Tracer(SpanProcessor spanProcessor, TraceConfig traceConfig, IBinaryFormat binaryFormat, ITextFormat textFormat) { this.spanProcessor = spanProcessor ?? throw new ArgumentNullException(nameof(spanProcessor)); this.ActiveTraceConfig = traceConfig ?? throw new ArgumentNullException(nameof(traceConfig)); this.BinaryFormat = binaryFormat ?? throw new ArgumentNullException(nameof(binaryFormat)); this.TextFormat = textFormat ?? throw new ArgumentNullException(nameof(textFormat)); }
private TracerFactory(TracerBuilder builder) { this.sampler = builder.Sampler ?? Samplers.AlwaysSample; // TODO separate sampler from options this.configurationOptions = builder.TracerConfigurationOptions ?? new TracerConfiguration(this.sampler); // TODO log warning (or throw?) if there is no exporter this.exporter = builder.SpanExporter ?? new NoopSpanExporter(); this.spanProcessor = builder.ProcessorFactory != null? builder.ProcessorFactory(this.exporter) : new BatchingSpanProcessor(this.exporter); this.binaryFormat = builder.BinaryFormat ?? new BinaryFormat(); this.textFormat = builder.TextFormat ?? new TraceContextFormat(); this.defaultTracer = new Tracer( this.spanProcessor, this.configurationOptions, this.binaryFormat, this.textFormat, Resource.Empty); }
public Tracer(IRandomGenerator randomGenerator, IStartEndHandler startEndHandler, ITraceConfig traceConfig, IExportComponent exportComponent, IBinaryFormat binaryFormat, ITextFormat textFormat) { this.spanBuilderOptions = new SpanBuilderOptions(randomGenerator, startEndHandler, traceConfig); this.binaryFormat = binaryFormat ?? new BinaryFormat(); this.textFormat = textFormat ?? new TraceContextFormat(); this.exportComponent = exportComponent; }
/// <summary> /// Creates an instance of <see cref="Tracer"/>. /// </summary> /// <param name="spanProcessor">Span processor.</param> /// <param name="traceConfig">Trace configuration.</param> /// <param name="binaryFormat">Binary format context propagator.</param> /// <param name="textFormat">Text format context propagator.</param> public Tracer(SpanProcessor spanProcessor, TraceConfig traceConfig, IBinaryFormat binaryFormat, ITextFormat textFormat) { this.spanProcessor = spanProcessor ?? new SimpleSpanProcessor(new NoopSpanExporter()); this.ActiveTraceConfig = traceConfig; this.BinaryFormat = binaryFormat ?? new BinaryFormat(); this.TextFormat = textFormat ?? new TraceContextFormat(); }
public TracerFactory(SpanProcessor spanProcessor = null, TracerConfiguration tracerConfiguration = null, ITextFormat textFormat = null, IBinaryFormat binaryFormat = null) { this.spanProcessor = spanProcessor ?? Tracing.SpanProcessor; this.tracerConfiguration = tracerConfiguration ?? Tracing.TracerConfiguration; this.textFormat = textFormat ?? new TraceContextFormat(); this.binaryFormat = binaryFormat ?? new BinaryFormat(); this.defaultTracer = new Tracer(this.spanProcessor, this.tracerConfiguration, this.binaryFormat, this.textFormat, Resource.Empty); }
public TracerShim(Trace.Tracer tracer, ITextFormat textFormat, IBinaryFormat binaryFormat) { this.tracer = tracer ?? throw new ArgumentNullException(nameof(tracer)); this.textFormat = textFormat ?? throw new ArgumentNullException(nameof(textFormat)); this.binaryFormat = binaryFormat ?? throw new ArgumentNullException(nameof(binaryFormat)); this.ScopeManager = new ScopeManagerShim(this.tracer); }
private TracerFactory(TracerBuilder builder) { this.sampler = builder.Sampler ?? Samplers.AlwaysSample; this.defaultResource = builder.Resource; this.configurationOptions = builder.TracerConfigurationOptions ?? new TracerConfiguration(); if (builder.ProcessingPipelines == null || !builder.ProcessingPipelines.Any()) { // if there are no pipelines are configured, use noop processor this.spanProcessor = new NoopSpanProcessor(); } else if (builder.ProcessingPipelines.Count == 1) { // if there is only one pipeline - use it's outer processor as a // single processor on the tracer. var processorFactory = builder.ProcessingPipelines[0]; this.spanProcessor = processorFactory.Build(); } else { // if there are more pipelines, use processor that will broadcast to all pipelines var processors = new SpanProcessor[builder.ProcessingPipelines.Count]; for (int i = 0; i < builder.ProcessingPipelines.Count; i++) { processors[i] = builder.ProcessingPipelines[i].Build(); } this.spanProcessor = new BroadcastProcessor(processors); } this.binaryFormat = builder.BinaryFormat ?? new BinaryFormat(); this.textFormat = builder.TextFormat ?? new TraceContextFormat(); this.defaultTracer = new Tracer( this.spanProcessor, this.sampler, this.configurationOptions, this.binaryFormat, this.textFormat, this.defaultResource); }
/// <summary> /// Creates an instance of <see cref="TracerSdk"/>. /// </summary> /// <param name="spanProcessor">Span processor.</param> /// <param name="sampler">Sampler to use.</param> /// <param name="tracerConfiguration">Trace configuration.</param> /// <param name="binaryFormat">Binary format context propagator.</param> /// <param name="textFormat">Text format context propagator.</param> /// <param name="libraryResource">Resource describing the instrumentation library.</param> internal TracerSdk(SpanProcessor spanProcessor, Sampler sampler, TracerConfiguration tracerConfiguration, IBinaryFormat binaryFormat, ITextFormat textFormat, Resource libraryResource) { this.spanProcessor = spanProcessor ?? throw new ArgumentNullException(nameof(spanProcessor)); this.tracerConfiguration = tracerConfiguration ?? throw new ArgumentNullException(nameof(tracerConfiguration)); this.BinaryFormat = binaryFormat ?? throw new ArgumentNullException(nameof(binaryFormat)); this.TextFormat = textFormat ?? throw new ArgumentNullException(nameof(textFormat)); this.LibraryResource = libraryResource ?? throw new ArgumentNullException(nameof(libraryResource)); this.sampler = sampler ?? throw new ArgumentNullException(nameof(sampler)); }
/// <summary> /// Configures <see cref="IBinaryFormat"/> on the tracerSdk. /// </summary> /// <param name="binaryFormat"><see cref="IBinaryFormat"/> implementation class instance.</param> public TracerBuilder SetBinaryFormat(IBinaryFormat binaryFormat) { this.BinaryFormat = binaryFormat ?? throw new ArgumentNullException(nameof(binaryFormat)); return(this); }
/// <summary> /// Creates an instance of <see cref="ITracer"/>. /// </summary> /// <param name="startEndHandler">Start/end event handler.</param> /// <param name="traceConfig">Trace configuration.</param> /// <param name="spanExporter">Exporter for span.</param> /// <param name="binaryFormat">Binary format context propagator.</param> /// <param name="textFormat">Text format context propagator.</param> public Tracer(IStartEndHandler startEndHandler, ITraceConfig traceConfig, SpanExporter spanExporter, IBinaryFormat binaryFormat, ITextFormat textFormat) { this.spanBuilderOptions = new SpanBuilderOptions(startEndHandler, traceConfig); this.spanExporter = spanExporter ?? (SpanExporter)SpanExporter.Create(ExporterBufferSize, ExporterScheduleDelay); this.BinaryFormat = binaryFormat ?? new BinaryFormat(); this.TextFormat = textFormat ?? new TraceContextFormat(); }