Skip to content

Instrument MVC and WebFlux for Observability #28880

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

Closed
bclozel opened this issue Jul 27, 2022 · 0 comments
Closed

Instrument MVC and WebFlux for Observability #28880

bclozel opened this issue Jul 27, 2022 · 0 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) theme: observability An issue related to observability and tracing type: enhancement A general enhancement
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Jul 27, 2022

Currently, Spring MVC and WebFlux applications are instrumented wit Micrometer metrics in Spring Boot, thanks to org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter and org.springframework.boot.actuate.metrics.web.reactive.server.MetricsWebFilter. Those filters are then auto-configured by Spring Boot and their metrics exported with the metrics system.

While those are timing request handling properly, the extraction of metadata can be complex since it requires inner knowledge of the web framework and is sometimes limited because it would need direct access to the request handling.

With the introduction of Observation in Micrometer 1.10, Spring Framework is now instrumenting directly some of its features.
This issue aims at instrumenting the MVC and WebFlux web frameworks for the "http.server.requests" observation.

@bclozel bclozel added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement theme: observability An issue related to observability and tracing labels Jul 27, 2022
@bclozel bclozel added this to the 6.0.0-M6 milestone Jul 27, 2022
@bclozel bclozel self-assigned this Jul 27, 2022
bclozel added a commit that referenced this issue Sep 12, 2022
This commit introduces the new `HttpRequestsObservationFilter`
This `Filter` can be used to instrument Servlet-based web frameworks for
Micrometer Observations. While the Servlet request and responses are
automatically used for extracting KeyValues for observations, web
frameworks still need to provide the matching URL pattern, if supported.

This can be done by fetching the observation context from the request
attributes and contributing to it.

This commit instruments Spring MVC (annotation and functional variants),
effectively replacing Spring Boot's `WebMvcMetricsFilter`.

See gh-28880
bclozel added a commit that referenced this issue Sep 12, 2022
This commit introduces a `HttpRequestsObservationWebFilter` which
instruments web frameworks using Spring's reactive `ServerHttpRequest`
and `ServerHttpResponse` interfaces.

This replaces Spring Boot's `MetricsWebFilter`.

See gh-28880
@bclozel bclozel closed this as completed Sep 13, 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) theme: observability An issue related to observability and tracing type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant