The most readable for a case like this is to use unless, something like: swap unless on(host) state == 0
You can also turn the logic around, using and, e.g.: swap and on(host) state > 0 David On Wed, 17 Mar 2021 at 23:19, Patrick Macdonald <[email protected]> wrote: > This seems a pretty simple thing to achieve so apologies if it's been > answered here a hundred times before. > > If I have two metrics : > "state" > "swap" > > Each metric has records from different hosts, so they both have a "host" > label. > > eg > 1. state, label {host="machineA"} value 0 > 2. state, label {host="machineB"} value 1 > 3. swap, label {host="machineA"} value 1234 > 4. swap, label {host="machineb"} value 123 > > I want to filter my graph of "swap" so that any hosts with a "state" value > of "0" are removed/ignored. > > What's the trick? > Is the correct nomenclature for this "Filtering series A by series B"? > (I'm still trying to get my head around the correct terminology to use). > > Thanks in advance for your help. > Patrick > > -- > You received this message because you are subscribed to the Google Groups > "Prometheus Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/prometheus-users/44b33eb4-5b55-4fe8-aff8-c90c1215309fn%40googlegroups.com > <https://groups.google.com/d/msgid/prometheus-users/44b33eb4-5b55-4fe8-aff8-c90c1215309fn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/CAP9KPhDxb4yNmL6wBW%3DM7_DCav3t0NRfo81yNBGcFjcj83hTiw%40mail.gmail.com.

