---
title: Monitoring gRPC services: health checks, status codes and the proxy in between
description: A TCP check on the port passes while every gRPC call fails, and a proxy's 403 page reaches your client as PERMISSION_DENIED. How the standard health check answers, which status codes mean up or down, how clients turn plain HTTP into gRPC codes, real runs against a local server and our own website, and how to watch a gRPC service from outside.
canonical: https://watchfor.io/blog/monitoring-grpc-services
---

# Monitoring gRPC services: health checks, status codes and the proxy in between

2026-11-30 · WatchFor Team · Guides · guides, api, networking, monitoring

A TCP check on the port passes while every gRPC call fails, and a proxy's 403 page reaches your client as PERMISSION_DENIED. How the standard health check answers, which status codes mean up or down, how clients turn plain HTTP into gRPC codes, real runs against a local server and our own website, and how to watch a gRPC service from outside.

Point a TCP check at a gRPC server's port and it tells you one thing: the
port accepts connections. In the runs below, a plain HTTP/1.1 server sat on
the port. The TCP connect succeeded. Every gRPC call failed.

The second trap is worse because it looks like an answer. When something in
front of the service replies instead of the service, a load balancer during a
deploy or a CDN that does not pass gRPC through, the client still reports a
gRPC status code. A proxy's `403` page reaches your logs as
`PERMISSION_DENIED`, and the first suspect is your own authorization code.

This guide covers what a gRPC monitor has to get right: the standard health
check, which status codes mean "up but refusing me" and which mean "down",
how clients turn plain HTTP answers into status codes, the transport, and
deadlines. Every output below comes from a real run with grpc-go 1.85, against
a local server and against our own website. Then it shows the free
[gRPC Health Checker](/grpc-health-checker) and the new gRPC monitor.

## The standard health check

