Class Metric

  • All Implemented Interfaces:
    software.amazon.jsii.JsiiSerializable

    @Generated(value="jsii-pacmak/1.72.0 (build 4b8828b)",
               date="2022-12-10T02:31:41.450Z")
    @Stability(Stable)
    public class Metric
    extends software.amazon.jsii.JsiiObject
    A metric condition that HorizontalPodAutoscaler's scale on.
    • Constructor Detail

      • Metric

        protected Metric​(software.amazon.jsii.JsiiObjectRef objRef)
      • Metric

        protected Metric​(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • Method Detail

      • containerCpu

        @Stability(Stable)
        @NotNull
        public static Metric containerCpu​(@NotNull
                                          MetricContainerResourceOptions options)
        Metric that tracks the CPU of a container.

        This metric will be tracked across all pods of the current scale target.

        Parameters:
        options - This parameter is required.
      • containerEphemeralStorage

        @Stability(Stable)
        @NotNull
        public static Metric containerEphemeralStorage​(@NotNull
                                                       MetricContainerResourceOptions options)
        Metric that tracks the local ephemeral storage of a container.

        This metric will be tracked across all pods of the current scale target.

        Parameters:
        options - This parameter is required.
      • containerMemory

        @Stability(Stable)
        @NotNull
        public static Metric containerMemory​(@NotNull
                                             MetricContainerResourceOptions options)
        Metric that tracks the Memory of a container.

        This metric will be tracked across all pods of the current scale target.

        Parameters:
        options - This parameter is required.
      • containerStorage

        @Stability(Stable)
        @NotNull
        public static Metric containerStorage​(@NotNull
                                              MetricContainerResourceOptions options)
        Metric that tracks the volume size of a container.

        This metric will be tracked across all pods of the current scale target.

        Parameters:
        options - This parameter is required.
      • external

        @Stability(Stable)
        @NotNull
        public static Metric external​(@NotNull
                                      MetricOptions options)
        A global metric that is not associated with any Kubernetes object.

        Allows for autoscaling based on information coming from components running outside of the cluster.

        Use case:

        • Scale up when the length of an SQS queue is greater than 10 messages.
        • Scale down when an outside load balancer's queries are less than 10000 per second.

        Parameters:
        options - This parameter is required.
      • object

        @Stability(Stable)
        @NotNull
        public static Metric object​(@NotNull
                                    MetricObjectOptions options)
        Metric that describes a metric of a kubernetes object.

        Use case:

        • Scale on a Kubernetes Ingress's hits-per-second metric.

        Parameters:
        options - This parameter is required.
      • pods

        @Stability(Stable)
        @NotNull
        public static Metric pods​(@NotNull
                                  MetricOptions options)
        A pod metric that will be averaged across all pods of the current scale target.

        Use case:

        • Average CPU utilization across all pods
        • Transactions processed per second across all pods

        Parameters:
        options - This parameter is required.
      • resourceCpu

        @Stability(Stable)
        @NotNull
        public static Metric resourceCpu​(@NotNull
                                         MetricTarget target)
        Tracks the available CPU of the pods in a target.

        Note: Since the resource usages of all the containers are summed up the total pod utilization may not accurately represent the individual container resource usage. This could lead to situations where a single container might be running with high usage and the HPA will not scale out because the overall pod usage is still within acceptable limits.

        Use case:

        • Scale up when CPU is above 40%.

        Parameters:
        target - This parameter is required.
      • resourceEphemeralStorage

        @Stability(Stable)
        @NotNull
        public static Metric resourceEphemeralStorage​(@NotNull
                                                      MetricTarget target)
        Tracks the available Ephemeral Storage of the pods in a target.

        Note: Since the resource usages of all the containers are summed up the total pod utilization may not accurately represent the individual container resource usage. This could lead to situations where a single container might be running with high usage and the HPA will not scale out because the overall pod usage is still within acceptable limits.

        Parameters:
        target - This parameter is required.
      • resourceMemory

        @Stability(Stable)
        @NotNull
        public static Metric resourceMemory​(@NotNull
                                            MetricTarget target)
        Tracks the available Memory of the pods in a target.

        Note: Since the resource usages of all the containers are summed up the total pod utilization may not accurately represent the individual container resource usage. This could lead to situations where a single container might be running with high usage and the HPA will not scale out because the overall pod usage is still within acceptable limits.

        Use case:

        • Scale up when Memory is above 512MB.

        Parameters:
        target - This parameter is required.
      • resourceStorage

        @Stability(Stable)
        @NotNull
        public static Metric resourceStorage​(@NotNull
                                             MetricTarget target)
        Tracks the available Storage of the pods in a target.

        Note: Since the resource usages of all the containers are summed up the total pod utilization may not accurately represent the individual container resource usage. This could lead to situations where a single container might be running with high usage and the HPA will not scale out because the overall pod usage is still within acceptable limits.

        Parameters:
        target - This parameter is required.
      • getType

        @Stability(Stable)
        @NotNull
        public String getType()