Skip to content

limit

Input Stack:
n: Int
expr: TimeSeriesExpr
Output Stack:
StyleExpr
 

Limit the number of time series displayed to the first N series from the input expression. The selection is based on the current sort order determined by :sort and :order operations. This is useful for focusing on the most important series when dealing with large result sets.

Parameters

  • expr: The time series expression to limit
  • n: Maximum number of series to display (positive integer)

Selection Behavior

The limit operation selects the first N series based on the current ordering:

  • If no sort is specified, series are ordered by legend text (alphabetical)
  • If :sort is used, series are ordered by the specified statistic
  • The :order operation controls ascending vs. descending sort direction

Examples

Limiting results to the top 3 series:

BeforeAfter
name,sps,:eq,
(,nf.cluster,),:by
name,sps,:eq,
(,nf.cluster,),:by,
3,:limit
  • :sort - Specify what to sort by before limiting
  • :order - Control sort direction (ascending/descending)
  • :head - Alias for limit (historical compatibility)
  • :by - Group data that might need limiting