elastic / apm-agent-java

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

Proper Transaction Name for Spring Boot Actuators #513

Open remmeier opened 5 years ago

remmeier commented 5 years ago

Calls to the Spring Boot Actuators are labels: "ControllerClassName#methodName". For many kinds and for many kinds of applications (like with Kubernetes and health checks), those endpoints will be called often. One can configure https://www.elastic.co/guide/en/apm/agent/java/current/config-http.html#config-use-path-as-transaction-name to make use of the path as transcation names, but this can lead to other issues. Since it is a common use case, would be great to have a good default for the Spring MVC integration to support the Actuators out-of-the-box with reasonable labels, probably the first path element would already be sufficient (and will mostly stay like that anyway, like /health).

SylvainJuge commented 3 years ago

Hi @remmeier ,

Just to clarify here:

I'm not familiar with Actuator implementation details, do you know how (and if) we could identify which actuator endpoint is being called at runtime without relying on brittle URL parsing ? If yes, changing the current implementation would be quite straightforward.

It seems that there is a property management.endpoints.web.base-path that allows to set the path prefix (default /actuator), thus we could use that also.