Documentation for automated readers
A curated documentation index is available at: https://grafana.com/llms.txt
A complete documentation index is available at: https://grafana.com/llms-full.txt
These indexes can help with page discovery before fetching individual documents.
This page is also available in Markdown, which may be easier for automated readers and AI tools to parse than HTML. The Markdown version is available at https://grafana.com/docs/k6/next/javascript-api/k6-net-grpc/client/client-health-check.md, or by sending Accept: text/markdown to https://grafana.com/docs/k6/next/javascript-api/k6-net-grpc/client/client-health-check/. For broader documentation discovery, the curated index is available at https://grafana.com/llms.txt and the complete index is available at https://grafana.com/llms-full.txt.
This is documentation for the next version of Grafana k6 documentation. For the latest stable release, go to the latest version.
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

