Hi, guys,
many thanks for your interesting solutions.

I have implemented Vicente's suggestion, it works as expected.

loadmodule "xhttp_prom.so"
modparam("xhttp_prom", "prom_counter", "name=mycounter;")
modparam("pv", "shvset", "is_prometheus_init=i:0")
route {
    if ($shv(is_prometheus_init) == 0) {
        xlog("L_NOTICE", "Initialization of Prometheus counters\n");
        prom_counter_reset("mycounter");
        $shv(is_prometheus_init) = 1;
    }
}

Regards,
Marat