Files

68 lines
2.1 KiB
C#

using EonaCat.Json;
namespace EonaCat.DoxaApi.Models
{
// This file is part of the EonaCat project(s) which is released under the Apache License.
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
/// <summary>
/// Analytics dashboard data containing metrics and insights.
/// </summary>
public class AnalyticsDashboard
{
[JsonProperty("totalEndpoints")]
public int TotalEndpoints { get; set; }
[JsonProperty("totalRequests")]
public int TotalRequests { get; set; }
[JsonProperty("totalErrors")]
public int TotalErrors { get; set; }
[JsonProperty("averageResponseTime")]
public double AverageResponseTime { get; set; }
[JsonProperty("peakRequestsPerSecond")]
public double PeakRequestsPerSecond { get; set; }
[JsonProperty("uptime")]
public TimeSpan Uptime { get; set; }
[JsonProperty("topEndpoints")]
public List<EndpointUsageSummary> TopEndpoints { get; set; } = new();
[JsonProperty("recentRequests")]
public List<RequestMetadata> RecentRequests { get; set; } = new();
[JsonProperty("errorRate")]
public double ErrorRate { get; set; }
[JsonProperty("generatedAt")]
public DateTime GeneratedAt { get; set; } = DateTime.UtcNow;
}
/// <summary>
/// Summary of endpoint usage for dashboard display.
/// </summary>
public class EndpointUsageSummary
{
[JsonProperty("method")]
public string Method { get; set; } = string.Empty;
[JsonProperty("path")]
public string Path { get; set; } = string.Empty;
[JsonProperty("requestCount")]
public int RequestCount { get; set; }
[JsonProperty("errorCount")]
public int ErrorCount { get; set; }
[JsonProperty("averageResponseTimeMs")]
public double AverageResponseTimeMs { get; set; }
[JsonProperty("lastCalled")]
public DateTime? LastCalled { get; set; }
}
}