-
Notifications
You must be signed in to change notification settings - Fork 151
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 DD_APPSEC_SCA_ENABLED new configuration variable #2557
Conversation
d812229
to
fa41d2a
Compare
BenchmarksBenchmark execution time: 2024-03-05 16:23:25 Comparing candidate commit fa41d2a in PR branch Found 3 performance improvements and 3 performance regressions! Performance is the same for 176 metrics, 0 unstable metrics. scenario:PDOBench/benchPDOBaseline
scenario:PDOBench/benchPDOBaseline-opcache
scenario:PDOBench/benchPDOOverhead
scenario:PDOBench/benchPDOOverhead-opcache
scenario:PDOBench/benchPDOOverheadWithDBM
scenario:PDOBench/benchPDOOverheadWithDBM-opcache
|
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.
Are there perhaps any tests showing that this variable is actually being sent?
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #2557 +/- ##
============================================
- Coverage 77.08% 75.91% -1.17%
Complexity 2574 2574
============================================
Files 214 240 +26
Lines 23057 27033 +3976
Branches 0 976 +976
============================================
+ Hits 17773 20522 +2749
- Misses 5284 5991 +707
- Partials 0 520 +520
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 26 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
ext/telemetry.c
Outdated
@@ -53,6 +53,8 @@ void ddtrace_telemetry_finalize(void) { | |||
ddog_ConfigurationOrigin origin = DDOG_CONFIGURATION_ORIGIN_DEFAULT; | |||
if (!zend_string_equals_cstr(ini->value, cfg->default_encoded_value.ptr, cfg->default_encoded_value.len)) { | |||
origin = cfg->name_index >= 0 ? DDOG_CONFIGURATION_ORIGIN_ENV_VAR : DDOG_CONFIGURATION_ORIGIN_CODE; | |||
} else { |
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.
I found that when a configuration is explicitly defined as a env/ini with the same value as the default value of that config, the value sent to telemetry was default
and it should be EnvVar
instead
1b1225b
to
7f6fc56
Compare
I think you should test |
da51431
to
0f417ed
Compare
Thanks for pointing that out @bwoebi . If I understood correctly, I fixed it |
@bwoebi pr is ready. Can you review when you have a chance please? |
ext/configuration.c
Outdated
if (env_name.ptr == strstr(env_name.ptr, "DD_APPSEC_")) { | ||
ini_name->ptr[sizeof("datadog.appsec") - 1] = '.'; | ||
} | ||
|
||
if (env_name.ptr == strstr(env_name.ptr, "DD_TRACE_")) { | ||
ini_name->ptr[sizeof("datadog.trace") - 1] = '.'; | ||
} |
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.
Can we reorder this and put an else if there? Just to avoid eval of strstr when unnecessary.
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.
Makes sense. Done
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 LGTM :-)
Description
It is required to create a new configuration variable
DD_APPSEC_SCA_ENABLED
so customers can enable SCA. This variable is reported to the backend via telemetry and used there.Reviewer checklist
APPSEC-14721