Skip to content

Commit

Permalink
Add track_error: false on ignored caught exceptions (#3074)
Browse files Browse the repository at this point in the history
Signed-off-by: Bob Weinand <[email protected]>
  • Loading branch information
bwoebi authored and realFlowControl committed Feb 14, 2025
1 parent 7858254 commit 20e07ba
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ext/serializer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,22 @@ 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(parent->parent);
if (Z_TYPE(parent->property_exception) == IS_OBJECT && Z_OBJ(parent->property_exception) == Z_OBJ(span->property_exception)) {
zval *zv;
if ((zv = zend_hash_str_find(ddtrace_property_array(&parent->property_meta), ZEND_STRL("error.ignored"))) && zval_is_true(zv)) {
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 20e07ba

Please sign in to comment.