-
Notifications
You must be signed in to change notification settings - Fork 481
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
Implement lifetime feature #78
Conversation
In some situations it is very useful if you can submit values to the pushgateway that disappear after a certain while (if they are not refreshed). The lifetime is specified by adding a "Lifetime"-Field to your HTTP-Header. The value is a string that the "ParseDuration" (golang-builtin) function accepts as valid format. Implements prometheus#19
@@ -70,6 +70,7 @@ type MetricStore interface { | |||
type WriteRequest struct { | |||
Labels map[string]string | |||
Timestamp time.Time | |||
Lifetime time.Duration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would tend to name this Timeout
.
Thanks for submitting this! |
What's the use case for this? Usually the only time you want to delete data from the Pushgateway is when a job is being turned down. |
@brian-brazil The use-case discussion was done in #19, and a @brian-brazil said there: “A use case for this has appeared, it may be a way to allow clients who really really want to push to do so; while offering some GC.” Personally, I'm not a fan of a timeout. In general, I see the need for the timeout as a sign for a not very “Promethean” design. But enough people seem to be stuck in such design patterns (for reasons) and expressed the need for timeouts, so I'd be willing to add it to the PGW if there is no strong resistance otherwise. I'll look at the code once we have agreement that we need the feature at all. |
My usecase:
Or is there any better solution in this scenario? |
We generally recommend running Prometheus on the same network as what it's monitoring. Trying to workaround with the pushgateway will run into issues as you've discovered, and this PR is not sufficient to fully resolve them. |
Hm. I don't exactly know which problems are left over after with this feature. If I get it right, it is a problem if you wan't to use it in combination with the alert manager. Is it because the the statistics are simply removed and therefore not monitored anymore? Possible solutions to this problem:
Are there are any other issues regarding to this feature? |
@lemoer Introducing a semantics of timed-out vs removed into the Prometheus data model would be really confusing. Prometheus is all pull-based. Representing anything that only makes sense in push world would break consistency and is asking for a lot of trouble down the rabbit hole. Alerting on disappearing metrics should already be possible with the existing expression language. No reason to change anything in Alertmanager. @juliusv @fabxc I'd still be very interested in your opinion if we should declare a timeout for metrics on the pushgateway a goal or non-goal. I think all aspects have been discussed here, or in the past. I just would like to wrap this up, either by adding the timeout feature (even if not used for @lemoer 's use-case in the end, but quite possibly based on this PR) or by closing #19 as "won't fix" and thus this PR. |
@juliusv @fabxc Would be great to get an explicit answer from you (even if it is "I have no opinion on this") instead of just running into a timeout. So far, @brian-brazil is pretty clearly against a timeout feature. I don't really like it myself, but I'm not completely decided yet. However, if nobody else of you speaks up for it, we'll toss it. |
I see all arguments, but I don't have a strong opinion either way. |
@fabxc expressed not having a strong opinion on this earlier. I've just now talked to the OP of #19 , and he agreed that he never really ran into the use case again. I conclude for now that the consensus is to not have a timeout feature in PGW. I'll close #19. @lemoer my sincerest apologies for not making up our mind earlier and thus luring you into creating this PR. We are still grateful for your contribution. At the very least, it sparked a discussion and we finally made up our mind. |
I wrote an implementation for the lifetime feature a few months ago. It's working great for me so I want to bring it back to you. What do you think about this implementation?
Implements #19