-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add options support for the SQL obfuscator and update CGo bindings #8556
Conversation
Since Addressing this either requires:
|
You're totally right, I updated it to where we pass the options directly to the method rather than trying to use the receiver struct to take/use options. a186696c9124afcb921358a7a06833d33c7b4246 |
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.
@alexbarksdale I left some comments but since some of this is a bit above my head, I'll try to see if someone else from agent-core can review as well.
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.
There's pending feedback for this comment but overall LGTM
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.
Overall looks good to me!
I've left a few comments, two of them not blocking anything but please make sure to review the one concerning the error return.
releasenotes/notes/add-sql-obfuscator-options-and-update-cgo-bindings-078a7fe8bf91076e.yaml
Outdated
Show resolved
Hide resolved
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.
This is fine to unblock you, but we should find a better way to do it. We can refactor in another PR.
releasenotes/notes/add-sql-obfuscator-options-and-update-cgo-bindings-078a7fe8bf91076e.yaml
Outdated
Show resolved
Hide resolved
releasenotes/notes/add-sql-obfuscator-options-and-update-cgo-bindings-078a7fe8bf91076e.yaml
Outdated
Show resolved
Hide resolved
b743e43
to
8d17878
Compare
Apologies for the goof up, please ignore. |
What does this PR do?
Adds support to provide options to configure the behavior of the SQL obfuscator, as well as update the python CGo bindings to consume the obfuscator options from the integration.
Motivation
The current iteration of the obfuscator is unable to handle unique use cases, and this PR aims to make it more generic. For example, there is an option to quantize SQL tables via a feature flag. If this flag is enabled, it's an all or nothing scenario, meaning if one agent is monitoring two database instances, and one needs obfuscation but the other explicitly does not, we cannot adapt to this requirement.
Additional Notes
Important context
The primary change in this PR includes the implementation of the newly added options to configure the obfuscator for the CGo bindings used by various integrations. As mentioned before, the
quantize_sql_tables
option is currently an all or nothing option, we need this to be configurable per database instance. This PR has removed the use of the feature flag and instead consumes theoptions
to enable/disable it. For further details, please read below on this option will now be configured.How the CGo bindings will consume options from the integration
quantize_sql_tables
will be moved into their instance configs and passed into the CGo bindings.quantize_sql_tables
option and future options that need to be at a per instance level will configure the obfuscator as such:Pull instance config at the integration -> pass the value to a Python method that implements a CGo binding -> trigger C code -> invoke Go code
Performance of the options unmarshalling in the CGo binding
To keep things as performant as possible, I opted to use the
easyjson
library to perform the unmarshalling of the options from the integration. The snippet below is a benchmark that compares the use ofeasyjson
toencoding/json
.Integration changes for added context
Describe how to test your changes
invoke rtloader.test
at the root dir.easyjson
results in the same output asencoding/json
by running:invoke test --targets=./pkg/trace/config --skip-linters
at the root dir.invoke test --targets=./pkg/trace/obfuscate --skip-linters
at the root dir.Checklist
changelog/no-changelog
label has been applied.