Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure GrpcChannel #5555

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#nullable enable

using System.Diagnostics;
#if NETSTANDARD2_1 || NET6_0_OR_GREATER
using Grpc.Net.Client;
#endif
#if NETFRAMEWORK
using System.Net.Http;
#endif
Expand Down Expand Up @@ -120,6 +123,11 @@ public OtlpExportProtocol Protocol
set => this.protocol = value;
}


#if NETSTANDARD2_1 || NET6_0_OR_GREATER
public GrpcChannelOptions? GrpcChannelOptions { get; set; }
#endif

/// <summary>
/// Gets or sets the export processor type to be used with the OpenTelemetry Protocol Exporter. The default value is <see cref="ExportProcessorType.Batch"/>.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ public static Channel CreateChannel(this OtlpExporterOptions options)
}

#if NETSTANDARD2_1 || NET6_0_OR_GREATER
return GrpcChannel.ForAddress(options.Endpoint);
if (options.GrpcChannelOptions is null)
{
return GrpcChannel.ForAddress(options.Endpoint);
}
return GrpcChannel.ForAddress(options.Endpoint, options.GrpcChannelOptions!);
#else
ChannelCredentials channelCredentials;
if (options.Endpoint.Scheme == Uri.UriSchemeHttps)
Expand Down