Skip to content
v2.277.0

Statistic Enum ​

Statistic to use over the aggregation period.

Example ​

ts
declare const matchmakingRuleSet: gamelift.MatchmakingRuleSet;
// Alarm that triggers when the per-second average of not placed matches exceed 10%
const ruleEvaluationRatio = new cloudwatch.MathExpression({
  expression: '1 - (ruleEvaluationsPassed / ruleEvaluationsFailed)',
  usingMetrics: {
    ruleEvaluationsPassed: matchmakingRuleSet.metricRuleEvaluationsPassed({ statistic: cloudwatch.Statistic.SUM }),
    ruleEvaluationsFailed: matchmakingRuleSet.metric('ruleEvaluationsFailed'),
  },
});
new cloudwatch.Alarm(this, 'Alarm', {
  metric: ruleEvaluationRatio,
  threshold: 0.1,
  evaluationPeriods: 3,
});
python
# matchmaking_rule_set: gamelift.MatchmakingRuleSet

# Alarm that triggers when the per-second average of not placed matches exceed 10%
rule_evaluation_ratio = cloudwatch.MathExpression(
    expression="1 - (ruleEvaluationsPassed / ruleEvaluationsFailed)",
    using_metrics={
        "rule_evaluations_passed": matchmaking_rule_set.metric_rule_evaluations_passed(statistic=cloudwatch.Statistic.SUM),
        "rule_evaluations_failed": matchmaking_rule_set.metric("ruleEvaluationsFailed")
    }
)
cloudwatch.Alarm(self, "Alarm",
    metric=rule_evaluation_ratio,
    threshold=0.1,
    evaluation_periods=3
)
java
MatchmakingRuleSet matchmakingRuleSet;

// Alarm that triggers when the per-second average of not placed matches exceed 10%
MathExpression ruleEvaluationRatio = MathExpression.Builder.create()
        .expression("1 - (ruleEvaluationsPassed / ruleEvaluationsFailed)")
        .usingMetrics(Map.of(
                "ruleEvaluationsPassed", matchmakingRuleSet.metricRuleEvaluationsPassed(MetricOptions.builder().statistic(Statistic.SUM).build()),
                "ruleEvaluationsFailed", matchmakingRuleSet.metric("ruleEvaluationsFailed")))
        .build();
Alarm.Builder.create(this, "Alarm")
        .metric(ruleEvaluationRatio)
        .threshold(0.1)
        .evaluationPeriods(3)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
MatchmakingRuleSet matchmakingRuleSet;

// Alarm that triggers when the per-second average of not placed matches exceed 10%
var ruleEvaluationRatio = new MathExpression(new MathExpressionProps {
    Expression = "1 - (ruleEvaluationsPassed / ruleEvaluationsFailed)",
    UsingMetrics = new Dictionary<string, IMetric> {
        { "ruleEvaluationsPassed", matchmakingRuleSet.MetricRuleEvaluationsPassed(new MetricOptions { Statistic = Statistic.SUM }) },
        { "ruleEvaluationsFailed", matchmakingRuleSet.Metric("ruleEvaluationsFailed") }
    }
});
new Alarm(this, "Alarm", new AlarmProps {
    Metric = ruleEvaluationRatio,
    Threshold = 0.1,
    EvaluationPeriods = 3
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var matchmakingRuleSet MatchmakingRuleSet

// Alarm that triggers when the per-second average of not placed matches exceed 10%
ruleEvaluationRatio := cloudwatch.NewMathExpression(&MathExpressionProps{
	Expression: jsii.String("1 - (ruleEvaluationsPassed / ruleEvaluationsFailed)"),
	UsingMetrics: map[string]IMetric{
		"ruleEvaluationsPassed": matchmakingRuleSet.metricRuleEvaluationsPassed(&MetricOptions{
			"statistic": cloudwatch.Statistic_SUM,
		}),
		"ruleEvaluationsFailed": matchmakingRuleSet.metric(jsii.String("ruleEvaluationsFailed")),
	},
})
cloudwatch.NewAlarm(this, jsii.String("Alarm"), &AlarmProps{
	Metric: ruleEvaluationRatio,
	Threshold: jsii.Number(0.1),
	EvaluationPeriods: jsii.Number(3),
})

Members ​

MemberDescription
SAMPLE_COUNTThe count (number) of data points used for the statistical calculation.
AVERAGEThe value of Sum / SampleCount during the specified period.
SUMAll values submitted for the matching metric added together.
MINIMUMThe lowest value observed during the specified period.
MAXIMUMThe highest value observed during the specified period.