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

enhancement(prometheus_exporter sink): expire metrics #9769

Merged
merged 5 commits into from
Nov 3, 2021

Conversation

lukesteensen
Copy link
Member

Closes #5867

Closes #5867

Signed-off-by: Luke Steensen <luke.steensen@gmail.com>
@netlify
Copy link

netlify bot commented Oct 22, 2021

✔️ Deploy Preview for vector-project canceled.

🔨 Explore the source changes: 0dfa3ed

🔍 Inspect the deploy log: https://app.netlify.com/sites/vector-project/deploys/6182e39bf0c21c00078f2835

@jszwedko jszwedko requested a review from bruceg October 22, 2021 18:09
Signed-off-by: Luke Steensen <luke.steensen@gmail.com>
Copy link
Member

@bruceg bruceg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some doubts to this approach. Did you consider making the update time part of the "value" part of the hash map instead of bundling it with the value?

Signed-off-by: Luke Steensen <luke.steensen@gmail.com>
@lukesteensen
Copy link
Member Author

@bruceg

Did you consider making the update time part of the "value" part of the hash map instead of bundling it with the value?

I do agree it'd make more sense for this to live on the value side of the map, but it's awkward right now because the value itself lives in the key. I can move it in that direction, but I think my thought process was mostly that this is part of the "metrics entry".

The whole thing would make more sense if we did something like IndexMap<MetricId, MetricEntry>, but I'm not sure I want to push through that big a change as part of this PR.

Signed-off-by: Luke Steensen <luke.steensen@gmail.com>
@lukesteensen
Copy link
Member Author

@bruceg I switched over to the approach you suggested and I agree that's probably the way to go for now.

@lukesteensen lukesteensen marked this pull request as ready for review October 25, 2021 18:47
@lukesteensen lukesteensen requested a review from bruceg October 29, 2021 14:39
Copy link
Member

@bruceg bruceg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic looks good. I have an optimization suggestion below for the filter loop.

(entry, metadata)
})
.filter(|(_metric, metadata)| {
metadata.updated_at.elapsed().as_secs() < self.config.flush_period_secs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use an Instant::now computed outside of the filter and start.duration_since(metadata.updated_at).as_secs() here.

@bits-bot
Copy link

bits-bot commented Nov 3, 2021

CLA assistant check
All committers have signed the CLA.

Signed-off-by: Luke Steensen <luke.steensen@gmail.com>
@lukesteensen lukesteensen enabled auto-merge (squash) November 3, 2021 19:38
@lukesteensen lukesteensen merged commit 53862fb into master Nov 3, 2021
@lukesteensen lukesteensen deleted the prom-expire-metrics branch November 3, 2021 23:37
jszwedko added a commit that referenced this pull request Nov 9, 2021
This field took on more responsibility in
#9769. This PR updates the
doc to reflect its new semantics.

Signed-off-by: Jesse Szwedko <jesse@szwedko.me>
tobz pushed a commit that referenced this pull request Nov 9, 2021
* docs(prometheus_exporter sink): Update `flush_period_secs` docs

This field took on more responsibility in
#9769. This PR updates the
doc to reflect its new semantics.

Signed-off-by: Jesse Szwedko <jesse@szwedko.me>
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.

prometheus_scrape source or prometheus_exporter sink does not expire values
3 participants