Skip to content

prometheus

grafonnet.query.prometheus

Index

Fields

fn new

new(datasource, expr)

PARAMETERS:

  • datasource (string)
  • expr (string)

Creates a new prometheus query target for panels.

fn withDatasource

withDatasource(value)

PARAMETERS:

  • value (string)

Set the datasource for this query.

fn withEditorMode

withEditorMode(value)

PARAMETERS:

  • value (string)
    • valid values: "code", "builder"

Specifies which editor is being used to prepare the query. It can be "code" or "builder"

fn withExemplar

withExemplar(value=true)

PARAMETERS:

  • value (boolean)
    • default value: true

Execute an additional query to identify interesting raw samples relevant for the given expr

fn withExpr

withExpr(value)

PARAMETERS:

  • value (string)

The actual expression/query that will be evaluated by Prometheus

fn withFormat

withFormat(value)

PARAMETERS:

  • value (string)
    • valid values: "time_series", "table", "heatmap"

Query format to determine how to display data points in panel. It can be "time_series", "table", "heatmap"

fn withHide

withHide(value=true)

PARAMETERS:

  • value (boolean)
    • default value: true

If hide is set to true, Grafana will filter out the response(s) associated with this query before returning it to the panel.

fn withInstant

withInstant(value=true)

PARAMETERS:

  • value (boolean)
    • default value: true

Returns only the latest value that Prometheus has scraped for the requested time series

fn withInterval

withInterval(value)

PARAMETERS:

  • value (string)

An additional lower limit for the step parameter of the Prometheus query and for the $__interval and $__rate_interval variables.

fn withIntervalFactor

withIntervalFactor(value)

PARAMETERS:

  • value (string)

Set the interval factor for this query.

fn withLegendFormat

withLegendFormat(value)

PARAMETERS:

  • value (string)

Set the legend format for this query.

fn withQueryType

withQueryType(value)

PARAMETERS:

  • value (string)

Specify the query flavor TODO make this required and give it a default

fn withRange

withRange(value=true)

PARAMETERS:

  • value (boolean)
    • default value: true

Returns a Range vector, comprised of a set of time series containing a range of data points over time for each time series

fn withRefId

withRefId(value)

PARAMETERS:

  • value (string)

A unique identifier for the query within the list of targets. In server side expressions, the refId is used as a variable name to identify results. By default, the UI will assign A->Z; however setting meaningful names may be useful.