Data source
In Builder mode, select metrics as your source.

Query type
Select either an instant or range query. The query is executed over a specific timeframe, defined by the dashboard time picker or the widget timeframe.
Instant query mode displays the metric's value at a single point in time, specifically at the end timestamp of the selected timeframe. This mode is ideal for real-time monitoring, providing a snapshot of data at the moment of visualization. It is also more performant, retrieving only the most recent data point without fetching the entire dataset.
Range query mode retrieves and aggregates metric data over a specified timeframe. It returns all data points between the start and end timestamps that match your query. As the timeframe changes, the system automatically adjusts the interval to optimize the number of data points displayed in the graph. This mode is well-suited for identifying trends or evaluating performance over a defined period.
Metric name
Select your preferred metric from a dropdown menu that is dynamically filled with available metrics. Use the autocomplete capability to explore the metric name, labels, and values.

Filters
To add a filter, select +. Select a metric label and an associated value to filter your metric.
Select the = or != operator from the drop-down menu to include or exclude one or more values, respectively. Selecting the =~ or !~ operators will allow you to input a regex expression.
To add additional label-value pairs, select the + button.
Functions
Selecting metrics and labels already builds a valid Prometheus query, but you can create more complex queries using functions.
To add a function, select +. Select between aggregation, count and rollup functions.
Aggregation
Aggregation functions calculate a set of values and return a single value. Once you select the function, select the label to aggregate in the dropdown menu or type it.
Count
Count functions perform calculations on a set of values and return a single value.
Rollup
Rollup functions aggregate time series data over a specified time range.
Once you select the function, select the range to be queried as a hard number or ${__range}. This variable represents the duration of the dashboard time range. It is rendered as an interval string supported by PromQL. For example, if one selects a time range from 13.00 to 14.30, the ${__range} variable will be rendered as 90m. For detailed information about pre-defined variables, see this tutorial.
Rank
Rank functions allow you to sort, rank, and filter data within your queries. You can use them to refine your results based on specific metrics and values.
To add a rank function, select + and select from TOPK, SORT, or SORT Descending. Once you select a rank function, configure it by specifying the metric and parameters (e.g., populate the number of K results you would like the query to retrieve for TOPK).