Class BytesThroughputEstimator<T>
- java.lang.Object
-
- org.apache.beam.sdk.io.gcp.spanner.changestreams.estimator.BytesThroughputEstimator<T>
-
- All Implemented Interfaces:
java.io.Serializable
,ThroughputEstimator<T>
public class BytesThroughputEstimator<T> extends java.lang.Object implements ThroughputEstimator<T>
An estimator to provide an estimate on the throughput of the outputted elements.This estimator will keep track of the bytes of reported records within a sliding window. The window consists of the configured number of seconds and each record's bytes will fall into exactly one given second bucket. When more than window size seconds have passed from the current time, the bytes reported for the seconds that fall of the window will not be considered anymore. The bytes of the records will be estimated using the configured
Coder
.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BytesThroughputEstimator(int windowSizeSeconds, SizeEstimator<T> sizeEstimator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
get()
Returns the estimated throughput bytes for now.double
getFrom(com.google.cloud.Timestamp time)
Returns the estimated throughput bytes for a specified time.void
update(com.google.cloud.Timestamp timeOfRecords, T element)
Updates the estimator with the bytes of records.
-
-
-
Constructor Detail
-
BytesThroughputEstimator
public BytesThroughputEstimator(int windowSizeSeconds, SizeEstimator<T> sizeEstimator)
-
-
Method Detail
-
update
public void update(com.google.cloud.Timestamp timeOfRecords, T element)
Updates the estimator with the bytes of records.- Specified by:
update
in interfaceThroughputEstimator<T>
- Parameters:
timeOfRecords
- the committed timestamp of the recordselement
- the element to estimate the byte size of
-
get
public double get()
Returns the estimated throughput bytes for now.- Specified by:
get
in interfaceThroughputEstimator<T>
-
getFrom
public double getFrom(com.google.cloud.Timestamp time)
Returns the estimated throughput bytes for a specified time.- Specified by:
getFrom
in interfaceThroughputEstimator<T>
- Parameters:
time
- the specified timestamp to check throughput
-
-