/// <summary> /// Initializes a new instance of the <see cref="ZipkinExporter"/> class. /// </summary> /// <param name="options">Configuration options.</param> /// <param name="client">Http client to use to upload telemetry.</param> public ZipkinExporter(ZipkinExporterOptions options, HttpClient client = null) { Guard.Null(options, nameof(options)); this.options = options; this.maxPayloadSizeInBytes = (!options.MaxPayloadSizeInBytes.HasValue || options.MaxPayloadSizeInBytes <= 0) ? ZipkinExporterOptions.DefaultMaxPayloadSizeInBytes : options.MaxPayloadSizeInBytes.Value; this.httpClient = client ?? new HttpClient(); }
/// <summary> /// Initializes a new instance of the <see cref="ZipkinExporter"/> class. /// </summary> /// <param name="options">Configuration options.</param> /// <param name="client">Http client to use to upload telemetry.</param> public ZipkinExporter(ZipkinExporterOptions options, HttpClient client = null) { Guard.Null(options, nameof(options)); this.options = options; this.maxPayloadSizeInBytes = (!options.MaxPayloadSizeInBytes.HasValue || options.MaxPayloadSizeInBytes <= 0) ? ZipkinExporterOptions.DefaultMaxPayloadSizeInBytes : options.MaxPayloadSizeInBytes.Value; this.httpClient = client ?? options.HttpClientFactory?.Invoke() ?? throw new InvalidOperationException("ZipkinExporter was missing HttpClientFactory or it returned null."); }
/// <summary> /// Initializes a new instance of the <see cref="ZipkinExporter"/> class. /// </summary> /// <param name="options">Configuration options.</param> /// <param name="client">Http client to use to upload telemetry.</param> public ZipkinExporter(ZipkinExporterOptions options, HttpClient client = null) { this.options = options ?? throw new ArgumentNullException(nameof(options)); #if !NET452 this.maxPayloadSizeInBytes = (!options.MaxPayloadSizeInBytes.HasValue || options.MaxPayloadSizeInBytes <= 0) ? ZipkinExporterOptions.DefaultMaxPayloadSizeInBytes : options.MaxPayloadSizeInBytes.Value; #endif this.httpClient = client ?? new HttpClient(); }