Point.MetricBuilder

Updated at:
Copy as MD

Class: com.aliyun.hitsdb.client.value.request.Point.MetricBuilder

java.lang.Object
    └── com.aliyun.hitsdb.client.value.request.Point.MetricBuilder

Enclosing class: Point

public static class Point.MetricBuilder extends Object

Point.MetricBuilder is the builder for constructing Point objects, which represent data points written to TSDB. Use the builder methods to set the metric name, tags, timestamp, and value before calling build() to produce a Point.

Constructors

ConstructorDescription
MetricBuilder()Creates a builder without a metric name.
MetricBuilder(String metric)Creates a builder with the specified metric name.

Method summary

Return typeMethodDescription
Point.MetricBuilderaggregator(String aggregator)Sets the aggregator for the data point.
Pointbuild()Builds and returns a Point object.
Pointbuild(boolean checkPoint)Builds and returns a Point object, with a check option.
Point.MetricBuildergranularity(Granularity granularity)Sets the granularity of the data point.
Point.MetricBuildertag(Map<String,String> tags)Adds multiple tag key-value pairs at once.
Point.MetricBuildertag(String tagName, String value)Adds a single tag key-value pair.
Point.MetricBuildertimestamp(Date date)Sets the timestamp using a Date object.
Point.MetricBuildertimestamp(long timestamp)Sets the timestamp as a numeric value in seconds or milliseconds.
Point.MetricBuildervalue(Date date, Number value)Sets the timestamp and value together using a Date object.
Point.MetricBuildervalue(long timestamp, Number value)Sets the timestamp and value together using a numeric timestamp.
Point.MetricBuildervalue(Number value)Sets the value of the data point.
Point.MetricBuilderversion(Long version)Sets the version of the data point value.

Inherited methods from `java.lang.Object`: clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait

Constructor details

MetricBuilder()

public MetricBuilder()

Creates a builder without a metric name.

MetricBuilder(String metric)

public MetricBuilder(String metric)

Creates a builder with the specified metric name.

ParameterDescription
metricThe name of the metric.

Method details

tag(String tagName, String value)

public Point.MetricBuilder tag(String tagName, String value)

Adds a tag key-value pair to the data point.

ParameterDescription
tagNameThe tag name.
valueThe tag value.

Returns: MetricBuilder

tag(Map<String,String> tags)

public Point.MetricBuilder tag(Map<String,String> tags)

Adds multiple tag key-value pairs to the data point.

ParameterDescription
tagsA map of tag key-value pairs.

Returns: MetricBuilder

aggregator(String aggregator)

public Point.MetricBuilder aggregator(String aggregator)

Sets the aggregator for the data point.

ParameterDescription
aggregatorAn instance of the Aggregator enumeration.

Returns: MetricBuilder

timestamp(long timestamp)

public Point.MetricBuilder timestamp(long timestamp)

Sets the timestamp of the data point. Accepts values in seconds or milliseconds.

ParameterDescription
timestampThe timestamp, in seconds or milliseconds.

Returns: MetricBuilder

timestamp(Date date)

public Point.MetricBuilder timestamp(Date date)

Sets the timestamp of the data point using a java.util.Date value.

ParameterDescription
dateThe timestamp as a java.util.Date object.

Returns: MetricBuilder

value(Number value)

public Point.MetricBuilder value(Number value)

Sets the value of the data point.

ParameterDescription
valueThe data point value.

Returns: MetricBuilder

value(long timestamp, Number value)

public Point.MetricBuilder value(long timestamp, Number value)

Sets the timestamp and value of the data point together.

ParameterDescription
timestampThe timestamp, in seconds or milliseconds.
valueThe data point value. Supported types: double, long, int.

Returns: MetricBuilder

value(Date date, Number value)

public Point.MetricBuilder value(Date date, Number value)

Sets the timestamp and value of the data point together using a Date object.

ParameterDescription
dateThe timestamp as a java.util.Date object.
valueThe data point value. Supported types: double, long, int.

Returns: MetricBuilder

granularity(Granularity granularity)

public Point.MetricBuilder granularity(Granularity granularity)

Sets the granularity of the data point.

ParameterDescription
granularityThe granularity value.

Returns: Point.MetricBuilder

version(Long version)

public Point.MetricBuilder version(Long version)

Sets the version of the data point value.

ParameterDescription
versionThe version number.

Returns: Point.MetricBuilder

build()

public Point build()

Builds and returns a Point object using the values set on the builder.

Returns: Point

build(boolean checkPoint)

public Point build(boolean checkPoint)

Builds and returns a Point object.

ParameterDescription
checkPointSpecifies whether to check the data point before building.

Returns: Point