public class WorkerMetricStats extends Object implements EntityDAO.Entity
WorkerMetricStats.LegacyWorkerMetricStats (PK: wid) and WorkerMetricStats.LeaseTableWorkerMetricStats (PK: leaseKey)
override the partition key annotation on getWorkerId() for the legacy worker-metrics table vs. the unified lease
table respectively. The DAO delegates select the appropriate subclass for the DynamoDB Enhanced Client.| Modifier and Type | Class and Description |
|---|---|
static class |
WorkerMetricStats.Features
Add any new "breaking" feature to the END of this list.
|
static class |
WorkerMetricStats.LeaseTableWorkerMetricStats
Schema for lease table uses "leaseKey" as the partition key.
|
static class |
WorkerMetricStats.LegacyWorkerMetricStats
Schema for worker stats table uses "wid" as the partition key.
|
static class |
WorkerMetricStats.WorkerSupportInfo
Immutable snapshot of a worker's support code information.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
ENTITY_TYPE_ATTRIBUTE_NAME |
static String |
KEY_LAST_UPDATE_TIME |
static String |
KEY_WORKER_ID |
| Constructor and Description |
|---|
WorkerMetricStats() |
| Modifier and Type | Method and Description |
|---|---|
double |
computePercentageToReachAverage(Map<String,Double> workerMetricToFleetLevelAverage)
Determines percentage of load to reach the mean for the worker.
|
boolean |
containsMetricStat(String workerMetricName)
Returns true if given is available for the current worker else false
|
void |
extrapolateMetricStatValuesForAddedLease(Map<String,Double> workerMetricToFleetLevelAverage,
int averageLeaseCount)
Increase the metric stat value corresponding to the added single lease.
|
void |
extrapolateMetricStatValuesForAddedThroughput(Map<String,Double> workerMetricsToFleetLevelAverageMap,
double averageThroughput,
double increaseThroughput,
double averageLeaseCount)
Increase the WorkerMetricStats value by given increaseLoadPercentage.
|
String |
getEntityTypeDdbValue()
DDB Enhanced Client accessor: serializes entityType using
EntityType.getDdbValue(). |
double |
getMetricStat(String workerMetricName)
Returns the value for given WorkerMetricStats name.
|
boolean |
isAnyWorkerMetricAboveAverageUtilizationOrOperatingRange(Map<String,Double> workerMetricToFleetLevelAverage) |
boolean |
isAnyWorkerMetricFailing()
Returns true if any of the metric stat values has -1 in last index which represents that the metric stat value
was not successfully fetched in last attempt by worker.
|
boolean |
isExpired(Duration maxAge)
Determines whether this worker metrics entry is expired (i.e., the worker is no longer active).
|
boolean |
isStale(Duration staleCleanupThreshold)
Determines if this worker metric entry is stale and eligible for cleanup/deletion.
|
boolean |
isUsingDefaultWorkerMetric()
If a worker is not using an explicit WorkerMetric such as CPU, Memory, or Network, then it
is said to be using the default WorkerMetric.
|
boolean |
isValidWorkerMetric()
WorkerMetricStats entry is invalid
if any of the field from lastUpdateTime, operatingRange, resourcesStats are not present or
if resourcesStats is empty or
if any of the WorkerMetrics having resourceStats does not have operatingRange or
if operating range values are not present or
if maxUtilization is 0 for any WorkerMetric
|
boolean |
isWorkerMetricAboveOperatingRange(String workerMetricName)
Evaluates if the given metric stat is above operatingRange for the given WorkerMetric name.
|
void |
setEntityTypeDdbValue(String ddbValue)
DDB Enhanced Client accessor: deserializes entityType from the DDB value string.
|
boolean |
willAnyMetricStatsGoAboveAverageUtilizationOrOperatingRange(Map<String,Double> workerMetricsToFleetLevelAverageMap,
double averageThroughput,
double increaseThroughput,
double averageLeaseCount) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetEntityTypepublic static final String KEY_LAST_UPDATE_TIME
public static final String KEY_WORKER_ID
public static final String ENTITY_TYPE_ATTRIBUTE_NAME
public String getEntityTypeDdbValue()
EntityType.getDdbValue().public void setEntityTypeDdbValue(String ddbValue)
public boolean containsMetricStat(String workerMetricName)
public double getMetricStat(String workerMetricName)
public void extrapolateMetricStatValuesForAddedThroughput(Map<String,Double> workerMetricsToFleetLevelAverageMap, double averageThroughput, double increaseThroughput, double averageLeaseCount)
public boolean willAnyMetricStatsGoAboveAverageUtilizationOrOperatingRange(Map<String,Double> workerMetricsToFleetLevelAverageMap, double averageThroughput, double increaseThroughput, double averageLeaseCount)
public void extrapolateMetricStatValuesForAddedLease(Map<String,Double> workerMetricToFleetLevelAverage, int averageLeaseCount)
public double computePercentageToReachAverage(Map<String,Double> workerMetricToFleetLevelAverage)
workerMetricToFleetLevelAverage - : WorkerMetric to fleet level mean value.public boolean isAnyWorkerMetricFailing()
public boolean isValidWorkerMetric()
public boolean isAnyWorkerMetricAboveAverageUtilizationOrOperatingRange(Map<String,Double> workerMetricToFleetLevelAverage)
public boolean isUsingDefaultWorkerMetric()
public boolean isWorkerMetricAboveOperatingRange(String workerMetricName)
workerMetricName - WorkerMetric name to evaluatepublic boolean isExpired(Duration maxAge)
lastUpdateTime exceeds
the given maximum allowed age.
For example, if the max age is 2 * workerMetricsReporterFreqInMillis, then a worker
that hasn't updated in more than that duration is considered expired/dead.
maxAge - the maximum allowed age since lastUpdateTime. If the elapsed time since
lastUpdateTime exceeds this duration, the worker is considered expired.public boolean isStale(Duration staleCleanupThreshold)
A stale entry is one that hasn't been updated for longer than the
staleCleanupThreshold. Stale entries are typically much older than expired
entries — they represent workers that have been dead for a long time and whose entries
should be garbage-collected from the table.
staleCleanupThreshold - the maximum allowed age. If the elapsed time since
lastUpdateTime exceeds this duration, the entry is considered stale.Copyright © 2026. All rights reserved.