-
Notifications
You must be signed in to change notification settings - Fork 40.7k
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
DefaultJerseyTagsProvider clashes with WebMvcObservationAutoConfiguration #39294
Comments
as it clashes with DefaultJerseyTagsProvider, rendering Prometheus actuator output useless by showing "UNKNOWN" in the `uri` field instead of the real path pattern. This is only happening with Jersey-annotated endpoints that we use. It does work correctly with Spring-annotated endpoints, just for the record. See issues: - spring-projects/spring-framework#32099 - spring-projects/spring-boot#39294
DefaultJerseyTagsProvider
clashes with WebMvcObservationAutoConfiguration
I think we can summarize the situation as follows: when Spring Boot auto-configures an application with Each instrumentation contributes the same metric name, which can cause conflicts like described in the linked issue. I think we can consider several solutions:
|
The only problem with |
Here two competing systems are trying to contribute to the same metric. Have you considered renaming one of the observations to separate both? You can use |
Can you please elaborate what you mean? You may open a branch from my repro project (or open a PR) |
I mean doing the following in actuator.management.observations.http.server.requests.name=spring.http.server.requests This will rename the HTTP server observations for Spring and leave the |
The suggestion does not help at all. It keeps the URI properties UNKNOWN. |
Sorry I forgot that the Jersey metrics would also follow the same property. I guess the only choice here is to disable the MVC instrumentation and only rely on the Jersey one. |
We have discussed this as a team and think that there are several ways to fix this. Remove the MVC starter as it's not usedFirst, if your application does not need Spring MVC then the @ApplicationPath("/")
@Configuration
public class EndpointConfig extends ResourceConfig { and adapt the application configuration as a result: management:
endpoints:
web:
base-path: "/"
exposure:
include: info,health,prometheus
path-mapping:
prometheus: metrics
I've checked that all requests are being instrumented as expected. Configure the MVC Observation filterIf your application needs both Jersey and MVC, manually configuring the Observation Filter makes sense: Spring Boot won't necessarily know which paths your application intends to use with MVC or Jersey and which instrumentation should prevail in each case. Something like:
In light of that, I'm closing this issue as we don't think we can make auto-configurations depend on each other and deduce what's expected for the application. Thanks! |
Hey @bclozel, I was facing a similar problem but on my side, prometheus metrics are working fine. The problem that I'm facing is related to the tracing. I created a repo (https://github.com/carlos-silva24/springboot-observability) with a demo. In summary, the traces have the URI defined as unknown, however in prometheus the metrics are fine. |
Hey @carlos-silva24 this looks like an issue with the Jersey instrumentation, which is not maintained in Spring Boot but in Micrometer. Can you open an issue there? Thanks! |
@bclozel thanks for the quick feedback. I'll open an issue there also, but was thinking if the need to also include the spring-boot-starter-web in order to report traces could be a problem. |
@carlos-silva24 Sorry, I don't think you'll need to create a new issue in Micrometer. In fact, to get traces you'll need an instrumentation that uses the This means that the Spring Boot auto-configuration should use the new Thanks! |
Hi @bclozel, I have had the same problem as described in the original issue title (unknown URIs). Excluding Repro project: https://github.com/ftdinh/metrics-repro I have forked the original reproduction sample project and tried the suggested solution to configure the web MVC observation filter.
I am finding that only the URI that is first requested is being reported:
Wasn't sure if I need to open a new issue for this -- if so, then I can do so. |
When using Jersey (not Spring) annotated endpoints and also using Micrometer Prometheus integration, the "prometheus" actuator endpoint shows "UNKNOWN" in the
uri
instead of the path pattern.ServerHttpObservationFilter
does not fill pathPattern.In the
org.springframework.http.server.observation.DefaultServerRequestObservationConvention
class, theprotected KeyValue uri(ServerRequestObservationContext context)
method tries to getcontext.getPathPattern()
but it is alwaysnull
.Reproduction sample project with instructions: https://github.com/bergerdenes/metrics-repro
The suggested workaround,
@SpringBootApplication(exclude=WebMvcObservationAutoConfiguration.class)
annotation solves the issue.Details are at spring-projects/spring-framework#32099 (I was redirected from there)
The text was updated successfully, but these errors were encountered: