Native Queries
Introduction
When simple queries don't meet your needs you can define native queries in the connector's configuration.yaml
file with
prepared variables with the ${<name>}
template. Native queries are defined as collections.
metadata:
native_operations:
queries:
service_up:
query: up{job="${job}", instance="${instance}"}
labels:
instance: {}
job: {}
arguments:
instance:
type: String
job:
type: String
The native query is exposed as a read-only function with two required fields job
and instance
.
{
service_up(
args: { step: "1m", job: "node", instance: "node-exporter:9100" }
where: { timestamp: { _gt: "2024-10-11T00:00:00Z" }, job: { _in: ["node"] } }
) {
job
instance
values {
timestamp
value
}
}
}
Labels aren't automatically added.
You need to define them manually. Additionally, label and value boolean expressions in where
are used to filter
results after the query is executed.