diff --git a/src/BlazorPong.Backend.Defaults/BlazorPong.Backend.Defaults.csproj b/src/BlazorPong.Backend.Defaults/BlazorPong.Backend.Defaults.csproj index 955d133..07b64f4 100644 --- a/src/BlazorPong.Backend.Defaults/BlazorPong.Backend.Defaults.csproj +++ b/src/BlazorPong.Backend.Defaults/BlazorPong.Backend.Defaults.csproj @@ -7,12 +7,15 @@ + + + diff --git a/src/BlazorPong.Backend.Defaults/StartupExtensions.cs b/src/BlazorPong.Backend.Defaults/StartupExtensions.cs index 885581e..9e089c7 100644 --- a/src/BlazorPong.Backend.Defaults/StartupExtensions.cs +++ b/src/BlazorPong.Backend.Defaults/StartupExtensions.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Builder; +using AspNetCore.SignalR.OpenTelemetry; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Diagnostics.HealthChecks; @@ -29,31 +30,29 @@ public static IHostApplicationBuilder ConfigureOpenTelemetry(this IHostApplicati logging.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService(builder.Environment.ApplicationName)); logging.IncludeFormattedMessage = true; logging.IncludeScopes = true; - //logging.AddConsoleExporter(); }); builder.Services.AddOpenTelemetry() .WithMetrics(metrics => { metrics.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService(builder.Environment.ApplicationName)); - metrics.AddRuntimeInstrumentation() - .AddBuiltInMeters(); - //metrics.AddConsoleExporter(); + metrics.AddAspNetCoreInstrumentation() + .AddHttpClientInstrumentation() + .AddRuntimeInstrumentation() + .AddProcessInstrumentation(); }) .WithTracing(tracing => { tracing.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService(builder.Environment.ApplicationName)); if (builder.Environment.IsDevelopment()) { - // We want to view all traces in development tracing.SetSampler(new AlwaysOnSampler()); } tracing.AddAspNetCoreInstrumentation() + .AddSignalRInstrumentation() .AddGrpcClientInstrumentation() .AddHttpClientInstrumentation(); - - //tracing.AddConsoleExporter(); }); builder.AddOpenTelemetryExporters(); diff --git a/src/BlazorPong.SignalR/BlazorPong.SignalR.csproj b/src/BlazorPong.SignalR/BlazorPong.SignalR.csproj index 514f1b9..a76845f 100644 --- a/src/BlazorPong.SignalR/BlazorPong.SignalR.csproj +++ b/src/BlazorPong.SignalR/BlazorPong.SignalR.csproj @@ -9,6 +9,8 @@ + + diff --git a/src/BlazorPong.SignalR/WebApplicationBuilderExtensions.cs b/src/BlazorPong.SignalR/WebApplicationBuilderExtensions.cs index 131afef..28a42fb 100644 --- a/src/BlazorPong.SignalR/WebApplicationBuilderExtensions.cs +++ b/src/BlazorPong.SignalR/WebApplicationBuilderExtensions.cs @@ -1,4 +1,5 @@ -using BlazorPong.SignalR.Cache; +using AspNetCore.SignalR.OpenTelemetry; +using BlazorPong.SignalR.Cache; using BlazorPong.SignalR.EFCore; using BlazorPong.SignalR.Rooms; using BlazorPong.SignalR.Rooms.Games; @@ -15,6 +16,7 @@ public static void AddRedis(this WebApplicationBuilder builder) { var redisCs = builder.Configuration.GetConnectionString("Redis") ?? throw new Exception("Redis CS is missing"); builder.Services.AddSignalR() + .AddHubInstrumentation() .AddStackExchangeRedis(redisCs, options => {