Skip to content

TypeThresholdBuilder🔗

Constructor🔗

new TypeThresholdBuilder()

Methods🔗

build🔗

Builds the object.

build()

conditions🔗

Threshold Conditions

conditions(conditions: {
    evaluator: {
        params: number[];
        // e.g. "gt"
        type: "gt" | "lt" | "within_range" | "outside_range";
    };
    loadedDimensions?: any;
    unloadEvaluator?: {
        params: number[];
        // e.g. "gt"
        type: "gt" | "lt" | "within_range" | "outside_range";
    };
}[])

datasource🔗

The datasource

datasource(datasource: dashboard.DataSourceRef)

expression🔗

Reference to single query result

expression(expression: string)

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)

hide(hide: boolean)

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

intervalMs(intervalMs: number)

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

maxDataPoints(maxDataPoints: number)

queryType🔗

QueryType is an optional identifier for the type of query.

It can be used to distinguish different types of queries.

queryType(queryType: string)

refId🔗

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

refId(refId: string)

resultAssertions🔗

Optionally define expected query result behavior

resultAssertions(resultAssertions: {
    // Maximum frame count
    maxFrames?: number;
    // Type asserts that the frame matches a known type structure.
    // Possible enum values:
    //  - `""` 
    //  - `"timeseries-wide"` 
    //  - `"timeseries-long"` 
    //  - `"timeseries-many"` 
    //  - `"timeseries-multi"` 
    //  - `"directory-listing"` 
    //  - `"table"` 
    //  - `"numeric-wide"` 
    //  - `"numeric-multi"` 
    //  - `"numeric-long"` 
    //  - `"log-lines"` 
    type?: "" | "timeseries-wide" | "timeseries-long" | "timeseries-many" | "timeseries-multi" | "directory-listing" | "table" | "numeric-wide" | "numeric-multi" | "numeric-long" | "log-lines";
    // TypeVersion is the version of the Type property. Versions greater than 0.0 correspond to the dataplane
    // contract documentation https://grafana.github.io/dataplane/contract/.
    typeVersion: number[];
})

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

timeRange(timeRange: {
    // From is the start time of the query.
    from: string;
    // To is the end time of the query.
    to: string;
})

See also🔗