refactor: reorganize a few lines in Misc.cs
This commit is contained in:
parent
a16903037f
commit
2e17522de6
@ -62,12 +62,28 @@ public class Misc
|
|||||||
var timeAfter = SystemClock.Instance.GetCurrentInstant();
|
var timeAfter = SystemClock.Instance.GetCurrentInstant();
|
||||||
var apiLatency = timeAfter - timeBefore;
|
var apiLatency = timeAfter - timeBefore;
|
||||||
|
|
||||||
|
var embed = new EmbedBuilder();
|
||||||
|
|
||||||
var messagesReceived = _metrics.Snapshot.GetForContext("Bot").Meters
|
var messagesReceived = _metrics.Snapshot.GetForContext("Bot").Meters
|
||||||
.FirstOrDefault(m => m.MultidimensionalName == BotMetrics.MessagesReceived.Name)?.Value;
|
.FirstOrDefault(m => m.MultidimensionalName == BotMetrics.MessagesReceived.Name)?.Value;
|
||||||
|
if (messagesReceived != null)
|
||||||
|
embed.Field(new Embed.Field("Messages processed",
|
||||||
|
$"{messagesReceived.OneMinuteRate * 60:F1}/m ({messagesReceived.FifteenMinuteRate * 60:F1}/m over 15m)",
|
||||||
|
true));
|
||||||
|
|
||||||
var messagesProxied = _metrics.Snapshot.GetForContext("Bot").Meters
|
var messagesProxied = _metrics.Snapshot.GetForContext("Bot").Meters
|
||||||
.FirstOrDefault(m => m.MultidimensionalName == BotMetrics.MessagesProxied.Name)?.Value;
|
.FirstOrDefault(m => m.MultidimensionalName == BotMetrics.MessagesProxied.Name)?.Value;
|
||||||
|
if (messagesProxied != null)
|
||||||
|
embed.Field(new Embed.Field("Messages proxied",
|
||||||
|
$"{messagesProxied.OneMinuteRate * 60:F1}/m ({messagesProxied.FifteenMinuteRate * 60:F1}/m over 15m)",
|
||||||
|
true));
|
||||||
|
|
||||||
var commandsRun = _metrics.Snapshot.GetForContext("Bot").Meters
|
var commandsRun = _metrics.Snapshot.GetForContext("Bot").Meters
|
||||||
.FirstOrDefault(m => m.MultidimensionalName == BotMetrics.CommandsRun.Name)?.Value;
|
.FirstOrDefault(m => m.MultidimensionalName == BotMetrics.CommandsRun.Name)?.Value;
|
||||||
|
if (commandsRun != null)
|
||||||
|
embed.Field(new Embed.Field("Commands executed",
|
||||||
|
$"{commandsRun.OneMinuteRate * 60:F1}/m ({commandsRun.FifteenMinuteRate * 60:F1}/m over 15m)",
|
||||||
|
true));
|
||||||
|
|
||||||
var counts = await _repo.GetStats();
|
var counts = await _repo.GetStats();
|
||||||
|
|
||||||
@ -82,20 +98,6 @@ public class Misc
|
|||||||
var now = SystemClock.Instance.GetCurrentInstant();
|
var now = SystemClock.Instance.GetCurrentInstant();
|
||||||
var shardUptime = now - shardInfo.LastConnectionTime;
|
var shardUptime = now - shardInfo.LastConnectionTime;
|
||||||
|
|
||||||
var embed = new EmbedBuilder();
|
|
||||||
if (messagesReceived != null)
|
|
||||||
embed.Field(new Embed.Field("Messages processed",
|
|
||||||
$"{messagesReceived.OneMinuteRate * 60:F1}/m ({messagesReceived.FifteenMinuteRate * 60:F1}/m over 15m)",
|
|
||||||
true));
|
|
||||||
if (messagesProxied != null)
|
|
||||||
embed.Field(new Embed.Field("Messages proxied",
|
|
||||||
$"{messagesProxied.OneMinuteRate * 60:F1}/m ({messagesProxied.FifteenMinuteRate * 60:F1}/m over 15m)",
|
|
||||||
true));
|
|
||||||
if (commandsRun != null)
|
|
||||||
embed.Field(new Embed.Field("Commands executed",
|
|
||||||
$"{commandsRun.OneMinuteRate * 60:F1}/m ({commandsRun.FifteenMinuteRate * 60:F1}/m over 15m)",
|
|
||||||
true));
|
|
||||||
|
|
||||||
embed
|
embed
|
||||||
.Field(new Embed.Field("Current shard",
|
.Field(new Embed.Field("Current shard",
|
||||||
$"Shard #{shardId} (of {shardTotal} total, {shardUpTotal} are up)", true))
|
$"Shard #{shardId} (of {shardTotal} total, {shardUpTotal} are up)", true))
|
||||||
|
Loading…
Reference in New Issue
Block a user