Add a benchmark for aspnetcore#879
Conversation
|
/azp run Benchmarks |
|
Azure Pipelines successfully started running 1 pipeline(s). |
aac9ff2 to
308ee2b
Compare
|
|
||
| static AspNetCoreBenchmark() | ||
| { | ||
| Environment.SetEnvironmentVariable(ConfigurationKeys.TraceEnabled, "0"); |
There was a problem hiding this comment.
nit: I think you can set this in the TracerSettings below with TraceEnabled = false so you don't have to modify the environment variables
There was a problem hiding this comment.
The problem is subtle:
to initialize the tracer, I do:
Tracer.Instance = new Tracer(settings, new DummyAgentWriter(), null, null, null);By calling new Tracer, the static constructor is invoked, which initializes a new tracer before I have time to construct mine. That tracer is fully functional, with background threads and stuff, and adds noise to the benchmark. Adding environment variables is the only way I found to limit what that tracer does in background.
Now that I think about it, I should probably just add a global internal setting that prevents that tracer from being instantiated. I'll look into that in a separate PR.
There was a problem hiding this comment.
Could we move the creation of the first Tracer instance from the static constructor to the Tracer.Instance getter? If we can do this, it should allow users (including ourselves here) to set Tracer.Instance without creating a not-so-throwaway Tracer instance. Just something to think about, not for this PR.
zacharycmontoya
left a comment
There was a problem hiding this comment.
Looks good! Looking forward to having more benchmarks!
308ee2b to
8143584
Compare
* Add benchmark for aspnetcore
The benchmark goes through a typical customer scenario: receive a request through aspnetcore, and query an external HTTP service.