Class VThreadSystemMetersProvider
java.lang.Object
io.helidon.metrics.systemmeters.VThreadSystemMetersProvider
- All Implemented Interfaces:
Resumable, MetersProvider, HelidonShutdownHandler, AutoCloseable
public class VThreadSystemMetersProvider
extends Object
implements MetersProvider, HelidonShutdownHandler, Resumable, AutoCloseable
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.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Collection<Meter.Builder<?, ?>> meterBuilders(MetricsFactory metricsFactory) Returns meter builders created using the specifiedMetricsFactory.Collection<Meter.Builder<?, ?>> meterBuilders(MetricsFactory metricsFactory, MeterRegistry meterRegistry) Returns meter builders created using the specifiedMetricsFactoryfor the specifiedMeterRegistry.voidresume()Invoked after restore.voidshutdown()Handle the shutdown work of this component.voidsuspend()Invoked by before suspend.
-
Constructor Details
-
VThreadSystemMetersProvider
public VThreadSystemMetersProvider()Required public constructor forServiceLoader.
-
-
Method Details
-
meterBuilders
Description copied from interface:MetersProviderReturns meter builders created using the specifiedMetricsFactory.- Specified by:
meterBuildersin interfaceMetersProvider- Parameters:
metricsFactory- theMetricsFactorythe provider should use- Returns:
- meter builders
-
meterBuilders
public Collection<Meter.Builder<?,?>> meterBuilders(MetricsFactory metricsFactory, MeterRegistry meterRegistry) Returns meter builders created using the specifiedMetricsFactoryfor the specifiedMeterRegistry.- Specified by:
meterBuildersin interfaceMetersProvider- Parameters:
metricsFactory- metrics factory the provider should usemeterRegistry- meter registry which will receive the meters- Returns:
- meter builders
-
shutdown
public void shutdown()Description copied from interface:HelidonShutdownHandlerHandle the shutdown work of this component.- Specified by:
shutdownin interfaceHelidonShutdownHandler
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
suspend
-
resume
-