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

Add timestamp option to render_sample #18

Merged
merged 1 commit into from
Jun 16, 2020
Merged

Conversation

j2ghz
Copy link
Contributor

@j2ghz j2ghz commented Jun 13, 2020

Fixes #17
This is a simple implementation where the parameter is Option<i64>. This leaves working with dates to the crate's users.
From prometheus' documentation:

The timestamp is an int64 (milliseconds since epoch, i.e. 1970-01-01 00:00:00 UTC, excluding leap seconds).

I think I could use https://docs.rs/chrono/0.4.11/chrono/struct.DateTime.html#method.timestamp_millis instead, so users can pass chrono's DateTime. The question is whether this is desirable, taking a hard dependency on chrono. Another option would be an enum with options of either a DateTime or an i64. (I will have to implement it for the exporter I'm writing anyway, so the question is just if it should be in this base crate, or not.) Let me know what you think @MindFlavor

@MindFlavor
Copy link
Owner

That's great! Thank you! I prefer your approach, forcing Chrono on users does not give us many advantages.

@MindFlavor MindFlavor merged commit faf2e07 into MindFlavor:master Jun 16, 2020
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

Successfully merging this pull request may close these issues.

Allow specifying timestamps for metrics
2 participants