mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-13 12:44:15 +01:00
minor refactoring
This commit is contained in:
parent
6c243d0247
commit
f9e4fd4f2d
38 changed files with 1391 additions and 854 deletions
|
|
@ -0,0 +1,39 @@
|
|||
using Grpc.Core;
|
||||
using MareSynchronosServices.Metrics;
|
||||
using MareSynchronosShared.Protos;
|
||||
|
||||
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