Class VThreadSystemMetersProvider

java.lang.Object
io.helidon.metrics.systemmeters.VThreadSystemMetersProvider
All Implemented Interfaces:
Resumable, MetersProvider, HelidonShutdownHandler

public class VThreadSystemMetersProvider extends Object implements MetersProvider, HelidonShutdownHandler, Resumable
Provides system meters for virtual threads using Java Flight Recorder events.

The virtual thread meters are all net changes since this object was initialized during metrics start-up. This currently happens before the server listeners start so the virtual thread data should be fairly accurate.

Further, we track both the number of pinned virtual threads and a distribution summary of their length. That's because distribution summaries reset after a while to manage storage and reduce the contribution of stale samples. Keeping a separate count gives some indication of the level of thread pinning over the entire lifetime of the server.

JFR delivers events in batches. For performance the values we track are stored as longs without concern for concurrent updates which should not happen anyway.