diff --git a/ArchiSteamFarm.OfficialPlugins.Monitoring/MonitoringPlugin.cs b/ArchiSteamFarm.OfficialPlugins.Monitoring/MonitoringPlugin.cs index c4e6b12bec2c7..8ee68f15f0128 100644 --- a/ArchiSteamFarm.OfficialPlugins.Monitoring/MonitoringPlugin.cs +++ b/ArchiSteamFarm.OfficialPlugins.Monitoring/MonitoringPlugin.cs @@ -249,33 +249,33 @@ private void InitializeMeter() { ); 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 @@ private void InitializeMeter() { ); 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 d7572fb61a9b7..c735a29e2571b 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 void Include(ParseTradeResult result) { 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: