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

OtlpExporter: Enable support for both http and https - no tests #1804

Merged
Merged
Show file tree
Hide file tree
Changes from 5 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 @@ -2,6 +2,9 @@

## Unreleased

* Add back support for secure gRPC connections over https.
([#1795](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1795))

## 1.0.0-rc3

Released 2021-Feb-04
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,25 @@ internal OtlpTraceExporter(OtlpExporterOptions options, OtlpCollector.TraceServi
}
else
{
if (options.Endpoint.Scheme == Uri.UriSchemeHttps)
if (options.Endpoint.Scheme != Uri.UriSchemeHttp && options.Endpoint.Scheme != Uri.UriSchemeHttps)
{
throw new NotSupportedException("Https Endpoint is not supported.");
throw new NotSupportedException($"Endpoint URI scheme ({options.Endpoint.Scheme}) is not supported. Currently only \"http\" and \"https\" are supported.");
}

#if NETSTANDARD2_1
this.channel = GrpcChannel.ForAddress(options.Endpoint);
#else
this.channel = new Channel(options.Endpoint.Authority, ChannelCredentials.Insecure);
ChannelCredentials channelCredentials;
if (options.Endpoint.Scheme == Uri.UriSchemeHttps)
{
channelCredentials = new SslCredentials();
}
else
{
channelCredentials = ChannelCredentials.Insecure;
}

this.channel = new Channel(options.Endpoint.Authority, channelCredentials);
#endif
this.traceClient = new OtlpCollector.TraceService.TraceServiceClient(this.channel);
}
Expand Down