Skip to content

Add System.Diagnostics.TextMapPropagator support - #33777

Merged
shirhatti merged 10 commits into
mainfrom
shirhatti/propagator
Jul 15, 2021
Merged

Add System.Diagnostics.TextMapPropagator support#33777
shirhatti merged 10 commits into
mainfrom
shirhatti/propagator

Conversation

@shirhatti

Copy link
Copy Markdown
Contributor

No description provided.

@ghost ghost added the area-runtime label Jun 22, 2021
@shirhatti
shirhatti requested a review from tarekgh June 22, 2021 23:46
@shirhatti

This comment has been minimized.

@shirhatti shirhatti added the community-contribution Indicates that the PR has been added by a community member label Jun 25, 2021
@shirhatti

shirhatti commented Jun 28, 2021

Copy link
Copy Markdown
Contributor Author

Plaintext on aspnet-citrine-lin

application old new
CPU Usage (%) 99 99 0.00%
Cores usage (%) 2,781 2,778 -0.11%
Working Set (MB) 415 415 0.00%
Private Memory (MB) 1,006 1,557 +54.77%
Build Time (ms) 3,553 5,432 +52.88%
Start Time (ms) 150 171 +14.00%
Published Size (KB) 106,173 106,173 0.00%
.NET Core SDK Version 6.0.100-preview.6.21276.12 6.0.100-preview.6.21276.12
Max CPU Usage (%) 181 99 -45.30%
Max Working Set (MB) 434 435 +0.23%
Max GC Heap Size (MB) 317 302 -4.73%
Size of committed memory by the GC (MB) 363 362 -0.28%
Max Number of Gen 0 GCs / sec 7.00 7.00 0.00%
Max Number of Gen 1 GCs / sec 1.00 1.00 0.00%
Max Number of Gen 2 GCs / sec 1.00 1.00 0.00%
Max Time in GC (%) 1.00 0.00
Max Gen 0 Size (B) 672 672 0.00%
Max Gen 1 Size (B) 4,125,536 1,060,016 -74.31%
Max Gen 2 Size (B) 3,181,976 3,221,496 +1.24%
Max LOH Size (B) 230,160 672 -99.71%
Max Allocation Rate (B/sec) 2,040,420,720 2,040,749,408 +0.02%
Max GC Heap Fragmentation 1 1 -9.88%
# of Assemblies Loaded 94 93 -1.06%
Max Exceptions (#/s) 697 687 -1.43%
Max Lock Contention (#/s) 263 361 +37.26%
Max ThreadPool Threads Count 48 48 0.00%
Max ThreadPool Queue Length 207 185 -10.63%
Max ThreadPool Items (#/s) 176,635 186,574 +5.63%
Max Active Timers 0 0
IL Jitted (B) 172,641 183,274 +6.16%
Methods Jitted 1,859 2,072 +11.46%
load old new
CPU Usage (%) 19 19 0.00%
Cores usage (%) 531 531 0.00%
Working Set (MB) 37 37 0.00%
Private Memory (MB) 358 358 0.00%
Start Time (ms) 0 0
First Request (ms) 70 72 +2.86%
Requests/sec 2,476,644 2,475,423 -0.05%
Requests 37,394,952 37,378,301 -0.04%
Mean latency (ms) 1.15 1.15 0.00%
Max latency (ms) 49.90 53.67 +7.56%
Bad responses 0 0
Socket errors 0 0
Read throughput (MB/s) 311.77 311.62 -0.05%
Latency 50th (ms) 0.99 0.96 -3.03%
Latency 75th (ms) 1.46 1.41 -3.42%
Latency 90th (ms) 2.07 1.91 -7.73%
Latency 99th (ms) 0.00 0.00

@shirhatti
shirhatti requested a review from Tratcher June 28, 2021 19:39
@shirhatti

Copy link
Copy Markdown
Contributor Author

@Tratcher The only new change I've made since we last spoke is to resolve the Propagator from DI instead of using the global static. Can you review that?

Also, the difference in the GC counters makes no sense to me 🤷. Can you help me make sense of that?

@Tratcher Tratcher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The DI change seems fine

Comment thread src/Hosting/Hosting/src/GenericHost/GenericWebHostBuilder.cs Outdated
@Tratcher

Copy link
Copy Markdown
Member

No idea on the GC data, but at least it's getting better and not worse 😁.

@shirhatti

Copy link
Copy Markdown
Contributor Author

There's no way LOH is 672 bytes. Kestrel's slabbed memory pool is allocated in the LOH. @sebastienros any ideas? Repeating the run, I got 131800 for Max LOH size for both before/after.

As for reduction in Max Gen 1 and increase in Max Gen 2 size, I'm not sure what to make of it? Something is getting promoted sooner? I'll try collecting an allocation profile to make more sense of this

@shirhatti shirhatti linked an issue Jul 14, 2021 that may be closed by this pull request
@shirhatti
shirhatti force-pushed the shirhatti/propagator branch from d476798 to abcc758 Compare July 14, 2021 19:43
@shirhatti
shirhatti marked this pull request as ready for review July 14, 2021 19:48
@shirhatti
shirhatti requested a review from noahfalk July 14, 2021 19:49
Comment thread src/Hosting/Hosting/src/Internal/HostingApplicationDiagnostics.cs Outdated
Comment thread src/Hosting/Hosting/src/Internal/HostingApplicationDiagnostics.cs Outdated
Comment thread src/Hosting/Hosting/src/Internal/HostingApplicationDiagnostics.cs Outdated
Comment thread src/Hosting/Hosting/src/Internal/HostingApplicationDiagnostics.cs
Comment thread src/Hosting/Hosting/src/Internal/HostingApplicationDiagnostics.cs Outdated
@tarekgh

tarekgh commented Jul 14, 2021

Copy link
Copy Markdown
Member
    private static HostingApplication CreateApplication(IHttpContextFactory httpContextFactory = null, bool useHttpContextAccessor = false,

May be a clever idea in a future PR to add a test consuming other propagator. e.g., tests create a custom propagator and consume it. You don't have to block this PR on that.


Refers to: src/Hosting/Hosting/test/HostingApplicationTests.cs:182 in abcc758. [](commit_id = abcc758, deletion_comment = False)

@tarekgh tarekgh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Added some commented. LGTM otherwise.

Comment thread src/Hosting/Hosting/src/Microsoft.AspNetCore.Hosting.csproj Outdated
// AddBaggage adds items at the beginning of the list, so we need to add them in reverse to keep the same order as the client
// An order could be important if baggage has two items with the same key (that is allowed by the contract)
for (var i = baggage.Length - 1; i >= 0; i--)
// Order could be important if baggage has two items with the same key (that is allowed by the contract)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You used to add these in reverse, does ExtractBaggage handle the reversal? If so then include that in the comment. Otherwise this comment about order sensitivity doesn't make sense.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I’ll send a follow-up PR to fix the comment. I want to merge this when the PR checks are green in case AzDo has a bad day again

@shirhatti
shirhatti merged commit e6afd50 into main Jul 15, 2021
@shirhatti
shirhatti deleted the shirhatti/propagator branch July 15, 2021 02:21
@ghost ghost added this to the 6.0-preview7 milestone Jul 15, 2021
@davidfowl

Copy link
Copy Markdown
Member

I'm assuming there's no extra allocations here.

shirhatti added a commit that referenced this pull request Jul 20, 2021
shirhatti added a commit that referenced this pull request Jul 21, 2021
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Aug 24, 2023
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to disable creation of intermediate activities in DiagnosticsHandler Allow control over Activity creation

6 participants