Class Measurement

  • All Implemented Interfaces:
    DataSerializable, IdentifiedDataSerializable

    public final class Measurement
    extends java.lang.Object
    implements IdentifiedDataSerializable
    Immutable data class containing information about one metric measurement, consisting of:
    • metric value
    • metric timestamp, generated when the metric was gathered
    • metric descriptor (set of tag name-value pairs)

    A metrics descriptor can be thought of as a set of attributes associated with a particular metric, metric which in turn is defined by its name (for a full list of metric names provided see MetricNames). The attributes are specified as tags that have names and values (for a full list of tag names see MetricTags). An example descriptor would have a collection of tags/attributes like this: module=jet, job=jobId, exec=execId, vertex=filter, proc=3, unit=count, metric=queuesCapacity, ...

    Since:
    Jet 3.2
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      int getClassId()
      Returns type identifier for this class.
      int getFactoryId()
      Returns DataSerializableFactory factory ID for this class.
      int hashCode()  
      java.lang.String metric()
      Returns the name of the metric.
      static Measurement of​(java.lang.String metric, long value, long timestamp, java.util.Map<java.lang.String,​java.lang.String> tags)
      Builds a Measurement instance based on timestamp, value and the metric descriptor in map form.
      void readData​(ObjectDataInput in)
      Reads fields from the input stream
      java.lang.String tag​(java.lang.String name)
      Returns the value associated with a specific tag, based on the metric description of this particular Measurement.
      long timestamp()
      Returns the timestamps associated with this Measurement, the moment when the value was gathered.
      java.lang.String toString()  
      long value()
      Returns the value associated with this Measurement.
      void writeData​(ObjectDataOutput out)
      Writes object fields to output stream
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • of

        @Nonnull
        public static Measurement of​(@Nonnull
                                     java.lang.String metric,
                                     long value,
                                     long timestamp,
                                     @Nonnull
                                     java.util.Map<java.lang.String,​java.lang.String> tags)
        Builds a Measurement instance based on timestamp, value and the metric descriptor in map form.
      • value

        public long value()
        Returns the value associated with this Measurement.
      • timestamp

        public long timestamp()
        Returns the timestamps associated with this Measurement, the moment when the value was gathered.
      • metric

        @Nonnull
        public java.lang.String metric()
        Returns the name of the metric. For a list of different metrics see MetricNames.
      • tag

        @Nullable
        public java.lang.String tag​(java.lang.String name)
        Returns the value associated with a specific tag, based on the metric description of this particular Measurement. For a list of possible tag names see MetricTags.
      • writeData

        public void writeData​(ObjectDataOutput out)
                       throws java.io.IOException
        Description copied from interface: DataSerializable
        Writes object fields to output stream
        Specified by:
        writeData in interface DataSerializable
        Parameters:
        out - output
        Throws:
        java.io.IOException - if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed.
      • readData

        public void readData​(ObjectDataInput in)
                      throws java.io.IOException
        Description copied from interface: DataSerializable
        Reads fields from the input stream
        Specified by:
        readData in interface DataSerializable
        Parameters:
        in - input
        Throws:
        java.io.IOException - if an I/O error occurs. In particular, an IOException may be thrown if the input stream has been closed.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object