/// <summary> /// Adds the core services required for OpenTracing without any actual instrumentations. /// </summary> public static IServiceCollection AddOpenTracingCoreServices(this IServiceCollection services, Action <IOpenTracingBuilder> builder = null) { if (services == null) { throw new ArgumentNullException(nameof(services)); } services.TryAddSingleton <ITracer>(GlobalTracer.Instance); services.TryAddSingleton <IGlobalTracerAccessor, GlobalTracerAccessor>(); services.TryAddSingleton <DiagnosticManager>(); services.TryAddEnumerable(ServiceDescriptor.Singleton <IHostedService, InstrumentationService>()); var builderInstance = new OpenTracingBuilder(services); builder?.Invoke(builderInstance); return(services); }