Overview
Silky provides RPC health check capabilities through the Silky.HealthChecks.Rpc module. In container orchestration environments (Kubernetes, Docker Swarm), health checks are essential for liveness and readiness probes. In microservice architectures, they underpin service governance (fault detection, traffic management).
Silky.HealthChecks.Rpc integrates AspNetCore.HealthChecks.UI and exposes two endpoint formats:
- UI Format (
/healthz): Returns the standard HealthChecks.UI JSON — plugs directly into a HealthChecks UI dashboard - API Format: Returns a compact Silky JSON format suitable for programmatic health evaluation
Installation
<PackageReference Include="Silky.HealthChecks.Rpc" Version="3.9.2" />
RPC Microservice Health Check
Register Services
public void ConfigureServices(IServiceCollection services)
{
services.AddHealthChecks()
.AddSilkyRpc(); // RPC health check
services.AddSilkyServerHealthCheck(); // optional: active server-side health reporting
}
Middleware Mode (Simple)
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
// HealthChecks.UI JSON format (suitable for UI dashboard)
app.UseSilkyRpcHealthCheck("/silkyrpc/healthz");
// Silky API JSON format (suitable for programmatic checks)
app.UseSilkyRpcHealthCheckApi("/api/silkyrpc/healthz");
app.UseRouting();
app.UseEndpoints(endpoints => { endpoints.MapSilkyRpcServices(); });
}
Endpoint Routing Mode (with Authorization)
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapSilkyRpcServices();
endpoints.MapSilkyRpcHealthChecks("/api/silkyrpc/health");
});
}
Gateway Health Check
Register Services
public void ConfigureServices(IServiceCollection services)
{
services.AddHealthChecks()
.AddSilkyRpc()
.AddSilkyGateway(); // gateway-specific health checks
}
Expose Endpoint
app.UseEndpoints(endpoints =>
{
endpoints.MapSilkyRpcServices();
endpoints.MapSilkyRpcHealthChecks("/api/health");
});
Kubernetes Integration
# Deployment liveness/readiness probes
livenessProbe:
httpGet:
path: /api/silkyrpc/healthz
port: 5000
initialDelaySeconds: 10
periodSeconds: 30
readinessProbe:
httpGet:
path: /api/silkyrpc/healthz
port: 5000
initialDelaySeconds: 5
periodSeconds: 10
Health Check Response Format
HealthChecks.UI format (/healthz):
{
"status": "Healthy",
"results": {
"silkyrpc": {
"status": "Healthy",
"description": "All RPC endpoints are healthy",
"data": {}
}
}
}
Silky API format (/api/silkyrpc/healthz):
{
"isHealth": true,
"serverDescriptors": [
{
"hostName": "OrderService",
"isHealth": true,
"endpoints": ["192.168.1.10:2200"]
}
]
}
