mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-20 08:18:37 +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:
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
|
using System.Collections.Frozen;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Composition;
|
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 bool Enabled => ASF.GlobalConfig?.IPC ?? GlobalConfig.DefaultIPC;
|
||||||
|
|
||||||
|
private static FrozenSet<Measurement<int>>? PluginMeasurements;
|
||||||
|
|
||||||
[JsonInclude]
|
[JsonInclude]
|
||||||
[Required]
|
[Required]
|
||||||
public override string Name => nameof(MonitoringPlugin);
|
public override string Name => nameof(MonitoringPlugin);
|
||||||
@@ -136,6 +139,12 @@ internal sealed class MonitoringPlugin : OfficialPlugin, IDisposable, IOfficialG
|
|||||||
return;
|
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 = new Meter(MeterName, Version.ToString());
|
||||||
|
|
||||||
Meter.CreateObservableGauge(
|
Meter.CreateObservableGauge(
|
||||||
@@ -158,7 +167,7 @@ internal sealed class MonitoringPlugin : OfficialPlugin, IDisposable, IOfficialG
|
|||||||
|
|
||||||
Meter.CreateObservableGauge(
|
Meter.CreateObservableGauge(
|
||||||
$"{MetricNamePrefix}_active_plugins",
|
$"{MetricNamePrefix}_active_plugins",
|
||||||
static () => PluginsCore.ActivePlugins.Count,
|
static () => PluginMeasurements,
|
||||||
description: "Number of plugins currently loaded in ASF"
|
description: "Number of plugins currently loaded in ASF"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ internal static class TagNames {
|
|||||||
internal const string CurrencyCode = "currency";
|
internal const string CurrencyCode = "currency";
|
||||||
internal const string Framework = "framework";
|
internal const string Framework = "framework";
|
||||||
internal const string OS = "operating_system";
|
internal const string OS = "operating_system";
|
||||||
|
internal const string PluginType = "type";
|
||||||
internal const string Runtime = "runtime";
|
internal const string Runtime = "runtime";
|
||||||
internal const string SteamID = "steamid";
|
internal const string SteamID = "steamid";
|
||||||
internal const string TradeOfferResult = "result";
|
internal const string TradeOfferResult = "result";
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user