Skip to main content

AutoscalingPolicyCustomMetricUtilization

Struct AutoscalingPolicyCustomMetricUtilization 

Source
#[non_exhaustive]
pub struct AutoscalingPolicyCustomMetricUtilization { pub filter: Option<String>, pub metric: Option<String>, pub single_instance_assignment: Option<f64>, pub utilization_target: Option<f64>, pub utilization_target_type: Option<UtilizationTargetType>, /* private fields */ }
Available on crate features autoscalers or region-autoscalers only.
Expand description

Custom utilization metric policy.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§filter: Option<String>

A filter string, compatible with a Stackdriver Monitoringfilter string forTimeSeries.list API call. This filter is used to select a specific TimeSeries for the purpose of autoscaling and to determine whether the metric is exporting per-instance or per-group data.

For the filter to be valid for autoscaling purposes, the following rules apply:

- You can only use the AND operator for joining
   selectors.
- You can only use direct equality comparison operator
   (=) without any functions for each selector.
- You can specify the metric in both the filter string and in the
   metric field. However, if specified in both places, the metric must
   be identical.
- The monitored resource type
   determines what kind of values are expected for the metric. If it is
   a gce_instance, the autoscaler expects the metric to
   include a separate TimeSeries for each instance in a group. In such a
   case, you cannot filter on resource labels.

If the resource type is any other value, the autoscaler expects this metric to contain values that apply to the entire autoscaled instance group and resource label filtering can be performed to point autoscaler at the correct TimeSeries to scale upon. This is called a per-group metric for the purpose of autoscaling.

   If not specified, the type defaults to
   gce_instance.

Try to provide a filter that is selective enough to pick just one TimeSeries for the autoscaled group or for each of the instances (if you are using gce_instance resource type). If multiple TimeSeries are returned upon the query execution, the autoscaler will sum their respective values to obtain its scaling value.

§metric: Option<String>

The identifier (type) of the Stackdriver Monitoring metric. The metric cannot have negative values.

The metric must have a value type of INT64 orDOUBLE.

§single_instance_assignment: Option<f64>

If scaling is based on a per-group metric value that represents the total amount of work to be done or resource usage, set this value to an amount assigned for a single instance of the scaled group. Autoscaler keeps the number of instances proportional to the value of this metric. The metric itself does not change value due to group resizing.

A good metric to use with the target is for examplepubsub.googleapis.com/subscription/num_undelivered_messages or a custom metric exporting the total number of requests coming to your instances.

A bad example would be a metric exporting an average or median latency, since this value can’t include a chunk assignable to a single instance, it could be better used with utilization_target instead.

§utilization_target: Option<f64>

The target value of the metric that autoscaler maintains. This must be a positive value. A utilization metric scales number of virtual machines handling requests to increase or decrease proportionally to the metric.

For example, a good metric to use as a utilization_target ishttps://www.googleapis.com/compute/v1/instance/network/received_bytes_count. The autoscaler works to keep this value constant for each of the instances.

§utilization_target_type: Option<UtilizationTargetType>

Defines how target utilization value is expressed for a Stackdriver Monitoring metric. Either GAUGE,DELTA_PER_SECOND, or DELTA_PER_MINUTE.

Implementations§

Source§

impl AutoscalingPolicyCustomMetricUtilization

Source

pub fn new() -> Self

Source

pub fn set_filter<T>(self, v: T) -> Self
where T: Into<String>,

Sets the value of filter.

§Example
let x = AutoscalingPolicyCustomMetricUtilization::new().set_filter("example");
Source

pub fn set_or_clear_filter<T>(self, v: Option<T>) -> Self
where T: Into<String>,

Sets or clears the value of filter.

§Example
let x = AutoscalingPolicyCustomMetricUtilization::new().set_or_clear_filter(Some("example"));
let x = AutoscalingPolicyCustomMetricUtilization::new().set_or_clear_filter(None::<String>);
Source

