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

fix: allow exit spans to have child spans with the same type and subtype #1320

Merged
merged 8 commits into from
Sep 23, 2022

Conversation

kruskall
Copy link
Member

Do not silently drop child spans of exit spans. The spec allows for exit spans to have child spans if they have the same type and subtype. One example of this is http trace requests being child spans of an exit span.

Update exit span test to make sure the feature is working as intended.

Closes #1319

Do not silently drop child spans of exit spans. The spec allows for exit
spans to have child spans if they have the same type and subtype.
One example of this is http trace requests being child spans of an exit
span.

Update exit span test to make sure the feature is working as intended.
@apmmachine
Copy link
Collaborator

apmmachine commented Sep 22, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-09-23T07:14:55.697+0000

  • Duration: 51 min 12 sec

Test stats 🧪

Test Results
Failed 0
Passed 8554
Skipped 201
Total 8755

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • run benchmark tests : Run the benchmark test.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@apmmachine
Copy link
Collaborator

apmmachine commented Sep 22, 2022

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (59/59) 💚
Files 99.346% (152/153) 👍
Classes 96.275% (336/349) 👍
Methods 90.216% (959/1063) 👍
Lines 82.131% (11169/13599) 👍 0.012
Conditionals 100.0% (0/0) 💚

@kruskall kruskall requested a review from axw September 22, 2022 19:26
Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

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

Should we be checking the type/subtype in Span.End, rather than at creation time? Type/Subtype are mutable.

Also, should we check that the child span is not an exit span? The spec says that the child span must not have any destination context. That's to ensure we don't count both the exit span and its children in destination metrics.

What should happen if a child is created for a child of an exit span?

span.go Outdated Show resolved Hide resolved
Type/SubType is mutable. Move validation inside span.end and drop span
according to the spec.
According to the spec:

These spans MUST NOT have any destination context, so that there's no effect on destination metrics.

Update the code accordingly to remove destination context from them.
Moving the check to span.end introduced a small change in behaviour:
child spans of exit spans are not dropped immediately. Update test case
to account for that
@kruskall
Copy link
Member Author

Should we be checking the type/subtype in Span.End, rather than at creation time? Type/Subtype are mutable.

Good point! Changed.

The spec says that the child span must not have any destination context. That's to ensure we don't count both the exit span and its children in destination metrics.

Updated the code to remove destination context 👍

Also, should we check that the child span is not an exit span?
What should happen if a child is created for a child of an exit span?

The spec does not forbid that. The status of the child span has no effect on the decision of dropping the span.

@kruskall kruskall requested a review from axw September 23, 2022 01:47
span.go Outdated Show resolved Hide resolved
span.go Outdated Show resolved Hide resolved
kruskall and others added 2 commits September 23, 2022 04:32
Co-authored-by: Andrew Wilkins <axwalk@gmail.com>
Do not null out the tracer, instead call the method and follow
the proper flow.
The destination context is set to null to prevent the spans from
being aggregated in the dropped spans metrics.
@kruskall kruskall requested a review from axw September 23, 2022 02:46
@kruskall kruskall enabled auto-merge (squash) September 23, 2022 07:14
@kruskall kruskall merged commit 14f1d71 into elastic:main Sep 23, 2022
@kruskall kruskall deleted the fix/exit-span-parent branch October 19, 2022 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Child spans of exit spans are silently dropped
3 participants