mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-10 07:04:27 +00:00
Monitoring (#3251)
* Add more plugin metrics * Update dashboard to account for changed labels in upstream library and new plugin metrics
This commit is contained in:
parent
f87b63d6ee
commit
38ae309285
3 changed files with 563 additions and 400 deletions
|
@ -23,6 +23,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Frozen;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Composition;
|
||||
|
@ -69,6 +70,8 @@ internal sealed class MonitoringPlugin : OfficialPlugin, IDisposable, IOfficialG
|
|||
|
||||
private static bool Enabled => ASF.GlobalConfig?.IPC ?? GlobalConfig.DefaultIPC;
|
||||
|
||||
private static FrozenSet<Measurement<int>>? PluginMeasurements;
|
||||
|
||||
[JsonInclude]
|
||||
[Required]
|
||||
public override string Name => nameof(MonitoringPlugin);
|
||||
|
@ -136,6 +139,12 @@ internal sealed class MonitoringPlugin : OfficialPlugin, IDisposable, IOfficialG
|
|||
return;
|
||||
}
|
||||
|
||||
PluginMeasurements = new[] {
|
||||
new Measurement<int>(PluginsCore.ActivePlugins.Count),
|
||||
new Measurement<int>(PluginsCore.ActivePlugins.Count(static plugin => plugin is OfficialPlugin), new KeyValuePair<string, object?>(TagNames.PluginType, "official")),
|
||||
new Measurement<int>(PluginsCore.ActivePlugins.Count(static plugin => plugin is not OfficialPlugin), new KeyValuePair<string, object?>(TagNames.PluginType, "custom"))
|
||||
}.ToFrozenSet();
|
||||
|
||||
Meter = new Meter(MeterName, Version.ToString());
|
||||
|
||||
Meter.CreateObservableGauge(
|
||||
|
@ -158,7 +167,7 @@ internal sealed class MonitoringPlugin : OfficialPlugin, IDisposable, IOfficialG
|
|||
|
||||
Meter.CreateObservableGauge(
|
||||
$"{MetricNamePrefix}_active_plugins",
|
||||
static () => PluginsCore.ActivePlugins.Count,
|
||||
static () => PluginMeasurements,
|
||||
description: "Number of plugins currently loaded in ASF"
|
||||
);
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ internal static class TagNames {
|
|||
internal const string CurrencyCode = "currency";
|
||||
internal const string Framework = "framework";
|
||||
internal const string OS = "operating_system";
|
||||
internal const string PluginType = "type";
|
||||
internal const string Runtime = "runtime";
|
||||
internal const string SteamID = "steamid";
|
||||
internal const string TradeOfferResult = "result";
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue