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
ConstructorsConstructorDescriptionMeasurement(Number value, Map<String, Object> attributes, boolean isDouble) Creates an instance of aMeasurementrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theattributesrecord component.static List<Measurement> combine(List<Measurement> measurements) Add measurements with the same attributes together.final booleanIndicates whether some other object is "equal to" this one.doublelonggetLong()final inthashCode()Returns a hash code value for this object.booleanisDouble()Returns the value of theisDoublerecord component.booleanisLong()final StringtoString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.
-
Constructor Details
-
Measurement
Creates an instance of aMeasurementrecord class.- Parameters:
value- the value for thevaluerecord componentattributes- the value for theattributesrecord componentisDouble- the value for theisDoublerecord 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 thevaluerecord component.- Returns:
- the value of the
valuerecord component
-
attributes
Returns the value of theattributesrecord component.- Returns:
- the value of the
attributesrecord component
-
isDouble
public boolean isDouble()Returns the value of theisDoublerecord component.- Returns:
- the value of the
isDoublerecord component
-