For the histogram buckets, is your intention to have a few preconfigured "age" buckets like 0s-15s, 0s-1m, 0s-5m, and so on (cumulative buckets, all starting at 0, as in normal Prometheus histograms), and then a count for how many timestamps you have that fall into each age bucket?
You could make one recording rule for *each bucket*, with all the recording rules sharing the same output metric name. For example, for a bucket with a range of 0s - 1m, you could have this kind of rule:
record: my_timestamp_age_bucket
expr: count(time() - my_timestamp_seconds <= 60)
labels:
le: "60"
...and equivalently for the other buckets.
If you wanted to have a *non-cumulative* histogram (and don't need to use histogram_quantile() on it), the rule would look like this (e.g. for a bucket from 15s - 1m):
record: my_timestamp_age_bucket
expr: count(time() - my_timestamp_seconds > 15 <= 60)
labels:
# some other label(s) here to designate your bucket range
Remember to include a catch-all bucket for very long durations with an upper bound of +Inf, so you don't miss recording them.
Note that with the "count()" approach I use above, it will only create a bucket time series for buckets with at least one timestamp falling into the bucket, as otherwise "count()" will just return an empty result. If you want to create a bucket with the value of "0" instead, you can append "or vector(0)" to the rule expression:
record: my_timestamp_age_bucket
expr: count(time() - my_timestamp_seconds <= 60) or vector(0)
labels:
le: "60"