remove unnecessary usings from solution, fixes in metrics
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
using MareSynchronos.API;
|
using MareSynchronos.API;
|
||||||
using MareSynchronosServer.Utils;
|
using MareSynchronosServer.Utils;
|
||||||
using MareSynchronosShared.Authentication;
|
|
||||||
using MareSynchronosShared.Models;
|
using MareSynchronosShared.Models;
|
||||||
using MareSynchronosShared.Utils;
|
using MareSynchronosShared.Utils;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
@@ -8,7 +7,6 @@ using Microsoft.AspNetCore.SignalR;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ using MareSynchronos.API;
|
|||||||
using MareSynchronosServer.Utils;
|
using MareSynchronosServer.Utils;
|
||||||
using MareSynchronosShared.Metrics;
|
using MareSynchronosShared.Metrics;
|
||||||
using MareSynchronosShared.Models;
|
using MareSynchronosShared.Models;
|
||||||
using MareSynchronosShared.Protos;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.SignalR;
|
using Microsoft.AspNetCore.SignalR;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ using MareSynchronosServer.Services;
|
|||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using MareSynchronosServer.Utils;
|
using MareSynchronosServer.Utils;
|
||||||
using MareSynchronosServer.RequirementHandlers;
|
using MareSynchronosServer.RequirementHandlers;
|
||||||
using MareSynchronosShared.Services;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MareSynchronosServer;
|
namespace MareSynchronosServer;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class MareMetrics
|
|||||||
{
|
{
|
||||||
if (gauges.ContainsKey(gaugeName))
|
if (gauges.ContainsKey(gaugeName))
|
||||||
{
|
{
|
||||||
gauges[gaugeName].IncTo(value);
|
gauges[gaugeName].Set(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using StackExchange.Redis;
|
namespace MareSynchronosShared.Metrics;
|
||||||
|
|
||||||
namespace MareSynchronosShared.Metrics;
|
|
||||||
|
|
||||||
public class MetricsAPI
|
public class MetricsAPI
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
using System;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MareSynchronosShared.Models;
|
namespace MareSynchronosShared.Models;
|
||||||
|
|
||||||
|
|||||||
@@ -28,14 +28,14 @@ public class FileStatisticsService : IHostedService
|
|||||||
if (!_pastHourFiles.ContainsKey(fileHash))
|
if (!_pastHourFiles.ContainsKey(fileHash))
|
||||||
{
|
{
|
||||||
_pastHourFiles[fileHash] = length;
|
_pastHourFiles[fileHash] = length;
|
||||||
_metrics.SetGaugeTo(MetricsAPI.GaugeFilesUniquePastHour, _pastHourFiles.Count);
|
_metrics.IncGauge(MetricsAPI.GaugeFilesUniquePastHour);
|
||||||
_metrics.SetGaugeTo(MetricsAPI.GaugeFilesUniquePastHourSize, _pastHourFiles.Sum(f => f.Value));
|
_metrics.IncGauge(MetricsAPI.GaugeFilesUniquePastHourSize, length);
|
||||||
}
|
}
|
||||||
if (!_pastDayFiles.ContainsKey(fileHash))
|
if (!_pastDayFiles.ContainsKey(fileHash))
|
||||||
{
|
{
|
||||||
_pastDayFiles[fileHash] = length;
|
_pastDayFiles[fileHash] = length;
|
||||||
_metrics.SetGaugeTo(MetricsAPI.GaugeFilesUniquePastDay, _pastDayFiles.Count);
|
_metrics.IncGauge(MetricsAPI.GaugeFilesUniquePastDay);
|
||||||
_metrics.SetGaugeTo(MetricsAPI.GaugeFilesUniquePastDaySize, _pastDayFiles.Sum(f => f.Value));
|
_metrics.IncGauge(MetricsAPI.GaugeFilesUniquePastDaySize, length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ using Microsoft.AspNetCore.Hosting;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.FileProviders;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Prometheus;
|
using Prometheus;
|
||||||
using System;
|
using System;
|
||||||
|
|||||||
Reference in New Issue
Block a user