Add metrics related to virtual threads #9619
Open
+465
−37
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Resolves #9533
Helidon exposes new meters related to virtual thread usage:
The virtual thread count meters are disabled by default for performance reasons. Enable them by setting
metrics.virtual-threads.count.enabled=true
in configuration, but be aware doing so can degrade the server's performance.The PR adds a new
MetersProvider
implementation to thehelidon-metrics-system-meters
component. The new implementation registers for selected Java Flight Recorder events to track data related to virtual threads.The three meters enabled by default should be rare so monitoring the JFR events for them adds very little overhead. In contrast, to maintain the current number of active virtual threads and the total number of virtual thread starts the added code must register for and respond to virtual thread start and end events which can be costly. That's why those two meters--and the registration of listeners for those events from JFR--are disabled by default.
Documentation
Small additions to the SE and MP metrics guide and doc pages.