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

QueryManager - Prevent queries leaking between check instances #7750

Merged
merged 2 commits into from
Oct 9, 2020

Conversation

FlorianVeaux
Copy link
Member

Database checks pass instances of 'Query' directly to the QueryManager for them to be 'compiled' and used.
The QueryManager modifies those 'Query' instances in-place which means that multiple instances of a same check will share the same references to those 'Query' objects.
It wouldn't be a problem if those Query did not contain references to bounded methods of the check.

Impact:

Any check currently using the QueryManager with multiple configuration instances will see metrics that should be submitted with one instance being submitted with another one. This is transparent to users, metrics will be sent to Datadog app anyway.
If the check is using autodiscovery, configuration instances are generated dynamically. Instances can be unscheduled and that leads to integrations trying to report metrics through another un-existing check instance which the agent refuses to send.

@codecov
Copy link

codecov bot commented Oct 8, 2020

@yzhan289
Copy link
Contributor

yzhan289 commented Oct 8, 2020

Is this different than: #7739

@FlorianVeaux
Copy link
Member Author

Is this different than: #7739

Different implementation to choose from indeed. This one requires modification to every single integration but is a bit cleaner. The other one doesn't require changes to integrations but is a bit more hacky.

Copy link
Contributor

@coignetp coignetp left a comment

Choose a reason for hiding this comment

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

This option looks good IMO, but couldn't this break any extra or marketplace integration that's using the query manager?

@FlorianVeaux
Copy link
Member Author

It would, but no extras or marketplace integration is currently using that

coignetp
coignetp previously approved these changes Oct 9, 2020
Copy link
Contributor

@coignetp coignetp left a comment

Choose a reason for hiding this comment

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

LGTM, but maybe the changelog label should be set to changed then

@hithwen
Copy link
Contributor

hithwen commented Oct 9, 2020

Much nicer indeed

@FlorianVeaux FlorianVeaux merged commit c9c2151 into master Oct 9, 2020
@FlorianVeaux FlorianVeaux deleted the florian/fix_qm_state2 branch October 9, 2020 14:37
github-actions bot pushed a commit that referenced this pull request Oct 9, 2020
* QueryManager - Prevent queries leaking between check instances

* Fix snowflake c9c2151
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants