Join our biggest community event of the year—get a first look at Grafana 12, plus a science fair and sessions on Prometheus, OpenTelemetry, and more. Save 20% with 3+ or 10% when you bring a friend.
Prometheus provides a variety of metric types that can be used to track different aspects of your service’s performance. You can map custom or non-standard Prometheus metrics to RED KPIs to leverage the features of Asserts. These KPIs include request rate, error rate, latency average, and latency quantile.
Common inputs required for all KPI mappings
When you add a new mapping, you must provide the following information:
Field
Description
Source metric
Name of the Prometheus metric to be used as input
Metric source
Identifier for the source of the metric, for example, grpc, springboot, loopback, and so on
Service name
Label from the metric that identifies the service
Request context labels
One or more labels that together uniquely identify each request. When there are multiple labels, you must specify a separator character to join the label values.
Request type
Type of request being tracked. Common values include inbound and outbound. You can also specify a custom value.
Note
When defining the KPIs individually, maintain consistency in the Request context labels and Request type field definitions. After you have provided all the required inputs, the mapped KPI displays as a metric chart. You can review the KPI metric for any selected service, request, and time window. This enables a feedback loop to validate if the KPI is providing expected results.
KPI-specific inputs
The following sections provide an overview of specific inputs that you enter depending on the KPI you are mapping.
Request rate
Field
Description
Metric type
counter or gauge
Error rate
Field
Description
Metric type
counter or gauge
Error type
Label in the metric containing the error code, for example, status_code
Error type mapping rules
Specify how error codes are grouped into error types using:
Equality: status_code = "500"
Regex: status_code =~ "5.."
Latency average
Field
Description
Latency average type
Gauge: Source metric is the average latency
Sum and Count: Two count metrics, including one for total latency and one for request count
Latency unit
seconds, milliseconds, or microseconds
Latency Quantile
Field
Description
Latency unit
seconds, milliseconds, or microseconds.
Quantiles
One or more quantiles to extract: 50%, 75%, 90%, and 99%.
Map all KPIs using a histogram
Instead of mapping each KPI individually, you can derive the request rate, latency average, latency quantile, and error rate from a single histogram.
Field
Description
Histogram metric base name
Prefix of the histogram metric before _sum, _count, _bucket. Example: for http_request_duration_seconds_sum, use http_request_duration_seconds.
Latency unit
seconds, milliseconds, or microseconds.
Quantiles
Supported quantiles to extract from the histogram: 50%, 75%, 90%, and 99%.
Error type
Label in the histogram metric containing the error code.
Error type mapping rules
Specify how to group error codes into error categories using exact or pattern match. Examples:
Equality: status_code = "500"
Regex: status_code =~ "5.."
Before you begin
Before you begin, ensure that you are familiar with Prometheus metrics and RED KPIs.
Steps
Sign in to Grafana Cloud and click Asserts > Configuration.
Click RED mapping.
Determine which KPI you want to map and click Add new mapping.
Define the mapping as described in the above sections.