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:
parent
1bab006af1
commit
1f60819dee
9 changed files with 770 additions and 895 deletions
22
src/cartservice/HealthImpl.cs
Normal file
22
src/cartservice/HealthImpl.cs
Normal 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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue