Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metric Sample TimeStamp is zero #7

Open
fastbike opened this issue Oct 8, 2024 · 4 comments
Open

Metric Sample TimeStamp is zero #7

fastbike opened this issue Oct 8, 2024 · 4 comments
Assignees

Comments

@fastbike
Copy link

fastbike commented Oct 8, 2024

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 ?

@marcobreveglieri marcobreveglieri self-assigned this Oct 8, 2024
@fastbike
Copy link
Author

fastbike commented Oct 9, 2024

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
Copy link
Owner

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.

@fastbike
Copy link
Author

@marcobreveglieri my colleague has done some work to populate the timestamp field. It is used by Prometheus to build the time series collection where the data has been scrapped from other systems.

@marcobreveglieri
Copy link
Owner

marcobreveglieri commented Dec 7, 2024

@marcobreveglieri my colleague has done some work to populate the timestamp field. It is used by Prometheus to build the time series collection where the data has been scrapped from other systems.

Hi @fastbike,
thanks again for taking this topic into account. 🙏

Have you (or your colleague) tested what you said in a real scenario?
If so, can you send a pull request, or a description of what needs to be implemented?

I would like to give this timestamp field the right purpose it deserves. 😄

Regards,
Marco.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants