-
Notifications
You must be signed in to change notification settings - Fork 41.1k
Align WebClient uri metric tag with RestTemplate's #22832
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
Comments
5 is working as expected. From For 2 and 3, the URI template can be captured and the |
Well I see your point regarding 5.. I was not sure about how |
You said above that "it is conceptually wrong", but did not explain why. Could you please do so? Query parameters are part of the URI so it feels correct to me that they should be included in a URI tag when available. |
We are just talking about metrics here and in that scope I think it makes no sense. I did said "there is no way to group them later", but let me explain better 😄 Imagine you are monitoring an app and want to know, for instance, which endpoints have most calls. Now imagine you have an endpoint that can take like 5 optional query parameters. This means you will have 1 different uri value for each possible combination of those optional query parameters (C(5,1) + C(5,2) + C(5,3) + C(5,4) + C(5,5) = 31 combinations). You will not be able to sum (or any other type of aggregation) those metrics because the |
You may say that you may want to know about the query parameters for the metrics in some cases. And though I will agree with you, I think you could put the query parameters part in another tag and that would cover those cases too. |
That doesn't sound conceptually wrong to me, rather it sounds like a situation where it isn't possible to provide default behaviour that meets everyone's needs. Some will want the query parameters in the URI tag, others like you won't. If the default tagging behaviour doesn't meet your needs, you can provide a |
Well, if it is provided all in one tag, it will serve one group of people. But if it is provided separately, it will serve both groups :) So I think the default behaviour should be the one that satisfies the majority (and in this case, the second approach actually serves the purpose of the first too, so there is no downside to it). I still think it is conceptually wrong in the scope of metrics tagging. |
Let's summarize the behavior we're seeing here. Whenever a String template is given to the client, the
Regarding the statement above, I'm not sure I understand this point: no matter what combination of query parameter values are provided to the request, the template will remain the same and will be reused for all metrics. I guess your statement was referring to expanded For the samples where the But we do see an inconsistency here: when the expanded The team has discussed this issue and we came to the following conclusions:
So this issue is now about aligning the |
I think that
http.client.requests
metric has a wrong behaviour with query parameters. The query parameters should not be considered as part of theuri
tag.If you have 2 calls to
http://test123.io/api
andhttp://test123.io/api?q=1
I wouldn't expect them to be counted as different uris. Not only I think it is conceptually wrong, but also there is no way to group them later.On top of that I can observe some inconsistencies on the result you get by using different approaches with either
RestTemplate
andWebClient
.Some examples:
uri="/api/{pathParam}?queryParam={queryParam}"
uri="/test123.io/api/foobar"
uri="/api/foobar"
uri="/api/{pathParam}?queryParam={queryParam}"
uri="/api/foobar?queryParam=xpto"
In any of these cases I believe the correct value, for the tag, would be
uri="/api/{pathParam}"
This was all tested using
SB2.3.2
using thespring-boot-starter-webflux
andspring-boot-starter-web
.I believe this is related to what is reported on this issue spring-projects/spring-framework#22371 , which was closed and marked as superseded, but references itself.
The text was updated successfully, but these errors were encountered: