mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-14 09:40:10 +00:00
Collect command runtime metrics
This commit is contained in:
parent
db5fae0fb4
commit
b6fc86d427
2 changed files with 4 additions and 1 deletions
|
|
@ -10,6 +10,7 @@ namespace PluralKit.Bot
|
||||||
public static MeterOptions MessagesReceived => new MeterOptions { Name = "Messages processed", MeasurementUnit = Unit.Events, RateUnit = TimeUnit.Seconds, Context = "Bot" };
|
public static MeterOptions MessagesReceived => new MeterOptions { Name = "Messages processed", MeasurementUnit = Unit.Events, RateUnit = TimeUnit.Seconds, Context = "Bot" };
|
||||||
public static MeterOptions MessagesProxied => new MeterOptions { Name = "Messages proxied", MeasurementUnit = Unit.Events, RateUnit = TimeUnit.Seconds, Context = "Bot" };
|
public static MeterOptions MessagesProxied => new MeterOptions { Name = "Messages proxied", MeasurementUnit = Unit.Events, RateUnit = TimeUnit.Seconds, Context = "Bot" };
|
||||||
public static MeterOptions CommandsRun => new MeterOptions { Name = "Commands run", MeasurementUnit = Unit.Commands, RateUnit = TimeUnit.Seconds, Context = "Bot" };
|
public static MeterOptions CommandsRun => new MeterOptions { Name = "Commands run", MeasurementUnit = Unit.Commands, RateUnit = TimeUnit.Seconds, Context = "Bot" };
|
||||||
|
public static TimerOptions CommandTime => new TimerOptions { Name = "Command run time", MeasurementUnit = Unit.Commands, RateUnit = TimeUnit.Seconds, DurationUnit = TimeUnit.Seconds, Context = "Bot" };
|
||||||
public static GaugeOptions MembersTotal => new GaugeOptions { Name = "Members total", MeasurementUnit = Unit.None, Context = "Bot" };
|
public static GaugeOptions MembersTotal => new GaugeOptions { Name = "Members total", MeasurementUnit = Unit.None, Context = "Bot" };
|
||||||
public static GaugeOptions MembersOnline => new GaugeOptions { Name = "Members online", MeasurementUnit = Unit.None, Context = "Bot" };
|
public static GaugeOptions MembersOnline => new GaugeOptions { Name = "Members online", MeasurementUnit = Unit.None, Context = "Bot" };
|
||||||
public static GaugeOptions Guilds => new GaugeOptions { Name = "Guilds", MeasurementUnit = Unit.None, Context = "Bot" };
|
public static GaugeOptions Guilds => new GaugeOptions { Name = "Guilds", MeasurementUnit = Unit.None, Context = "Bot" };
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,9 @@ namespace PluralKit.Bot
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await handler(_provider.Resolve<T>());
|
using (_metrics.Measure.Timer.Time(BotMetrics.CommandTime, new MetricTags("Command", commandDef.Key)))
|
||||||
|
await handler(_provider.Resolve<T>());
|
||||||
|
|
||||||
_metrics.Measure.Meter.Mark(BotMetrics.CommandsRun);
|
_metrics.Measure.Meter.Mark(BotMetrics.CommandsRun);
|
||||||
}
|
}
|
||||||
catch (PKSyntaxError e)
|
catch (PKSyntaxError e)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue