Interface MetricCollector<T>

Type Parameters:
T - the type of metrics this collector produces
All Known Implementing Classes:
ContainerCollector, CpuCollector, DiskCollector, FileDescriptorCollector, JvmClassCollector, JvmGcCollector, JvmMemoryCollector, JvmThreadCollector, UptimeCollector

public interface MetricCollector<T>
Interface for collecting a specific type of metric.

Implementations should be stateless and thread-safe. The collect() method may be called concurrently from multiple threads.

  • Method Summary

    Modifier and Type
    Method
    Description
    Collects metrics.
    boolean
    Checks if this collector is available on the current platform.
  • Method Details

    • collect

      Optional<T> collect()
      Collects metrics.
      Returns:
      an Optional containing the collected metrics, or empty if collection failed or the metrics are not available on this platform
    • isAvailable

      boolean isAvailable()
      Checks if this collector is available on the current platform.

      This method should return quickly and may cache its result.

      Returns:
      true if this collector can collect metrics on the current platform