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

Getting custom metric #2552

Closed
strelchm opened this issue Oct 20, 2022 · 10 comments
Closed

Getting custom metric #2552

strelchm opened this issue Oct 20, 2022 · 10 comments
Labels
status/invalid We don't feel this issue is valid

Comments

@strelchm
Copy link

I have to make next netty metrics for all http requests of Spring Webflux app:

  • time from receiving a request to being laid to the request pool
  • waiting time for processing in the pool request

Can you please suggest idea - how I can get such metrics? May be with help of AOP? Or there are some listeners that can be used?

With honour, Michael

@violetagg violetagg added for/user-attention This issue needs user attention (feedback, rework, etc...) and removed ❓need-triage labels Oct 20, 2022
@violetagg
Copy link
Member

@strelchm Can you please elaborate a bit more on the requirements? Also most probably you need this for 1.0.x version?

@strelchm
Copy link
Author

strelchm commented Oct 21, 2022

@strelchm Can you please elaborate a bit more on the requirements? Also most probably you need this for 1.0.x version?

@violetagg Project is built with spring boot and web-flux. The version of reactor-netty is 1.0.13. Now I have enabled some metrics with NettyServerCustomizer, but want some more information about http-request(events) in thread pool

@violetagg
Copy link
Member

@strelchm So you are targeting server metrics. Ok.

but want some more information about http-request(events) in thread pool

I cannot get this ...

Reactor Netty doesn't use thread per request paradigm which is typical for blocking processing of the requests. Reactor Netty processes the requests in a non-blocking fashion and uses an even loop. Typically the number of the threads that we use is the number of the cores that you have.

@violetagg
Copy link
Member

We do have metrics for how many connections are opened at any moment and how many of them are active (which basically represents the number of the requests that are in process at the moment).

@strelchm
Copy link
Author

strelchm commented Oct 21, 2022

@violetagg Sorry, I explained not correct. I need the metrics: time from receiving a request to being laid to the request pool and
waiting time for processing in the pool of requests (after which the request comes to @RestController). The problem is that the time between request coming to server and coming to @RestController is several seconds. This situation is rare, so such time metrics can give answer, is this problems in app (db or business-logic) or may be this is big quantaty of requests or may be some problems with thread pool cause using blocking operations. The metrics that you wrote is very useful too, thanks

@violetagg
Copy link
Member

violetagg commented Oct 21, 2022

@strelchm @RestController this is something that is not provided by Reactor Netty...
Spring WebFlux uses I/O Handler functionality that Reactor Netty provides which mean once the request comes on a given connection Reactor Netty immediately does the the HTTP decoding and forwards the request to the Spring WebFlux I/O Handler.
You can monitor the event loop task queue if you think that there is some blocking operation that causes the event loop to slowly process the tasks.
Other than that there is a feature request #1433 for event loop task duration, but this is not only for requests but for every task that is pending in the event loop.
So what we may think of exposing is only this time "the request comes on a given connection Reactor Netty immediately does the the HTTP decoding and forwards the request to the Spring WebFlux I/O Handler"

@strelchm
Copy link
Author

@strelchm You can monitor the event loop task queue if you think that there is some blocking operation that causes the event loop to slowly process the tasks

@violetagg Can you please suggest how I can do this? I see one metric reactor.netty.eventloop.pending.tasks in docs. In other way, can we measure the time with aop or this is bad idea?

@violetagg
Copy link
Member

@strelchm This one reactor.netty.eventloop.pending.tasks reports in Micrometer if you need something else you can follow the snippet here #1398

@strelchm
Copy link
Author

@violetagg thanks much!

@violetagg
Copy link
Member

@strelchm I'm closing this one. We can reopen it if something else is needed.

@violetagg violetagg added status/invalid We don't feel this issue is valid and removed for/user-attention This issue needs user attention (feedback, rework, etc...) labels Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/invalid We don't feel this issue is valid
Projects
None yet
Development

No branches or pull requests

3 participants