Skip to content

Commit 36d5401

Browse files
authored
Merge pull request #3986 from DataDog/oscarld/use-libdatadog-trace-filter-implementation
chore: use libdatadog's trace filter implementation
2 parents 941af06 + 2854817 commit 36d5401

9 files changed

Lines changed: 100 additions & 281 deletions

File tree

Cargo.lock

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components-rs/agent_info.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@ use std::ffi::CString;
1818
fn info_to_concentrator_config(info: &AgentInfoStruct) {
1919
apply_concentrator_config(
2020
info.peer_tags.as_deref().unwrap_or(&[]).to_owned(),
21-
info.span_kinds_stats_computed.as_deref().unwrap_or(&[]).to_owned(),
22-
info.filter_tags.as_ref().and_then(|f| f.require.as_deref()).unwrap_or(&[]).to_owned(),
23-
info.filter_tags.as_ref().and_then(|f| f.reject.as_deref()).unwrap_or(&[]).to_owned(),
24-
info.filter_tags_regex.as_ref().and_then(|f| f.require.as_deref()).unwrap_or(&[]).to_owned(),
25-
info.filter_tags_regex.as_ref().and_then(|f| f.reject.as_deref()).unwrap_or(&[]).to_owned(),
26-
info.ignore_resources.as_deref().unwrap_or(&[]).to_owned(),
21+
info.span_kinds_stats_computed
22+
.as_deref()
23+
.unwrap_or(&[])
24+
.to_owned(),
25+
info.filter_tags.require.to_owned(),
26+
info.filter_tags.reject.to_owned(),
27+
info.filter_tags_regex.require.to_owned(),
28+
info.filter_tags_regex.reject.to_owned(),
29+
info.ignore_resources.to_owned(),
2730
info.client_drop_p0s.unwrap_or(false),
2831
info.version.as_deref(),
2932
);

components-rs/common.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -785,21 +785,6 @@ typedef const char *(*ddog_RootTagLookupFn)(const void *ctx,
785785
uintptr_t key_len,
786786
uintptr_t *out_len);
787787

788-
/**
789-
* Per-entry callback passed to `RootMetaIterFn`. Return `false` to stop iteration early.
790-
*/
791-
typedef bool (*ddog_MetaEntryCb)(void *iter_ctx,
792-
const char *key,
793-
uintptr_t key_len,
794-
const char *val,
795-
uintptr_t val_len);
796-
797-
/**
798-
* Slow-path meta iterator. `NULL` when no regex-key filter entries are present.
799-
* Iterates all string meta entries, calling `cb` for each; stops when `cb` returns `false`.
800-
*/
801-
typedef void (*ddog_RootMetaIterFn)(const void *ctx, void *iter_ctx, ddog_MetaEntryCb cb);
802-
803788
/**
804789
* A 128-bit (16 byte) buffer containing the UUID.
805790
*

components-rs/datadog.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -407,16 +407,13 @@ bool ddog_sidecar_telemetry_are_endpoints_collected(ddog_ShmCacheMap *cache,
407407
* no stats). Filters are evaluated against the root span — the decision applies uniformly
408408
* to all spans of the trace.
409409
*
410-
* * **Common case**: `filter_tags` and literal-key `filter_tags_regex` entries — one O(1)
410+
* * **When configured**: `filter_tags` and `filter_tags_regex` entries — one
411411
* `lookup_fn` call per filter entry.
412-
* * **Rare case**: `filter_tags_regex` entries with regex key patterns — `iter_fn` is invoked
413-
* to scan all meta entries for those filters. Pass `NULL` when not needed.
414412
* * **Fast path**: returns `true` immediately when no filters are configured.
415413
*/
416414
bool ddog_check_stats_trace_filter(ddog_CharSlice resource,
417415
const void *root_span,
418-
ddog_RootTagLookupFn lookup_fn,
419-
ddog_RootMetaIterFn iter_fn);
416+
ddog_RootTagLookupFn lookup_fn);
420417

421418
void ddog_init_span_func(void (*free_func)(ddog_OwnedZendString),
422419
void (*addref_func)(struct _zend_string*),

0 commit comments

Comments
 (0)