BotSharp/src/Infrastructure/BotSharp.Abstraction/Statistics/Models/BotSharpStats.cs

34 lines
890 B
C#
Raw Normal View History

2025-01-24 05:45:43 +00:00
namespace BotSharp.Abstraction.Statistics.Models;
public class BotSharpStats
{
2025-01-28 16:56:45 +00:00
[JsonPropertyName("metric")]
public string Metric { get; set; } = null!;
2025-01-24 05:45:43 +00:00
2025-01-28 16:56:45 +00:00
[JsonPropertyName("dimension")]
public string Dimension { get; set; } = null!;
2025-01-24 05:45:43 +00:00
[JsonPropertyName("data")]
2025-01-28 05:10:37 +00:00
public IDictionary<string, double> Data { get; set; } = new Dictionary<string, double>();
2025-01-24 05:45:43 +00:00
2025-01-24 19:42:17 +00:00
private DateTime innerRecordTime;
2025-01-24 05:45:43 +00:00
2025-01-24 19:42:17 +00:00
[JsonPropertyName("record_time")]
public DateTime RecordTime
2025-01-24 05:45:43 +00:00
{
get
{
2025-01-24 19:42:17 +00:00
return innerRecordTime;
2025-01-24 05:45:43 +00:00
}
set
{
var date = new DateTime(value.Year, value.Month, value.Day, value.Hour, 0, 0);
2025-01-24 19:42:17 +00:00
innerRecordTime = DateTime.SpecifyKind(date, DateTimeKind.Utc);
2025-01-24 05:45:43 +00:00
}
}
public override string ToString()
{
2025-01-28 16:56:45 +00:00
return $"{Metric}-{Dimension}: {Data?.Count ?? 0} ({RecordTime})";
2025-01-24 05:45:43 +00:00
}
}