1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-05-04 04:56:30 +03:00

Add profiler base (#235)

This PR adds the base classes required for profiling code inside of
Octobot. The implementation of the profiler is similar to Minecraft,
however it is more detailed and provides per-event logs for each event.
This PR does not change any code to be profiled and this is intentional.
Changes required for profiling will come as separate PRs, one for
commands, one for responders, and one for background services.

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2023-12-20 22:59:17 +05:00 committed by GitHub
parent d4871bb23d
commit 7d9a85d815
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 153 additions and 0 deletions

View file

@ -4,6 +4,7 @@ using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Octobot.Commands.Events;
using Octobot.Services;
using Octobot.Services.Profiler;
using Octobot.Services.Update;
using Remora.Discord.API.Abstractions.Gateway.Commands;
using Remora.Discord.API.Abstractions.Objects;
@ -86,6 +87,8 @@ public sealed class Octobot
.AddPreparationErrorEvent<LoggingPreparationErrorEvent>()
.AddPostExecutionEvent<ErrorLoggingPostExecutionEvent>()
// Services
.AddTransient<Profiler>()
.AddSingleton<ProfilerFactory>()
.AddSingleton<Utility>()
.AddSingleton<GuildDataService>()
.AddHostedService<GuildDataService>(provider => provider.GetRequiredService<GuildDataService>())