-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
45 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
41 changes: 41 additions & 0 deletions
41
src/main/scala/com/rawlabs/das/server/HealthCheckServiceGrpcImpl.scala
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,41 @@ | ||
/* | ||
* Copyright 2024 RAW Labs S.A. | ||
* | ||
* Use of this software is governed by the Business Source License | ||
* included in the file licenses/BSL.txt. | ||
* | ||
* As of the Change Date specified in that file, in accordance with | ||
* the Business Source License, use of this software will be governed | ||
* by the Apache License, Version 2.0, included in the file | ||
* licenses/APL.txt. | ||
*/ | ||
|
||
package com.rawlabs.das.server | ||
|
||
import com.rawlabs.protocol.das.services.{HealthCheckRequest, HealthCheckResponse, HealthCheckServiceGrpc} | ||
import com.typesafe.scalalogging.StrictLogging | ||
import io.grpc.stub.StreamObserver | ||
|
||
/** | ||
* gRPC service implementation for health checks. | ||
*/ | ||
class HealthCheckServiceGrpcImpl extends HealthCheckServiceGrpc.HealthCheckServiceImplBase with StrictLogging { | ||
|
||
/** | ||
* Check the health of the service. | ||
* | ||
* @param request the health check request | ||
* @return the health check response | ||
*/ | ||
override def check(request: HealthCheckRequest, responseObserver: StreamObserver[HealthCheckResponse]): Unit = { | ||
responseObserver.onNext( | ||
HealthCheckResponse | ||
.newBuilder() | ||
.setStatus(HealthCheckResponse.ServingStatus.SERVING) | ||
.setDescription(s"Version: ${BuildInfo.version}") | ||
.build() | ||
) | ||
responseObserver.onCompleted() | ||
} | ||
|
||
} |