Create PromQL queries with the query builder
This feature isn’t available to all Chronosphere Observability Platform users and might not be visible in your app. For information about enabling this feature in your environment, contact Chronosphere Support.
Creating PromQL queries from scratch can take time. To help with the task, Chronosphere includes a tool you can use to construct PromQL queries.
The query builder supports only Prometheus metrics and PromQL.
The query builder is available in Metrics Explorer and when building queries in dashboards.
To open the tool, click Builder when writing a query in Observability Platform. Any changes you make will update your original query.
You can add comments to annotate metrics with information to signify importance, help other users to understand usage context, and turn informal knowledge into institutional knowledge that can be used across your organization.
Builder
The builder contains fields that represent key parts of a PromQL query. As you type in the search boxes for each field, the builder suggests metric names, label names, label values, and function names.
Add values
To add values to any field, click the plus icon next to the field name.
-
Next to Metric, a list of selectable metrics opens. Choose a metric, or search for one.
When reviewing a metric for selection, an additional window opens to the side of the search menu. This window displays:
- The type of metric (for example, gauge).
- A Description. Click the pencil icon to add or edit a description and then click Save.
- A list of Labels this metric has.
- To add a comment to a metric, click Add comment.
- A link to open the Telemetry Usage Analyzer.
-
Add Filters. A filter is a Label and Value pair that selects a subset of the data.
-
After you select a metric, the PromQL builder requests the metric type. If the builder knows the metric type, it applies best Rollup option. If the PromQL builder doesn’t know the metric type, then it lets you select an option.
Chronosphere recommends the following settings::
- Cumulative counter or cumulative exponential histogram: Use
rate
orincrease
. - Delta counter or delta exponential histogram: Use
sum_per_second
orsum_over_time
. - Gauge: Don’t use any of these functions.
- Cumulative counter or cumulative exponential histogram: Use
-
In the Calculate menu, you will see options depending on the type of metric.
If you chose a counter metric (cumulative counter or delta counter) or a gauge metric, select from the following options:
Sum
Average
Min
Max
If you chose a histogram metric (cumulative exponential histogram, delta exponential histogram, or classic histogram), select from the following options:
Percentile
Average
Count
Then, select the one or more labels to group by.
-
Click Run to run the query.
For additional query options, see Time series chart queries.
Remove values
To clear any field, click close icon at the end of the field.
To reset to the default value, click the field value and then click Reset.