SigNoz/signoz · error

rate is not supported for table view

Error message

rate is not supported for table view

What it means

When building a ClickHouse query for the cumulative table view (buildMetricQueryForTable, reached via PrepareMetricQuery), the aggregate operator 'rate' is explicitly rejected because a plain rate cannot be represented correctly in table form (table queries need per-series grouping that rate alone doesn't provide; use the *Rate variants which group by fingerprint). The API returns this error instead of producing an invalid query.

Source

Thrown at pkg/query-service/app/metrics/v3/cumulative_table.go:102

	groupByWithoutLe := groupBy(tagsWithoutLe...)
	groupTagsWithoutLe := groupSelect(tagsWithoutLe...)
	orderWithoutLe := orderBy(mq.OrderBy, tagsWithoutLe)

	groupBy := groupByAttributeKeyTags(metricQueryGroupBy...)
	groupTags := groupSelectAttributeKeyTags(metricQueryGroupBy...)
	orderBy := orderByAttributeKeyTags(mq.OrderBy, metricQueryGroupBy)

	if len(orderBy) != 0 {
		orderBy += ","
	}
	if len(orderWithoutLe) != 0 {
		orderWithoutLe += ","
	}

	switch mq.AggregateOperator {
	case v3.AggregateOperatorRate:
		return "", fmt.Errorf("rate is not supported for table view")
	case v3.AggregateOperatorSumRate, v3.AggregateOperatorAvgRate, v3.AggregateOperatorMaxRate, v3.AggregateOperatorMinRate:
		rateGroupBy := "fingerprint, " + groupBy
		rateGroupTags := "fingerprint, " + groupTags
		rateOrderBy := "fingerprint, " + orderBy
		partitionBy := "fingerprint"
		if len(groupTags) != 0 {
			partitionBy += ", " + groupTags
			partitionBy = strings.Trim(partitionBy, ", ")
		}
		op := "max(value)"
		subQuery := fmt.Sprintf(
			queryTmplCounterInner, rateGroupTags, step, op, filterSubQuery, rateGroupBy, rateOrderBy,
		) // labels will be same so any should be fine
		query := `SELECT %s ts, ` + rateWithoutNegative + `as rate_value FROM(%s) WINDOW rate_window as (PARTITION BY %s ORDER BY %s ts)`
		query = fmt.Sprintf(query, groupTags, subQuery, partitionBy, rateOrderBy)
		query = fmt.Sprintf(`SELECT %s toStartOfHour(now()) as ts, %s(rate_value)/%d as value FROM (%s) WHERE isNaN(rate_value) = 0 GROUP BY %s ORDER BY %s ts`, groupTags, aggregateOperatorToSQLFunc[mq.AggregateOperator], points, query, groupBy, orderBy)
		return query, nil
	case

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Change the aggregate operator to sum_rate/min_rate/max_rate/avg_rate, which are supported in table view
  2. If you need plain rate, use a graph/time-series query instead of table
  3. Update dashboard JSON / saved API payloads so table panels never use 'rate'

Example fix

// before
{"aggregateOperator":"rate","queryType":"table"}
// after
{"aggregateOperator":"sum_rate","queryType":"table"}
Defensive patterns

Strategy: type-guard

Validate before calling

var tableSupported = map[string]bool{"sum":true,"avg":true,"min":true,"max":true,"count":true,"count_distinct":true,"sum_rate":true,"avg_rate":true,"min_rate":true,"max_rate":true}
if queryType == "table" && !tableSupported[aggregateOperator] {
  return fmt.Errorf("operator %q not supported in table view", aggregateOperator)
}

Type guard

func isTableSafeOperator(op string) bool { return !isTableView || tableSupported[op] }

Try / catch

On error from the metrics API, catch and suggest replacing 'rate' with 'sum_rate' for table panels; do not retry unchanged.

Prevention

When it happens

Trigger: A BuildQueryRequest/v3 metrics query with dataSource=metrics, queryType=table (or a panel switched to table view) and aggregateOperator: 'rate'. PrepareMetricQuery dispatches to the cumulative table builder and hits the AggregateOperatorRate case.

Common situations: Copying a graph panel's query (rate) into a table widget; switching visualization from chart to table without changing the aggregator; API clients hardcoding 'rate' for all panels; dashboards imported from other tools mapping per-second rates to 'rate'.

Related errors


AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28). Data as JSON: /api/errors/29faf2e06b9f2dd8. Report an issue: GitHub.