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

Instrument webmvc #27936

Conversation

jonatan-ivanov
Copy link
Member

@jonatan-ivanov jonatan-ivanov commented Jan 15, 2022

Questions/todo items:

  • Error handling might be more tricky than this
  • Controller class/method tag is missing from the span
  • Integrating with Micrometer's new http tag provider
  • Consolidating tags (e.g.: we have method and http.method)
  • Add tests
  • Do we want to keep LongtaskTimer here?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 15, 2022
@@ -121,11 +119,7 @@ private TimingContext startAndAttachTimingContext(HttpServletRequest request) {
}

private Throwable fetchException(HttpServletRequest request) {
Throwable exception = (Throwable) request.getAttribute(ErrorAttributes.ERROR_ATTRIBUTE);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should we do with this?

* @since 6.0.0
*/
@FunctionalInterface
public interface AutoTimer {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this class be better in io.micrometer? Other than CollectionUtils there's no direct Spring connection.

Copy link
Member Author

@jonatan-ivanov jonatan-ivanov Jan 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something we need to figure out. I think based on what we have right now, it would be but we need to check if we can/want to provide a different disable mechanism (for Meters this mechanism is provided by MeterFilters but that won't work in this use-case).

*
* @since 6.0.0
*/
public final class HttpServletRequestWrapper implements HttpServerRequest {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this can be package private? It looks like it's not pluggable. Possible also worth renaming since it's specifically for MVC.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of related Boot issues if we're redesigning this:
spring-projects/spring-boot#29303
spring-projects/spring-boot#13064

*
* @since 6.0.0
*/
public final class HttpServletResponseWrapper implements HttpServerResponse {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above. I wonder if this can be package private.

* @param request the request to wrap
* @return an {@link HttpServletRequestWrapper} instance that uses the provided request.
*/
static HttpServletRequestWrapper wrap(HttpServletRequest request) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about framework, but boot often keeps static factory methods like this at the bottom of the file.

@bclozel bclozel self-assigned this Feb 18, 2022
@bclozel
Copy link
Member

bclozel commented Sep 6, 2022

Superseded by #28880

@bclozel bclozel closed this Sep 6, 2022
@bclozel bclozel added in: web Issues in web modules (web, webmvc, webflux, websocket) status: declined A suggestion or change that we don't feel we should currently apply theme: observability An issue related to observability and tracing and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: declined A suggestion or change that we don't feel we should currently apply theme: observability An issue related to observability and tracing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants