Skip to content
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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

jtduffy
Copy link
Contributor

@jtduffy jtduffy commented Sep 26, 2024

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.

@jtduffy jtduffy requested a review from a team September 26, 2024 18:49
@codecov-commenter
Copy link

codecov-commenter commented Sep 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.58%. Comparing base (8308389) to head (caa721f).
Report is 27 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

// 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("/");
Copy link
Contributor

@meiao meiao Sep 26, 2024

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.


if (transaction != null) {
String uri = SpringActuatorUtils.normalizeActuatorUri(request.getRequestURI());
String reportablePrefix = SpringActuatorUtils.normalizeActuatorUri(uri);
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

JAVA APM agent - support Spring Actuator
3 participants