MetricTrigger Class

The trigger that results in a scaling action.

All required parameters must be populated in order to send to server.

Constructor

MetricTrigger(*, metric_name: str, metric_resource_uri: str, time_grain: timedelta, statistic: str | _models.MetricStatisticType, time_window: timedelta, time_aggregation: str | _models.TimeAggregationType, operator: str | _models.ComparisonOperationType, threshold: float, metric_namespace: str | None = None, metric_resource_location: str | None = None, dimensions: List[_models.ScaleRuleMetricDimension] | None = None, divide_per_instance: bool | None = None, **kwargs: Any)

Keyword-Only Parameters

Name Description
metric_name
str

the name of the metric that defines what the rule monitors. Required.

metric_namespace
str

the namespace of the metric that defines what the rule monitors.

Default value: None
metric_resource_uri
str

the resource identifier of the resource the rule monitors. Required.

metric_resource_location
str

the location of the resource the rule monitors.

Default value: None
time_grain

the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute. Required.

statistic

the metric statistic type. How the metrics from multiple instances are combined. Required. Known values are: "Average", "Min", "Max", "Sum", and "Count".

time_window

the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes. Required.

time_aggregation

time aggregation type. How the data that is collected should be combined over time. The default value is Average. Required. Known values are: "Average", "Minimum", "Maximum", "Total", "Count", and "Last".

operator

the operator that is used to compare the metric data and the threshold. Required. Known values are: "Equals", "NotEquals", "GreaterThan", "GreaterThanOrEqual", "LessThan", and "LessThanOrEqual".

threshold

the threshold of the metric that triggers the scale action. Required.

dimensions

List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}].

Default value: None
divide_per_instance

a value indicating whether metric should divide per instance.

Default value: None

Variables

Name Description
metric_name
str

the name of the metric that defines what the rule monitors. Required.

metric_namespace
str

the namespace of the metric that defines what the rule monitors.

metric_resource_uri
str

the resource identifier of the resource the rule monitors. Required.

metric_resource_location
str

the location of the resource the rule monitors.

time_grain

the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute. Required.

statistic

the metric statistic type. How the metrics from multiple instances are combined. Required. Known values are: "Average", "Min", "Max", "Sum", and "Count".

time_window

the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes. Required.

time_aggregation

time aggregation type. How the data that is collected should be combined over time. The default value is Average. Required. Known values are: "Average", "Minimum", "Maximum", "Total", "Count", and "Last".

operator

the operator that is used to compare the metric data and the threshold. Required. Known values are: "Equals", "NotEquals", "GreaterThan", "GreaterThanOrEqual", "LessThan", and "LessThanOrEqual".

threshold

the threshold of the metric that triggers the scale action. Required.

dimensions

List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}].

divide_per_instance

a value indicating whether metric should divide per instance.