Endpoint and authentication
Every project has its own Prometheus base URL:x-squasher-key: <key> or in Authorization: Bearer <key>. The key needs the
project:read scope, which the read scope includes. An ingest key cannot read data. See
API keys. A request reads only the metrics of its own project.
series, labels, label/{name}/values, and metadata read the last hour when you do not send
start. metadata returns the type and unit of each metric, and no help text. A POST body is a
form (application/x-www-form-urlencoded) of at most 64 KiB.
status: "error", an errorType,
and an error message. The types are bad_data (400), execution (422), timeout (503), and
unavailable (503). On unavailable, wait and retry.
Add Squasher to Grafana
1
Create an API key
Create a key with the
read scope. See API keys.2
Add a Prometheus data source
In Grafana, add a data source of type Prometheus. Set the URL to
https://api.squasher.ai/v1/projects/<project id>/prometheus.3
Send the key
Add a custom HTTP header named
x-squasher-key with the API key as its value. Grafana has no
bearer token field, so use a custom header. Leave basic authentication off.4
Save and explore
Save the data source, then open Explore and run a query with one of your metric names. The
metric browser and autocomplete list the names Squasher exposes.
/api/v1/status/* endpoints.
Metric and label names
OpenTelemetry names are not valid in the classic Prometheus syntax, so Squasher maps them. The rules follow the OpenTelemetry Prometheus compatibility rules, without unit suffixes.
Two attributes that map to the same label name join their values with
;. Other resource
attributes are not labels, and there is no target_info series.
A quoted name selects the original OpenTelemetry name, in the Prometheus 3 UTF-8 syntax:
Example queries
Metric names depend on what your services send. These examples assumehttp.server.requests is a
monotonic sum and http.server.duration is an explicit-bucket histogram in seconds.
Supported PromQL
- Selectors with
offset,@, and subqueries. Instant selectors look back 5 minutes, as in Prometheus 3. - Functions:
rate,irate,increase,delta,idelta,resets,changes,deriv,predict_linear, the*_over_timefamily (avg,min,max,sum,count,last,quantile,stddev,stdvar,present),absent,histogram_quantile,label_replace,label_join,clamp,round,sort,scalar,vector,time, and the math and date functions. - Aggregations:
sum,avg,min,max,count,group,stddev,stdvar,topk,bottomk,quantile, andcount_values, withbyandwithout. - Binary operators, comparisons with and without
bool,and,or,unless, andon,ignoring,group_left, andgroup_rightmatching.
Limits and unsupported items
Narrow the time range, add label matchers, or raise
step to stay inside a limit. The timeout
parameter can only lower the evaluation time.
These return a bad_data error that says the feature is unsupported:
- Exponential histograms and the native histogram functions (
histogram_count,histogram_sum,histogram_fraction,histogram_avg,histogram_stddev,histogram_stdvar). Send explicit-bucket histograms if you need them in PromQL. limitk,limit_ratio,fill()modifiers, and experimental functions such asfirst_over_time,mad_over_time,sort_by_label, andinfo.
Next steps
Query guide and safe SQL
Run SQL over logs, spans, and metrics.
Prometheus metrics
Send Prometheus scrape data to Squasher.