Package cloud.spawnery.agent.api
Record Class ResourceUsage
java.lang.Object
java.lang.Record
cloud.spawnery.agent.api.ResourceUsage
public record ResourceUsage(long cpuUsedMillicores, long cpuRequestedMillicores, long cpuLimitMillicores, boolean cpuUnlimited, long memoryUsedBytes, long memoryRequestedBytes, long memoryLimitBytes, boolean memoryUnlimited, int pods, int podsMeasured)
extends Record
What a set of pods uses right now, and what they asked for. CPU in
millicores, memory in bytes. The used figures cover
podsMeasured
of pods; a pod the metrics API has no sample for is left out
rather than counted as idle.
cpuUnlimited (and memoryUnlimited) means some container
has no limit, so the limit figure is a floor.
-
Constructor Summary
ConstructorsConstructorDescriptionResourceUsage(long cpuUsedMillicores, long cpuRequestedMillicores, long cpuLimitMillicores, boolean cpuUnlimited, long memoryUsedBytes, long memoryRequestedBytes, long memoryLimitBytes, boolean memoryUnlimited, int pods, int podsMeasured) Creates an instance of aResourceUsagerecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleancomplete()Whether every pod in the set was measured.longReturns the value of thecpuLimitMillicoresrecord component.longReturns the value of thecpuRequestedMillicoresrecord component.booleanReturns the value of thecpuUnlimitedrecord component.longReturns the value of thecpuUsedMillicoresrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanmeasured()Whether any pod in the set was measured.longReturns the value of thememoryLimitBytesrecord component.longReturns the value of thememoryRequestedBytesrecord component.booleanReturns the value of thememoryUnlimitedrecord component.longReturns the value of thememoryUsedBytesrecord component.intpods()Returns the value of thepodsrecord component.intReturns the value of thepodsMeasuredrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ResourceUsage
public ResourceUsage(long cpuUsedMillicores, long cpuRequestedMillicores, long cpuLimitMillicores, boolean cpuUnlimited, long memoryUsedBytes, long memoryRequestedBytes, long memoryLimitBytes, boolean memoryUnlimited, int pods, int podsMeasured) Creates an instance of aResourceUsagerecord class.- Parameters:
cpuUsedMillicores- the value for thecpuUsedMillicoresrecord componentcpuRequestedMillicores- the value for thecpuRequestedMillicoresrecord componentcpuLimitMillicores- the value for thecpuLimitMillicoresrecord componentcpuUnlimited- the value for thecpuUnlimitedrecord componentmemoryUsedBytes- the value for thememoryUsedBytesrecord componentmemoryRequestedBytes- the value for thememoryRequestedBytesrecord componentmemoryLimitBytes- the value for thememoryLimitBytesrecord componentmemoryUnlimited- the value for thememoryUnlimitedrecord componentpods- the value for thepodsrecord componentpodsMeasured- the value for thepodsMeasuredrecord component
-
-
Method Details
-
measured
public boolean measured()Whether any pod in the set was measured. -
complete
public boolean complete()Whether every pod in the set was measured. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
cpuUsedMillicores
public long cpuUsedMillicores()Returns the value of thecpuUsedMillicoresrecord component.- Returns:
- the value of the
cpuUsedMillicoresrecord component
-
cpuRequestedMillicores
public long cpuRequestedMillicores()Returns the value of thecpuRequestedMillicoresrecord component.- Returns:
- the value of the
cpuRequestedMillicoresrecord component
-
cpuLimitMillicores
public long cpuLimitMillicores()Returns the value of thecpuLimitMillicoresrecord component.- Returns:
- the value of the
cpuLimitMillicoresrecord component
-
cpuUnlimited
public boolean cpuUnlimited()Returns the value of thecpuUnlimitedrecord component.- Returns:
- the value of the
cpuUnlimitedrecord component
-
memoryUsedBytes
public long memoryUsedBytes()Returns the value of thememoryUsedBytesrecord component.- Returns:
- the value of the
memoryUsedBytesrecord component
-
memoryRequestedBytes
public long memoryRequestedBytes()Returns the value of thememoryRequestedBytesrecord component.- Returns:
- the value of the
memoryRequestedBytesrecord component
-
memoryLimitBytes
public long memoryLimitBytes()Returns the value of thememoryLimitBytesrecord component.- Returns:
- the value of the
memoryLimitBytesrecord component
-
memoryUnlimited
public boolean memoryUnlimited()Returns the value of thememoryUnlimitedrecord component.- Returns:
- the value of the
memoryUnlimitedrecord component
-
pods
public int pods()Returns the value of thepodsrecord component.- Returns:
- the value of the
podsrecord component
-
podsMeasured
public int podsMeasured()Returns the value of thepodsMeasuredrecord component.- Returns:
- the value of the
podsMeasuredrecord component
-