Class NodeLabelStats

java.lang.Object
io.jenkins.plugins.smartexecutorloadbalancer.NodeLabelStats
All Implemented Interfaces:
Serializable

public final class NodeLabelStats extends Object implements Serializable
Ring-buffer of recent build records for one (nodeName, labelExpression) combination. The buffer size is controlled by SmartLBConfig.getFailureThreshold() and is applied each time a record is added.

Thread-safety: all mutating methods are synchronized. Read-only accessors snapshot the list to avoid holding the lock.

See Also:
  • Constructor Details

    • NodeLabelStats

      public NodeLabelStats(String nodeName, String label)
  • Method Details

    • addRecord

      public void addRecord(BuildRecord record, int maxSize)
    • getNodeName

      public String getNodeName()
    • getLabel

      public String getLabel()
    • getRecords

      public List<BuildRecord> getRecords()
    • getNodeFaultCount

      public int getNodeFaultCount()
    • getNodeFaultCountInWindow

      public int getNodeFaultCountInWindow(int threshold)
      Count of node faults in the most recent threshold records.
    • isSuppressedForScheduling

      public boolean isSuppressedForScheduling(int threshold)
      True when the most recent threshold records are all node faults. Only looks at the newest threshold entries so that changing the threshold does not require flushing old history from the buffer.
    • failurePenalty

      public int failurePenalty()
      Penalty score contribution from failure history.