Add ability for users to configure settings related to virtual threads meters #9653
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 #9652
Release Note
Joe - this release note supersedes and expands on the one for the earlier PR #9619 for virtual threads metrics.
Helidon's built-in meters now include new ones for additional thread information.
New meters related to virtual thread usage
New meter related to platform threads
Helidon also now exposes the new system meter
thread.starts
which displays the total number of platform thread starts performed in the JVM since server start-up.Configuration
metrics.virtual-threads.enabled
Whether the virtual thread meters features is enabled.
Default:
true
metrics.virtual-threads.count.enabled
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.Default:
false
metrics.virtual-threads.pinned.threshold
Helidon tracks pinned thread events only if the duration reaches a threshold. This value is a
Duration
expression.Default:
PT0.02S
(20 ms)Overview of the PR changes
VThreadSystemMetersProvider
class respect the config settings. If virtual threads metrics are disabled the code does not do anything at all with the JFR API which would remove any performance impact from registering for event notifications with JFR. If virtual thread metrics are enabled, create theRecordingStream
(as before) but augment the settings by specifying the pinning threshold from the config.Documentation
Includes updates to the SE and MP metrics guide pages and the generated doc for config.