Log gateway latency to console

This commit is contained in:
Ske 2019-08-12 04:05:22 +02:00
parent aa04d2055e
commit c68ce1bdd3

View File

@ -106,7 +106,7 @@ namespace PluralKit.Bot
.AddTransient<LogChannelService>() .AddTransient<LogChannelService>()
.AddTransient<DataFileService>() .AddTransient<DataFileService>()
.AddSingleton<ProxyCacheService>() .AddTransient<ProxyCacheService>()
.AddSingleton<WebhookCacheService>() .AddSingleton<WebhookCacheService>()
.AddTransient<SystemStore>() .AddTransient<SystemStore>()
@ -368,6 +368,9 @@ namespace PluralKit.Bot
private void RegisterMessageMetrics(SocketMessage msg) private void RegisterMessageMetrics(SocketMessage msg)
{ {
_metrics.Measure.Meter.Mark(BotMetrics.MessagesReceived); _metrics.Measure.Meter.Mark(BotMetrics.MessagesReceived);
var gatewayLatency = DateTimeOffset.Now - msg.CreatedAt;
_logger.Debug("Message received with latency {Latency}", gatewayLatency);
} }
public Task HandleReactionAdded(Cacheable<IUserMessage, ulong> message, ISocketMessageChannel channel, public Task HandleReactionAdded(Cacheable<IUserMessage, ulong> message, ISocketMessageChannel channel,