Skip to content

Commit

Permalink
add Hub instrumentation (#174)
Browse files Browse the repository at this point in the history
* add Hub instrumentation

* update csproj
  • Loading branch information
nenoNaninu authored Jan 22, 2024
1 parent 8858e4c commit 46def5a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 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="TypedSignalR.Client" Version="3.4.3" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.4.0" />
<PackageVersion Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.1" />
Expand Down
3 changes: 2 additions & 1 deletion sandbox/SignalR.Server/SignalR.Server.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<CopyRefAssembliesToPublishDirectory>false</CopyRefAssembliesToPublishDirectory>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AspNetCore.SignalR.OpenTelemetry" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" />
</ItemGroup>

Expand Down
9 changes: 3 additions & 6 deletions sandbox/SignalR.Server/Startup.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion tests/TypedSignalR.Client.Tests.Server/Program.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using AspNetCore.SignalR.OpenTelemetry;
using TypedSignalR.Client.Tests.Server.Hubs;
using TypedSignalR.Client.Tests.Server.Services;

Expand All @@ -6,7 +7,8 @@
// Add services to the container.

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

builder.Services.AddSingleton<IDataStore, DataStore>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@
<InternalsVisibleTo Include="TypedSignalR.Client.Tests" />
</ItemGroup>

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

</Project>

0 comments on commit 46def5a

Please sign in to comment.