Thank you. Got It. for NewMetricWithTimestamp(time.Time,metric) Is it compulsory that the time should be in UTC?
On Tuesday, August 31, 2021 at 2:14:44 PM UTC+5:30 Stuart Clark wrote: > On 2021-08-30 07:19, Prince wrote: > > So that means in the Prometheus graph the data will be getting > > displayed from the time of scraping and at a regular intervals (scrape > > interval). > > Example: my_metric 1669.574 1630299163151(data and it's timestamp). > > So this data 1669.574 will be displayed at starting scrape time not at > > this 1630299163151 time. > > > > ** 163029916315 this is older time than the starting scrape time. > > > > In general you shouldn't set the timestamp for a metric at all. There > are very few use cases where it should be used, with the main one being > when connecting another scrape based metric system to Prometheus (e.g. > CloudWatch). > > For everything else you set the metric to the latest value (for a gauge) > and it will then update Prometheus during the next scrape. If you must > know the exact time of the last event (for example to alert if events > stop happening) you'd have a gauge whos value is that timestamp. But in > none of those situations would you set the metrics timestamp. > > -- > Stuart Clark > -- You received this message because you are subscribed to the Google Groups "Prometheus Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/e316d09f-fe99-4c3a-977d-a25fb6478f39n%40googlegroups.com.

