Point.MetricBuilder
Class: com.aliyun.hitsdb.client.value.request.Point.MetricBuilder
java.lang.Object
└── com.aliyun.hitsdb.client.value.request.Point.MetricBuilderEnclosing class: Point
public static class Point.MetricBuilder extends ObjectPoint.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
| Constructor | Description |
|---|---|
MetricBuilder() | Creates a builder without a metric name. |
MetricBuilder(String metric) | Creates a builder with the specified metric name. |
Method summary
| Return type | Method | Description |
|---|---|---|
Point.MetricBuilder | aggregator(String aggregator) | Sets the aggregator for the data point. |
Point | build() | Builds and returns a Point object. |
Point | build(boolean checkPoint) | Builds and returns a Point object, with a check option. |
Point.MetricBuilder | granularity(Granularity granularity) | Sets the granularity of the data point. |
Point.MetricBuilder | tag(Map<String,String> tags) | Adds multiple tag key-value pairs at once. |
Point.MetricBuilder | tag(String tagName, String value) | Adds a single tag key-value pair. |
Point.MetricBuilder | timestamp(Date date) | Sets the timestamp using a Date object. |
Point.MetricBuilder | timestamp(long timestamp) | Sets the timestamp as a numeric value in seconds or milliseconds. |
Point.MetricBuilder | value(Date date, Number value) | Sets the timestamp and value together using a Date object. |
Point.MetricBuilder | value(long timestamp, Number value) | Sets the timestamp and value together using a numeric timestamp. |
Point.MetricBuilder | value(Number value) | Sets the value of the data point. |
Point.MetricBuilder | version(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.
| Parameter | Description |
|---|---|
metric | The 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.
| Parameter | Description |
|---|---|
tagName | The tag name. |
value | The 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.
| Parameter | Description |
|---|---|
tags | A map of tag key-value pairs. |
Returns: MetricBuilder
aggregator(String aggregator)
public Point.MetricBuilder aggregator(String aggregator)Sets the aggregator for the data point.
| Parameter | Description |
|---|---|
aggregator | An 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.
| Parameter | Description |
|---|---|
timestamp | The 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.
| Parameter | Description |
|---|---|
date | The 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.
| Parameter | Description |
|---|---|
value | The 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.
| Parameter | Description |
|---|---|
timestamp | The timestamp, in seconds or milliseconds. |
value | The 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.
| Parameter | Description |
|---|---|
date | The timestamp as a java.util.Date object. |
value | The 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.
| Parameter | Description |
|---|---|
granularity | The granularity value. |
Returns: Point.MetricBuilder
version(Long version)
public Point.MetricBuilder version(Long version)Sets the version of the data point value.
| Parameter | Description |
|---|---|
version | The 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.
| Parameter | Description |
|---|---|
checkPoint | Specifies whether to check the data point before building. |
Returns: Point