From ba897aa69ee0402f438e89c8136cb812257ad4b2 Mon Sep 17 00:00:00 2001 From: "E.G. Hornbostel" Date: Tue, 9 Jul 2019 12:15:15 -0700 Subject: [PATCH] cleanup after merge. --- Directory.Build.targets | 2 +- lib/Directory.Build.props | 8 ++++++++ lib/Directory.Build.targets | 10 ++++++++++ lib/Thrift/Thrift.csproj | 7 ++++++- lib/Thrift/Transports/Client/THttpClientTransport.cs | 8 ++++++-- .../Transports/Client/TMemoryBufferClientTransport.cs | 6 +++--- lib/Thrift/Transports/TTransportFactory.cs | 8 ++++---- samples/Exporters/Program.cs | 5 +++-- samples/Exporters/TestJaeger.cs | 4 ++-- src/Directory.Build.targets | 4 ++-- .../Implimentation/JaegerSpanRef.cs | 6 +++--- .../Implimentation/JaegerSpanRefType.cs | 4 ++-- .../Implimentation/JaegerTagType.cs | 4 ++-- .../OpenTelemetry.Exporter.Jaeger.csproj | 2 +- 14 files changed, 53 insertions(+), 25 deletions(-) create mode 100644 lib/Directory.Build.props create mode 100644 lib/Directory.Build.targets diff --git a/Directory.Build.targets b/Directory.Build.targets index cff5023aa..96d0176b0 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,6 +1,6 @@ - + All diff --git a/lib/Directory.Build.props b/lib/Directory.Build.props new file mode 100644 index 000000000..e3fa46613 --- /dev/null +++ b/lib/Directory.Build.props @@ -0,0 +1,8 @@ + + + + + + True + + \ No newline at end of file diff --git a/lib/Directory.Build.targets b/lib/Directory.Build.targets new file mode 100644 index 000000000..347a97078 --- /dev/null +++ b/lib/Directory.Build.targets @@ -0,0 +1,10 @@ + + + + + + all + runtime; build; native; contentfiles; analyzers + + + \ No newline at end of file diff --git a/lib/Thrift/Thrift.csproj b/lib/Thrift/Thrift.csproj index a25e3f509..3dbd8203b 100644 --- a/lib/Thrift/Thrift.csproj +++ b/lib/Thrift/Thrift.csproj @@ -3,10 +3,15 @@ net46;netstandard2.0 netstandard2.0 + OpenTelemetry authors + https://opentelemetry.io/img/logos/opentelemetry-icon-color.png + https://OpenTelemetry.io + Tracing;OpenTelemetry;Management;Monitoring;Jaeger;distributed-tracing - + + diff --git a/lib/Thrift/Transports/Client/THttpClientTransport.cs b/lib/Thrift/Transports/Client/THttpClientTransport.cs index f0e693d3d..8bd84c70d 100644 --- a/lib/Thrift/Transports/Client/THttpClientTransport.cs +++ b/lib/Thrift/Transports/Client/THttpClientTransport.cs @@ -112,7 +112,7 @@ namespace Thrift.Transports.Client try { - var ret = await _inputStream.ReadAsync(buffer, offset, length, cancellationToken); + var ret = await _inputStream.ReadAsync(buffer, offset, length, cancellationToken).ConfigureAwait(false); if (ret == -1) { @@ -134,12 +134,16 @@ namespace Thrift.Transports.Client await Task.FromCanceled(cancellationToken); } - await _outputStream.WriteAsync(buffer, offset, length, cancellationToken); + await _outputStream.WriteAsync(buffer, offset, length, cancellationToken).ConfigureAwait(false); } private HttpClient CreateClient() { +#if NET46 + var handler = new WebRequestHandler(); +#else var handler = new HttpClientHandler(); +#endif if (_certificates.Length > 0) { handler.ClientCertificates.AddRange(_certificates); diff --git a/lib/Thrift/Transports/Client/TMemoryBufferClientTransport.cs b/lib/Thrift/Transports/Client/TMemoryBufferClientTransport.cs index 46a55a64a..be55e4209 100644 --- a/lib/Thrift/Transports/Client/TMemoryBufferClientTransport.cs +++ b/lib/Thrift/Transports/Client/TMemoryBufferClientTransport.cs @@ -1,4 +1,4 @@ -// Licensed to the Apache Software Foundation(ASF) under one +// Licensed to the Apache Software Foundation(ASF) under one // or more contributor license agreements.See the NOTICE file // distributed with this work for additional information // regarding copyright ownership.The ASF licenses this file @@ -49,7 +49,7 @@ namespace Thrift.Transports.Client public override void Close() { - /** do nothing **/ + // do nothing } public override async Task ReadAsync(byte[] buffer, int offset, int length, @@ -94,4 +94,4 @@ namespace Thrift.Transports.Client _isDisposed = true; } } -} \ No newline at end of file +} diff --git a/lib/Thrift/Transports/TTransportFactory.cs b/lib/Thrift/Transports/TTransportFactory.cs index 26c3cc471..d505f45d4 100644 --- a/lib/Thrift/Transports/TTransportFactory.cs +++ b/lib/Thrift/Transports/TTransportFactory.cs @@ -1,4 +1,4 @@ -// Licensed to the Apache Software Foundation(ASF) under one +// Licensed to the Apache Software Foundation(ASF) under one // or more contributor license agreements.See the NOTICE file // distributed with this work for additional information // regarding copyright ownership.The ASF licenses this file @@ -18,11 +18,11 @@ namespace Thrift.Transports { /// - /// From Mark Slee & Aditya Agarwal of Facebook: + /// From Mark Slee & Aditya Agarwal of Facebook: /// Factory class used to create wrapped instance of Transports. /// This is used primarily in servers, which get Transports from /// a ServerTransport and then may want to mutate them (i.e. create - /// a BufferedTransport from the underlying base transport) + /// a BufferedTransport from the underlying base transport). /// // ReSharper disable once InconsistentNaming public class TTransportFactory @@ -32,4 +32,4 @@ namespace Thrift.Transports return trans; } } -} \ No newline at end of file +} diff --git a/samples/Exporters/Program.cs b/samples/Exporters/Program.cs index 73c3e4d03..1b7fb7b7d 100644 --- a/samples/Exporters/Program.cs +++ b/samples/Exporters/Program.cs @@ -35,8 +35,9 @@ namespace Samples /// Arguments from command line. public static void Main(string[] args) { - Parser.Default.ParseArguments(args) + Parser.Default.ParseArguments(args) .MapResult( + (JaegerOptions options) => TestJaeger.Run(options.Host, options.Port), (ZipkinOptions options) => TestZipkin.Run(options.Uri), (ApplicationInsightsOptions options) => TestApplicationInsights.Run(), (PrometheusOptions options) => TestPrometheus.Run(), @@ -58,7 +59,7 @@ namespace Samples } [Verb("jaeger", HelpText = "Specify the options required to test Jaeger exporter")] - class JaegerOptions + internal class JaegerOptions { [Option('h', "host", HelpText = "Please specify the host of the Jaeger Agent", Required = true)] public string Host { get; set; } diff --git a/samples/Exporters/TestJaeger.cs b/samples/Exporters/TestJaeger.cs index 101a80963..6b1e8f8d9 100644 --- a/samples/Exporters/TestJaeger.cs +++ b/samples/Exporters/TestJaeger.cs @@ -53,7 +53,7 @@ namespace Samples var tracer = Tracing.Tracer; // 4. Create a scoped span. It will end automatically when using statement ends - using (var scope = tracer.SpanBuilder("Main").StartScopedSpan()) + using (tracer.WithSpan(tracer.SpanBuilder("Main").StartSpan())) { tracer.CurrentSpan.SetAttribute("custom-attribute", 55); Console.WriteLine("About to do a busy work"); @@ -77,7 +77,7 @@ namespace Samples // 7. Start another span. If another span was already started, it'll use that span as the parent span. // In this example, the main method already started a span, so that'll be the parent span, and this will be // a child span. - using (var scope = tracer.SpanBuilder("DoWork").StartScopedSpan()) + using (tracer.WithSpan(tracer.SpanBuilder("DoWork").StartSpan())) { // Simulate some work. var span = tracer.CurrentSpan; diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 347a97078..e477c8e0e 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -2,9 +2,9 @@ - + \ No newline at end of file diff --git a/src/OpenTelemetry.Exporter.Jaeger/Implimentation/JaegerSpanRef.cs b/src/OpenTelemetry.Exporter.Jaeger/Implimentation/JaegerSpanRef.cs index 0cefc9aef..f14f341e8 100644 --- a/src/OpenTelemetry.Exporter.Jaeger/Implimentation/JaegerSpanRef.cs +++ b/src/OpenTelemetry.Exporter.Jaeger/Implimentation/JaegerSpanRef.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2018, OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -98,9 +98,9 @@ namespace OpenTelemetry.Exporter.Jaeger.Implimentation } /// - /// + /// /// - /// A string representation of the object + /// A string representation of the object. public override string ToString() { var sb = new StringBuilder("SpanRef("); diff --git a/src/OpenTelemetry.Exporter.Jaeger/Implimentation/JaegerSpanRefType.cs b/src/OpenTelemetry.Exporter.Jaeger/Implimentation/JaegerSpanRefType.cs index e5c8db52b..85e7d733d 100644 --- a/src/OpenTelemetry.Exporter.Jaeger/Implimentation/JaegerSpanRefType.cs +++ b/src/OpenTelemetry.Exporter.Jaeger/Implimentation/JaegerSpanRefType.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2018, OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,7 +19,7 @@ namespace OpenTelemetry.Exporter.Jaeger.Implimentation using System; /// - /// Represents the different types of Jaeger Spans + /// Represents the different types of Jaeger Spans. /// public enum JaegerSpanRefType { diff --git a/src/OpenTelemetry.Exporter.Jaeger/Implimentation/JaegerTagType.cs b/src/OpenTelemetry.Exporter.Jaeger/Implimentation/JaegerTagType.cs index 1e3df53a0..aa6fdbae1 100644 --- a/src/OpenTelemetry.Exporter.Jaeger/Implimentation/JaegerTagType.cs +++ b/src/OpenTelemetry.Exporter.Jaeger/Implimentation/JaegerTagType.cs @@ -1,4 +1,4 @@ -// +// // Copyright 2018, OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,7 +19,7 @@ namespace OpenTelemetry.Exporter.Jaeger.Implimentation using System; /// - /// Indicates the data type of a Jaeger tag + /// Indicates the data type of a Jaeger tag. /// public enum JaegerTagType { diff --git a/src/OpenTelemetry.Exporter.Jaeger/OpenTelemetry.Exporter.Jaeger.csproj b/src/OpenTelemetry.Exporter.Jaeger/OpenTelemetry.Exporter.Jaeger.csproj index b4c6b86c5..879d34105 100644 --- a/src/OpenTelemetry.Exporter.Jaeger/OpenTelemetry.Exporter.Jaeger.csproj +++ b/src/OpenTelemetry.Exporter.Jaeger/OpenTelemetry.Exporter.Jaeger.csproj @@ -1,4 +1,4 @@ - + net46;netstandard2.0