com.hazelcast.jet.core.metrics

## Class Measurement

- java.lang.Object
- - com.hazelcast.jet.core.metrics.Measurement

- All Implemented Interfaces:
    DataSerializable, IdentifiedDataSerializable

      public class Measurement
      extends 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`). The metric name is also duplicated as one of the tags, see `MetricTags.METRIC`. 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:
    3.2

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)`
    `int` | `getFactoryId()` Returns DataSerializableFactory factory ID for this class.
    `int` | `getId()` Returns type identifier for this class.
    `String` | `getTag(String name)` Returns the value associated with a specific tag, based on the metric description of this particular `Measurement`.
    `long` | `getTimestamp()` Returns the timestamps associated with this `Measurement`, the moment when the value was gathered.
    `long` | `getValue()` Returns the value associated with this `Measurement`.
    `int` | `hashCode()`
    `static Measurement` | `of(long value, long timestamp, Map<String,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
    `String` | `toString()`
    `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(long value,
                                                long timestamp,
                                                @Nonnull
                                                Map<String,String> tags)

      Builds a `Measurement` instance based on timestamp, value and the metric descriptor in map form.

    - #### getValue

          public long getValue()

      Returns the value associated with this `Measurement`.

    - #### getTimestamp

          public long getTimestamp()

      Returns the timestamps associated with this `Measurement`, the moment when the value was gathered.

    - #### getTag

          @Nullable
          public String getTag(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`.

    - #### getFactoryId

          public int getFactoryId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns DataSerializableFactory factory ID for this class.
      Specified by:
        `getFactoryId` in interface `IdentifiedDataSerializable`
      Returns:
        factory ID

    - #### getId

          public int getId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns type identifier for this class. It should be unique per DataSerializableFactory.
      Specified by:
        `getId` in interface `IdentifiedDataSerializable`
      Returns:
        type ID

    - #### writeData

          public void writeData(ObjectDataOutput out)
                         throws IOException

      Description copied from interface: `DataSerializable`
      Writes object fields to output stream
      Specified by:
        `writeData` in interface `DataSerializable`
      Parameters:
        `out` - output
      Throws:
        `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 IOException

      Description copied from interface: `DataSerializable`
      Reads fields from the input stream
      Specified by:
        `readData` in interface `DataSerializable`
      Parameters:
        `in` - input
      Throws:
        `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 `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2019. All rights reserved.