Differentiate between odd/even values

I’m monitoring the throughput of a given session, and each session comes with its value for the bandwidth itself, and a pair of IDs (PDRs), which increases per session created, where the odd number is the uplink and even value the downlink.

Is there a way to alter the query, or apply some transformation, that would allow me to separate the sessions, based on the PDR value being ODD/EVEN?

From what I can see in the picture the pdr is a label. So you can actually create two queries, one for odd and the other for even PDRs leveraging regex label filtering. For example:

upf_session_tx_bytes{pdr~=".*[02468]"} and upf_session_tx_bytes{pdr~=".*[13579]"}

Is that what you were looking for?

1 Like

That’s exactly what I was looking for. I didn’t even thought of using REGEX patterns.
Thank you very much!