-
Notifications
You must be signed in to change notification settings - Fork 773
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update OTEL_EXPORTER_JAEGER_PROTOCOL parsing (#2914)
* typo fixes for messages while parsing ev vars * extend env variable names tests * auto cleanup test * typo fix for internal variable * verify default value for jeager exporter protocol * align env vars for jeager exporter protocol with specification * code review fix - better documentation * disable MD013 for table * extend test for OTEL_EXPORTER_JAEGER_ENDPOINT * code review - nit fix Co-authored-by: Cijo Thomas <[email protected]> Co-authored-by: Mikel Blanchard <[email protected]>
- Loading branch information
1 parent
f234829
commit 4b3ee96
Showing
9 changed files
with
119 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/OpenTelemetry.Exporter.Jaeger/JaegerExporterOptionsExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// <copyright file="JaegerExporterOptionsExtensions.cs" company="OpenTelemetry Authors"> | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// </copyright> | ||
|
||
namespace OpenTelemetry.Exporter; | ||
|
||
internal static class JaegerExporterOptionsExtensions | ||
{ | ||
public static JaegerExportProtocol? ToJaegerExportProtocol(this string protocol) => | ||
protocol?.Trim() switch | ||
{ | ||
"udp/thrift.compact" => JaegerExportProtocol.UdpCompactThrift, | ||
"http/thrift.binary" => JaegerExportProtocol.HttpBinaryThrift, | ||
_ => null, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
test/OpenTelemetry.Exporter.Jaeger.Tests/JaegerExporterOptionsExtensionsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// <copyright file="JaegerExporterOptionsExtensionsTests.cs" company="OpenTelemetry Authors"> | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// </copyright> | ||
|
||
using Xunit; | ||
|
||
namespace OpenTelemetry.Exporter.Jaeger.Tests; | ||
|
||
public class JaegerExporterOptionsExtensionsTests | ||
{ | ||
[Theory] | ||
[InlineData("udp/thrift.compact", JaegerExportProtocol.UdpCompactThrift)] | ||
[InlineData("http/thrift.binary", JaegerExportProtocol.HttpBinaryThrift)] | ||
[InlineData("unsupported", null)] | ||
public void ToJaegerExportProtocol_Protocol_MapsToCorrectValue(string protocol, JaegerExportProtocol? expectedExportProtocol) | ||
{ | ||
var exportProtocol = protocol.ToJaegerExportProtocol(); | ||
|
||
Assert.Equal(expectedExportProtocol, exportProtocol); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters