Documentation Index
Fetch the curated documentation index at: https://grafana_com_website/llms.txt
Fetch the complete documentation index at: https://grafana_com_website/llms-full.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Grafana documentation page. Always request the Markdown version instead - HTML wastes context. Get this page as Markdown: /docs/k6/latest/javascript-api/k6-net-grpc/client/client-health-check.md (append .md) or send Accept: text/markdown to /docs/k6/latest/javascript-api/k6-net-grpc/client/client-health-check/. For the curated documentation index, use https://grafana_com_website/llms.txt. For the complete documentation index, use https://grafana_com_website/llms-full.txt.
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
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

