-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Collect metrics during application context startup #24878
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
+1 to this. We'd love to get some insight into this timing. Further, we'd really like to see this type of data recorded to something like Micrometer, or at least a hook point so that we can capture these timings and record them ourselves. |
Not sure if this is the right issue (or maybe should open a new issue). Now that the flight recorder is part of OpenJDK 11 (and backported to a recent 8 version) would it make sense to introduce these kind of events into the Spring (and maybe other Spring projects later)? |
@mdeinum this is the right issue. Right now we're thinking about providing an extension point for registering an implementation that would receive those events and could delegate to JFR, a library (like Micrometer) or anything custom. This would be a good start in Framework and we could provide such implementations in Spring Boot. What do you think? |
Awesome we are watching that feature closely as we have an internal implementation capturing similar metrics.
|
Really like this and could help identify bottlenecks in the startup/init of an application. Do you have a feature branch that we could checkout/play with? |
@smaldini Thanks for the feedback! This would be a good opportunity to ensure that this feature fits your use case.
@mdeinum I'm going to get feedback from the Framework team on the main elements (concept names, packaging interfaces). As soon as we're clear, I think we should push this to SNAPSHOTs and iterate on the actual instrumentation of the application context. I've run this with several sample applications but I did not cover the whole feature spectrum and I'm probably missing things here. Your feedback here will be super important. |
I've just pushed a first version of this, with the basic infrastructure. Note that as of this commit, JDK8u262 is required to build Spring Framework (to get the Java Flight Recorder implementation provided here) - of course, Spring Framework 5.x does not require this version at runtime since this JFR implementation is opt-in only. We'll continue working on this feature in Spring Boot to provide an easy setup and data export facilities. Feel free to start experimenting and submit feedback here or in a new issue. We've got some time to iterate on this new API until the RC phase. |
As of spring-projects/spring-framework#24878, Spring Framework provides an `ApplicationStartup` infrastructure that applications can use to collect and track events during the application startup phase. This commit adds a new `BufferingApplicationStartup` implementation that buffer `StartupStep`s and tracks their execution time. Once buffered, these steps can be pushed to an external metrics system or drained through a web endpoint, to a file... Closes gh-22603
Debugging issues about slow application startup times or even figuring out the sequence of events during the application context startup can be challenging.
This issue is about providing a low-cost, safe and metadata-rich strategy to collect metrics during the application context startup. This should be opt-in only and have little to no cost when disabled.
Collected data and metrics should help to:
@PostConstruct
processing, creating beans that should have been guarded with conditions, etc).The text was updated successfully, but these errors were encountered: