From b8be865da704f136e4471ce10c7c899d3a08aa97 Mon Sep 17 00:00:00 2001 From: nenoNaninu Date: Tue, 23 Jan 2024 03:00:08 +0900 Subject: [PATCH] add Hub instrumentation --- Directory.Packages.props | 1 + samples/SampleServer/Program.cs | 4 +++- samples/SampleServer/SampleServer.csproj | 1 + .../TypedSignalR.Client.TypeScript.Tests.Server/Program.cs | 6 ++++++ .../TypedSignalR.Client.TypeScript.Tests.Server.csproj | 6 +++++- 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 6bc1aea..708194c 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,6 +5,7 @@ true + diff --git a/samples/SampleServer/Program.cs b/samples/SampleServer/Program.cs index b4fbd1c..ee5a87f 100644 --- a/samples/SampleServer/Program.cs +++ b/samples/SampleServer/Program.cs @@ -1,3 +1,4 @@ +using AspNetCore.SignalR.OpenTelemetry; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using SampleServer.Hub; @@ -8,7 +9,8 @@ // Add services to the container. builder.Services.AddControllers(); -builder.Services.AddSignalR(); +builder.Services.AddSignalR() + .AddHubInstrumentation(); var app = builder.Build(); diff --git a/samples/SampleServer/SampleServer.csproj b/samples/SampleServer/SampleServer.csproj index 8eeccb2..54f0cba 100644 --- a/samples/SampleServer/SampleServer.csproj +++ b/samples/SampleServer/SampleServer.csproj @@ -6,6 +6,7 @@ + diff --git a/tests/TypedSignalR.Client.TypeScript.Tests.Server/Program.cs b/tests/TypedSignalR.Client.TypeScript.Tests.Server/Program.cs index f83949d..a9583b7 100644 --- a/tests/TypedSignalR.Client.TypeScript.Tests.Server/Program.cs +++ b/tests/TypedSignalR.Client.TypeScript.Tests.Server/Program.cs @@ -1,3 +1,6 @@ +#if NET8_0_OR_GREATER +using AspNetCore.SignalR.OpenTelemetry; +#endif using MessagePack; using MessagePack.Resolvers; using Microsoft.AspNetCore.HttpLogging; @@ -10,6 +13,9 @@ builder.Services.AddControllers(); builder.Services.AddSignalR() +#if NET8_0_OR_GREATER + .AddHubInstrumentation() +#endif .AddJsonProtocol() // dotnet tsrts --project path/to/Project.csproj --output generated --serializer MessagePack --naming-style none --enum name // .AddMessagePackProtocol(); // default diff --git a/tests/TypedSignalR.Client.TypeScript.Tests.Server/TypedSignalR.Client.TypeScript.Tests.Server.csproj b/tests/TypedSignalR.Client.TypeScript.Tests.Server/TypedSignalR.Client.TypeScript.Tests.Server.csproj index fe9e27d..9159f01 100644 --- a/tests/TypedSignalR.Client.TypeScript.Tests.Server/TypedSignalR.Client.TypeScript.Tests.Server.csproj +++ b/tests/TypedSignalR.Client.TypeScript.Tests.Server/TypedSignalR.Client.TypeScript.Tests.Server.csproj @@ -1,4 +1,4 @@ - + net7.0;net8.0 @@ -19,4 +19,8 @@ + + + +