22 Mar 2024 05:21 AM - edited 24 Mar 2024 11:39 PM
I have Prometheus query where it has "unless" logical operator to DQL. (Ref: logical-set-binary-operators )
Is there a similar logical operator which I could utilze in DQL?
If not, how can I use existing features to achieve a similar result to Prometheus?
Solved! Go to Solution.
22 Mar 2024 07:21 PM
I think you have not in operators in mind. This is example DQL query which operated on 2 different data sets (like Prometheus instant vectors) and does what "unless" does:
data
record(val=1, label="a"),
record(val=2, label="b"),
record(val=3, label="c")
| filter not label in [
data
record(val2=10, label="a")
| fields label
]
Can you give example of data you work with?
Kris
25 Mar 2024 12:38 AM
Thank you for the prompt response @krzysztof_hoja
I am working with two timeseries metrics combined using a join in my Grail DQL query.
The following is a representation of what my query looks like:
timeseries avg(metric1)
interval: 10m
by: {id}
| join [
timeseries avg(metric2)
interval: 10m
by: {id}
], on: {id}, kind: ???
What I am after is to combine/join two timeseries metrics with an operator which does the same as unless operator in Prometheus.
27 Mar 2024 08:56 PM
Please check if this query gives what you need:
timeseries avg(dt.host.cpu.system), by:{dt.entity.host}, filter:aws.region=="us-east-1"
| filterOut dt.entity.host in [
timeseries avg(dt.host.memory.usage), by:{dt.entity.host} , filter:aws.region=="us-east-1"
| fields dt.entity.host
]
IMHO it works like unless
On my test tenant, results of component queries and combined one look like this:
28 Mar 2024 02:56 AM
This solution works for me. Thank you 🙏