diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-12-27 19:45:51 +0100 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-12-27 19:45:51 +0100 |
commit | c04719d87abbe9feb94d9b3e8cf1812d3f7356e0 (patch) | |
tree | 68454b2f82300c887ddef475fa99f2560e38b611 /ModAS.Server/Program.cs | |
parent | Transactions test (diff) | |
download | ModAS-c04719d87abbe9feb94d9b3e8cf1812d3f7356e0.tar.xz |
Room query v0
Diffstat (limited to 'ModAS.Server/Program.cs')
-rw-r--r-- | ModAS.Server/Program.cs | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/ModAS.Server/Program.cs b/ModAS.Server/Program.cs index da44ca8..0b3d121 100644 --- a/ModAS.Server/Program.cs +++ b/ModAS.Server/Program.cs @@ -3,12 +3,17 @@ using Microsoft.OpenApi.Models; using ModAS.Server; using System.Diagnostics; using System.Text.Json; +using Elastic.Apm; +using Elastic.Apm.Api; +using Elastic.Apm.AspNetCore; +using Elastic.Apm.NetCoreAll; using LibMatrix; using LibMatrix.Services; using ModAS.Server.Services; using MxApiExtensions.Services; -var builder = WebApplication.CreateBuilder(args); +// var builder = WebApplication.CreateBuilder(args); +var builder = WebApplication.CreateSlimBuilder(args); builder.Services.AddControllers().AddJsonOptions(options => { options.JsonSerializerOptions.WriteIndented = true; }); ///add wwwroot @@ -30,7 +35,9 @@ builder.Services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>(); builder.Services.AddSingleton<ModASConfiguration>(); builder.Services.AddSingleton<AuthenticationService>(); -builder.Services.AddSingleton<AuthenticatedHomeserverProviderService>(); +builder.Services.AddSingleton<UserProviderService>(); +builder.Services.AddSingleton<RoomContextService>(); +builder.Services.AddSingleton<RoomStateCacheService>(); // builder.Services.AddScoped<UserContextService>(); builder.Services.AddSingleton<TieredStorageService>(x => { @@ -82,7 +89,6 @@ builder.Services.AddCors(options => { var app = builder.Build(); -// Configure the HTTP request pipeline. // if (app.Environment.IsDevelopment()) { app.UseSwagger(); app.UseSwaggerUI(c => { @@ -99,6 +105,15 @@ app.UseReDoc(c => { }); // } +app.UseAllElasticApm(builder.Configuration); +Agent.AddFilter((ISpan span) => { + if (span.Context.Http is not null && span.Name.StartsWith($"{span.Context.Http.Method} ")) { + span.Name = $"{span.Context.Http.Method} {span.Context.Http.Url}"; + } + + return span; +}); + ///wwwroot app.UseFileServer(); // app.UseStaticFiles(); |