Skip to content

Commit 0cc41fb

Browse files
Adding Span Grpc Health Check Service (#91)
1 parent 92ea895 commit 0cc41fb

4 files changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.expedia.www.haystack.agent.span.service;
2+
3+
import io.grpc.health.v1.HealthCheckRequest;
4+
import io.grpc.health.v1.HealthCheckResponse;
5+
import io.grpc.health.v1.HealthGrpc;
6+
import io.grpc.stub.StreamObserver;
7+
8+
public class SpanGrpcHealthService extends HealthGrpc.HealthImplBase {
9+
10+
@Override
11+
public void check(HealthCheckRequest request, StreamObserver<HealthCheckResponse> responseObserver) {
12+
responseObserver.onNext(HealthCheckResponse.newBuilder().setStatus(HealthCheckResponse.ServingStatus.SERVING).build());
13+
responseObserver.onCompleted();
14+
}
15+
}

agent-providers/span/src/main/java/com/expedia/www/haystack/agent/span/spi/SpanAgent.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.expedia.www.haystack.agent.core.BaseAgent;
2121
import com.expedia.www.haystack.agent.span.enricher.Enricher;
2222
import com.expedia.www.haystack.agent.span.service.SpanAgentGrpcService;
23+
import com.expedia.www.haystack.agent.span.service.SpanGrpcHealthService;
2324
import com.typesafe.config.Config;
2425
import io.grpc.Server;
2526
import io.grpc.netty.NettyServerBuilder;
@@ -55,6 +56,7 @@ public void initialize(final Config config) throws IOException {
5556
.permitKeepAliveWithoutCalls(true)
5657
.permitKeepAliveTime(KEEP_ALIVE_TIME_IN_SECONDS, TimeUnit.SECONDS)
5758
.addService(new SpanAgentGrpcService(dispatchers, enrichers))
59+
.addService(new SpanGrpcHealthService())
5860
.build()
5961
.start();
6062

api/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
<groupId>io.grpc</groupId>
2323
<artifactId>grpc-all</artifactId>
2424
</dependency>
25+
<dependency>
26+
<groupId>io.grpc</groupId>
27+
<artifactId>grpc-services</artifactId>
28+
</dependency>
2529
</dependencies>
2630

2731
<build>

pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@
124124
<version>${grpc.version}</version>
125125
</dependency>
126126

127+
<dependency>
128+
<groupId>io.grpc</groupId>
129+
<artifactId>grpc-services</artifactId>
130+
<version>${grpc.version}</version>
131+
</dependency>
132+
127133
<dependency>
128134
<groupId>com.google.protobuf</groupId>
129135
<artifactId>protobuf-java-util</artifactId>

0 commit comments

Comments
 (0)