feat: enhance the support for dropping filter#288
Conversation
|
@avinashkolluru @satish-mittal @ravisingal This PR extends the new approach. Once, this will be available, the existing one will be removed as follow-up PR. |
This comment has been minimized.
This comment has been minimized.
Codecov Report
@@ Coverage Diff @@
## main #288 +/- ##
============================================
+ Coverage 79.20% 79.44% +0.24%
- Complexity 1239 1265 +26
============================================
Files 111 112 +1
Lines 4880 4934 +54
Branches 442 452 +10
============================================
+ Hits 3865 3920 +55
+ Misses 813 812 -1
Partials 202 202
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
This comment has been minimized.
This comment has been minimized.
| switch (filter.getOperator()) { | ||
| case EQ: | ||
| return tags.containsKey(filter.getTagKey()) | ||
| && StringUtils.equals(tags.get(filter.getTagKey()).getVStr(), filter.getTagValue()); |
There was a problem hiding this comment.
@kotharironak We may have to look into the process tags too. See below
public Optional<String> getTenantId(
Map<String, KeyValue> spanTags, Map<String, KeyValue> processTags) {
return Optional.ofNullable(processTags.get(tenantIdKey))
.or(() -> Optional.ofNullable(spanTags.get(tenantIdKey)))
.map(KeyValue::getVStr);
}
There was a problem hiding this comment.
I think the process tags are meant for resources, do we want to drop span based on resource criteria? So, far we are dropping based on span attribute filters, and with that, we are able to filter existing scenarios, right? Are there some scenario?
There was a problem hiding this comment.
@ravisingal @avinashkolluru I have added the support for processTags too. So, now the filter will check in the union of two tags (processTags, spanTags).
Total Tags = Process Tags + Span Tags will be used for matching a filter.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
||
| if (anySpanDropFiltersMatch(spanDropFilters, tags, processTags)) { | ||
| if (DROPPED_SPANS_RATE_LIMITER.tryAcquire()) { | ||
| LOG.info("Dropping span: [{}] with drop filters: [{}]", span, spanDropFilters); |
There was a problem hiding this comment.
This will log too much. I think we should move this to debug. Even above it should move to debug.
I'm assuming once we migrate the configs to this new format, we'll get rid of the above.
| .collect(Collectors.toList()); | ||
| }) | ||
| .collect(Collectors.toList()); | ||
| LOG.info("Json String for Span drop criterion: {}", this.spanDropFilters); |
There was a problem hiding this comment.
toString() missing in SpanDropFilter class
There was a problem hiding this comment.
Its not a Json right?
There was a problem hiding this comment.
No, it is List<List>, move the logging in the top before parsing in case of any failure we know what has failed.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| } | ||
|
|
||
| if (anySpanDropFiltersMatch(spanDropFilters, tags, processTags)) { | ||
| if (DROPPED_SPANS_RATE_LIMITER.tryAcquire()) { |
There was a problem hiding this comment.
nit: can you put this block inside a debugger enabled check?
There was a problem hiding this comment.
There is to string not any eval, should it still matter?
There was a problem hiding this comment.
Wanted to avoid the extra ratelimiter check
There was a problem hiding this comment.
Ah! I see b'cause of tryAcquire, can do this.


Description
This PR, enhance the support for dropping the span at entry-level. There are certain issues in the existing one.
e.g of existing drop filter criteria
["k1:v1, k2:v2", "k3:v3]As we can see, it is supported as an array of strings that are considered as OR expressions. The string supports AND operation via
:.New Approach:
e.g
As it can be seen, its array of OR (AND [Filters]) expression.
Testing
Added unit tests and extended topology test driver test too
Checklist: