Skip to content

Commit cf475a1

Browse files
committed
feat(health): add deprecation warnings and headers for Livez endpoint; recommend migration to HTTP
1 parent ba282ec commit cf475a1

File tree

4 files changed

+45
-10
lines changed

4 files changed

+45
-10
lines changed

pkg/rpc/server/server.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,12 @@ func (h *HealthServer) Livez(
312312
ctx context.Context,
313313
req *connect.Request[emptypb.Empty],
314314
) (*connect.Response[pb.GetHealthResponse], error) {
315+
// Log deprecation warning
316+
h.logger.Warn().
317+
Str("deprecated_endpoint", "/evnode.v1.HealthService/Livez").
318+
Str("recommended_endpoint", "GET /health/live").
319+
Msg("DEPRECATED: gRPC health endpoint called. Please migrate to HTTP endpoint GET /health/live")
320+
315321
status := pb.HealthStatus_PASS
316322

317323
// For aggregator nodes, check if block production is healthy
@@ -359,9 +365,15 @@ func (h *HealthServer) Livez(
359365
}
360366
}
361367

362-
return connect.NewResponse(&pb.GetHealthResponse{
368+
// Add deprecation warning to response headers
369+
resp := connect.NewResponse(&pb.GetHealthResponse{
363370
Status: status,
364-
}), nil
371+
})
372+
resp.Header().Set("X-Deprecated", "true")
373+
resp.Header().Set("X-Deprecated-Message", "Use GET /health/live instead")
374+
resp.Header().Set("Warning", "299 - \"Deprecated endpoint. Use GET /health/live\"")
375+
376+
return resp, nil
365377
}
366378

367379
// NewServiceHandler creates a new HTTP handler for Store, P2P, Health and Config services

proto/evnode/v1/health.proto

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,18 @@ import "google/protobuf/empty.proto";
66
option go_package = "github.com/evstack/ev-node/types/pb/evnode/v1";
77

88
// HealthService defines the RPC service for the health package
9-
// DEPRECATED: Use HTTP endpoint GET /health/live instead
9+
// DEPRECATED: Use HTTP endpoint GET /health/live instead.
10+
// This service is maintained only for backward compatibility with external frameworks.
11+
// It will be removed in a future version.
1012
service HealthService {
13+
option deprecated = true;
14+
1115
// Livez returns the health status of the node
12-
// DEPRECATED: Use HTTP endpoint GET /health/live instead
13-
rpc Livez(google.protobuf.Empty) returns (GetHealthResponse) {}
16+
// DEPRECATED: Use HTTP endpoint GET /health/live instead.
17+
// This endpoint logs deprecation warnings and adds deprecation headers to responses.
18+
rpc Livez(google.protobuf.Empty) returns (GetHealthResponse) {
19+
option deprecated = true;
20+
}
1421
}
1522

1623
// HealthStatus defines the health status of the node

types/pb/evnode/v1/health.pb.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

types/pb/evnode/v1/v1connect/health.connect.go

Lines changed: 18 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)