---
title: "gRPC | Grafana Cloud documentation"
description: "Learn about the metrics you can capture using gRPC Go"
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Configure gRPC Go to generate Prometheus metrics

[gRPC Go](https://github.com/grpc/grpc-go) supports Interceptors which is middleware that gRPC Server executes before the request is passed to the user’s application logic. It is a perfect way to implement common patterns: auth, logging, and monitoring.

To use Interceptors in chains, refer to [go-grpc-middleware](https://github.com/mwitkow/go-grpc-middleware).

This library requires Go 1.9 or later.

To configure gRPC Go to generate Prometheus metrics, complete the following steps:

1. Navigate to [go-grpc-middleware](https://github.com/mwitkow/go-grpc-middleware).
2. Complete the steps in the [README](https://github.com/grpc-ecosystem/go-grpc-middleware/blob/main/README.md).
3. Verify the presence of the following metrics in Prometheus:
   
   - grpc\_server\_handled\_total
   - grpc\_server\_handling\_seconds\_bucket

## Metrics

Expand table

| **Metric**                                                                                                                           | **Key Performance Indicator(KPI)**                                                                                                                                                                                                                                                                            |
|--------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Requests<br /><br /><br /><br />grpc\_server\_handled\_total                                                                         | Request Rate<br /><br /><br /><br />rate(grpc\_server\_handled\_total\[5m])                                                                                                                                                                                                                                   |
| Errors<br /><br /><br /><br />grpc\_server\_handled\_total{grpc\_code!=“OK”}                                                         | Error Ratio<br /><br /><br /><br />rate(grpc\_server\_handled\_total{grpc\_code!=“OK”}\[5m])/ rate(grpc\_server\_handled\_total\[5m])                                                                                                                                                                         |
| Latency<br /><br /><br /><br />grpc\_server\_handling\_seconds\_count<br /><br /><br /><br />grpc\_server\_handling\_seconds\_bucket | Latency Average<br /><br /><br /><br />rate(grpc\_server\_handling\_seconds\_count\[5m])/ rate(grpc\_server\_handling\_seconds\_count\[5m])<br /><br /><br /><br />Latency P99<br /><br /><br /><br />```<br />histogram_quantile (0.99,sum (rate(grpc_server_handling_seconds_bucket[1m])) by (le))<br />``` |

## Alerts

Expand table

| **KPI**                                            | **Alerts**                                                                                                                  |
|----------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|
| Request Rate                                       | **RequestRateAnomaly**                                                                                                      |
| Error Rate                                         | **ErrorRatioBreach**<br /><br /><br /><br />**ErrorBuildup** based on a 99.9 SLO                                            |
| Latency Average<br /><br /><br /><br />Latency P99 | **LatencyAverageBreach**<br /><br /><br /><br />**LatencyAverageAnomaly**<br /><br /><br /><br />**LatencyP99ErrorBuildup** |

## Service KPI dashboard

This dashboard has the following KPIs for resources and requests:

- Request Rate
- Latency Average
- Latency P99
- Error Rate
- CPU %
- CPU Cores Used
- CPU Throttle
- Memory %
- Memory Bytes
- Disk Usage
- Network Usage
