Skip to content

Commit

Permalink
Add track_error: false on ignored caught exceptions
Browse files Browse the repository at this point in the history
Signed-off-by: Bob Weinand <[email protected]>
  • Loading branch information
bwoebi committed Feb 6, 2025
1 parent 9cc3c1f commit 28b9656
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ext/serializer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,21 @@ static void _serialize_meta(zval *el, ddtrace_span_data *span, zend_string *serv
ddtrace_hash_find_ptr(Z_ARR_P(meta), ZEND_STRL("error.type"));
if (error && !ignore_error) {
add_assoc_long(el, "error", 1);

if (Z_TYPE(span->property_exception) == IS_OBJECT) {
ddtrace_span_data *parent = span;
while (parent->parent) {
parent = SPANDATA(span->parent);
if (Z_TYPE(parent->property_exception) == IS_OBJECT && Z_OBJ(parent->property_exception) == Z_OBJ(span->property_exception)) {
if (zend_hash_str_exists(ddtrace_property_array(&parent->property_meta), ZEND_STRL("error.ignored"))) {
add_assoc_string(el, "track_error", "false");
break;
}
} else {
break;
}
}
}
}

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

0 comments on commit 28b9656

Please sign in to comment.