Ignoring Unwanted Resources in APM by jchrostek-dd · Pull Request #794 · DataDog/datadog-lambda-extension
| if let Some(require_tags) = &config.apm_filter_tags_require { | ||
| if !require_tags.is_empty() { | ||
| let matches_require = require_tags | ||
| .iter() | ||
| .all(|filter| span_matches_tag_exact_filter(span, filter)); | ||
| if !matches_require { | ||
| debug!( | ||
| "Filtering out span '{}' - doesn't match all required tags {}", | ||
| span.name, | ||
| require_tags.join(", ") | ||
| ); | ||
| return true; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Handle required regex tags from DD_APM_FILTER_TAGS_REGEX_REQUIRE (regex match) | ||
| if let Some(require_regex_tags) = &config.apm_filter_tags_regex_require { | ||
| if !require_regex_tags.is_empty() { | ||
| let matches_require_regex = require_regex_tags | ||
| .iter() | ||
| .all(|filter| span_matches_tag_regex_filter(span, filter)); | ||
| if !matches_require_regex { | ||
| debug!( | ||
| "Filtering out span '{}' - doesn't match all required regex tags {}", | ||
| span.name, | ||
| require_regex_tags.join(", ") | ||
| ); | ||
| return true; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Handle reject tags from DD_APM_FILTER_TAGS_REJECT (exact match) | ||
| if let Some(reject_tags) = &config.apm_filter_tags_reject { | ||
| if !reject_tags.is_empty() { | ||
| let matches_reject = reject_tags | ||
| .iter() | ||
| .any(|filter| span_matches_tag_exact_filter(span, filter)); | ||
| if matches_reject { | ||
| debug!( | ||
| "Filtering out span '{}' - matches reject tags {}", | ||
| span.name, | ||
| reject_tags.join(", ") | ||
| ); | ||
| return true; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Handle reject regex tags from DD_APM_FILTER_TAGS_REGEX_REJECT (regex match) | ||
| if let Some(reject_regex_tags) = &config.apm_filter_tags_regex_reject { | ||
| if !reject_regex_tags.is_empty() { | ||
| let matches_reject_regex = reject_regex_tags | ||
| .iter() | ||
| .any(|filter| span_matches_tag_regex_filter(span, filter)); | ||
| if matches_reject_regex { | ||
| debug!( | ||
| "Filtering out span '{}' - matches reject regex tags {}", | ||
| span.name, | ||
| reject_regex_tags.join(", ") | ||
| ); | ||
| return true; | ||
| } | ||
| } | ||
| } |