com.hazelcast.jet.core.metrics

## Class JobMetrics

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

- All Implemented Interfaces:
    DataSerializable, IdentifiedDataSerializable

      public final class JobMetrics
      extends Object
      implements IdentifiedDataSerializable

  An immutable collection of job-specific metrics, pairs of metric names and sets of associated `Measurement`s.
  Since:
    3.2

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static JobMetrics` | `empty()` Returns an empty `JobMetrics` object.
    `boolean` | `equals(Object obj)`
    `JobMetrics` | `filter(Predicate<Measurement> predicate)` Returns a new `JobMetrics` instance containing a subset of the `Measurement`s found in the current one.
    `JobMetrics` | `filter(String tagName, String tagValue)` Convenience method for `#filter(Predicate)`, returns a new `JobMetrics` instance containing only those `Measurement`s which have the specified tag set to the specified value.
    `List<Measurement>` | `get(String metricName)` Returns all `Measurement`s associated with a given metric name.
    `int` | `getFactoryId()` Returns DataSerializableFactory factory ID for this class.
    `int` | `getId()` Returns type identifier for this class.
    `int` | `hashCode()`
    `Set<String>` | `metrics()` Returns all metrics present.
    `static JobMetrics` | `of(Stream<Measurement> measurements)` Builds a `JobMetrics` object based on a stream of `Measurement`s.
    `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

    - #### empty

          @Nonnull
           @PrivateApi
          public static JobMetrics empty()

      Returns an empty `JobMetrics` object.

    - #### of

          @Nonnull
           @PrivateApi
          public static JobMetrics of(Stream<Measurement> measurements)

      Builds a `JobMetrics` object based on a stream of `Measurement`s.

    - #### metrics

          @Nonnull
          public Set<String> metrics()

      Returns all metrics present.

    - #### get

          @Nonnull
          public List<Measurement> get(@Nonnull
                                                String metricName)

      Returns all `Measurement`s associated with a given metric name.

      For a list of job-specific metric names please see `MetricNames`.

    - #### filter

          @Nonnull
          public JobMetrics filter(@Nonnull
                                            String tagName,
                                            @Nonnull
                                            String tagValue)

      Convenience method for `#filter(Predicate)`, returns a new `JobMetrics` instance containing only those `Measurement`s which have the specified tag set to the specified value.

      For a list of available tag names, see `MetricTags`.

    - #### filter

          @Nonnull
          public JobMetrics filter(@Nonnull
                                            Predicate<Measurement> predicate)

      Returns a new `JobMetrics` instance containing a subset of the `Measurement`s found in the current one. The subset is formed by those `Measurement`s which match the provided `Predicate`.

      The metric names which have all their `Measurement`s filtered out won't be present in the new `JobMetrics` instance.

    - #### 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.