Introducing super basic health check for cart service (#44)

* Introducing super basic health check for cart service
  - Generated C# proto implementation for grpc health check
  - Moved all C# protos to a dedicated folder
  - Implemented basic health checking to ping CartStore (which is Redis in default implementation)
  - Base plumbing for health checks

* Introducing super basic health check for cart service

- Generated C# proto implementation for grpc health check
- Moved all C# protos to a dedicated folder
- Implemented basic health checking to ping CartStore (which is Redis in default implementation)
- Base plumbing for health checks

* Changing Ping health probe to call Redis Cache Ping method
This commit is contained in:
Simon Zeltser 2018-09-21 19:09:52 +00:00 committed by Ahmet Alp Balkan
parent 1bab006af1
commit 1f60819dee
9 changed files with 770 additions and 895 deletions

View file

@ -0,0 +1,22 @@
using System;
using cartservice.interfaces;
using Grpc.Health.V1;
using StackExchange.Redis;
using static Grpc.Health.V1.Health;
namespace cartservice {
internal class HealthImpl : HealthBase {
private ICartStore dependency { get; }
public HealthImpl (ICartStore dependency) {
this.dependency = dependency;
}
public HealthCheckResponse Check (HealthCheckRequest request) {
Console.WriteLine ("Checking CartService Health");
return new HealthCheckResponse {
Status = dependency.Ping() ? HealthCheckResponse.Types.ServingStatus.Serving : HealthCheckResponse.Types.ServingStatus.NotServing
};
}
}
}