The examples in the docs use math.random for getting duration:
local latency = math.random(1, 10)
http_requests_latency_hist:observe(latency)
Please make the examples more real by using clock.monotonic or any other method which the developers of metrics recommend for production usage.