diff --git a/ArchiSteamFarm.OfficialPlugins.Monitoring/MonitoringPlugin.cs b/ArchiSteamFarm.OfficialPlugins.Monitoring/MonitoringPlugin.cs index c4e6b12be..8ee68f15f 100644 --- a/ArchiSteamFarm.OfficialPlugins.Monitoring/MonitoringPlugin.cs +++ b/ArchiSteamFarm.OfficialPlugins.Monitoring/MonitoringPlugin.cs @@ -249,33 +249,33 @@ internal sealed class MonitoringPlugin : OfficialPlugin, IDisposable, IOfficialG ); Meter.CreateObservableCounter( - $"{MetricNamePrefix}_bot_trades", () => TradeStatistics.SelectMany, Measurement>( + $"{MetricNamePrefix}_bot_trades", () => TradeStatistics.SelectMany, Measurement>( static kv => [ - new Measurement( + new Measurement( kv.Value.AcceptedOffers, new KeyValuePair(TagNames.BotName, kv.Key.BotName), new KeyValuePair(TagNames.SteamID, kv.Key.SteamID), new KeyValuePair(TagNames.TradeOfferResult, "accepted") ), - new Measurement( + new Measurement( kv.Value.RejectedOffers, new KeyValuePair(TagNames.BotName, kv.Key.BotName), new KeyValuePair(TagNames.SteamID, kv.Key.SteamID), new KeyValuePair(TagNames.TradeOfferResult, "rejected") ), - new Measurement( + new Measurement( kv.Value.IgnoredOffers, new KeyValuePair(TagNames.BotName, kv.Key.BotName), new KeyValuePair(TagNames.SteamID, kv.Key.SteamID), new KeyValuePair(TagNames.TradeOfferResult, "ignored") ), - new Measurement( + new Measurement( kv.Value.BlacklistedOffers, new KeyValuePair(TagNames.BotName, kv.Key.BotName), new KeyValuePair(TagNames.SteamID, kv.Key.SteamID), new KeyValuePair(TagNames.TradeOfferResult, "blacklisted") ), - new Measurement( + new Measurement( kv.Value.ConfirmedOffers, new KeyValuePair(TagNames.BotName, kv.Key.BotName), new KeyValuePair(TagNames.SteamID, kv.Key.SteamID), @@ -287,12 +287,12 @@ internal sealed class MonitoringPlugin : OfficialPlugin, IDisposable, IOfficialG ); Meter.CreateObservableCounter( - $"{MetricNamePrefix}_bot_items_given", () => TradeStatistics.Select(static kv => new Measurement(kv.Value.ItemsGiven, new KeyValuePair(TagNames.BotName, kv.Key.BotName), new KeyValuePair(TagNames.SteamID, kv.Key.SteamID))), + $"{MetricNamePrefix}_bot_items_given", () => TradeStatistics.Select(static kv => new Measurement(kv.Value.ItemsGiven, new KeyValuePair(TagNames.BotName, kv.Key.BotName), new KeyValuePair(TagNames.SteamID, kv.Key.SteamID))), description: "Items given per bot" ); Meter.CreateObservableCounter( - $"{MetricNamePrefix}_bot_items_received", () => TradeStatistics.Select(static kv => new Measurement(kv.Value.ItemsReceived, new KeyValuePair(TagNames.BotName, kv.Key.BotName), new KeyValuePair(TagNames.SteamID, kv.Key.SteamID))), + $"{MetricNamePrefix}_bot_items_received", () => TradeStatistics.Select(static kv => new Measurement(kv.Value.ItemsReceived, new KeyValuePair(TagNames.BotName, kv.Key.BotName), new KeyValuePair(TagNames.SteamID, kv.Key.SteamID))), description: "Items received per bot" ); } diff --git a/ArchiSteamFarm.OfficialPlugins.Monitoring/TradeStatistics.cs b/ArchiSteamFarm.OfficialPlugins.Monitoring/TradeStatistics.cs index d7572fb61..c735a29e2 100644 --- a/ArchiSteamFarm.OfficialPlugins.Monitoring/TradeStatistics.cs +++ b/ArchiSteamFarm.OfficialPlugins.Monitoring/TradeStatistics.cs @@ -29,13 +29,13 @@ namespace ArchiSteamFarm.OfficialPlugins.Monitoring; internal sealed class TradeStatistics { private readonly object Lock = new(); - internal uint AcceptedOffers { get; private set; } - internal uint BlacklistedOffers { get; private set; } - internal uint ConfirmedOffers { get; private set; } - internal uint IgnoredOffers { get; private set; } - internal uint ItemsGiven { get; private set; } - internal uint ItemsReceived { get; private set; } - internal uint RejectedOffers { get; private set; } + internal int AcceptedOffers { get; private set; } + internal int BlacklistedOffers { get; private set; } + internal int ConfirmedOffers { get; private set; } + internal int IgnoredOffers { get; private set; } + internal int ItemsGiven { get; private set; } + internal int ItemsReceived { get; private set; } + internal int RejectedOffers { get; private set; } internal void Include(ParseTradeResult result) { ArgumentNullException.ThrowIfNull(result); @@ -45,8 +45,8 @@ internal sealed class TradeStatistics { case ParseTradeResult.EResult.Accepted when result.Confirmed: ConfirmedOffers++; - ItemsGiven += (uint) (result.ItemsToGive?.Count ?? 0); - ItemsReceived += (uint) (result.ItemsToReceive?.Count ?? 0); + ItemsGiven += result.ItemsToGive?.Count ?? 0; + ItemsReceived += result.ItemsToReceive?.Count ?? 0; goto case ParseTradeResult.EResult.Accepted; case ParseTradeResult.EResult.Accepted: