-
Notifications
You must be signed in to change notification settings - Fork 200
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 option to fetch timestamp from JSON #97
Conversation
699bbfe
to
9c265cf
Compare
This fixes prometheus-community#80 Signed-off-by: Jérôme LOYET <822436+fatpat@users.noreply.github.com>
This seems a good idea, however I would prefer to have a fixed format rather than guessing it from a third party library. |
OK I'll check |
The idea would be to use |
Also update the Readme and the example configs for reference. And link to this section explaining the behavior that when time series are missed for more than 5 minutes, they just "disappear" from graphs, (so that users understand the expected behavior when the scrapes are successful, but metrics are still missing from prometheus):
|
I don't really know how prometheus handles time series with timestamps from exporters. But one of the concerns I initially had when I saw this PR the first time, was that just by looking at Prometheus is it possible for a user know if the Does prometheus actually somehow show that the last scrape was at time 10 seconds ago, but the actual data collected was with a timestamp of 4 minutes ago. Because if that is not possible, then prometehus can never reliably tell me about the Would be great if @roidelapluie you an explanation or a link to some blog/doc explaining this. I found this but this is not targeted at timeseries with timestamps, just for missed scrapes which then get marked as I had put off reviewing this PR for a day when I would actually be able to test this behavior and understand the consequences, but I think that might still take a few weeks before I can afford to do that. |
I expect the timestamp to be exported as a metric, not to be set on metrics. I did not review the PR yet, just scanned it very quickly. We should not set timestamps on metrics |
Ah yes, in that case all would be fine. Exporting the timestamp as a metric (probably with unix epoch time as the value) would be fine. Although on initial thought I can't think how such a metric might actually be useful. But I'll let @fatpat decide if this is useful to them or not. |
Oh, indeed, the current implentation exposes a metric with a timestamp, which is something we should not do I think. cc @SuperQ do you agree? |
@roidelapluie Agreed, it should not expose with a timestamp. |
based on prometheus-community#97 and prometheus-community#80 this provides the posibility to use a metric that has a unix style timestamp as the timestamp of the scraped metric
based on prometheus-community#97 and prometheus-community#80 this provides the posibility to use a metric that has a unix style timestamp as the timestamp of the scraped metric When deserializing objects we need to take the key json path into account as well like we would do for all the values as well. This allows collections to be defined still with each entry having a separate timestamp (e.g. list of time-stamped log messages). Update examples for timestamp Update Readme about staleness for custom timestamps
based on prometheus-community#97 and prometheus-community#80 this provides the posibility to use a metric that has a unix style timestamp as the timestamp of the scraped metric When deserializing objects we need to take the key json path into account as well like we would do for all the values as well. This allows collections to be defined still with each entry having a separate timestamp (e.g. list of time-stamped log messages). Update examples for timestamp Update Readme about staleness for custom timestamps Signed-off-by: Jan Phillip Kretzschmar <janphkre@gmx.de>
based on prometheus-community#97 and prometheus-community#80 this provides the posibility to use a metric that has a unix style timestamp as the timestamp of the scraped metric When deserializing objects we need to take the key json path into account as well like we would do for all the values as well. This allows collections to be defined still with each entry having a separate timestamp (e.g. list of time-stamped log messages). Update examples for timestamp Update Readme about staleness for custom timestamps Signed-off-by: Jan Phillip Kretzschmar <janphkre@gmx.de>
based on prometheus-community#97 and prometheus-community#80 this provides the posibility to use a metric that has a unix style timestamp as the timestamp of the scraped metric When deserializing objects we need to take the key json path into account as well like we would do for all the values as well. This allows collections to be defined still with each entry having a separate timestamp (e.g. list of time-stamped log messages). Update examples for timestamp Update Readme about staleness for custom timestamps Signed-off-by: Jan Phillip Kretzschmar <janphkre@gmx.de>
* Pick timestamp from metric based on #97 and #80 this provides the posibility to use a metric that has a unix style timestamp as the timestamp of the scraped metric When deserializing objects we need to take the key json path into account as well like we would do for all the values as well. This allows collections to be defined still with each entry having a separate timestamp (e.g. list of time-stamped log messages). Update examples for timestamp Update Readme about staleness for custom timestamps Signed-off-by: Jan Phillip Kretzschmar <janphkre@gmx.de> Signed-off-by: Ben Kochie <superq@gmail.com> Co-authored-by: Ben Kochie <superq@gmail.com>
This fixes #80