-
Notifications
You must be signed in to change notification settings - Fork 150
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
Actuator endpoint naming for Spring Boot 3 #2077
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2077 +/- ##
=========================================
Coverage 70.57% 70.58%
- Complexity 9875 9879 +4
=========================================
Files 829 829
Lines 39945 39960 +15
Branches 6078 6081 +3
=========================================
+ Hits 28191 28205 +14
Misses 9024 9024
- Partials 2730 2731 +1 ☔ View full report in Codecov by Sentry. |
// other than the first two, to prevent MGI for certain actuator endpoints. | ||
// For example, "/actuator/loggers/com.newrelic" will be converted into | ||
// "actuator/loggers" | ||
String [] parts = uri.replaceFirst("^/", "").split("/"); |
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.
The replaceFirst
method causes a regex to be compiled every time it is called.
uri.substring(uri.charAt(0) == '/' ? 1 : 0)
would have better performance.
.../boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping_Instrumentation.java
Show resolved
Hide resolved
|
||
if (transaction != null) { | ||
String uri = SpringActuatorUtils.normalizeActuatorUri(request.getRequestURI()); | ||
String reportablePrefix = SpringActuatorUtils.normalizeActuatorUri(uri); |
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.
won't this return the same string?
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.
Duh, yeah good catch, I left that in by accident when I did a refactor.
import java.util.Map; | ||
|
||
@Weave(type = MatchType.BaseClass, originalName = "org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping") | ||
public class AbstractWebMvcEndpointHandlerMapping_Instrumentation { |
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.
what about reactive mappings?
org.springframework.boot.actuate.endpoint.web.reactive.AbstractWebFluxEndpointHandlerMapping$ReactiveWebOperationAdapter
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.
@zboris Thanks for the suggestion. I'll get an issue created so it gets on our backlog.
Naming of actuator endpoints for Spring Boot 3
Resolves #2035
By default, built-in actuator endpoints and custom actuator endpoints (using the @endpoint annotation
and it's subclasses) will all be named as "OperationHandler/handle" in New Relic. Activating this
module will result in the transaction name reflecting the actual base actuator endpoint URI.
For example, invoking "/actuator/loggers" or "actuator/loggers/com.newrelic" will result in the
transaction name "actuator/loggers (GET)". This is to prevent MGI.
To activate actuator naming, set the following configuration to true:
class_transformer.name_actuator_endpoints
The default value is false.