public static TracerFactory Create(Action <TracerBuilder> configure) { if (configure == null) { throw new ArgumentNullException(nameof(configure)); } var builder = new TracerBuilder(); configure(builder); var factory = new TracerFactory(builder); if (builder.CollectorFactories != null) { foreach (var collector in builder.CollectorFactories) { var tracer = factory.GetTracer(collector.Name, collector.Version); var collectorInstance = collector.Factory(tracer); if (collectorInstance is IDisposable disposableCollector) { factory.disposables.Add(disposableCollector); } } } return(factory); }
/// <summary> /// Creates tracerSdk factory. /// </summary> /// <param name="configure">Function that configures tracerSdk factory.</param> /// <returns>Returns new <see cref="TracerFactory"/>.</returns> public static TracerFactory Create(Action <TracerBuilder> configure) { if (configure == null) { throw new ArgumentNullException(nameof(configure)); } var builder = new TracerBuilder(); configure(builder); var factory = new TracerFactory(builder); if (builder.AdapterFactories != null) { foreach (var adapter in builder.AdapterFactories) { var tracer = factory.GetTracer(adapter.Name, adapter.Version); factory.adapters.Add(adapter.Factory(tracer)); } } return(factory); }