chore: use libdatadog's trace filter implementation#3986
Conversation
5be0f9c to
64c0891
Compare
There was a problem hiding this comment.
Pull request overview
This PR replaces the project’s custom trace-filtering logic with libdatadog’s TraceFilterer implementation to better match agent behavior, and updates the C/Rust FFI surface accordingly.
Changes:
- Swap
components-rs/trace_filter.rsfrom an in-tree regex/tag filter implementation tolibdd_trace_utils::trace_filter::TraceFilterer. - Remove the slow-path meta-iterator callback from the FFI API and update call sites and headers.
- Update agent-info config plumbing to pass the filter lists into the concentrator config application.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tracer/trace_filter.c | Updates the C-side call into ddog_check_stats_trace_filter to the new signature (no iterator). |
| components-rs/trace_filter.rs | Replaces custom filter compilation/evaluation with TraceFilterer and adapts the span lookup interface. |
| components-rs/datadog.h | Updates the exported C header signature/documentation for ddog_check_stats_trace_filter. |
| components-rs/common.h | Removes the no-longer-used meta-iteration callback typedefs from the public header. |
| components-rs/agent_info.rs | Adjusts how filter config fields are extracted and passed into apply_concentrator_config. |
| Cargo.lock | Adds a new Rust dependency entry related to trace normalization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| bool ddtrace_trace_passes_filter(ddtrace_span_data *span) { | ||
| zval *root_resource_zv = &span->root->property_resource; | ||
| ZVAL_DEREF(root_resource_zv); | ||
| ddog_CharSlice resource = Z_TYPE_P(root_resource_zv) == IS_STRING | ||
| ? dd_zend_string_to_CharSlice(Z_STR_P(root_resource_zv)) | ||
| : DDOG_CHARSLICE_C(""); | ||
| return ddog_check_stats_trace_filter(resource, span, ddtrace_root_tag_value, ddtrace_meta_iter); | ||
| return ddog_check_stats_trace_filter(resource, span, ddtrace_root_tag_value); | ||
| } |
| fn resource_normalized(&'a self) -> &'a str { | ||
| // FIXME: normalization: if resource is empty, name should be used instead | ||
| self.resource_str | ||
| } |
There was a problem hiding this comment.
true but the fix is very wrong
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Benchmarks [ tracer ]Benchmark execution time: 2026-06-15 20:52:53 Comparing candidate commit 3f0f4b6 in PR branch Found 0 performance improvements and 3 performance regressions! Performance is the same for 191 metrics, 0 unstable metrics.
|
Description
Removes the current trace filter implementation and use libdatadog's implementation instead which more closely matches the agent's behavior.
Reviewer checklist