Skip to content

Commit

Permalink
Fix redis tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
SapiensAnatis committed Oct 24, 2024
1 parent 58922aa commit d28dadc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions DragaliaAPI/DragaliaAPI/DragaliaAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<PackageReference Include="OpenTelemetry.Instrumentation.Http" />
<PackageReference Include="OpenTelemetry.Instrumentation.Process" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" />
<PackageReference Include="OpenTelemetry.Instrumentation.StackExchangeRedis" />
<PackageReference Include="Riok.Mapperly" />
<PackageReference Include="Serilog.Exceptions" />
<PackageReference Include="Serilog.Expressions" />
Expand Down
8 changes: 7 additions & 1 deletion DragaliaAPI/DragaliaAPI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
using Microsoft.FeatureManagement;
using Microsoft.JSInterop;
using Serilog;
using StackExchange.Redis;

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);

Expand Down Expand Up @@ -70,9 +71,14 @@

builder.Services.ConfigureDatabaseServices(builder.Configuration);

IConnectionMultiplexer multiplexer = ConnectionMultiplexer.Connect(

Check failure on line 74 in DragaliaAPI/DragaliaAPI/Program.cs

View workflow job for this annotation

GitHub Actions / Test DragaliaAPI report

DragaliaAPI.Integration.Test.Dragalia.AbilityCrestTest ► BuildupPiece_DoesNotMutateGlobalProperty

Failed test found in: DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx DragaliaAPI.Integration.Test.trx Error: System.InvalidOperationException : Missing redis connection string!
Raw output
System.InvalidOperationException : Missing redis connection string!
   at Program.<Main>$(String[] args) in /home/runner/work/Dawnshard/Dawnshard/DragaliaAPI/DragaliaAPI/Program.cs:line 74
   at Program.<Main>(String[] args)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
--- End of stack trace from previous location ---
   at Microsoft.Extensions.Hosting.HostFactoryResolver.HostingListener.CreateHost()
   at Microsoft.Extensions.Hosting.HostFactoryResolver.<>c__DisplayClass10_0.<ResolveHostFactory>b__0(String[] args)
   at Microsoft.AspNetCore.Mvc.Testing.DeferredHostBuilder.Build()
   at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory`1.CreateHost(IHostBuilder builder)
   at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory`1.ConfigureHostBuilder(IHostBuilder hostBuilder)
   at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory`1.EnsureServer()
   at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory`1.get_Services()
   at DragaliaAPI.Integration.Test.CustomWebApplicationFactory.InitializeAsync() in /home/runner/work/Dawnshard/Dawnshard/DragaliaAPI/DragaliaAPI.Integration.Test/CustomWebApplicationFactory.cs:line 46
builder.Configuration.GetConnectionString("redis")
?? throw new InvalidOperationException("Missing redis connection string!")
);
builder.Services.AddSingleton(multiplexer);
builder.Services.AddStackExchangeRedisCache(options =>
{
options.Configuration = builder.Configuration.GetConnectionString("redis");
options.ConnectionMultiplexerFactory = () => Task.FromResult(multiplexer);
options.InstanceName = "RedisInstance";
});

Expand Down
10 changes: 5 additions & 5 deletions DragaliaAPI/DragaliaAPI/ServiceConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,11 @@ public static WebApplicationBuilder ConfigureObservability(this WebApplicationBu
cfg.AddService(serviceName: "dragalia-api", autoGenerateServiceInstanceId: false);
})
.WithTracing(tracing =>
tracing.AddEntityFrameworkCoreInstrumentation(options =>
options.SetDbStatementForText = true
)
// Not compatible with IDistributedCache as requires IConnectionMultiplexer
// .AddRedisInstrumentation()
tracing
.AddEntityFrameworkCoreInstrumentation(options =>
options.SetDbStatementForText = true
)
.AddRedisInstrumentation()
);

return builder;
Expand Down

0 comments on commit d28dadc

Please sign in to comment.