giantswarm / microkit

The microkit package implements an opinionated microservice framework which can be used as library in golang microservices to speed up development.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

use timestamps, not time since

xh3b4sd opened this issue · comments

I recently read some Prometheus docs. We might do something wrong when emitting the endpoint durations. We emit them as duration. The Prometheus docs recommend emitting timestamps. What do you think @JosephSalisbury

See

I think there's a small nuance here.

The documentation refers to measuring the time since something took place, and then recommends exporting the unix timestamp - this makes sense.

In our case of endpoint durations, this is the amount of time the endpoint took to complete. I would say exporting the duration makes sense. We can't use time() - my_timestamp_metric to calculate how long it took an endpoint to complete - this would be the time since the endpoint completed.

Totally makes sense. Vacation brain wasn't certain.