mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-30 19:03:38 +01:00
rework metrics
This commit is contained in:
parent
7c1395df77
commit
ace31926db
21 changed files with 179 additions and 244 deletions
|
|
@ -1,40 +0,0 @@
|
|||
using Grpc.Core;
|
||||
using MareSynchronosServices.Metrics;
|
||||
using MareSynchronosShared.Protos;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MareSynchronosServices.Services;
|
||||
|
||||
public class MetricsService : MareSynchronosShared.Protos.MetricsService.MetricsServiceBase
|
||||
{
|
||||
private readonly MareMetrics metrics;
|
||||
|
||||
public MetricsService(MareMetrics metrics)
|
||||
{
|
||||
this.metrics = metrics;
|
||||
}
|
||||
|
||||
public override Task<Empty> IncreaseCounter(IncreaseCounterRequest request, ServerCallContext context)
|
||||
{
|
||||
metrics.IncCounterBy(request.CounterName, request.Value);
|
||||
return Task.FromResult(new Empty());
|
||||
}
|
||||
|
||||
public override Task<Empty> SetGauge(SetGaugeRequest request, ServerCallContext context)
|
||||
{
|
||||
metrics.SetGaugeTo(request.GaugeName, request.Value);
|
||||
return Task.FromResult(new Empty());
|
||||
}
|
||||
|
||||
public override Task<Empty> DecGauge(GaugeRequest request, ServerCallContext context)
|
||||
{
|
||||
metrics.DecGaugeBy(request.GaugeName, request.Value);
|
||||
return Task.FromResult(new Empty());
|
||||
}
|
||||
|
||||
public override Task<Empty> IncGauge(GaugeRequest request, ServerCallContext context)
|
||||
{
|
||||
metrics.IncGaugeBy(request.GaugeName, request.Value);
|
||||
return Task.FromResult(new Empty());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue