-
Notifications
You must be signed in to change notification settings - Fork 294
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
Do not require appsec modules when disabling appsec if they have not been required before #4244
Conversation
Overall package sizeSelf size: 6.3 MB Dependency sizes
🤖 This report was automatically generated by heaviest-objects-in-the-universe |
BenchmarksBenchmark execution time: 2024-04-18 15:25:33 Comparing candidate commit 043efb7 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 261 metrics, 5 unstable metrics. |
2a8f2a0
to
aaf4bfa
Compare
We should take care of this point where appsec could be enabled via RC. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4244 +/- ##
==========================================
- Coverage 73.16% 69.19% -3.98%
==========================================
Files 245 1 -244
Lines 10442 198 -10244
Branches 33 33
==========================================
- Hits 7640 137 -7503
+ Misses 2802 61 -2741 ☔ View full report in Codecov by Sentry. |
packages/dd-trace/src/proxy.js
Outdated
@@ -58,7 +79,7 @@ class Tracer extends NoopProxy { | |||
} | |||
|
|||
if (config.remoteConfig.enabled && !config.isCiVisibility) { | |||
const rc = remoteConfig.enable(config) | |||
const rc = remoteConfig.enable(config, this) |
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.
here we could pass to RC this._modules.appsec
instead this
. That way RC wouldn't need to know where to obtain the appsec module. It'd directly invoke enable or disable.
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.
good point, but i feel like we have this habit of passing the tracer instance a bit everywhere, so, up to you 🤷
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.
ok, I'll leave it as it is
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.
It's a habit we want to revert ASAP, so I'd use the boy scout rule here if possible.
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.
Is there anything in the CI that will ensure this works with bundlers ?
Co-authored-by: simon-id <simon.id@datadoghq.com>
there are some integration tests for es-build. Let me take a look |
esbuild tests are working as expected 👍 |
@iunanua where are they running ? i can't find them in the CI |
AFAIK they are not in the CI. |
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.
code looks good, but if it's not tested in the CI, do I have to just trust you ?
…been required before (#4244) * mark if a module has been required before * Add esm bundler comment * Rename TracerModule as LazyModule * Handle appsec enablement/disablement via RC * Test module.enable call arguments * Check appsec and iast are not enabled by default * Check appsec and iast are not enabled via RC when they are not enabled by default * Update packages/dd-trace/src/proxy.js Co-authored-by: simon-id <simon.id@datadoghq.com> * Pass appsec module to RC instead of the tracer --------- Co-authored-by: simon-id <simon.id@datadoghq.com>
…been required before (#4244) * mark if a module has been required before * Add esm bundler comment * Rename TracerModule as LazyModule * Handle appsec enablement/disablement via RC * Test module.enable call arguments * Check appsec and iast are not enabled by default * Check appsec and iast are not enabled via RC when they are not enabled by default * Update packages/dd-trace/src/proxy.js Co-authored-by: simon-id <simon.id@datadoghq.com> * Pass appsec module to RC instead of the tracer --------- Co-authored-by: simon-id <simon.id@datadoghq.com>
…been required before (#4244) * mark if a module has been required before * Add esm bundler comment * Rename TracerModule as LazyModule * Handle appsec enablement/disablement via RC * Test module.enable call arguments * Check appsec and iast are not enabled by default * Check appsec and iast are not enabled via RC when they are not enabled by default * Update packages/dd-trace/src/proxy.js Co-authored-by: simon-id <simon.id@datadoghq.com> * Pass appsec module to RC instead of the tracer --------- Co-authored-by: simon-id <simon.id@datadoghq.com>
…been required before (#4244) * mark if a module has been required before * Add esm bundler comment * Rename TracerModule as LazyModule * Handle appsec enablement/disablement via RC * Test module.enable call arguments * Check appsec and iast are not enabled by default * Check appsec and iast are not enabled via RC when they are not enabled by default * Update packages/dd-trace/src/proxy.js Co-authored-by: simon-id <simon.id@datadoghq.com> * Pass appsec module to RC instead of the tracer --------- Co-authored-by: simon-id <simon.id@datadoghq.com>
…been required before (#4244) * mark if a module has been required before * Add esm bundler comment * Rename TracerModule as LazyModule * Handle appsec enablement/disablement via RC * Test module.enable call arguments * Check appsec and iast are not enabled by default * Check appsec and iast are not enabled via RC when they are not enabled by default * Update packages/dd-trace/src/proxy.js Co-authored-by: simon-id <simon.id@datadoghq.com> * Pass appsec module to RC instead of the tracer --------- Co-authored-by: simon-id <simon.id@datadoghq.com>
…been required before (#4244) * mark if a module has been required before * Add esm bundler comment * Rename TracerModule as LazyModule * Handle appsec enablement/disablement via RC * Test module.enable call arguments * Check appsec and iast are not enabled by default * Check appsec and iast are not enabled via RC when they are not enabled by default * Update packages/dd-trace/src/proxy.js Co-authored-by: simon-id <simon.id@datadoghq.com> * Pass appsec module to RC instead of the tracer --------- Co-authored-by: simon-id <simon.id@datadoghq.com>
What does this PR do?
Use
LazyModule
s to handle how a module is loaded, enabled and disabled by theTracer
.It takes into account ESM bundles keeping requires in place.
Also handles enablements/disablements via RC
Motivation
do not require a module to disable it if it hasn't enabled before
Plugin Checklist
Additional Notes