pub fn set_metric<T>(self, v: T) -> Self
where T: Into<String>,

Sets the value of metric.

§Example
let x = AutoscalingPolicyCustomMetricUtilization::new().set_metric("example");
Source

pub fn set_or_clear_metric<T>(self, v: Option<T>) -> Self
where T: Into<String>,

Sets or clears the value of metric.

§Example
let x = AutoscalingPolicyCustomMetricUtilization::new().set_or_clear_metric(Some("example"));
let x = AutoscalingPolicyCustomMetricUtilization::new().set_or_clear_metric(None::<String>);
Source

pub fn set_single_instance_assignment<T>(self, v: T) -> Self
where T: Into<f64>,

Sets the value of single_instance_assignment.

§Example
let x = AutoscalingPolicyCustomMetricUtilization::new().set_single_instance_assignment(42.0);
Source

pub fn set_or_clear_single_instance_assignment<T>(self, v: Option<T>) -> Self
where T: Into<f64>,

Sets or clears the value of single_instance_assignment.

§Example
let x = AutoscalingPolicyCustomMetricUtilization::new().set_or_clear_single_instance_assignment(Some(42.0));
let x = AutoscalingPolicyCustomMetricUtilization::new().set_or_clear_single_instance_assignment(None::<f32>);
Source

pub fn set_utilization_target<T>(self, v: T) -> Self
where T: Into<f64>,

Sets the value of utilization_target.

§Example
let x = AutoscalingPolicyCustomMetricUtilization::new().set_utilization_target(42.0);
Source

pub fn set_or_clear_utilization_target<T>(self, v: Option<T>) -> Self
where T: Into<f64>,

Sets or clears the value of utilization_target.

§Example
let x = AutoscalingPolicyCustomMetricUtilization::new().set_or_clear_utilization_target(Some(42.0));
let x = AutoscalingPolicyCustomMetricUtilization::new().set_or_clear_utilization_target(None::<f32>);
Source

pub fn set_utilization_target_type<T>(self, v: T) -> Self

Sets the value of utilization_target_type.

§Example
use google_cloud_compute_v1::model::autoscaling_policy_custom_metric_utilization::UtilizationTargetType;
let x0 = AutoscalingPolicyCustomMetricUtilization::new().set_utilization_target_type(UtilizationTargetType::DeltaPerSecond);
let x1 = AutoscalingPolicyCustomMetricUtilization::new().set_utilization_target_type(UtilizationTargetType::Gauge);
Source

pub fn set_or_clear_utilization_target_type<T>(self, v: Option<T>) -> Self

Sets or clears the value of utilization_target_type.

§Example
use google_cloud_compute_v1::model::autoscaling_policy_custom_metric_utilization::UtilizationTargetType;
let x0 = AutoscalingPolicyCustomMetricUtilization::new().set_or_clear_utilization_target_type(Some(UtilizationTargetType::DeltaPerSecond));
let x1 = AutoscalingPolicyCustomMetricUtilization::new().set_or_clear_utilization_target_type(Some(UtilizationTargetType::Gauge));
let x_none = AutoscalingPolicyCustomMetricUtilization::new().set_or_clear_utilization_target_type(None::<UtilizationTargetType>);

Trait Implementations§

Source§

impl Clone for AutoscalingPolicyCustomMetricUtilization

Source§

fn clone(&self) -> AutoscalingPolicyCustomMetricUtilization

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AutoscalingPolicyCustomMetricUtilization

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AutoscalingPolicyCustomMetricUtilization

Source§

fn default() -> AutoscalingPolicyCustomMetricUtilization

Returns the “default value” for a type. Read more
Source§

impl Message for AutoscalingPolicyCustomMetricUtilization

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for AutoscalingPolicyCustomMetricUtilization

Source§

fn eq(&self, other: &AutoscalingPolicyCustomMetricUtilization) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for AutoscalingPolicyCustomMetricUtilization

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,