-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix DiagnosticSource + Disposable issues + service name doc #75
Conversation
In order to make the API more simple we autosubscribe to outgoing HTTP calls and EFCore calls. Also added 2 tests to test non-ASP.NET Core scenarios + HttpDiagnosticsSubscriber registration.
And removed unused `using`s
With this unit tests can dispose the agent, which automatically unsubscribes from all diagnosticsource events.
Codecov Report
@@ Coverage Diff @@
## master #75 +/- ##
=========================================
+ Coverage 80.53% 81.33% +0.8%
=========================================
Files 34 35 +1
Lines 904 943 +39
Branches 115 119 +4
=========================================
+ Hits 728 767 +39
+ Misses 131 129 -2
- Partials 45 47 +2
Continue to review full report at Codecov.
|
Just for reference: the coverage report is probably wrong. @kuisathaverat is on it... |
@bmorelli25 |
Also removed IDisposable from the Listeners
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment below. Everything else is 👍
Elastic.Apm.All has a reference to all other agent projects and it contains convenient methods to activate the agent very easily and enable each agent component.
Added service name doc
Some refactorings:
TheApmMiddlewareExtension
automatically subscribes to EFCore and HttpClient events. Additionally, theElastic.Apm.AspNetCore
now references theElastic.Apm.EntityFrameworkCore
project.With this, registering the agent in ASP.NET Core became simpler:
app.UseElasticApm(Configuration);
This was the old code:
`app.UseElasticApm(Configuration, new HttpDiagnosticsSubscriber(), new EfCoreDiagnosticsSubscriber());
Update:
Added
Elastic.Apm.All
project that references every other agent project and contains anApmMiddlewareExtension
that automatically subscribes to HttpClient and EFCore events. This way in typical ASP.NET Core apps (ASP.NET Core + EF Core) that referenceMicrosoft.AspNetCore.All
users can just reference ourElastic.Apm.All
package and enable the agent with all its features (including EF Core and HttpClient monitoring) withapp.UseElasticApm(Configuration);
. In other cases (e.g. ASP.NET Core without EF Core, or even no ASP.NET Core) the other packages can be referenced individually to avoid unnecessary dependencies. In those scenarios the diagnostic listeners must be enabled manually.Moved
TransactionContainer
intoAgentComponents
. With thatTransactionContainer.Transactions
becameAgent.TransactionContainer
, which we can reset in tests.Fix for Bug: Unsubscribing from DiagnosticSource events does not work #72.
As a consequence of fixing Bug: Unsubscribing from DiagnosticSource events does not work #72 the
ApmAgent
also became Disposable. With this in tests we can dispose the agent.