Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop spans for child-to-parent ordered traces in SpanFilter #2074

Merged
merged 1 commit into from
Jul 15, 2022

Conversation

delner
Copy link
Contributor

@delner delner commented Jun 9, 2022

Addresses #2038

Problem

SpanFilter attempts to drop all descendant spans for any span targeted by the filter. To do this efficiently, it depends upon the spans to be ordered in a particular way in the trace span array: parent-to-child.

In 1.x, this ordering reversed, thereby breaking the filter.

Solution

As a partial solution, this PR simply reverse iterates the span array, applying the same logic. This should address most of the old behavior, however, it is still an incomplete solution, since it is still order dependent, just the opposite now. Furthermore, it's actually impossible for SpanFilter to work effectively if a trace is ever flushed in smaller segments, as is often the case in partial flushing.

In short, this a workaround to try to restore previous 0.x behavior in most cases. It needs further work to fully address.

@delner delner self-assigned this Jun 9, 2022
@delner delner added bug Involves a bug core Involves Datadog core libraries labels Jun 9, 2022
@delner
Copy link
Contributor Author

delner commented Jun 9, 2022

NOTE: I added tests for both forward and reverse ordering, but its clear only one will work. In its current state, its mostly meant to test with. A different strategy may need to be employed to fix this.

@delner delner added this to the 1.3.0 milestone Jul 14, 2022
@delner delner marked this pull request as ready for review July 15, 2022 14:00
@delner delner requested a review from a team July 15, 2022 14:00
@delner delner merged commit e300f3a into master Jul 15, 2022
@delner delner deleted the fix/span_filter_ordering branch July 15, 2022 14:05
@delner delner linked an issue Jul 15, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Involves a bug core Involves Datadog core libraries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SpanFilter not working after upgrading to 1.0
2 participants