diff --git a/src/Serval.ApiServer/Serval.ApiServer.csproj b/src/Serval.ApiServer/Serval.ApiServer.csproj index 4179ede2..a401910a 100644 --- a/src/Serval.ApiServer/Serval.ApiServer.csproj +++ b/src/Serval.ApiServer/Serval.ApiServer.csproj @@ -21,6 +21,10 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/Serval.ApiServer/Startup.cs b/src/Serval.ApiServer/Startup.cs index 4218e4b5..6b86e760 100644 --- a/src/Serval.ApiServer/Startup.cs +++ b/src/Serval.ApiServer/Startup.cs @@ -157,6 +157,14 @@ public void ConfigureServices(IServiceCollection services) }; }); } + + services + .AddOpenTelemetry() + .WithTracing(builder => + { + builder.AddAspNetCoreInstrumentation().AddConsoleExporter(); + builder.AddHttpClientInstrumentation().AddConsoleExporter(); + }); } public void Configure(IApplicationBuilder app, IWebHostEnvironment env) diff --git a/src/Serval.ApiServer/Usings.cs b/src/Serval.ApiServer/Usings.cs index a6a10d38..d64037a7 100644 --- a/src/Serval.ApiServer/Usings.cs +++ b/src/Serval.ApiServer/Usings.cs @@ -13,12 +13,15 @@ global using Microsoft.AspNetCore.Authorization; global using Microsoft.AspNetCore.Diagnostics.HealthChecks; global using Microsoft.Extensions.Diagnostics.HealthChecks; +global using Microsoft.Extensions.DependencyInjection; global using Microsoft.IdentityModel.Tokens; global using NJsonSchema; global using NJsonSchema.Generation; global using NSwag; global using NSwag.AspNetCore; global using NSwag.Generation.Processors.Security; +global using OpenTelemetry; +global using OpenTelemetry.Trace; global using Serval.Shared.Contracts; global using Serval.Shared.Controllers; global using Serval.Shared.Models;