-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not reset
Activity.Id
for non-W3C formats (#5739)
## Summary of changes This makes it so that we validate that the `Activity` object is in W3C format (by checking that the `Activity` has a SpanID and TraceID after it stars) if we are updating the SpanId and TraceId. Note that for this to happen the `Activity` needs to be a non-W3C format _and_ it's start time must be less than the Datadog Active Span start time. This start time issue can happen as an `Activity` can modify its start time _after_ it is started and we don't update the created Datadog span with that new information. ## Reason for change T fixes an edge case where an `Activity` object could be in a non-W3C format and hit this code resulting in its `Id` being erroneously set to `null` causing a `NullReferenceException` for us (workaround in #5690), but could have also thrown if anyone accessed that `Id` and attempted to make a call on it. ## Implementation details Check to ensure that the `Activity` is in W3C format - this is done by just checking that it already has a Span Id and Trace Id. ## Test coverage Added tests to `Samples.NetActivitySdk`, the `RunManuallyUpdatedStartTime()` would fail and throw an exception. ## Other details Should consider handling instances where users update the start time of the `Activity` and update the Datadog `Span` accordingly. <!--⚠️ Note: where possible, please obtain 2 approvals prior to merging. Unless CODEOWNERS specifies otherwise, for external teams it is typically best to have one review from a team member, and one review from apm-dotnet. Trivial changes do not require 2 reviews. -->
- Loading branch information
Showing
5 changed files
with
98 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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