From 46def5a1d7aa6e9a5019aae4122acc877cfd926c Mon Sep 17 00:00:00 2001 From: nenoNaninu Date: Tue, 23 Jan 2024 02:50:39 +0900 Subject: [PATCH] add Hub instrumentation (#174) * add Hub instrumentation * update csproj --- Directory.Packages.props | 1 + sandbox/SignalR.Server/SignalR.Server.csproj | 3 ++- sandbox/SignalR.Server/Startup.cs | 9 +++------ tests/TypedSignalR.Client.Tests.Server/Program.cs | 4 +++- .../TypedSignalR.Client.Tests.Server.csproj | 4 ++++ 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index aa04d23..fce061d 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,6 +5,7 @@ true + diff --git a/sandbox/SignalR.Server/SignalR.Server.csproj b/sandbox/SignalR.Server/SignalR.Server.csproj index 6ada174..6098417 100644 --- a/sandbox/SignalR.Server/SignalR.Server.csproj +++ b/sandbox/SignalR.Server/SignalR.Server.csproj @@ -1,4 +1,4 @@ - + net8.0 @@ -6,6 +6,7 @@ + diff --git a/sandbox/SignalR.Server/Startup.cs b/sandbox/SignalR.Server/Startup.cs index f5f75ff..8dca94a 100644 --- a/sandbox/SignalR.Server/Startup.cs +++ b/sandbox/SignalR.Server/Startup.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +using AspNetCore.SignalR.OpenTelemetry; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -25,7 +21,8 @@ public Startup(IConfiguration configuration) public void ConfigureServices(IServiceCollection services) { services.AddControllersWithViews(); - services.AddSignalR(); + services.AddSignalR() + .AddHubInstrumentation(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. diff --git a/tests/TypedSignalR.Client.Tests.Server/Program.cs b/tests/TypedSignalR.Client.Tests.Server/Program.cs index 49192c7..3c81132 100644 --- a/tests/TypedSignalR.Client.Tests.Server/Program.cs +++ b/tests/TypedSignalR.Client.Tests.Server/Program.cs @@ -1,3 +1,4 @@ +using AspNetCore.SignalR.OpenTelemetry; using TypedSignalR.Client.Tests.Server.Hubs; using TypedSignalR.Client.Tests.Server.Services; @@ -6,7 +7,8 @@ // Add services to the container. builder.Services.AddControllers(); -builder.Services.AddSignalR(); +builder.Services.AddSignalR() + .AddHubInstrumentation(); builder.Services.AddSingleton(); diff --git a/tests/TypedSignalR.Client.Tests.Server/TypedSignalR.Client.Tests.Server.csproj b/tests/TypedSignalR.Client.Tests.Server/TypedSignalR.Client.Tests.Server.csproj index ed3edb5..113bc71 100644 --- a/tests/TypedSignalR.Client.Tests.Server/TypedSignalR.Client.Tests.Server.csproj +++ b/tests/TypedSignalR.Client.Tests.Server/TypedSignalR.Client.Tests.Server.csproj @@ -14,4 +14,8 @@ + + + +