-
Notifications
You must be signed in to change notification settings - Fork 654
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
Inconsistent reactor_netty_http_client_* and reactor_netty_tcp_client_* metrics when proxy in use #3060
Comments
@jtorkkel I can reproduce it and I'm working on a fix. Thanks for the detailed explanation! |
Thanks, please consider having separate label for proxy and remote_address. It would also show if proxy in use. I also noticed that "reactor_netty_tcp_client_errors_total" but probably also "reactor_netty_http_client_errors_total" are also inconsistent. I can see from logs 6 separate errors, 2 first are 1s from each other and remaining 4 few min apart from each.
And I can see from spring FW I can also see same amount of "WebClientRequestException" in http client and http server, 2 change in one scrape and 4 change in 4 other scrape.
But in reactor metrics I can see only 3 and they happen at same time as last of above 6, but in logs only one error seen.
So sounds that "reactor_netty_*_client_errors_total" is not counting all errors, and sometimes counting error multiple times. Would be great also to have label for error reason like exception as spring FW seems to aggregate all request exceptions into "WebClientRequestException" resulting you cannot differentiate "connectTimeout", "readtimeout", queueTimeout. But apparently might be hard as exception happens on so many layers, read timeout happen in "io.netty.handler.timeout.ReadTimeoutException" |
@jtorkkel For Reactor Netty version For the issue with the errors number can you provide some reproducible example? |
…gardless whether there is proxy Fixes #3060
Thanks, make sense to add new label only to 1.1.x. We were seeing "The connection observed an error reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response". We never found the root cause but we noticed that increasing web client "maxIdleTime" from 2min to 10min and turning on eviction (2min, instead of checking age in acquire/release) we started to get 100x more of "prematurely closed" errors. While root causing I was hoping to see errors in "reactor_netty_tcp_client_errors_total" metrics but as said sometimes "prematurely closed" were reported, sometimes not reported and sometimes single exception resulted multiple errors (no other exception seen) . I then tested 5 different test cases
1 and 2 resulted connect error correctly, and naturally no error on "reactor_netty_tcp_client_errors_total"
I was expecting that 3-5 would be also seen on "reactor_netty_tcp_client_errors_total" but did not see counter increased (actually missing).
Apparently reactor netty is not handling most of the exception and WebClient handle them instead, and aggregate to single WebClientRequestException.
|
…e correct order for ChannelHandlers - Place ResponseTimeoutHandler before HttpMetricsHandler so that is an error happened it can be recorded - Add test to verify that errors with establishing a connection are recorded Fixes #3060
For the moment we do not plan to add the type of the error. |
Current behauviour:
Without proxy springFW "http_client_requests_seconds_count" "client_name" label report same address as reactor_netty_http_client_* and reactor_netty_tcp_client_* "remote_address" label.
Example correctly reported by reactor_netty_http_client
With proxy enabled the reactor_netty reports
http and tcp reports differently.
Example when both reported
Expected behaviour
Reproduction steps:
Create @RestController GET /proxy endpoint, which make proxy http client (you needs to use your own proxy like "proxy:8080") GET call to "https://petstore.swagger.io/v2/swagger.json", enable either reactor_netty_tcp or http_metrics
Enable proxy, enable http or tcp metrics
Metrics outcome when reactor_netty_http_client metrics in use
spring FW http metrics
proxy address reported
real address reported
both proxy and real address ****
This was not shown in test case, but looks that it use XXX
Metrics outcome when reactor_netty_tcp_client metrics in use
spring FW http metrics
proxy address reported
real address reported
Environment
SpringBoot 3.2.2.
Windows and Linux
java 17
The text was updated successfully, but these errors were encountered: