Class MetricsWriter

java.lang.Object
com.aerospike.client.metrics.MetricsWriter
All Implemented Interfaces:
MetricsListener

public final class MetricsWriter extends Object implements MetricsListener
Default metrics listener. This implementation writes periodic metrics snapshots to a file which will later be read and forwarded to OpenTelemetry by a separate offline application.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Initialize metrics writer.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onDisable(com.aerospike.client.cluster.Cluster cluster)
    Write final cluster metrics snapshot to file and then close the file.
    void
    onEnable(com.aerospike.client.cluster.Cluster cluster, MetricsPolicy policy)
    Open timestamped metrics file in append mode and write header indicating what metrics will be stored.
    void
    Write final node metrics snapshot on node that will be closed.
    void
    onSnapshot(com.aerospike.client.cluster.Cluster cluster)
    Write cluster metrics snapshot to file.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MetricsWriter

      public MetricsWriter(String dir)
      Initialize metrics writer.
  • Method Details

    • onEnable

      public void onEnable(com.aerospike.client.cluster.Cluster cluster, MetricsPolicy policy)
      Open timestamped metrics file in append mode and write header indicating what metrics will be stored.
      Specified by:
      onEnable in interface MetricsListener
    • onSnapshot

      public void onSnapshot(com.aerospike.client.cluster.Cluster cluster)
      Write cluster metrics snapshot to file.
      Specified by:
      onSnapshot in interface MetricsListener
    • onNodeClose

      public void onNodeClose(Node node)
      Write final node metrics snapshot on node that will be closed.
      Specified by:
      onNodeClose in interface MetricsListener
    • onDisable

      public void onDisable(com.aerospike.client.cluster.Cluster cluster)
      Write final cluster metrics snapshot to file and then close the file.
      Specified by:
      onDisable in interface MetricsListener