Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

Table of Contents

Introduction Querying Metrics

Querying

Info
  • Prometheus provides a functional expression language called PromQL
    • Provides built in operators and functions
    • Vector-based calculations like Excel
    • Expressions over time-series vectors
  • PromQL is read-only
  • Example:
    • 100 - (avg by (instance) (irate(node_cpu_seconds_total{job='node_exporter',mode="idle"}[5m])) * 100)

Querying - Expressions

Info
  • Instance vector
    • a set of time series containing a single sample for each time series, all sharing the same timestamp
    • Example:
      • node_cpu_secounds_total
  • Range  vector
    • a set of time series containing a range of data points over time for each time series
    • Example:
      • node_cpu_seconds_total[5m]
  • Scalar
    • a simple numeric floating point value
    • Example:
      • -3.14
  • String
    • a simple string value; currently unused

Querying - Operators

Info
  • Arithmetic binary operators
    • Example:
      • Operatorsdescription
        -subtraction
        *multiplication
        /division
        %modulo
        ^power/exponentiation)
  • Comparison binary operators
    • Example:
      • Operatorsdescription
        ==equal
        !=not-equal
        >greater-then
        <less-than
        >=greater-or-equal
        <=less-or-equal
  • Logical/set binary operators
    • Example:
      • Operatorsdescription
        andintersection
        orunion
        unlesscomplement
  • Aggregation operators
    • Example:
      • Operatorsdescription
        sumcalculate sum over dimensions
        minselect minimum over dimensions
        maxselect maximum over dimensions
        avgcalculate the average over dimensions
        stddevcalculate population standard deviation over dimensions
        stdvarcalculate population standard variance over dimensions
        countcount number of elements in the vector
        count_valuescount number of elements with the same value
        bottomksmallest k elements by sample value
        topklargest k elements by sample value
        quantile

        calculate Image Addedover dimensions