Skip to content

QueryV2Builder🔗

Constructor🔗

new QueryV2Builder()

Methods🔗

build🔗

Builds the object.

public QueryV2 build()

adhocFilters🔗

Additional Ad-hoc filters that take precedence over Scope on conflict.

public QueryV2Builder adhocFilters(List<com.grafana.foundation.cog.Builder<AdhocFilters>> adhocFilters)

datasource🔗

New type for datasource reference

Not creating a new type until we figure out how to handle DS refs for group by, adhoc, and every place that uses DataSourceRef in TS.

public QueryV2Builder datasource(com.grafana.foundation.cog.Builder<Dashboardv2DataQueryKindDatasource> datasource)

editorMode🔗

what we should show in the editor

Possible enum values:

  • "builder"

  • "code"

public QueryV2Builder editorMode(QueryEditorMode editorMode)

exemplar🔗

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

public QueryV2Builder exemplar(Boolean exemplar)

expr🔗

The actual expression/query that will be evaluated by Prometheus

public QueryV2Builder expr(String expr)

format🔗

The response format

Possible enum values:

  • "time_series"

  • "table"

  • "heatmap"

public QueryV2Builder format(PromQueryFormat format)

groupByKeys🔗

Group By parameters to apply to aggregate expressions in the query

public QueryV2Builder groupByKeys(List<String> groupByKeys)

hide🔗

true if query is disabled (ie should not be returned to the dashboard)

NOTE: this does not always imply that the query should not be executed since

the results from a hidden query may be used as the input to other queries (SSE etc)

public QueryV2Builder hide(Boolean hide)

instant🔗

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

public QueryV2Builder instant(Boolean instant)

interval🔗

An additional lower limit for the step parameter of the Prometheus query and for the

$__interval and $__rate_interval variables.

public QueryV2Builder interval(String interval)

intervalFactor🔗

Used to specify how many times to divide max data points by. We use max data points under query options

See https://github.com/grafana/grafana/issues/48081

Deprecated: use interval

public QueryV2Builder intervalFactor(Long intervalFactor)

intervalMs🔗

Interval is the suggested duration between time points in a time series query.

NOTE: the values for intervalMs is not saved in the query model. It is typically calculated

from the interval required to fill a pixels in the visualization

public QueryV2Builder intervalMs(Double intervalMs)

labels🔗

public QueryV2Builder labels(Map<String, String> labels)

legendFormat🔗

Series name override or template. Ex. {{hostname}} will be replaced with label value for hostname

public QueryV2Builder legendFormat(String legendFormat)

maxDataPoints🔗

MaxDataPoints is the maximum number of data points that should be returned from a time series query.

NOTE: the values for maxDataPoints is not saved in the query model. It is typically calculated

from the number of pixels visible in a visualization

public QueryV2Builder maxDataPoints(Long maxDataPoints)

queryType🔗

QueryType is an optional identifier for the type of query.

It can be used to distinguish different types of queries.

public QueryV2Builder queryType(String queryType)

range🔗

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

public QueryV2Builder range(Boolean range)

refId🔗

RefID is the unique identifier of the query, set by the frontend call.

public QueryV2Builder refId(String refId)

resultAssertions🔗

Optionally define expected query result behavior

public QueryV2Builder resultAssertions(com.grafana.foundation.cog.Builder<ResultAssertions> resultAssertions)

scopes🔗

A set of filters applied to apply to the query

public QueryV2Builder scopes(List<com.grafana.foundation.cog.Builder<Scopes>> scopes)

timeRange🔗

TimeRange represents the query range

NOTE: unlike generic /ds/query, we can now send explicit time values in each query

NOTE: the values for timeRange are not saved in a dashboard, they are constructed on the fly

public QueryV2Builder timeRange(com.grafana.foundation.cog.Builder<TimeRange> timeRange)

version🔗

public QueryV2Builder version(String version)

See also🔗