mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
fix for duplicated value
This commit is contained in:
parent
371d23852b
commit
226af90698
@ -64,21 +64,21 @@ public class MetricsController : ControllerBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("{action}/{subject}")]
|
[Route("{subject}/{value}")]
|
||||||
public async Task<Result> LogMetricAsync(string action, string subject)
|
public async Task<Result> LogMetricAsync(string subject, string value)
|
||||||
{
|
{
|
||||||
var date = DateTime.UtcNow;
|
var date = DateTime.UtcNow;
|
||||||
var metricsKey = Request.Headers[_settings.MetricsKeyHeader].FirstOrDefault();
|
var metricsKey = Request.Headers[_settings.MetricsKeyHeader].FirstOrDefault();
|
||||||
|
|
||||||
// Used in tests
|
// Used in tests
|
||||||
if (subject is "Default" or "untitled" || subject == "failed_download" || Guid.TryParse(subject, out _))
|
if (value is "Default" or "untitled" || subject == "failed_download" || Guid.TryParse(value, out _))
|
||||||
return new Result {Timestamp = date};
|
return new Result {Timestamp = date};
|
||||||
|
|
||||||
await _metricsStore.Ingest(new Metric
|
await _metricsStore.Ingest(new Metric
|
||||||
{
|
{
|
||||||
Timestamp = DateTime.UtcNow,
|
Timestamp = DateTime.UtcNow,
|
||||||
Action = action,
|
Action = subject,
|
||||||
Subject = subject,
|
Subject = value,
|
||||||
MetricsKey = metricsKey,
|
MetricsKey = metricsKey,
|
||||||
UserAgent = Request.Headers.UserAgent.FirstOrDefault() ?? "<unknown>",
|
UserAgent = Request.Headers.UserAgent.FirstOrDefault() ?? "<unknown>",
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user