elastic / apm-agent-java

https://www.elastic.co/guide/en/apm/agent/java/current/index.html
Apache License 2.0
566 stars 320 forks source link

Add ability for automatic URL path pattern discovery #774

Open eyalkoren opened 5 years ago

eyalkoren commented 5 years ago

When the use_path_as_transaction_name config option is used, this can lead to transaction name explosion if path parameters are used. For this purpose, we also have the url_groups config option, but it requires (possibly complex) user configuration. By applying the algorithm presented in this POC, the agent can auto-discover URL path patterns and use them as transaction names.

The additional advantage of implementing this now is that we will have the option of testing this algorithm, which we may want to employ in the future to facilitate head-based sampling.

nithril commented 5 years ago

Why not supporting the parametrized url that most frameworks have already implemented ? eg. RequestMapping

eyalkoren commented 5 years ago

Yeah, it would be a nice addition. We just recently added that for the @Path annotation.

This POC is something I wrote to demonstrate an algorithm that ALL Elastic APM agents can use in order to deal with a general problem that some agents have (in fact, other agents like Node more than Java) of computing the transaction name too late for some decision making, like whether to sample or not. With this, we can can do some decision making right when encountering the request.

I added this issue suggesting we can add it for transaction naming as well because it is the most generic approach (not restricted to specific frameworks) and because it can provide good feedback for us about how the algorithm behaves in real world applications.