Skip to content

Commit 50ce39c

Browse files
authored
Strip error messages from hook telemetry (#3449)
Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
1 parent 83b4cf2 commit 50ce39c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

ext/hook/uhook.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ void dd_uhook_report_sandbox_error(zend_execute_data *execute_data, zend_object
217217
log("%s thrown in ddtrace's closure defined at %s:%d for %s%s%s(): %s in %s on line %d",
218218
type, deffile, defline, scope, colon, name, msg, regular_exception ? ZSTR_VAL(exfile) : "Unknown", exline);
219219
if (get_global_DD_INSTRUMENTATION_TELEMETRY_ENABLED() && get_DD_TELEMETRY_LOG_COLLECTION_ENABLED()) {
220-
INTEGRATION_ERROR_TELEMETRY(ERROR, "%s thrown in ddtrace's closure defined at <redacted>%s:%d for %s%s%s(): %s in <redacted>%s on line %d",
221-
type, ddtrace_telemetry_redact_file(deffile), defline, scope, colon, name, msg, regular_exception ? ddtrace_telemetry_redact_file(ZSTR_VAL(exfile)) : "Unknown", exline);
220+
INTEGRATION_ERROR_TELEMETRY(ERROR, "%s thrown in ddtrace's closure defined at <redacted>%s:%d for %s%s%s(): $ERROR_MSG in <redacted>%s on line %d",
221+
type, ddtrace_telemetry_redact_file(deffile), defline, scope, colon, name, regular_exception ? ddtrace_telemetry_redact_file(ZSTR_VAL(exfile)) : "Unknown", exline);
222222
}
223223
if (exfile) {
224224
zend_string_release(exfile);
@@ -227,8 +227,8 @@ void dd_uhook_report_sandbox_error(zend_execute_data *execute_data, zend_object
227227
log("Error raised in ddtrace's closure defined at %s:%d for %s%s%s(): %s in %s on line %d",
228228
deffile, defline, scope, colon, name, LAST_ERROR_STRING, LAST_ERROR_FILE, PG(last_error_lineno));
229229
if (get_global_DD_INSTRUMENTATION_TELEMETRY_ENABLED() && get_DD_TELEMETRY_LOG_COLLECTION_ENABLED()) {
230-
INTEGRATION_ERROR_TELEMETRY(ERROR, "Error raised in ddtrace's closure defined at <redacted>%s:%d for %s%s%s(): %s in <redacted>%s on line %d",
231-
ddtrace_telemetry_redact_file(deffile), defline, scope, colon, name, LAST_ERROR_STRING, ddtrace_telemetry_redact_file(LAST_ERROR_FILE), PG(last_error_lineno));
230+
INTEGRATION_ERROR_TELEMETRY(ERROR, "Error raised in ddtrace's closure defined at <redacted>%s:%d for %s%s%s(): $ERROR_MSG in <redacted>%s on line %d",
231+
ddtrace_telemetry_redact_file(deffile), defline, scope, colon, name, ddtrace_telemetry_redact_file(LAST_ERROR_FILE), PG(last_error_lineno));
232232
}
233233
}
234234
})

tests/ext/telemetry/integration_runtime_error.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ array(2) {
6868
[0]=>
6969
array(7) {
7070
["message"]=>
71-
string(165) "Error raised in ddtrace's closure defined at <redacted>%cintegration_runtime_error.php:12 for foo(): Testnotice in <redacted>%cintegration_runtime_error.php on line 13"
71+
string(165) "Error raised in ddtrace's closure defined at <redacted>%cintegration_runtime_error.php:12 for foo(): $ERROR_MSG in <redacted>%cintegration_runtime_error.php on line 13"
7272
["level"]=>
7373
string(5) "ERROR"
7474
["count"]=>
@@ -85,7 +85,7 @@ array(2) {
8585
[1]=>
8686
array(7) {
8787
["message"]=>
88-
string(161) "Exception thrown in ddtrace's closure defined at <redacted>%cintegration_runtime_error.php:7 for foo(): test in <redacted>%cintegration_runtime_error.php on line %d"
88+
string(167) "Exception thrown in ddtrace's closure defined at <redacted>%cintegration_runtime_error.php:7 for foo(): $ERROR_MSG in <redacted>%cintegration_runtime_error.php on line %d"
8989
["level"]=>
9090
string(5) "ERROR"
9191
["count"]=>

0 commit comments

Comments
 (0)