Package 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 java.lang.Object implements IdentifiedDataSerializable
An immutable collection of job-specific metrics, pairs of metric names and sets of associatedMeasurement
s.- Since:
- Jet 3.2
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsTag(java.lang.String tagName)
Returns true if there is anyMeasurement
that has the specified tag.static JobMetrics
empty()
Returns an emptyJobMetrics
object.boolean
equals(java.lang.Object obj)
JobMetrics
filter(java.lang.String tagName, java.lang.String tagValue)
Convenience method forfilter(Predicate)
, returns a newJobMetrics
instance containing only thoseMeasurement
s which have the specified tag set to the specified value.JobMetrics
filter(java.util.function.Predicate<Measurement> predicate)
Returns a newJobMetrics
instance containing a subset of theMeasurement
s found in the current one.java.util.List<Measurement>
get(java.lang.String metricName)
Returns allMeasurement
s associated with a given metric name.int
getClassId()
Returns type identifier for this class.int
getFactoryId()
Returns DataSerializableFactory factory ID for this class.int
hashCode()
java.util.Set<java.lang.String>
metrics()
Returns all metrics present.static JobMetrics
of(java.util.Map<java.lang.String,java.util.List<Measurement>> metrics)
Builds aJobMetrics
object based on a map ofMeasurement
s.void
readData(ObjectDataInput in)
Reads fields from the input streamjava.lang.String
toString()
void
writeData(ObjectDataOutput out)
Writes object fields to output stream
-
-
-
Method Detail
-
empty
@Nonnull @PrivateApi public static JobMetrics empty()
Returns an emptyJobMetrics
object.
-
of
@Nonnull @PrivateApi public static JobMetrics of(@Nonnull java.util.Map<java.lang.String,java.util.List<Measurement>> metrics)
Builds aJobMetrics
object based on a map ofMeasurement
s.
-
metrics
@Nonnull public java.util.Set<java.lang.String> metrics()
Returns all metrics present.
-
get
@Nonnull public java.util.List<Measurement> get(@Nonnull java.lang.String metricName)
Returns allMeasurement
s associated with a given metric name.For a list of job-specific metric names please see
MetricNames
.
-
filter
@Nonnull public JobMetrics filter(@Nonnull java.lang.String tagName, @Nonnull java.lang.String tagValue)
Convenience method forfilter(Predicate)
, returns a newJobMetrics
instance containing only thoseMeasurement
s which have the specified tag set to the specified value.For a list of available tag names, see
MetricTags
.
-
containsTag
public boolean containsTag(@Nonnull java.lang.String tagName)
Returns true if there is anyMeasurement
that has the specified tag.- Since:
- 5.4
-
filter
@Nonnull public JobMetrics filter(@Nonnull java.util.function.Predicate<Measurement> predicate)
Returns a newJobMetrics
instance containing a subset of theMeasurement
s found in the current one. The subset is formed by thoseMeasurement
s which match the providedPredicate
.The metric names which have all their
Measurement
s filtered out won't be present in the newJobMetrics
instance.
-
getFactoryId
public int getFactoryId()
Description copied from interface:IdentifiedDataSerializable
Returns DataSerializableFactory factory ID for this class.- Specified by:
getFactoryId
in interfaceIdentifiedDataSerializable
- Returns:
- factory ID
-
getClassId
public int getClassId()
Description copied from interface:IdentifiedDataSerializable
Returns type identifier for this class. It should be unique per DataSerializableFactory.- Specified by:
getClassId
in interfaceIdentifiedDataSerializable
- Returns:
- type ID
-
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 interfaceDataSerializable
- Parameters:
out
- output- Throws:
java.io.IOException
- if an I/O error occurs. In particular, anIOException
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 interfaceDataSerializable
- Parameters:
in
- input- Throws:
java.io.IOException
- if an I/O error occurs. In particular, anIOException
may be thrown if the input stream has been closed.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-