mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.6 KiB
51 lines
1.6 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschränkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using System;
|
|
using Newtonsoft.Json;
|
|
using Squidex.Infrastructure.Json.Newtonsoft;
|
|
using Squidex.Infrastructure.UsageTracking;
|
|
|
|
namespace Squidex.Areas.Api.Controllers.Statistics.Models
|
|
{
|
|
public sealed class CallsUsagePerDateDto
|
|
{
|
|
/// <summary>
|
|
/// The date when the usage was tracked.
|
|
/// </summary>
|
|
[JsonConverter(typeof(DateConverter))]
|
|
public DateTime Date { get; set; }
|
|
|
|
/// <summary>
|
|
/// The total number of API calls.
|
|
/// </summary>
|
|
public long TotalCalls { get; set; }
|
|
|
|
/// <summary>
|
|
/// The total number of bytes transferred.
|
|
/// </summary>
|
|
public long TotalBytes { get; set; }
|
|
|
|
/// <summary>
|
|
/// The average duration in milliseconds.
|
|
/// </summary>
|
|
public double AverageElapsedMs { get; set; }
|
|
|
|
public static CallsUsagePerDateDto FromStats(ApiStats stats)
|
|
{
|
|
var result = new CallsUsagePerDateDto
|
|
{
|
|
Date = DateTime.SpecifyKind(stats.Date, DateTimeKind.Utc),
|
|
TotalBytes = stats.TotalBytes,
|
|
TotalCalls = stats.TotalCalls,
|
|
AverageElapsedMs = stats.AverageElapsedMs,
|
|
};
|
|
|
|
return result;
|
|
}
|
|
}
|
|
}
|
|
|