Compute top-level span in tracer#2137
Merged
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## fix-tag-helper #2137 +/- ##
===============================================
Coverage 97.52% 97.53%
===============================================
Files 1040 1040
Lines 53991 54005 +14
===============================================
+ Hits 52656 52672 +16
+ Misses 1335 1333 -2
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
marcotc
force-pushed
the
compute-top-level
branch
from
July 8, 2022 01:11
9ad3d84 to
c7edbab
Compare
marcotc
force-pushed
the
compute-top-level
branch
from
July 8, 2022 01:13
c7edbab to
7359c15
Compare
TonyCTHsu
approved these changes
Jul 8, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is the first step towards early top level detection in the tracer.
As a preamble, the definition of top-level span is:
After the introduction of the
service_entryattribute in #2080, now know how to calculate the effective top-level spans in a trace, exactly how the agent does. Both the tracer and agent must follow the definition in previous paragraph.For every trace received, the agent calculate the top-level spans and tags them with
_dd.top_level.This is the default case. But if we send a special header, (
Datadog-Client-Computed-Top-Level), the agent will skip calculating the top-level spans itself.With this PR, this is he trace timeline:
_dd.top_levelmetric.This means that the traces are effectively the same, but each top-level span received the tagging,
span.set_metric('_dd.top_level', 1.0), twice, having no ill-effect.Follow up work
Introduce the special header https://github.com/DataDog/datadog-agent/blob/b4542cc65a1289cfe72903e52c9ed4d219d6453b/pkg/trace/api/api.go#L359-L361 to allow for the Agent to completely skip top-level calculation.