Skip to content

Commit eb628cc

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

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Diff for: ext/serializer.c

+15
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,21 @@ 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+
if (zend_hash_str_exists(ddtrace_property_array(&parent->property_meta), ZEND_STRL("error.ignored"))) {
1290+
add_assoc_string(el, "track_error", "false");
1291+
break;
1292+
}
1293+
} else {
1294+
break;
1295+
}
1296+
}
1297+
}
12831298
}
12841299

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

0 commit comments

Comments
 (0)