chore: some adjustments to tracing
All checks were successful
Build, Package and Push Images / preprocess (push) Successful in 2s
Build, Package and Push Images / build (push) Successful in 30s
Build, Package and Push Images / sbom-scan (push) Successful in 41s
Build, Package and Push Images / container-build (push) Successful in 1m31s
Build, Package and Push Images / sonarqube (push) Successful in 1m33s
Build, Package and Push Images / container-sbom-scan (push) Successful in 32s

This commit is contained in:
Timothy Schenk 2023-11-22 06:28:01 +01:00
parent b3a8aee1f7
commit d15b1f8045

View file

@ -24,6 +24,8 @@ var builder = Host.CreateApplicationBuilder();
builder.Environment.EnvironmentName = "Development"; builder.Environment.EnvironmentName = "Development";
#endif #endif
builder.Services.AddMetrics();
builder.Configuration.AddJsonFile("settings.json", true, true) builder.Configuration.AddJsonFile("settings.json", true, true)
.AddJsonFile($"settings.{builder.Environment.EnvironmentName}.json", true) .AddJsonFile($"settings.{builder.Environment.EnvironmentName}.json", true)
.AddEnvironmentVariables().Build(); .AddEnvironmentVariables().Build();
@ -47,16 +49,13 @@ if (configuration.GetValue<bool>("Tracing:Enabled"))
.WithTracing(tracing => .WithTracing(tracing =>
{ {
tracing.AddSource(nameof(Server)); tracing.AddSource(nameof(Server));
tracing.SetSampler(new AlwaysOnSampler()); //tracing.AddSource("MassTransit");
tracing.AddMassTransitInstrumentation();
tracing.AddEntityFrameworkCoreInstrumentation(options => options.SetDbStatementForText = true); tracing.AddEntityFrameworkCoreInstrumentation(options => options.SetDbStatementForText = true);
tracing.AddHttpClientInstrumentation();
tracing.AddNpgsql(); tracing.AddNpgsql();
}) })
.WithMetrics(metrics => .WithMetrics(metrics =>
{ {
metrics.AddRuntimeInstrumentation(); metrics.AddRuntimeInstrumentation();
metrics.AddHttpClientInstrumentation();
}); });
builder.Logging.AddOpenTelemetry(logging => builder.Logging.AddOpenTelemetry(logging =>