-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Keep input timestamp for prometheus metrics #5292
Conversation
Looks good, but based on my understanding of prometheus best-practice we should add a new option to the output that must be enabled to add timestamps: |
I added |
Can you flip the default to false, we need to do this for backwards compatibility. Separately, and we don't have to know now, it would be good to know if we should change it to true when Telegraf 2.0 comes out. Timestamps seem to be somewhat frowned upon in prometheus, prometheus/client_golang#187, but perhaps ours is the right use case. I also found https://github.com/prometheus/pushgateway#about-timestamps, I would think this is a fairly similar use and they have chosen not to export timestamps. |
I flipped the default value to But I'm sure, that in future
Telegraf can't calculates metrics on demand, so it should use push gateway. Logically telegraf work with embedded push gateway for exposing metrics. And this embedded push gateway should store metrics timestamp for collected metrics. |
Also, please refrain from force pushing once a review has been started. We squash merge so there won't be messy history anyways |
Only last commit was force pushed: I lost configuration parameter name from commit message. |
I still feel like I'm missing some understanding. It seems to me almost obvious that Telegraf should recommend including the timestamp. At the same time it also seems that Telegraf operates very similarly to the pushgateway, which doesn't use timestamps. What happens when prometheus scapes a metric that is over 5m old? |
I did not check. I think he will add a backdating metric. But I admit that he will ignore her. |
You've added the |
You are right about the default being true, I will fix that, but the I believe the |
Default option to false: ab1a1b0 |
@danielnelson Can I ask an question in here about the fix/update? I have updated our existing Telegraf implementation with the new v1.14.1 and enabled the timestamp as shown below. But I don't see any timestamp information in my metrics. Configuration: Startup log: Exposed metrics: > (with missing timestamp) |
It looks like your example output has timestamps, it's the last value of each line: 1587927480000 |
@danielnelson Sorry for the miss conception on my part. You are right, I overlooked that there was a space between the 1 value of the metric and the timestamp. So it's working and you can ignore my comments. |
This change passes the metrics collection time to prometheus.
Prior to this change, prometheus can see one sample as two different samples, which generates dips/spikes on the charts.
For example:
irate(system_uptime[30s])