From f9602e2d43436f1912062ec68ffbd7db321c40b8 Mon Sep 17 00:00:00 2001 From: Cijo Thomas Date: Fri, 22 Apr 2022 13:42:22 -0700 Subject: [PATCH] Cleanup .NET 5.0 (#3227) * Cleanup net5.0 apps and readme * api doc --- OpenTelemetry.sln | 7 -- README.md | 4 +- src/OpenTelemetry.Api/README.md | 6 +- src/OpenTelemetry.Exporter.Jaeger/README.md | 7 -- test/TestApp.AspNetCore.5.0/AssemblyInfo.cs | 24 ------- .../CallbackMiddleware.cs | 49 ------------- .../Controllers/ChildActivityController.cs | 46 ------------ .../Controllers/ForwardController.cs | 72 ------------------- .../Controllers/ValuesController.cs | 56 --------------- test/TestApp.AspNetCore.5.0/Program.cs | 33 --------- test/TestApp.AspNetCore.5.0/Startup.cs | 63 ---------------- .../TestApp.AspNetCore.5.0.csproj | 25 ------- .../appsettings.Development.json | 10 --- test/TestApp.AspNetCore.5.0/appsettings.json | 15 ---- 14 files changed, 5 insertions(+), 412 deletions(-) delete mode 100644 test/TestApp.AspNetCore.5.0/AssemblyInfo.cs delete mode 100644 test/TestApp.AspNetCore.5.0/CallbackMiddleware.cs delete mode 100644 test/TestApp.AspNetCore.5.0/Controllers/ChildActivityController.cs delete mode 100644 test/TestApp.AspNetCore.5.0/Controllers/ForwardController.cs delete mode 100644 test/TestApp.AspNetCore.5.0/Controllers/ValuesController.cs delete mode 100644 test/TestApp.AspNetCore.5.0/Program.cs delete mode 100644 test/TestApp.AspNetCore.5.0/Startup.cs delete mode 100644 test/TestApp.AspNetCore.5.0/TestApp.AspNetCore.5.0.csproj delete mode 100644 test/TestApp.AspNetCore.5.0/appsettings.Development.json delete mode 100644 test/TestApp.AspNetCore.5.0/appsettings.json diff --git a/OpenTelemetry.sln b/OpenTelemetry.sln index d99b21e04..58879039f 100644 --- a/OpenTelemetry.sln +++ b/OpenTelemetry.sln @@ -192,8 +192,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.InMe EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "extending-the-sdk", "docs\logs\extending-the-sdk\extending-the-sdk.csproj", "{13C10C9A-07E8-43EB-91F5-C2B116FBE0FC}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApp.AspNetCore.5.0", "test\TestApp.AspNetCore.5.0\TestApp.AspNetCore.5.0.csproj", "{972396A8-E35B-499C-9BA1-765E9B8822E1}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "reporting-exceptions", "docs\trace\reporting-exceptions\reporting-exceptions.csproj", "{08D29501-F0A3-468F-B18D-BD1821A72383}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "customizing-the-sdk", "docs\trace\customizing-the-sdk\customizing-the-sdk.csproj", "{64E3D8BB-93AB-4571-93F7-ED8D64DFFD06}" @@ -406,10 +404,6 @@ Global {13C10C9A-07E8-43EB-91F5-C2B116FBE0FC}.Debug|Any CPU.Build.0 = Debug|Any CPU {13C10C9A-07E8-43EB-91F5-C2B116FBE0FC}.Release|Any CPU.ActiveCfg = Release|Any CPU {13C10C9A-07E8-43EB-91F5-C2B116FBE0FC}.Release|Any CPU.Build.0 = Release|Any CPU - {972396A8-E35B-499C-9BA1-765E9B8822E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {972396A8-E35B-499C-9BA1-765E9B8822E1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {972396A8-E35B-499C-9BA1-765E9B8822E1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {972396A8-E35B-499C-9BA1-765E9B8822E1}.Release|Any CPU.Build.0 = Release|Any CPU {08D29501-F0A3-468F-B18D-BD1821A72383}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {08D29501-F0A3-468F-B18D-BD1821A72383}.Debug|Any CPU.Build.0 = Debug|Any CPU {08D29501-F0A3-468F-B18D-BD1821A72383}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -505,7 +499,6 @@ Global {DB942F5A-D571-4DEA-B1A7-B6BE0E24E6ED} = {E359BB2B-9AEC-497D-B321-7DF2450C3B8E} {B3F03725-23A0-4582-9526-F6A7E38F35CC} = {3862190B-E2C5-418E-AFDC-DB281FB5C705} {13C10C9A-07E8-43EB-91F5-C2B116FBE0FC} = {3862190B-E2C5-418E-AFDC-DB281FB5C705} - {972396A8-E35B-499C-9BA1-765E9B8822E1} = {77C7929A-2EED-4AA6-8705-B5C443C8AA0F} {08D29501-F0A3-468F-B18D-BD1821A72383} = {5B7FB835-3FFF-4BC2-99C5-A5B5FAE3C818} {64E3D8BB-93AB-4571-93F7-ED8D64DFFD06} = {5B7FB835-3FFF-4BC2-99C5-A5B5FAE3C818} {E7F491CC-C37E-4A56-9CA7-8F77F59E0614} = {3277B1C0-BDFE-4460-9B0D-D9A661FB48DB} diff --git a/README.md b/README.md index 154288564..33059ef73 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ The .NET [OpenTelemetry](https://opentelemetry.io/) client. Packages shipped from this repository generally support all the officially supported versions of [.NET](https://dotnet.microsoft.com/download/dotnet) and [.NET Framework](https://dotnet.microsoft.com/download/dotnet-framework) (an -older Windows-based .NET implementation), except for versions lower than `.NET -Framework 4.6.1`. Any exceptions to this are noted in the individual `README.md` +older Windows-based .NET implementation), except `.NET Framework 3.5`. +Any exceptions to this are noted in the individual `README.md` files. ## Getting Started diff --git a/src/OpenTelemetry.Api/README.md b/src/OpenTelemetry.Api/README.md index bcf0ac0df..ab11fd6d7 100644 --- a/src/OpenTelemetry.Api/README.md +++ b/src/OpenTelemetry.Api/README.md @@ -467,9 +467,9 @@ runtime itself, as part of the package. This means, users can instrument their applications/libraries to emit metrics by simply using the `System.Diagnostics.DiagnosticSource` package. This package can be used in applications targeting any of the officially supported -versions of [.NET Core](https://dotnet.microsoft.com/download/dotnet-core), and -[.NET Framework](https://dotnet.microsoft.com/download/dotnet-framework) except -for versions lower than `.NET Framework 4.6.1`. +versions of [.NET](https://dotnet.microsoft.com/download/dotnet) and +[.NET Framework](https://dotnet.microsoft.com/download/dotnet-framework) (an +older Windows-based .NET implementation). ## Instrumenting a library/application with .NET Metrics API diff --git a/src/OpenTelemetry.Exporter.Jaeger/README.md b/src/OpenTelemetry.Exporter.Jaeger/README.md index a282f64bb..5849eac0a 100644 --- a/src/OpenTelemetry.Exporter.Jaeger/README.md +++ b/src/OpenTelemetry.Exporter.Jaeger/README.md @@ -9,13 +9,6 @@ following the [OpenTelemetry specification](https://github.com/open-telemetry/op The exporter communicates to a Jaeger Agent through the thrift protocol on the Compact Thrift API port, and as such only supports Thrift over UDP. -## Supported .NET Versions - -This package supports all the officially supported versions of [.NET -Core](https://dotnet.microsoft.com/download/dotnet-core). - -For .NET Framework, versions 4.6.1 and above are supported. - ## Prerequisite * [Get Jaeger](https://www.jaegertracing.io/docs/1.13/getting-started/) diff --git a/test/TestApp.AspNetCore.5.0/AssemblyInfo.cs b/test/TestApp.AspNetCore.5.0/AssemblyInfo.cs deleted file mode 100644 index 5672c4ca5..000000000 --- a/test/TestApp.AspNetCore.5.0/AssemblyInfo.cs +++ /dev/null @@ -1,24 +0,0 @@ -// -// 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. -// - -using System.Diagnostics.CodeAnalysis; - -[assembly: SuppressMessage( - "StyleCop.CSharp.NamingRules", - "SA1300", - Justification = "Reviewed.", - Scope = "namespaceanddescendants", - Target = "TestApp.AspNetCore._5._0")] diff --git a/test/TestApp.AspNetCore.5.0/CallbackMiddleware.cs b/test/TestApp.AspNetCore.5.0/CallbackMiddleware.cs deleted file mode 100644 index 50636cb9c..000000000 --- a/test/TestApp.AspNetCore.5.0/CallbackMiddleware.cs +++ /dev/null @@ -1,49 +0,0 @@ -// -// 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. -// - -using System.Threading.Tasks; -using Microsoft.AspNetCore.Http; - -namespace TestApp.AspNetCore._5._0 -{ - public class CallbackMiddleware - { - private readonly CallbackMiddlewareImpl impl; - private readonly RequestDelegate next; - - public CallbackMiddleware(RequestDelegate next, CallbackMiddlewareImpl impl) - { - this.next = next; - this.impl = impl; - } - - public async Task InvokeAsync(HttpContext context) - { - if (this.impl == null || await this.impl.ProcessAsync(context)) - { - await this.next(context); - } - } - - public class CallbackMiddlewareImpl - { - public virtual async Task ProcessAsync(HttpContext context) - { - return await Task.FromResult(true); - } - } - } -} diff --git a/test/TestApp.AspNetCore.5.0/Controllers/ChildActivityController.cs b/test/TestApp.AspNetCore.5.0/Controllers/ChildActivityController.cs deleted file mode 100644 index 39c556d77..000000000 --- a/test/TestApp.AspNetCore.5.0/Controllers/ChildActivityController.cs +++ /dev/null @@ -1,46 +0,0 @@ -// -// 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. -// - -using System.Collections.Generic; -using System.Diagnostics; -using Microsoft.AspNetCore.Mvc; -using OpenTelemetry; - -namespace TestApp.AspNetCore._5._0.Controllers -{ - public class ChildActivityController : Controller - { - [Route("api/GetChildActivityTraceContext")] - public Dictionary GetChildActivityTraceContext() - { - var result = new Dictionary(); - var activity = new Activity("ActivityInsideHttpRequest"); - activity.Start(); - result["TraceId"] = activity.Context.TraceId.ToString(); - result["ParentSpanId"] = activity.ParentSpanId.ToString(); - result["TraceState"] = activity.Context.TraceState; - activity.Stop(); - return result; - } - - [Route("api/GetChildActivityBaggageContext")] - public IReadOnlyDictionary GetChildActivityBaggageContext() - { - var result = Baggage.Current.GetBaggage(); - return result; - } - } -} diff --git a/test/TestApp.AspNetCore.5.0/Controllers/ForwardController.cs b/test/TestApp.AspNetCore.5.0/Controllers/ForwardController.cs deleted file mode 100644 index 24e9233e1..000000000 --- a/test/TestApp.AspNetCore.5.0/Controllers/ForwardController.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -// 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. -// - -using System.Net.Http; -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Newtonsoft.Json; - -namespace TestApp.AspNetCore._5._0.Controllers -{ - [Route("api/[controller]")] - public class ForwardController : Controller - { - private readonly HttpClient httpClient; - - public ForwardController(HttpClient httpClient) - { - this.httpClient = httpClient; - } - - // POST api/test - [HttpPost] - public async Task Post([FromBody] Data[] data) - { - var result = string.Empty; - - if (data != null) - { - foreach (var argument in data) - { - var request = new HttpRequestMessage(HttpMethod.Post, argument.Url) - { - Content = new StringContent( - JsonConvert.SerializeObject(argument.Arguments), - Encoding.UTF8, - "application/json"), - }; - await this.httpClient.SendAsync(request); - } - } - else - { - result = "done"; - } - - return result; - } - - public class Data - { - [JsonProperty("url")] - public string Url { get; set; } - - [JsonProperty("arguments")] - public Data[] Arguments { get; set; } - } - } -} diff --git a/test/TestApp.AspNetCore.5.0/Controllers/ValuesController.cs b/test/TestApp.AspNetCore.5.0/Controllers/ValuesController.cs deleted file mode 100644 index 15234c466..000000000 --- a/test/TestApp.AspNetCore.5.0/Controllers/ValuesController.cs +++ /dev/null @@ -1,56 +0,0 @@ -// -// 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. -// -using System.Collections.Generic; -using Microsoft.AspNetCore.Mvc; - -namespace TestApp.AspNetCore._5._0.Controllers -{ - [Route("api/[controller]")] - public class ValuesController : Controller - { - // GET api/values - [HttpGet] - public IEnumerable Get() - { - return new string[] { "value1", "value2" }; - } - - // GET api/values/5 - [HttpGet("{id}")] - public string Get(int id) - { - return "value"; - } - - // POST api/values - [HttpPost] - public void Post([FromBody] string value) - { - } - - // PUT api/values/5 - [HttpPut("{id}")] - public void Put(int id, [FromBody] string value) - { - } - - // DELETE api/values/5 - [HttpDelete("{id}")] - public void Delete(int id) - { - } - } -} diff --git a/test/TestApp.AspNetCore.5.0/Program.cs b/test/TestApp.AspNetCore.5.0/Program.cs deleted file mode 100644 index f9b9e7fde..000000000 --- a/test/TestApp.AspNetCore.5.0/Program.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// 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. -// - -using Microsoft.AspNetCore; -using Microsoft.AspNetCore.Hosting; - -namespace TestApp.AspNetCore._5._0 -{ - public class Program - { - public static void Main(string[] args) - { - CreateWebHostBuilder(args).Build().Run(); - } - - public static IWebHostBuilder CreateWebHostBuilder(string[] args) => - WebHost.CreateDefaultBuilder(args) - .UseStartup(); - } -} diff --git a/test/TestApp.AspNetCore.5.0/Startup.cs b/test/TestApp.AspNetCore.5.0/Startup.cs deleted file mode 100644 index f60f56c8c..000000000 --- a/test/TestApp.AspNetCore.5.0/Startup.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -// 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. -// - -using System.Net.Http; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - -namespace TestApp.AspNetCore._5._0 -{ - public class Startup - { - public Startup(IConfiguration configuration) - { - this.Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - // This method gets called by the runtime. Use this method to add services to the container. - public void ConfigureServices(IServiceCollection services) - { - services.AddMvc(); - services.AddSingleton(); - services.AddSingleton( - new CallbackMiddleware.CallbackMiddlewareImpl()); - } - - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - - app.UseMiddleware(); - app.UseRouting(); - - app.UseAuthorization(); - - app.UseEndpoints(endpoints => - { - endpoints.MapControllers(); - }); - } - } -} diff --git a/test/TestApp.AspNetCore.5.0/TestApp.AspNetCore.5.0.csproj b/test/TestApp.AspNetCore.5.0/TestApp.AspNetCore.5.0.csproj deleted file mode 100644 index 7df348f80..000000000 --- a/test/TestApp.AspNetCore.5.0/TestApp.AspNetCore.5.0.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - net5.0 - - - - - - - - - - - - - - - - - - - - - diff --git a/test/TestApp.AspNetCore.5.0/appsettings.Development.json b/test/TestApp.AspNetCore.5.0/appsettings.Development.json deleted file mode 100644 index fa8ce71a9..000000000 --- a/test/TestApp.AspNetCore.5.0/appsettings.Development.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Logging": { - "IncludeScopes": false, - "LogLevel": { - "Default": "Debug", - "System": "Information", - "Microsoft": "Information" - } - } -} diff --git a/test/TestApp.AspNetCore.5.0/appsettings.json b/test/TestApp.AspNetCore.5.0/appsettings.json deleted file mode 100644 index 26bb0ac7a..000000000 --- a/test/TestApp.AspNetCore.5.0/appsettings.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "Logging": { - "IncludeScopes": false, - "Debug": { - "LogLevel": { - "Default": "Warning" - } - }, - "Console": { - "LogLevel": { - "Default": "Warning" - } - } - } -}