public final class Measurement extends Object implements IdentifiedDataSerializable
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, ...
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
int |
getClassId()
Returns type identifier for this class.
|
int |
getFactoryId()
Returns DataSerializableFactory factory ID for this class.
|
int |
hashCode() |
String |
metric()
Returns the name of the metric.
|
static Measurement |
of(String metric,
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 |
tag(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. |
String |
toString() |
long |
value()
Returns the value associated with this
Measurement . |
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
@Nonnull public static Measurement of(@Nonnull String metric, long value, long timestamp, @Nonnull Map<String,String> tags)
Measurement
instance based on timestamp, value and
the metric descriptor in map form.public long value()
Measurement
.public long timestamp()
Measurement
, the
moment when the value was gathered.@Nonnull public String metric()
MetricNames
.@Nullable public String tag(String name)
Measurement
. For a list of
possible tag names see MetricTags
.public int getFactoryId()
IdentifiedDataSerializable
getFactoryId
in interface IdentifiedDataSerializable
public int getClassId()
IdentifiedDataSerializable
getClassId
in interface IdentifiedDataSerializable
public void writeData(ObjectDataOutput out) throws IOException
DataSerializable
writeData
in interface DataSerializable
out
- outputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
output stream has been closed.public void readData(ObjectDataInput in) throws IOException
DataSerializable
readData
in interface DataSerializable
in
- inputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
input stream has been closed.Copyright © 2024 Hazelcast, Inc.. All rights reserved.