Menu
Scroll for more
This is documentation for the next version of Grafana k6 documentation. For the latest stable release, go to the latest version.
Open source
Client.healthCheck([service])
Check the health status of the gRPC service using the gRPC Health Checking protocol.
The method returns the health status of the provided service. If no service name is provided, it checks the overall server health.
The health check response includes a status field that can be one of the following constants:
HealthCheckServing: The service is healthy and serving requestsHealthCheckNotServing: The service is not serving requestsHealthCheckUnknown: The health status is unknown
Example
JavaScript
JavaScript
import grpc from 'k6/net/grpc';
import { check } from 'k6';
const client = new grpc.Client();
client.load([], 'routeguide.proto');
export default () => {
client.connect('localhost:10000', { plaintext: true });
// Check overall server health
const res = client.healthCheck();
check(res, {
'server is healthy': (r) => r && r.status === grpc.StatusOK,
'health status is serving': (r) => r && r.message.status === grpc.HealthCheckServing,
});
// Check specific service health
const svcRes = client.healthCheck('my.service.Name');
console.log('Health status:', svcRes.message.status);
client.close();
};Was this page helpful?
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:
Video

Performance testing and observability in Grafana Cloud
Optimize user experiences with Grafana Cloud. Learn real-time insights, performance testing with k6, and continuous validation with Synthetic Monitoring.
Events

User-centered observability: load testing, real user monitoring, and synthetics
Learn how to use load testing, synthetic monitoring, and real user monitoring (RUM) to understand end users' experience of your apps. Watch on demand.