Added more security and metrics

This commit is contained in:
2026-06-22 07:28:03 +02:00
committed by Jeroen Saey
parent 2a1f7b77ee
commit cb2d111ad7
27 changed files with 1638 additions and 884 deletions
+46
View File
@@ -0,0 +1,46 @@
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>
/// Tracks metrics and statistics for API endpoints.
/// </summary>
public class ApiMetrics
{
[JsonProperty("endpointId")]
public string EndpointId { get; set; } = string.Empty;
[JsonProperty("method")]
public string Method { get; set; } = string.Empty;
[JsonProperty("path")]
public string Path { get; set; } = string.Empty;
[JsonProperty("totalRequests")]
public int TotalRequests { get; set; }
[JsonProperty("successfulRequests")]
public int SuccessfulRequests { get; set; }
[JsonProperty("failedRequests")]
public int FailedRequests { get; set; }
[JsonProperty("averageResponseTimeMs")]
public double AverageResponseTimeMs { get; set; }
[JsonProperty("lastRequestAt")]
public DateTime? LastRequestAt { get; set; }
[JsonProperty("createdAt")]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
[JsonProperty("statusCodes")]
public Dictionary<int, int> StatusCodes { get; set; } = new();
[JsonProperty("averageResponseSize")]
public long AverageResponseSize { get; set; }
}
}