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(processors.starlark): Avoid negative refcounts for tracking metrics #14395

Merged
merged 11 commits into from
Dec 7, 2023

Conversation

srebhan
Copy link
Member

@srebhan srebhan commented Dec 6, 2023

Summary

Tracking metrics are currently aggressively accepted and dropped by the starlark processor. In turn, those metrics might be double tagged (accept or drop) especially in cases where we use the deepcopy starlark command. Moreover, the current testutil.Accumulator implementation just strips the tracking information and thus those errors have gone unnoticed in the tests.

This PR fixes the testutil.Accumulator implementation to mimic the behavior of the actual accumulator and uncover refcount or unacknowledged-metric issues. The PR also modifies the starlark processor to not accept metrics but leaves this to the output plugins. To be on the safe-side, deepcopys are modified to strip the tracking information by default as metrics might be deep-copied and then dropped, which will go unnoticed by the processor . To keep the tracking information an optional track parameter is added to deepcopy.

Checklist

  • No AI generated code was used in this PR
  • Unit-tests
  • Updated documentation

Related issues

resolves #14360
superseeds #14372

@telegraf-tiger telegraf-tiger bot added area/starlark fix pr to fix corresponding bug plugin/processor labels Dec 6, 2023
@srebhan srebhan 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 Dec 6, 2023
Copy link
Contributor

@powersj powersj left a comment

Choose a reason for hiding this comment

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

Thanks for helping with this one!

@powersj powersj merged commit 57fbc73 into influxdata:master Dec 7, 2023
@github-actions github-actions bot added this to the v1.29.0 milestone Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/starlark fix pr to fix corresponding bug plugin/processor 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.

panic: negative refcount when returning deepcopy from starlark
3 participants