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

fix(outputs.prometheus_client): Ensure v1 collector data expires promptly #14232

Merged
merged 2 commits into from
Nov 30, 2023

Conversation

powersj
Copy link
Contributor

@powersj powersj commented Nov 1, 2023

The expire timer can overlap with each collection interval. Meaning that duplicate data can appear. What the v2 collector does is run expire function at every add and collect to avoid any overlap or non-new data.

fixes: #14230

@telegraf-tiger telegraf-tiger bot added fix pr to fix corresponding bug plugin/output 1. Request for new output plugins 2. Issues/PRs that are related to out plugins labels Nov 1, 2023
@powersj powersj self-assigned this Nov 7, 2023
@powersj powersj closed this Nov 15, 2023
@powersj powersj reopened this Nov 27, 2023
@powersj powersj marked this pull request as ready for review November 27, 2023 14:07
@powersj powersj assigned srebhan and unassigned powersj Nov 27, 2023
@powersj powersj added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Nov 27, 2023
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

While the code looks good as-is I do have one suggestion. Feel free to ignore @powersj!

plugins/outputs/prometheus_client/v1/collector.go Outdated Show resolved Hide resolved
@srebhan srebhan assigned powersj and unassigned srebhan Nov 27, 2023
@powersj
Copy link
Contributor Author

powersj commented Nov 29, 2023

@srebhan ready for another round. thanks!

@powersj powersj assigned srebhan and unassigned powersj Nov 29, 2023
…ptly

The expirey timer can overlap with each collection interval. Meaning
that duplicate data can appear. What the v2 collector does is run expire
function at every add and collect to avoid any overlap or non-new data.

fixes: influxdata#14230
@telegraf-tiger
Copy link
Contributor

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Wow I really love this @powersj! Thanks!

@srebhan srebhan merged commit f48b850 into influxdata:master Nov 30, 2023
4 checks passed
@github-actions github-actions bot added this to the v1.29.0 milestone Nov 30, 2023
akash-rubrik pushed a commit to akash-rubrik/telegraf that referenced this pull request Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/prometheus fix pr to fix corresponding bug plugin/output 1. Request for new output plugins 2. Issues/PRs that are related to out plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

telegraf collects data via prometheus scrape
3 participants