Skip to content

Conversation

Dav1dde
Copy link
Member

@Dav1dde Dav1dde commented Mar 11, 2025

Dynamic sampling currently only emits outcomes for the transaction but not the contained spans. With this PR sampled/filtered outcomes are also emitted for contained spans.

@Dav1dde Dav1dde requested a review from a team as a code owner March 11, 2025 13:05
@Dav1dde Dav1dde force-pushed the dav1d/ds-spans-in-transaction branch 3 times, most recently from e9e816e to 2f59f50 Compare March 11, 2025 13:32
@Dav1dde Dav1dde self-assigned this Mar 11, 2025
@Dav1dde Dav1dde requested a review from jan-auer March 11, 2025 13:39
@Dav1dde Dav1dde force-pushed the dav1d/ds-spans-in-transaction branch from 2f59f50 to dd58c9d Compare March 11, 2025 13:44
Copy link
Contributor

@iambriccardo iambriccardo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a minor comment

//
// This is yet another case, when the spans have not yet been separated from the transaction
// also emit dynamic sampling outcomes for the contained spans.
if !spans_extracted.0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Assuming top-level extracted spans are in the dropped_items list, isn't it cleaner to read it from there and sum them up?

It's for sure more expensive because we would have to iterate but maybe it's clearer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be the wrong signal, we have that explicit boolean which makes the decision if the contained spans should be counted or not (it's the spans_extracted here).

In theory it's possible to have a transaction and spans in the same envelope and then it becomes messy, so the boolean is the one thing that should always accurately track that state.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was not referring to the condition, I was referring to the counting of spans through dropped items of type ItemType::Span.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dropped_items will not contain any spans if spans_extracted is false.

@Dav1dde Dav1dde merged commit 3699983 into master Mar 13, 2025
25 checks passed
@Dav1dde Dav1dde deleted the dav1d/ds-spans-in-transaction branch March 13, 2025 13:48
Dav1dde added a commit that referenced this pull request Mar 14, 2025
When changing the span outcomes in #4569, I fixed this test incorrectly
making it flaky. When the test runner is fast enough it would never fail
(locally) but in CI this was noticed because the tests run slower.

This is the correct fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants