Fix activity tracing to track entire execution time of inbound calls #763
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.
The incoming RPC was getting an activity that bound only the time to invoke the server method and get its result back. But if the method were async, terminating the activity at that point meant the timestamp on the end of the activity would be premature. Instead, an async server method should mean the activity does not end until the returned Task completes. This makes it clear that child activities and other messages logged by the server method belong to that activity.
As shown in the Service Trace Viewer:
Before
![image](https://user-images.githubusercontent.com/3548/151636031-ba7a2c38-5cba-4983-bdcd-4a0eb58b2be8.png)
After
![image](https://user-images.githubusercontent.com/3548/151636010-820f5095-8d85-4e55-b697-3380303f149f.png)