0
votes

I have a /metrics HTTP route consumed by Prometheus.

It provides the following gauge:

# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1658919747

Using the Prometheus Web UI, I'm able to write simple promQL expressions, for instance to grab the year of this timestamp:

year(process_start_time_seconds)

which returns 2022 as intended in the table below the query input.

Unfortunately there does not seem to be any function like isodate(process_start_time_seconds) that would return a string like 2022-07-27T11:02:27.000Z

Is there an alternative way to obtain this human-friendly date value starting from a timestamp?

I think it's a reasonable request but I think you can't do this using PromQL. Please explain what you're trying to do as there may be a solution for that need. If you want to see "humanized" dates on Prometheus' Graph page, I think you're unable to do this. If you want dates in alert messages or console pages, see Template reference and e.g. humanizeTimestamp (I don't know what format this is). - DazWilkin