I’m looking at an efficient way of returning the MAX of each day’s metrics
in a given time period
The metric is a Gauge Vector that identifies each Validator by public key,
and the value represents an ENUM value.
Example
validator_statuses{pubkey="pk0"} 0 // UNKNOWN
validator_statuses{pubkey="pk1"} 1 // DEPOSITED
validator_statuses{pubkey="pk2"} 2 // PENDING
validator_statuses{pubkey="pk3"} 3 // ACTIVE
validator_statuses{pubkey="pk4"} 4 //EXITING
validator_statuses{pubkey="pk5"} 5 // SLASHING
validator_statuses{pubkey="pk6"} 6 //EXITED
I am retrieving the MAX by Day using this query:
max_over_time( validator_statuses{} [1d])
Which returns the timestamp of the day, the pubkey and the MAX status for
that timestamp day
+---------------------+--------+--------+
| Time | Pubkey | Status |
+---------------------+--------+--------+
| 2023-05-01 00:00:00 | 0x0 | 1 |
| 2023-05-02 00:00:00 | 0x0 | 2 |
| 2023-05-03 00:00:00 | 0x0 | 2 |
| 2023-05-04 00:00:00 | 0x0 | 3 |
| 2023-05-05 00:00:00 | 0x0 | 3 |
| 2023-05-06 00:00:00 | 0x0 | 3 |
| 2023-05-07 00:00:00 | 0x0 | 3 |
| 2023-05-08 00:00:00 | 0x0 | 3 |
| 2023-05-09 00:00:00 | 0x0 | 3 |
| 2023-05-010 00:00:00| 0x0 | 3 |
+---------------------+--------+--------+
However, i'm having trouble when trying to count by and aggregate those
statuses
My intention is to count the number of days a validator is in each status
per $__range, the above data would return this kind of tablular data
+--------+-----------+------------------+------------------+------------------+
| Pubkey | StatusNow | Days In Status 1 | Days In Status 2 | Days In Status
3 |
+--------+-----------+------------------+------------------+------------------+
| 0x0 | 3 | 1 | 2 |
7 |
+--------+-----------+------------------+------------------+------------------+
Can this be done entirely in PromQL? Or will i have to leverage multiple
queries and aggregate in Grafana?
--
All information and attachments included in this email are confidential and
intended for the original recipient only. You must not share any part of
this message with any third party. If you have received this message by
mistake, please let us know immediately, so that we can make sure such a
mistake does not happen again and delete this message from your system.
--
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/55f7203f-95f0-473c-b301-9f48ccc656b4n%40googlegroups.com.