Skip to content

Commit e9ceb7b

Browse files
committed
Add track_error: false on ignored caught exceptions
Signed-off-by: Bob Weinand <[email protected]>
1 parent 9cc3c1f commit e9ceb7b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Diff for: ext/serializer.c

+16
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,22 @@ static void _serialize_meta(zval *el, ddtrace_span_data *span, zend_string *serv
12801280
ddtrace_hash_find_ptr(Z_ARR_P(meta), ZEND_STRL("error.type"));
12811281
if (error && !ignore_error) {
12821282
add_assoc_long(el, "error", 1);
1283+
1284+
if (Z_TYPE(span->property_exception) == IS_OBJECT) {
1285+
ddtrace_span_data *parent = span;
1286+
while (parent->parent) {
1287+
parent = SPANDATA(parent->parent);
1288+
if (Z_TYPE(parent->property_exception) == IS_OBJECT && Z_OBJ(parent->property_exception) == Z_OBJ(span->property_exception)) {
1289+
zval *zv;
1290+
if ((zv = zend_hash_str_find(ddtrace_property_array(&parent->property_meta), ZEND_STRL("error.ignored"))) && zval_is_true(zv)) {
1291+
add_assoc_string(el, "track_error", "false");
1292+
break;
1293+
}
1294+
} else {
1295+
break;
1296+
}
1297+
}
1298+
}
12831299
}
12841300

12851301
if (span->root->trace_id.high && is_root_span) {

0 commit comments

Comments
 (0)