Package org.elasticsearch.telemetry
Record Class Measurement
java.lang.Object
java.lang.Record
org.elasticsearch.telemetry.Measurement
public record Measurement(Number value, Map<String,Object> attributes, boolean isDouble)
extends Record
A single measurement from an
Instrument
.-
Constructor Summary
ConstructorDescriptionMeasurement
(Number value, Map<String, Object> attributes, boolean isDouble) Creates an instance of aMeasurement
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theattributes
record component.static List<Measurement>
combine
(List<Measurement> measurements) Add measurements with the same attributes together.final boolean
Indicates whether some other object is "equal to" this one.double
long
getLong()
final int
hashCode()
Returns a hash code value for this object.boolean
isDouble()
Returns the value of theisDouble
record component.boolean
isLong()
final String
toString()
Returns a string representation of this record class.value()
Returns the value of thevalue
record component.
-
Constructor Details
-
Measurement
Creates an instance of aMeasurement
record class.- Parameters:
value
- the value for thevalue
record componentattributes
- the value for theattributes
record componentisDouble
- the value for theisDouble
record component
-
-
Method Details
-
isLong
public boolean isLong() -
getDouble
public double getDouble() -
getLong
public long getLong() -
combine
Add measurements with the same attributes together. All measurements must be from the same instrument. If some measurements differ onisDouble
, @throws IllegalArgumentException -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
value
Returns the value of thevalue
record component.- Returns:
- the value of the
value
record component
-
attributes
Returns the value of theattributes
record component.- Returns:
- the value of the
attributes
record component
-
isDouble
public boolean isDouble()Returns the value of theisDouble
record component.- Returns:
- the value of the
isDouble
record component
-