Skip to content

Commit

Permalink
Merge pull request #165 from nenoNaninu/instrumentation
Browse files Browse the repository at this point in the history
add Hub instrumentation
  • Loading branch information
nenoNaninu authored Jan 22, 2024
2 parents 5b541d5 + b8be865 commit 8a270ad
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="AspNetCore.SignalR.OpenTelemetry" Version="0.1.4" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.4.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.4.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.4.0" />
Expand Down
4 changes: 3 additions & 1 deletion samples/SampleServer/Program.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using AspNetCore.SignalR.OpenTelemetry;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using SampleServer.Hub;
Expand All @@ -8,7 +9,8 @@
// Add services to the container.

builder.Services.AddControllers();
builder.Services.AddSignalR();
builder.Services.AddSignalR()
.AddHubInstrumentation();

var app = builder.Build();

Expand Down
1 change: 1 addition & 0 deletions samples/SampleServer/SampleServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AspNetCore.SignalR.OpenTelemetry" />
<PackageReference Include="TypedSignalR.Client.DevTools" />
</ItemGroup>

Expand Down
6 changes: 6 additions & 0 deletions tests/TypedSignalR.Client.TypeScript.Tests.Server/Program.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#if NET8_0_OR_GREATER
using AspNetCore.SignalR.OpenTelemetry;
#endif
using MessagePack;
using MessagePack.Resolvers;
using Microsoft.AspNetCore.HttpLogging;
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
Expand All @@ -19,4 +19,8 @@
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.Json" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="AspNetCore.SignalR.OpenTelemetry" />
</ItemGroup>

</Project>

0 comments on commit 8a270ad

Please sign in to comment.