For the complete documentation index, see llms.txt. Markdown versions are available by appending .md to documentation URLs.

Using Variables in Queries

SigNoz Cloud - This page applies to SigNoz Cloud editions.
Self-Host - This page applies to self-hosted SigNoz editions.

Variables are referenced using $var syntax across all query types.

Query Builder

Single-select variables: Use the variable name directly

service.name = $service.name AND has_error = true AND http.route EXISTS

Multi-select variables: Use IN operator for multiple values

k8s.namespace.name = $k8s.namespace.name AND k8s.pod.name IN $k8s.pod.name

ClickHouse Queries

Reference variables with $ prefix in your SQL:

SELECT
    toStartOfInterval(timestamp, INTERVAL 1 MINUTE) AS interval,
    attributes_string['http.method'] AS method,
    toFloat64(avg(duration_nano)) AS value
FROM
    signoz_traces.distributed_signoz_index_v3
WHERE
    attributes_string['http.method'] != ''
    AND attributes_string['http.method'] = $http.method  -- Variable usage
    AND timestamp > now() - INTERVAL 30 MINUTE
    AND ts_bucket_start >= toUInt64(toUnixTimestamp(now() - toIntervalMinute(30))) - 1800
GROUP BY
    (method, interval)
ORDER BY
    (method, interval) ASC;

PromQL

Single-select variables: Use the = matcher with the variable:

sum(rate(http_requests_total{job="$job_name"}[5m]))

Multi-select variables: Use the =~ regex matcher instead of =. When multiple values are selected, SigNoz expands the variable into a regex pattern (e.g., value1|value2|value3), which requires =~ to match correctly.

sum(rate(http_requests_total{service_name=~"$service_name", deployment_environment=~"$deployment_environment"}[5m]))

Is this page helpful

Last updatedJuly 29, 2026

Edit on GitHub

Is this page helpful

On this page

Last updatedJuly 29, 2026

Edit on GitHub