From afbc2343310219271390e5f255903186e4f46bca Mon Sep 17 00:00:00 2001 From: Steve Gordon Date: Mon, 8 Apr 2024 10:47:07 +0100 Subject: [PATCH] Update dependencies (#82) --- Directory.Build.props | 3 ++- dotnet-tools.json | 2 +- .../Example.AspNetCore.Mvc.csproj | 4 ++-- .../Example.AspNetCore.Mvc/appsettings.json | 2 +- .../Example.Console/Example.Console.csproj | 4 ++-- .../Example.MinimalApi.csproj | 3 ++- examples/Example.MinimalApi/Program.cs | 9 +++++++-- .../Example.WorkerService.csproj | 3 ++- .../ServiceDefaults/ServiceDefaults.csproj | 20 +++++++++---------- src/Directory.Build.props | 6 +++--- .../Elastic.OpenTelemetry.csproj | 18 ++++++++--------- .../ElasticOpenTelemetryBuilder.cs | 13 ++++-------- tests/Directory.Build.props | 10 +++++----- ...Elastic.OpenTelemetry.EndToEndTests.csproj | 10 +++++----- .../Elastic.OpenTelemetry.Tests.csproj | 2 +- 15 files changed, 56 insertions(+), 53 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index c2b84ab..ad8531d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -20,7 +20,8 @@ $(MSBuildThisFileDirectory).artifacts 002400000480000094000000060200000024000052534131000400000100010015b0fa59d868c7f3ea2ae67567b19e102465745f01b430a38a42b92fd41a0f5869bec1f2b33b589d78662af432fe6b789ef72d4738f7b1a86264d7aeb5185ed8995b2bb104e7c5c58845f1a618be829e410fa34a6bd7d714ece191ed68a66333a83ae7456ee32e9aeb54bc1d7410ae8c344367257e9001abb5e96ce1f1d97696 + - + \ No newline at end of file diff --git a/dotnet-tools.json b/dotnet-tools.json index 602fd8b..1eb8d6b 100644 --- a/dotnet-tools.json +++ b/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "minver-cli": { - "version": "4.3.0", + "version": "5.0.0", "commands": [ "minver" ] diff --git a/examples/Example.AspNetCore.Mvc/Example.AspNetCore.Mvc.csproj b/examples/Example.AspNetCore.Mvc/Example.AspNetCore.Mvc.csproj index 5cf4a00..63e286c 100644 --- a/examples/Example.AspNetCore.Mvc/Example.AspNetCore.Mvc.csproj +++ b/examples/Example.AspNetCore.Mvc/Example.AspNetCore.Mvc.csproj @@ -12,7 +12,7 @@ - + - + diff --git a/examples/Example.AspNetCore.Mvc/appsettings.json b/examples/Example.AspNetCore.Mvc/appsettings.json index 3f00133..5033b13 100644 --- a/examples/Example.AspNetCore.Mvc/appsettings.json +++ b/examples/Example.AspNetCore.Mvc/appsettings.json @@ -3,7 +3,7 @@ "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning", - "Elastic.OpenTelemetry": "Trace" + "Elastic.OpenTelemetry": "Information" }, "OpenTelemetry": { "IncludeFormattedMessage": true, diff --git a/examples/Example.Console/Example.Console.csproj b/examples/Example.Console/Example.Console.csproj index d851645..aa6eda1 100644 --- a/examples/Example.Console/Example.Console.csproj +++ b/examples/Example.Console/Example.Console.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/examples/Example.MinimalApi/Example.MinimalApi.csproj b/examples/Example.MinimalApi/Example.MinimalApi.csproj index 1faf6d8..1ca4a79 100644 --- a/examples/Example.MinimalApi/Example.MinimalApi.csproj +++ b/examples/Example.MinimalApi/Example.MinimalApi.csproj @@ -12,6 +12,7 @@ - + + diff --git a/examples/Example.MinimalApi/Program.cs b/examples/Example.MinimalApi/Program.cs index fdb9f79..5ddc273 100644 --- a/examples/Example.MinimalApi/Program.cs +++ b/examples/Example.MinimalApi/Program.cs @@ -19,7 +19,8 @@ app.UseHttpsRedirection(); -app.MapGet("/", (IHttpClientFactory httpClientFactory) => Api.HandleRoot(httpClientFactory)); +app.MapGet("/", (IHttpClientFactory httpClientFactory, ILoggerFactory loggerFactory) => + Api.HandleRoot(httpClientFactory, loggerFactory)); app.Run(); @@ -30,8 +31,12 @@ internal static class Api public static string ActivitySourceName = "CustomActivitySource"; private static readonly ActivitySource ActivitySource = new(ActivitySourceName); - public static async Task HandleRoot(IHttpClientFactory httpClientFactory) + public static async Task HandleRoot(IHttpClientFactory httpClientFactory, ILoggerFactory loggerFactory) { + var logger = loggerFactory.CreateLogger("Example.Api"); + + logger.LogInformation("Doing stuff"); + using var client = httpClientFactory.CreateClient(); using var activity = ActivitySource.StartActivity("DoingStuff", ActivityKind.Internal); diff --git a/examples/Example.WorkerService/Example.WorkerService.csproj b/examples/Example.WorkerService/Example.WorkerService.csproj index 0430a31..0c8b03d 100644 --- a/examples/Example.WorkerService/Example.WorkerService.csproj +++ b/examples/Example.WorkerService/Example.WorkerService.csproj @@ -9,10 +9,11 @@ - + + diff --git a/examples/ServiceDefaults/ServiceDefaults.csproj b/examples/ServiceDefaults/ServiceDefaults.csproj index 839e392..12c8044 100644 --- a/examples/ServiceDefaults/ServiceDefaults.csproj +++ b/examples/ServiceDefaults/ServiceDefaults.csproj @@ -8,17 +8,17 @@ - + - - - - - - - - - + + + + + + + + + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 324cd27..951c886 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -27,10 +27,10 @@ nuget-icon.png - - - + + + diff --git a/src/Elastic.OpenTelemetry/Elastic.OpenTelemetry.csproj b/src/Elastic.OpenTelemetry/Elastic.OpenTelemetry.csproj index 0fcb0cf..06dc832 100644 --- a/src/Elastic.OpenTelemetry/Elastic.OpenTelemetry.csproj +++ b/src/Elastic.OpenTelemetry/Elastic.OpenTelemetry.csproj @@ -18,16 +18,16 @@ - - + + - - - - - - - + + + + + + + diff --git a/src/Elastic.OpenTelemetry/ElasticOpenTelemetryBuilder.cs b/src/Elastic.OpenTelemetry/ElasticOpenTelemetryBuilder.cs index 5d45ff2..151ee8f 100644 --- a/src/Elastic.OpenTelemetry/ElasticOpenTelemetryBuilder.cs +++ b/src/Elastic.OpenTelemetry/ElasticOpenTelemetryBuilder.cs @@ -3,6 +3,9 @@ // See the LICENSE file in the project root for more information using System.Diagnostics; +using System.Linq.Expressions; +using System.Reflection; +using System.Runtime.InteropServices; using Elastic.OpenTelemetry.Diagnostics; using Elastic.OpenTelemetry.Diagnostics.Logging; using Elastic.OpenTelemetry.Extensions; @@ -88,15 +91,9 @@ public ElasticOpenTelemetryBuilder(ElasticOpenTelemetryOptions options) }); openTelemetry - .WithLogging(logging => - { - logging.ConfigureResource(r => r.AddDistroAttributes()); - }) - + .ConfigureResource(r => r.AddDistroAttributes()) .WithTracing(tracing => { - tracing.ConfigureResource(r => r.AddDistroAttributes()); - tracing .AddHttpClientInstrumentation() .AddGrpcClientInstrumentation() @@ -108,8 +105,6 @@ public ElasticOpenTelemetryBuilder(ElasticOpenTelemetryOptions options) }) .WithMetrics(metrics => { - metrics.ConfigureResource(r => r.AddDistroAttributes()); - metrics .AddProcessInstrumentation() .AddRuntimeInstrumentation() diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 5d1eeb0..eda0b0a 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -22,17 +22,17 @@ - + - + - + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Elastic.OpenTelemetry.EndToEndTests/Elastic.OpenTelemetry.EndToEndTests.csproj b/tests/Elastic.OpenTelemetry.EndToEndTests/Elastic.OpenTelemetry.EndToEndTests.csproj index 644d8c1..e78b0c3 100644 --- a/tests/Elastic.OpenTelemetry.EndToEndTests/Elastic.OpenTelemetry.EndToEndTests.csproj +++ b/tests/Elastic.OpenTelemetry.EndToEndTests/Elastic.OpenTelemetry.EndToEndTests.csproj @@ -11,12 +11,12 @@ - + - - - - + + + + diff --git a/tests/Elastic.OpenTelemetry.Tests/Elastic.OpenTelemetry.Tests.csproj b/tests/Elastic.OpenTelemetry.Tests/Elastic.OpenTelemetry.Tests.csproj index 884a617..b2d9443 100644 --- a/tests/Elastic.OpenTelemetry.Tests/Elastic.OpenTelemetry.Tests.csproj +++ b/tests/Elastic.OpenTelemetry.Tests/Elastic.OpenTelemetry.Tests.csproj @@ -11,7 +11,7 @@ - +