Query aliasing

Query aliasing

This feature is deprecated.

Query aliasing map queries to an alias. For example, mapping the query up:sum{} to sum(up{}).

Use cases

Reducing alert and dashboard complexity

With query aliases you can create canonical queries to standardize dashboards and alerts.

For example, if there is a common error rate query that multiple dashboards share, then you can create a query alias to use with all these dashboards.

Recording rules

Backfill recording rules

A query outage or failure to execute the recording rule due to a timeout creates a gap in the recording rule's results, because the query must execute to generate the recorded metric.

With query aliases, this gap doesn't occur because Chronosphere reads the underlying data at query time and doesn't generate any additional metrics.

Replacing expensive recording rules

Typically, users query recording rules with specified filters, such as some:recording:rule{label_1="value_1". For better performance than executing the recording rule at a set interval, instead query this data only as you need it.

For example, given the following recording rule definition:

- bucket_slug: global
  name: global:http_server_request_by_path:irate1m
  slug: http-server-request-by-path
  interval: 30s
  expr: sum by (status, path) (irate(http_server_requests_count{service=~".+"}[1m])) > 0

In the example above, Chronosphere executes the expr every 30s across all services (.+). However, you generally don't want to query across all services as this doesn't offer much value especially when plotted on a graph. Instead, typically you apply filters such as global:http_server_request_by_path:irate1m{service="foo"} to scope the query to return a reasonably sized response.

Using query aliases, you can remove the need for this expensive recording rule and, instead, map the query global:http_server_request_by_path:irate1m{service="$my_service"} to the query sum by (status, path) (irate(http_server_requests_count{service="$my_service"}[1m])) > 0 where all of the filters are respected.

Defining query aliases

The Chronosphere team needs to define query aliases. To add a query alias, contact your account manager.