public class Load
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
Load()
Package constructor for load with given load properties.
|
Modifier and Type | Method and Description |
---|---|
double |
expectedUtilizationFor(KafkaMetricDef metric,
boolean wantMaxLoad,
boolean wantAvgLoad)
Get a single snapshot value that is representative for the given KafkaMetric type.
|
double |
expectedUtilizationFor(Resource resource) |
static double |
expectedUtilizationFor(Resource resource,
AggregatedMetricValues aggregatedMetricValues,
boolean ignoreMissingMetric)
Get a single snapshot value that is representative for the given resource.
|
double |
expectedUtilizationFor(Resource resource,
boolean wantMaxLoad,
boolean wantAvgLoad)
Get a single snapshot value that is representative for the given resource.
|
java.util.Map<java.lang.String,java.lang.Object> |
getJsonStructure()
Return an object that can be further used
to encode into JSON
|
AggregatedMetricValues |
loadByWindows()
Get load by their window time.
|
int |
numWindows()
Get the number of windows in the load.
|
java.lang.String |
toString()
Get string representation of
Load . |
java.util.List<java.lang.Long> |
windows()
Get the windows list for the load.
|
void |
writeTo(java.io.OutputStream out)
Output writing string representation of this class to the stream.
|
public AggregatedMetricValues loadByWindows()
public int numWindows()
public java.util.List<java.lang.Long> windows()
public double expectedUtilizationFor(Resource resource, boolean wantMaxLoad, boolean wantAvgLoad)
resource
- Resource for which the expected utilization will be provided.wantMaxLoad
- True if the requested utilization represents the peak load, false otherwise.wantAvgLoad
- True if the requested utilization represents the avg load, false otherwise.public double expectedUtilizationFor(Resource resource)
public double expectedUtilizationFor(KafkaMetricDef metric, boolean wantMaxLoad, boolean wantAvgLoad)
metric
- KafkaMetric type for which the expected utilization will be provided.wantMaxLoad
- True if the requested utilization represents the peak load, false otherwise.wantAvgLoad
- True if the requested utilization represents the avg load, false otherwise.public java.util.Map<java.lang.String,java.lang.Object> getJsonStructure()
public void writeTo(java.io.OutputStream out) throws java.io.IOException
out
- the output stream.java.io.IOException
public java.lang.String toString()
Load
.toString
in class java.lang.Object
public static double expectedUtilizationFor(Resource resource, AggregatedMetricValues aggregatedMetricValues, boolean ignoreMissingMetric)
resource
- Resource for which the expected utilization will be provided.aggregatedMetricValues
- the aggregated metric values to calculate the expected utilization.ignoreMissingMetric
- whether it is allowed for the value of the given resource to be missing.
If the value of the given resource is not found, when set to true, 0 will be returned.
Otherwise, an exception will be thrown.