A predicate limits the number of streams in the returned series.

A predicate can take one of the following forms:

  • time_series_attribute operator value, where
    • time_series_attribute is one of the supported attributes.
    • operator is one of = and rlike
    • value is an attribute value subject to the following constraints:
      • For attributes values that contain spaces or values of attributes of the form xxxName such as displayName, use quoted strings.
      • The value for the rlike operator must be specified in quotes. For example: hostname rlike "host[0-3]+.*".
      • value can be any regular expression as specified in regular expression constructs in the Java Pattern class documentation.
  • scalar_producing_function(metric_expression) comparator number , where
    • scalar_producing_function is any function that takes a time series and produces a scalar. For example, min or max.
    • metric_expression is a valid metric expression. For example, total_cpu_user + total_cpu_system.
    • comparator is a comparison operator: <, <=, =, !=, >=, >.
    • number is any number expression or a number expression with units. For example, 5, 5mb, 5s are all valid number expressions. The valid units are:
      • Time - ms (milliseconds), s (seconds), m (minutes), h (hours), and d (days).
      • Bytes -b (bytes), kb or kib (kilobytes), mb or mib (megabytes), gb or gib (gigabytes), tb or tib (terabytes), and pb or pib (petabytes)
      • Bytes per second - Bytes and Time: bps, kbps, kibps, mbps, mibps, and so on. For example, 5 kilobytes per second is 5 kbps.
      • Bytes time - Bytes and Time combined: bms, bs, bm, bh, bd, kms, ks, and so on. For example, 5 kilobytes seconds is 5 ks or 5 kis.

You use the AND and OR operators to compose compound predicates.

Example Statements with Compound Predicates

  1. Retrieve all time series for all metrics for DataNodes or TaskTrackers.
    select * where roleType=DATANODE or roleType=TASKTRACKER
  2. Retrieve all time series for all metrics for DataNodes or TaskTrackers that are running on host named "myhost".
    select * where (roleType=DATANODE or roleType=TASKTRACKER) and hostname=myhost
  3. Retrieve the total_cpu_user metric time series for all hosts with names that match the regular expression "host[0-3]+.*"
    select total_cpu_user where category=role and hostname rlike "host[0-3]+.*" 

Example Statements with Predicates with Scalar Producing Functions

  1. Return the entities where the last count of Java VM garbage collections was greater than 10:
    select jvm_gc_count where last(jvm_gc_count) > 10
  2. Return the number of open file descriptors where processes have more than 500Mb of mem_rss:
    select fd_open where min(mem_rss) > 500Mb