Added more security and metrics
This commit is contained in:
@@ -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; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user