Class ThreadExports
Example usage:
new ThreadExports().register();
Example metrics being exported:
jvm_threads_current{} 300 jvm_threads_daemon{} 200 jvm_threads_peak{} 410 jvm_threads_started_total{} 1200
-
Nested Class Summary
Nested classes/interfaces inherited from class io.prometheus.client.Collector
Collector.Describable, Collector.MetricFamilySamples, Collector.Type
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final String
private static final String
private static final String
private static final String
private static final String
static final String
private final ThreadMXBean
static final String
Fields inherited from class io.prometheus.client.Collector
MILLISECONDS_PER_SECOND, NANOSECONDS_PER_SECOND
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void
addThreadMetrics
(List<Collector.MetricFamilySamples> sampleFamilies, Predicate<String> nameFilter) collect()
Return all metrics of this Collector.LikeCollector.collect()
, but the result should only containMetricFamilySamples
wheresampleNameFilter.test(name)
istrue
for at least one Sample name.private static double
nullSafeArrayLength
(long[] array) Methods inherited from class io.prometheus.client.Collector
checkMetricLabelName, checkMetricName, doubleToGoString, register, register, sanitizeMetricName
-
Field Details
-
UNKNOWN
- See Also:
-
JVM_THREADS_STATE
- See Also:
-
JVM_THREADS_CURRENT
- See Also:
-
JVM_THREADS_DAEMON
- See Also:
-
JVM_THREADS_PEAK
- See Also:
-
JVM_THREADS_STARTED_TOTAL
- See Also:
-
JVM_THREADS_DEADLOCKED
- See Also:
-
JVM_THREADS_DEADLOCKED_MONITOR
- See Also:
-
threadBean
-
-
Constructor Details
-
ThreadExports
public ThreadExports() -
ThreadExports
-
-
Method Details
-
addThreadMetrics
void addThreadMetrics(List<Collector.MetricFamilySamples> sampleFamilies, Predicate<String> nameFilter) -
getThreadStateCountMap
-
nullSafeArrayLength
private static double nullSafeArrayLength(long[] array) -
collect
Description copied from class:Collector
Return all metrics of this Collector. -
collect
Description copied from class:Collector
LikeCollector.collect()
, but the result should only containMetricFamilySamples
wheresampleNameFilter.test(name)
istrue
for at least one Sample name.The default implementation first collects all
MetricFamilySamples
and then discards the ones wheresampleNameFilter.test(name)
returnsfalse
for all names inCollector.MetricFamilySamples.getNames()
. To improve performance, collector implementations should override this method to preventMetricFamilySamples
from being collected if they will be discarded anyways. SeeThreadExports
for an example.Note that the resulting List may contain
MetricFamilySamples
where some Sample names returntrue
forsampleNameFilter.test(name)
but some Sample names returnfalse
. This is ok, because before we produce the output format we will callCollector.MetricFamilySamples.filter(Predicate)
to strip all Samples wheresampleNameFilter.test(name)
returnsfalse
.
-