gRPC has one standard way to ask "are you up": the service
`grpc.health.v1.Health`, defined in
[health.proto](https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto).
Its `Check` method takes a service name and returns a status: `UNKNOWN`,
`SERVING`, `NOT_SERVING`, or `SERVICE_UNKNOWN` (that last one is "Used only by
the Watch method."). The rules, from the
[health checking protocol](https://github.com/grpc/grpc/blob/master/doc/health-checking.md):

- **An empty name asks about the whole server.** "The server should use an
  empty string as the key for server's overall health status".
- **A registered name** gets an `OK` call status, with the status field set to
  `SERVING` or `NOT_SERVING`.
- **An unregistered name** is not `NOT_SERVING`: "If the service name is not
  registered, the server returns a `NOT_FOUND` GRPC status." Matching is exact,
  "without support of any kind of wildcard matching".
- **A server without the health service** answers like any server asked for a
  method it does not have. "The client should be able to handle the case where
  server does not have the Health service."
- **Set a deadline:** "a deadline should be set on the rpc."

Here is what that looks like. The client is a few lines of grpc-go with a
3-second deadline:

```go
creds := credentials.NewTLS(&tls.Config{InsecureSkipVerify: *skip})
if *plain {
	creds = insecure.NewCredentials()
}
conn, err := grpc.NewClient(flag.Arg(0), grpc.WithTransportCredentials(creds))
// …
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
resp, err := healthpb.NewHealthClient(conn).Check(ctx,
	&healthpb.HealthCheckRequest{Service: *service})
```

Two local servers: one registers the health service and marks
`acme.orders.v1.Orders` as not serving, the other registers nothing.

```go
h := health.NewServer() // "" starts as SERVING
h.SetServingStatus("acme.orders.v1.Orders", healthpb.HealthCheckResponse_NOT_SERVING)
healthpb.RegisterHealthServer(s, h)
```

```bash
$ ./health-check -plaintext 127.0.0.1:50051
status: SERVING
$ ./health-check -plaintext -service acme.orders.v1.Orders 127.0.0.1:50051
status: NOT_SERVING
$ ./health-check -plaintext -service acme.orders.v1.Ordrs 127.0.0.1:50051
rpc error: code = NotFound desc = unknown service
$ ./health-check -plaintext 127.0.0.1:50052
rpc error: code = Unimplemented desc = unknown service grpc.health.v1.Health
```

Two lessons. A typo in the service name (`Ordrs`) comes back as `NOT_FOUND`,
not `NOT_SERVING`; a monitor that alerts only on `NOT_SERVING` never fires, and
one that treats every error as "down" cannot tell a typo from an outage. And
`UNIMPLEMENTED` on `Health/Check` means a gRPC server answered and does not
register the health service. It says nothing about whether your service works.

Counting `UNIMPLEMENTED` as healthy is the default of at least one load
balancer. An AWS Application Load Balancer's gRPC health check calls
`/AWS.ALB/healthcheck` unless you set a path, and its success codes default to
`12`, which is `UNIMPLEMENTED`: "The default value is 12."
([AWS docs](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/target-group-health-checks.html)).
With both defaults, a target passes as long as a gRPC server answers that it
has no such method.

## Status codes: up but refusing, or down

gRPC has 17 status codes. The
[status code reference](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md)
also says which side generates each one, and that is what a monitor needs:

| Code | Meaning in the docs | What it tells a monitor |
| --- | --- | --- |
| `OK` (0) | "Not an error; returned on success." | Up. |
| `UNAUTHENTICATED` (16) | "The request does not have valid authentication credentials for the operation." | Up and refusing, if the server sent it. |
| `PERMISSION_DENIED` (7) | "The caller does not have permission to execute the specified operation." | Up and refusing, if the server sent it. |
| `UNIMPLEMENTED` (12) | Generated by the server for "Method not found at server". | Up, wrong method or no such service. |
| `NOT_FOUND` (5), `INVALID_ARGUMENT` (3) and others | "The following status codes are never generated by the library" | Your application code answered. |
| `UNAVAILABLE` (14) | "The service is currently unavailable." Also server shutting down, a broken connection, a keepalive timeout. | Down, or briefly unreachable. |
| `DEADLINE_EXCEEDED` (4) | "The deadline expired before the operation could complete." | Down or too slow. |

`UNKNOWN`, `INTERNAL`, `RESOURCE_EXHAUSTED` and `CANCELLED` are in between: an
exception on the server, a parsing error, a message over the size limit, a
cancelled call. Which ones count as healthy depends on the endpoint. The
reference says the same about retries: "there is no fixed list of status codes
on which it is appropriate to retry in all applications."

An endpoint that must refuse anonymous calls is the clearest case. Call it
without a token: `UNAUTHENTICATED` from the server proves the server is up and
its authentication is in place. `OK` would be the alarm.

There is a catch. Three of the "up" codes can also be made up by the client,
from an answer no gRPC server sent.

## When a proxy answers: the HTTP-to-gRPC mapping

A gRPC call is an HTTP/2 request, and its status travels in the trailers:
"Status must be sent in **Trailers** even if the status code is OK"
([the HTTP/2 protocol doc](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md)).
When a load balancer or CDN answers instead, there is no `grpc-status` at all.
Clients then follow the
[HTTP to gRPC status mapping](https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md):

| HTTP status from the proxy | gRPC status the client reports |
| --- | --- |
| 400 | `INTERNAL` |
| 401 | `UNAUTHENTICATED` |
| 403 | `PERMISSION_DENIED` |
| 404 | `UNIMPLEMENTED` |
| 429, 502, 503, 504 | `UNAVAILABLE` |
| anything else | `UNKNOWN` |

The table is "to be used _only_ for clients that received a response that did
not include grpc-status. If grpc-status was provided, it _must_ be used." Even
a bare `200` maps to `UNKNOWN`, "because there should be a grpc-status in case
of truly OK response."

Our website is a good test subject, because it is not a gRPC server. It runs
behind Cloudflare, and Cloudflare
[documents](https://developers.cloudflare.com/network/grpc-connections/) that
"When gRPC is not enabled on a zone, Cloudflare will respond to gRPC requests
with a `403 Forbidden` response." Here is the health check against it:

```bash
$ ./health-check watchfor.io:443
rpc error: code = PermissionDenied desc = unexpected HTTP status code received from server: 403 (Forbidden); transport: received unexpected content-type "text/html; charset=UTF-8"
```

grpc-go is helpful here: the description names the HTTP status and the content
type. Many dashboards and logs keep only `code = PermissionDenied`. The same
request with curl shows what actually came back:

```bash
$ curl -s -o /dev/null -D - --http2 -X POST \
    -H 'content-type: application/grpc' -H 'te: trailers' \
    https://watchfor.io/grpc.health.v1.Health/Check \
  | grep -iE '^(HTTP|content-type|server|grpc-)'
HTTP/2 403
content-type: text/html; charset=UTF-8
server: cloudflare
```

No `grpc-status` header, an HTML body. That is the tell: a `PERMISSION_DENIED`
that arrives with `text/html` was never your service's decision.

The free [gRPC Health Checker](/grpc-health-checker) runs the same health
check from three regions at once and says this in words:

![The free gRPC Health Checker on watchfor.io:443: HTTP 403 answered by a proxy, no gRPC server answered. The explanation says a proxy or web server answered HTTP 403 (text/html) before the call reached a gRPC server, and PERMISSION_DENIED is what the gRPC client made of that answer. Vilnius, Cape Town and Tokyo each got HTTP 403 from a proxy in 29 to 37 ms. Timing: DNS under 1 ms, connect 6 ms, TLS handshake 11 ms, RPC 9 ms, total 34 ms. TLS 1.3, ALPN h2, certificate verified, expiring Feb 2, 2027, in 64 days](/blog/monitoring-grpc-services-proxy-403.webp)

Everything below the call is healthy. The TCP connect took 6 ms, TLS 1.3 was
negotiated with ALPN `h2`, and the certificate verified with 64 days left. A
TCP or TLS check would be green. Only the call fails, and only the HTTP answer
says why.

## Transport: HTTP/2, ALPN and plaintext

gRPC runs over HTTP/2, and a server has to agree to it before the first call.

**Over TLS, that agreement is ALPN.** [RFC 9113](https://www.rfc-editor.org/rfc/rfc9113)
names the ALPN identifier for HTTP/2 over TLS: `h2`. Since
[grpc-go 1.67](https://github.com/grpc/grpc-go/releases/tag/v1.67.0), "clients
and servers will now reject TLS connections that don't support ALPN." A TLS
server that does not negotiate ALPN (here `openssl s_server`) completes the
handshake, and the client refuses it anyway:

```bash
$ ./health-check -insecure 127.0.0.1:50054
rpc error: code = Unavailable desc = connection error: desc = "transport: authentication handshake failed: credentials: cannot check peer: missing selected ALPN property. If you upgraded from a grpc-go version earlier than 1.67, your TLS connections may have stopped working due to ALPN enforcement. For more details, see: https://github.com/grpc/grpc-go/issues/434"
```

A proxy that terminates TLS without negotiating `h2` fails the same way for
every grpc-go client (1.67 or later) that connects through it.

**Without TLS, it is HTTP/2 with prior knowledge.** The client assumes the
server speaks HTTP/2 and sends the HTTP/2 connection preface straight away
([RFC 9113](https://www.rfc-editor.org/rfc/rfc9113)). If the port speaks
something else, the connection opens and the call fails. This is the
HTTP/1.1 server from the introduction: the port check passes, the call does
not.

```bash
$ nc -zv 127.0.0.1 50053
Connection to 127.0.0.1 50053 port [tcp/*] succeeded!
$ ./health-check -plaintext 127.0.0.1:50053
rpc error: code = Unavailable desc = connection error: desc = "error reading server preface: http2: frame too large"
```

And the TLS switch set the wrong way round, a TLS client against a plaintext
server:

```bash
$ ./health-check 127.0.0.1:50051
rpc error: code = Unavailable desc = connection error: desc = "transport: authentication handshake failed: tls: first record does not look like a TLS handshake"
```

All three are `UNAVAILABLE`. The code alone cannot tell you whether the server
is down or the client is speaking the wrong protocol; the message can.

## Deadlines

"By default, gRPC does not set a deadline which means it is possible for a
client to end up waiting for a response effectively forever"
([gRPC deadlines guide](https://grpc.io/docs/guides/deadlines/)). For a monitor
that is the worst outcome: a hung check reports nothing, so nothing alerts.
Every check needs a deadline, and when it passes the call ends with
`DEADLINE_EXCEEDED`. Set it from what the call normally takes, not from what
you hope it takes.

## Watching a gRPC service from outside

The free checker answers once. The new [gRPC monitor](/grpc-monitoring) makes
the same call on a schedule, from the locations you choose, and alerts once a
failure is confirmed. The target is `host:port` with no scheme; TLS is a
switch, on by default. Each check is one of two kinds:

- **Health check:** `grpc.health.v1.Health/Check` for a service name, or the
  empty name for the whole server, compared with the status you expect
  (`SERVING` by default, `NOT_SERVING`, or any). No `.proto` file and no
  reflection needed.
- **Unary call:** a method of your own, `package.Service/Method`, with a JSON
  request and assertions on the JSON reply. The request and reply types are
  read through server reflection (`grpc.reflection.v1`, then `v1alpha`).

![Creating a gRPC monitor in the Acme demo organization: Use TLS is on, the method is acme.orders.v1.Orders/GetStatus, the JSON request sets region to eu, and one response assertion checks that $.status equals SERVING](/blog/monitoring-grpc-services-form.webp)

Assertions use the reply as JSON, with camelCase field names and default
values included. Paths are dot paths, `$.status` or `$.items.0.name` (an index
is `.0`, not `[0]`), and the operators are equals, not equals, contains,
exists, greater than, less than and matches a regex.

Then the parts that come from the rules above:

- **Accepted status codes.** `OK` by default. **Must refuse anonymous calls**
  accepts `UNAUTHENTICATED` instead; any of the 17 codes can be picked.
- **Where the status came from.** Every check records whether the status
  arrived in the server's own trailers, was derived from a proxy's plain HTTP
  answer (shown with its HTTP status and content type), or came from the check
  itself: the deadline passed, the connection was lost, or the reply was over
  4 MB. Only a status the server sent can count as accepted, so a proxy's 401
  never passes for your server's `UNAUTHENTICATED`.
- **The handshake, read by the check.** The check opens the connection and
  does the TLS handshake itself. The certificate's expiry and the negotiated
  ALPN are read even when the call then fails, and a server that does not
  agree to HTTP/2 is named as such. **Certificate expiring** warns at 14 days.
- **TLS options.** A custom CA for a private authority, a server name (SNI),
  an `:authority` override, skipping verification, and a client certificate
  for mutual TLS. The client key and any metadata value marked secret (an
  `authorization` token, an API key) are stored encrypted and never shown
  again.
- **Time per phase.** Connect, TLS, RPC and total on every check.
- **A deadline on every check,** 1 to 30 seconds for the whole check
  (10 by default).

In the Acme demo organization, the **Orders gRPC API** monitor makes a unary
call every minute. The demo shows its target under a documentation name,
`orders.acme-shop.example:443`.

![The Orders gRPC API monitor in the Acme demo organization: up, 100.00% uptime since it was created, no incidents in the last 24 hours. The gRPC status card shows 0 OK as the accepted status, the method HelloService/SayHello and 1 assertion passed. The response time card shows a last RPC time of 118 ms, with connect and RPC times and a total, and 74 ms min, 128 ms avg and 231 ms max](/blog/monitoring-grpc-services-monitor.webp)

The time per phase is charted for every successful check, so a slow handshake
and a slow method do not look the same:

![Response time by phase for the Orders gRPC API over the last hour: connect 126 ms, RPC 126 ms and total 768 ms, with the connect and RPC time of each check charted across the hour](/blog/monitoring-grpc-services-phases.webp)

When an assertion fails, the incident says which path, what was expected and
what came back:

![An Assertion failed incident, critical, on the Orders gRPC API. What happened: the call completed, but its response did not match what you assert. Expected: every assertion on the response of HelloService/SayHello holds. Detected: $.reply must contain "Acme v2" — the response has "hello Acme". Confirmed from Frankfurt, London and Singapore before the incident opened](/blog/monitoring-grpc-services-incident.webp)

### When it alerts

| Rule | Default | Fires when |
| --- | --- | --- |
| gRPC check failed | on, locked, critical | The name does not resolve, the connection or handshake fails, the server does not agree to HTTP/2, the endpoint does not answer in gRPC, the deadline passes, or the status code is not accepted. |
| Service not serving | on for health checks, critical | The health status is not the one you expect, such as `NOT_SERVING`. |
| Assertion failed | on for unary calls, critical | The call completed, but an assertion on the reply does not hold. |
| Certificate expiring | on with TLS, warning | Fewer than 14 days left. |
| Service list changed | on with service tracking, warning | A service disappeared from, or appeared in, the list reflection returns. |
| Slow response | off, warning | The RPC itself, after connect and TLS, takes longer than 1000 ms. |

**Service tracking** is optional: with reflection on, each check lists the
server's services and compares them with the list you accepted. The
[reflection docs](https://github.com/grpc/grpc/blob/master/doc/server-reflection.md)
note that "a server is under no obligation to return a complete list of all
methods it supports", which is why the monitor compares with a list you
accepted instead of judging the list on its own. An owner or admin accepts a
new list on the monitor page.

The gRPC monitor is on every plan, Free included. It counts as one monitor
and runs at your plan's intervals. The settings are in the
[docs](/docs/monitors/network#grpc).

## What it does not do

- **Unary calls only.** Server-streaming, client-streaming and bidirectional
  methods are refused with a message that says so, and `Health/Watch` is not
  used.
- **Reflection for calls.** A unary call and service tracking need server
  reflection, which "is _not_ automatically enabled on a gRPC server"
  ([reflection guide](https://grpc.io/docs/guides/reflection/)). There is no
  `.proto` upload yet. A health check works without reflection.
- **gRPC over HTTP/2 only.** gRPC-Web and Connect endpoints are not checked.
- **One endpoint, one call.** Each check opens one connection and makes one
  judged call. It is not a load test, and it sees your service from the
  outside, through whatever your clients go through.

## A short checklist

1. Register `grpc.health.v1.Health` on every server, and set a status for the
   empty name and for each service name you will check.
2. Check the address your clients use, through the load balancer, not only
   the pod behind it.
3. Decide per endpoint which status codes mean "up". `UNAUTHENTICATED` is the
   right answer for a protected method called without a token.
4. Log whether `grpc-status` was present. A status without trailers came from
   a proxy.
5. Put a deadline on every call, the monitor's included.
6. Watch the certificate and the negotiated ALPN in the same check as the
   call.

To try one endpoint now, the free [gRPC Health Checker](/grpc-health-checker)
needs no account: `host:port`, TLS on or off, an optional service name.

---

Canonical page: https://watchfor.io/blog/monitoring-grpc-services · All articles: https://watchfor.io/blog/all.md · Site guide: https://watchfor.io/llms.txt
