The standard way to use metrics in Prometheus is to declare them at file level, before using them. Why?
A blog on monitoring, scale and operational Sanity
For counting how many times a thing has happened you can use a counter and
rate(), but that doesn't work across batch jobs.