diff --git a/Directory.Packages.props b/Directory.Packages.props index 831cb14..0a754bf 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,6 +6,13 @@ + + + + + + + diff --git a/Smilodon.sln b/Smilodon.sln index ce10310..8a30c12 100644 --- a/Smilodon.sln +++ b/Smilodon.sln @@ -17,6 +17,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ActivityPub.Domain", "src\A EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Domain", "src\Domain\Domain.csproj", "{46FC91AA-B4F6-4339-A414-5126474048C6}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{98B687E0-157E-4EF0-8482-6E6EDF46E034}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + .gitattributes = .gitattributes + .gitignore = .gitignore + Directory.Packages.props = Directory.Packages.props + nuget.config = nuget.config + README.md = README.md + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/src/WebApp/Program.cs b/src/WebApp/Program.cs index 38e7e78..aa6d518 100644 --- a/src/WebApp/Program.cs +++ b/src/WebApp/Program.cs @@ -1,12 +1,35 @@ using Microsoft.EntityFrameworkCore; +using OpenTelemetry.Exporter; +using OpenTelemetry.Resources; +using OpenTelemetry.Trace; using Smilodon.Infrastructure.Persistence; using Smilodon.WebApp.Api.Admin; using Smilodon.WebApp.Api.Webfinger; var builder = WebApplication.CreateBuilder(args); +// this should really be in the app config instead... +const string serviceName = "Smilodon.WebApp"; +const string serviceVersion = "0.0.1"; + // Add services to the container. +builder.Services.AddOpenTelemetryTracing(tracerProviderBuilder => +{ + tracerProviderBuilder + .AddConsoleExporter() + .AddOtlpExporter(opt => + { + opt.Protocol = OtlpExportProtocol.HttpProtobuf; + }) + .AddSource(serviceName) + .SetResourceBuilder(ResourceBuilder.CreateDefault() + .AddService(serviceName: serviceName, serviceVersion: serviceVersion)) + .AddHttpClientInstrumentation() + .AddAspNetCoreInstrumentation() + .AddSqlClientInstrumentation(); +}); + builder.Services.AddControllersWithViews(); // Add the database context to the DI container @@ -15,7 +38,6 @@ .UseNpgsql("Host=localhost; Database=smilodon; User Id=smilodon; Password=smilodon;") .UseSnakeCaseNamingConvention()); - var app = builder.Build(); // Configure the HTTP request pipeline. diff --git a/src/WebApp/WebApp.csproj b/src/WebApp/WebApp.csproj index 4eb4a5d..9fa792d 100644 --- a/src/WebApp/WebApp.csproj +++ b/src/WebApp/WebApp.csproj @@ -1,4 +1,4 @@ - + net7.0 @@ -9,6 +9,15 @@ Smilodon.WebApp + + + + + + + + +