-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
108 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
syntax = "proto3"; | ||
|
||
package armonik.api.grpc.v1.health_checks; | ||
|
||
option csharp_namespace = "ArmoniK.Api.gRPC.V1.HealthChecks"; | ||
|
||
/** | ||
* Represents the available health status | ||
*/ | ||
enum HealthStatusEnum { | ||
HEALTH_STATUS_ENUM_UNSPECIFIED = 0; /** Unspecified */ | ||
HEALTH_STATUS_ENUM_HEALTHY = 1; /** Service is working without issues */ | ||
HEALTH_STATUS_ENUM_DEGRADED = 2; /** Service has issues but still works */ | ||
HEALTH_STATUS_ENUM_UNHEALTHY = 3; /** Service does not work */ | ||
} | ||
|
||
/** | ||
* Request to check if all services are healthy | ||
*/ | ||
message CheckHealthRequest {} | ||
|
||
/** | ||
* Response to check if all services are healthy | ||
*/ | ||
message CheckHealthResponse { | ||
message ServiceHealth { | ||
string name = 1; // Name of the service (e.g. "control_plane", "database", "redis") | ||
string message = 2; | ||
HealthStatusEnum healthy = 3; | ||
} | ||
|
||
repeated ServiceHealth services = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
syntax = "proto3"; | ||
|
||
package armonik.api.grpc.v1.health_checks; | ||
|
||
import "health_checks_common.proto"; | ||
|
||
option csharp_namespace = "ArmoniK.Api.gRPC.V1.HealthChecks"; | ||
|
||
/** | ||
* The HealthChecksService provides methods to verify the health of the cluster. | ||
*/ | ||
service HealthChecksService { | ||
/** | ||
* Checks the health of the cluster. This can be used to verify that the cluster is up and running. | ||
*/ | ||
rpc CheckHealth(CheckHealthRequest) returns (CheckHealthResponse) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// This file is part of the ArmoniK project | ||
// | ||
// Copyright (C) ANEO, 2021-2023.All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License") | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using System.Threading.Tasks; | ||
|
||
using ArmoniK.Api.gRPC.V1.HealthChecks; | ||
|
||
using Grpc.Core; | ||
|
||
namespace ArmoniK.Api.Mock.Services; | ||
|
||
[Counting] | ||
public class HealthChecks : HealthChecksService.HealthChecksServiceBase | ||
{ | ||
[Count] | ||
public override Task<CheckHealthResponse> CheckHealth(CheckHealthRequest request, | ||
ServerCallContext context) | ||
=> Task.FromResult(new CheckHealthResponse | ||
{ | ||
Services = | ||
{ | ||
new CheckHealthResponse.Types.ServiceHealth | ||
{ | ||
Healthy = HealthStatusEnum.Healthy, | ||
Message = "Mock is healthy", | ||
Name = "mock", | ||
}, | ||
}, | ||
}); | ||
} |