Package com.hazelcast.jet.core.metrics
Class Measurement
- java.lang.Object
-
- com.hazelcast.jet.core.metrics.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 seeMetricTags
). 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 aMeasurement
instance based on timestamp, value and the metric descriptor in map form.void
readData(ObjectDataInput in)
Reads fields from the input streamjava.lang.String
tag(java.lang.String name)
Returns the value associated with a specific tag, based on the metric description of this particularMeasurement
.long
timestamp()
Returns the timestamps associated with thisMeasurement
, the moment when the value was gathered.java.lang.String
toString()
long
value()
Returns the value associated with thisMeasurement
.void
writeData(ObjectDataOutput out)
Writes object fields to output stream
-
-
-
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 aMeasurement
instance based on timestamp, value and the metric descriptor in map form.
-
value
public long value()
Returns the value associated with thisMeasurement
.
-
timestamp
public long timestamp()
Returns the timestamps associated with thisMeasurement
, 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 seeMetricNames
.
-
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 particularMeasurement
. For a list of possible tag names seeMetricTags
.
-
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
-
-