Trace only some endpoints in .Net Core
See original GitHub issueIs your feature request related to a problem? Please describe.
Yes. I would like to install the .Net Core APM agent on a Web API to trace a particular endpoint which is slow. However when I install Elastic.Apm.AspNetCore
it starts listening to all requests through the ApmMiddleware. Since my API has very high request rates, I’d most likely have to set a TransactionSampleRate
config to avoid any performance hits. However, I’m afraid by setting this I’ll miss samples from the single endpoint for which I want to monitor all the calls.
The reason I can’t sample calls on that particular endpoint is because the response time of that endpoint varies wildly based on the parameters it receives which is exactly what I’d like to observe.
Describe the solution you’d like I’d like to have a way to enable tracing only on particular controllers instead of listening in on all using the middleware appraoch.
Describe alternatives you’ve considered A couple of alternative approaches that I can think off-
- I realize that I can achieve what I want by initiating the elastic apm agent as done in the (ApmMiddlewareExtensions) but it’s not easy for me to just instantiate the agent without turning on the middleware.
- If the lib can provide a way to instantiate the Agent without adding the middleware I could easily start a transaction myself wherever I need to trace. Actually I’m able to do that right now, but the agent tries to write the logs to
localhost:8200
which I’m guessing the default endpoint used when not properly configured.
Additional context
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
I’m fine with closing this. Will follow up with #688. Thanks!
@rvignesh89 there were some differences on this across agents. We had 1 issue to harmonize this across agents.
I just opened https://github.com/elastic/apm-agent-dotnet/issues/688 which is based on https://github.com/elastic/apm/issues/144 - that’s usually our process to be aligned across agents - first we have an APM issue in https://github.com/elastic/apm/ and then each agent creates a corresponding issue.
In case you open a PR, please make sure you follow the new issue.
I’d close this one if you are ok with it and keep https://github.com/elastic/apm-agent-dotnet/issues/688.