marcobreveglieri / prometheus-client-delphi

Prometheus Client Library for Delphi
MIT License
48 stars 17 forks source link

Metric Sample TimeStamp is zero #7

Closed fastbike closed 3 days ago

fastbike commented 2 weeks ago

The TSample record declares a field TimeStamp which is annotated "The timestamp of this sample."

However the collectors never populate this, setting it to zero.

Also, the value is not output when the Collect method is rendered if the value is non zero.

What is the purpose and how should this been used ?

fastbike commented 2 weeks ago

https://prometheus.io/docs/instrumenting/exposition_formats/

The timestamp is an int64 (milliseconds since epoch, i.e. 1970-01-01 00:00:00 UTC, excluding leap seconds), represented as required by Go's ParseInt() function.

marcobreveglieri commented 3 days ago

I've doing some research today about this topic.

If I remember (myself) well, I've added the timestamp field initially as a placeholder, since it was used to export metrics in text format. I have not taken care of its value since then. :)

Exploring some code of other client libraries, it seems this field has something to do with exemplars, but I have not implemented these ones yet.

I think it might be more useful to temporarily remove the field to avoid ambiguity and doubts, and add it again when there will be features that make use of it, assigning and managing it appropriately.

I will close the issue with a targeted commit.

Thanks again for your feedback and support to the project! 💘

Marco.