Instrument and log database queries
This commit is contained in:
@@ -364,16 +364,6 @@ namespace PluralKit.Bot
|
||||
|
||||
private void RegisterMessageMetrics(SocketMessage msg)
|
||||
{
|
||||
var guild = (msg.Channel as IGuildChannel)?.Guild;
|
||||
if (guild != null)
|
||||
{
|
||||
var shard = _client.GetShardFor(guild);
|
||||
var latencyMillis = shard.Latency;
|
||||
|
||||
_metrics.Provider.Timer.Instance(BotMetrics.GatewayLatency, new MetricTags("shard", shard.ShardId.ToString()))
|
||||
.Record(latencyMillis, TimeUnit.Milliseconds);
|
||||
}
|
||||
|
||||
_metrics.Measure.Meter.Mark(BotMetrics.MessagesReceived);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ namespace PluralKit.Bot
|
||||
public static GaugeOptions Channels => new GaugeOptions {Name = "Channels", MeasurementUnit = Unit.None, Context = "Bot"};
|
||||
public static GaugeOptions ShardsConnected => new GaugeOptions { Name = "Shards Connected", Context = "Bot" };
|
||||
public static GaugeOptions WebhookCacheSize => new GaugeOptions { Name = "Webhook Cache Size", Context = "Bot" };
|
||||
public static TimerOptions WebhookResponseTime => new TimerOptions { Name = "Webhook Response Time", Context = "Bot" };
|
||||
public static TimerOptions GatewayLatency => new TimerOptions { Name = "Gateway Latency", Context = "Bot" };
|
||||
public static TimerOptions WebhookResponseTime => new TimerOptions { Name = "Webhook Response Time", Context = "Bot", RateUnit = TimeUnit.Seconds, MeasurementUnit = Unit.Requests, DurationUnit = TimeUnit.Seconds };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user