public class Load extends Object implements 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.
|
Map<String,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.
|
String |
toString()
Get string representation of
Load . |
List<Long> |
windows()
Get the windows list for the load.
|
void |
writeTo(OutputStream out)
Output writing string representation of this class to the stream.
|
public AggregatedMetricValues loadByWindows()
public int numWindows()
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 Map<String,Object> getJsonStructure()
public void writeTo(OutputStream out) throws IOException
out
- the output stream.IOException
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.