I have a random job that runs at different intervals depending on the situation. Some instances of the job run every five minutes and some run only once an hour or once a day. The job created a node_exporter textfile snippet that gets scraped on 30 second interval.
Below is an example of a metric that changes only every five minutes with the lesser scrape interval. In this scenario all the points with same value are from the same job run. I really only care about one of those.
I have no way to know what the interval is between set for all my different jobs. All I know is that when the value changes, a new set is in play.
What I want to do in "reduce" my dataset to deal with only distinct values. I want to collapse these 27 entries into 3 by taking either the first or last value of each "set".
I can not find a PromQL function/operator that does what I want. Maybe I need to use recording rules?
All and any help is greatly appreciated.
metric_name{instance="hostname.example.net", job="external/generic", mode="pull", name="snafu"}
9973997301 @1673997343.774 9973997301 @1673997373.764 9973997301 @1673997403.764 9973997301 @1673997433.764 9973997301 @1673997463.764 9973997301 @1673997493.764 9973997301 @1673997523.764 9973997301 @1673997553.764 9973997301 @1673997583.764
9973997601 @1673997613.764 9973997601 @1673997643.764 9973997601 @1673997673.764 9973997601 @1673997703.774 9973997601 @1673997733.764 9973997601 @1673997763.764 9973997601 @1673997793.764 9973997601 @1673997823.764 9973997601 @1673997853.863
9973997901 @1673997913.764 9973997901 @1673997943.767 9973997901 @1673997973.764 9973997901 @1673998003.764 9973997901 @1673998033.764 9973997901 @1673998063.764 9973997901 @1673998093.764 9973997901 @1673998123.764 9973997901 @1673998153.764
I have tried many of the PromQL functions/operators to try and reduce my sets. The count_vaules() operator is the closest I have come but that works only with instant vectors not range vectors.
--
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 prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/b3882dc1-32ea-42ff-9264-3dcbb72f662dn%40googlegroups.com.