/// <summary> /// Initializes a new instance of the <see cref="OtlpTraceExporter"/> class. /// </summary> /// <param name="options">Configuration options for the exporter.</param> /// <param name="traceServiceClient"><see cref="OtlpCollector.TraceService.TraceServiceClient"/>.</param> internal OtlpTraceExporter(OtlpExporterOptions options, OtlpCollector.TraceService.ITraceServiceClient traceServiceClient = null) { this.options = options ?? throw new ArgumentNullException(nameof(options)); this.headers = GetMetadataFromHeaders(options.Headers); if (this.options.TimeoutMilliseconds <= 0) { throw new ArgumentException("Timeout value provided is not a positive number.", nameof(this.options.TimeoutMilliseconds)); } if (traceServiceClient != null) { this.traceClient = traceServiceClient; } else { if (options.Endpoint.Scheme == Uri.UriSchemeHttps) { throw new NotSupportedException("Https Endpoint is not supported."); } #if NETSTANDARD2_1 this.channel = GrpcChannel.ForAddress(options.Endpoint); #else this.channel = new Channel(options.Endpoint.Authority, ChannelCredentials.Insecure); #endif this.traceClient = new OtlpCollector.TraceService.TraceServiceClient(this.channel); } }
/// <summary> /// Initializes a new instance of the <see cref="OtlpTraceExporter"/> class. /// </summary> /// <param name="options">Configuration options for the exporter.</param> /// <param name="traceServiceClient"><see cref="OtlpCollector.TraceService.TraceServiceClient"/>.</param> internal OtlpTraceExporter(OtlpExporterOptions options, OtlpCollector.TraceService.ITraceServiceClient traceServiceClient = null) { this.options = options ?? throw new ArgumentNullException(nameof(options)); this.headers = GetMetadataFromHeaders(options.Headers); if (this.options.TimeoutMilliseconds <= 0) { throw new ArgumentException("Timeout value provided is not a positive number.", nameof(this.options.TimeoutMilliseconds)); } if (traceServiceClient != null) { this.traceClient = traceServiceClient; } else { #if NETSTANDARD2_1 this.channel = options.GrpcChannelOptions == default ? GrpcChannel.ForAddress(options.Endpoint) : GrpcChannel.ForAddress(options.Endpoint, options.GrpcChannelOptions); #else this.channel = new Channel(options.Endpoint, options.Credentials, options.ChannelOptions); #endif this.traceClient = new OtlpCollector.TraceService.TraceServiceClient(this.channel); } }
public OtlpGrpcTraceExportClient(OtlpExporterOptions options, OtlpCollector.TraceService.ITraceServiceClient traceServiceClient = null) : base(options) { if (traceServiceClient != null) { this.traceClient = traceServiceClient; } else { this.Channel = options.CreateChannel(); this.traceClient = new OtlpCollector.TraceService.TraceServiceClient(this.Channel); } }
/// <summary> /// Initializes a new instance of the <see cref="OtlpExporter"/> class. /// </summary> /// <param name="options">Configuration options for the exporter.</param> /// <param name="traceServiceClient"><see cref="OtlpCollector.TraceService.TraceServiceClient"/>.</param> internal OtlpExporter(OtlpExporterOptions options, OtlpCollector.TraceService.ITraceServiceClient traceServiceClient = null) { this.headers = options?.Headers ?? throw new ArgumentNullException(nameof(options)); if (traceServiceClient != null) { this.traceClient = traceServiceClient; } else { this.channel = new Channel(options.Endpoint, options.Credentials, options.ChannelOptions); this.traceClient = new OtlpCollector.TraceService.TraceServiceClient(this.channel); } }
/// <summary> /// Initializes a new instance of the <see cref="OtlpExporter"/> class. /// </summary> /// <param name="options">Configuration options for the exporter.</param> /// <param name="traceServiceClient"><see cref="OtlpCollector.TraceService.TraceServiceClient"/>.</param> internal OtlpExporter(OtlpExporterOptions options, OtlpCollector.TraceService.ITraceServiceClient traceServiceClient = null) { this.options = options ?? throw new ArgumentNullException(nameof(options)); this.headers = options.Headers ?? throw new ArgumentException("Headers were not provided on options.", nameof(options)); if (traceServiceClient != null) { this.traceClient = traceServiceClient; } else { #if NETSTANDARD2_1 this.channel = options.GrpcChannelOptions == default ? GrpcChannel.ForAddress(options.Endpoint) : GrpcChannel.ForAddress(options.Endpoint, options.GrpcChannelOptions); #else this.channel = new Channel(options.Endpoint, options.Credentials, options.ChannelOptions); #endif this.traceClient = new OtlpCollector.TraceService.TraceServiceClient(this.channel); } }