# stacks/container-apps/augury-alarms.yml
AWSTemplateFormatVersion: "2010-09-09"
Description: Augury alarms
Parameters:
  OpsWarnMessagesSnsTopicArn:
    Type: String
  OpsErrorMessagesSnsTopicArn:
    Type: String
  OpsFatalMessagesSnsTopicArn:
    Type: String
  EnvironmentType:
    Type: String
  EnvironmentTypeAbbreviation:
    Type: String
  AuguryWorkerLogGroupName:
    Type: String
Resources:
  AuguryActualsIngestJobInvocationMetric:
    Type: "AWS::Logs::MetricFilter"
    Properties:
      FilterPattern: '[ImpressionsFetchJob] Success'
      LogGroupName: !Ref AuguryWorkerLogGroupName
      MetricTransformations:
        - MetricName: !Sub "AuguryActualsRollupsCount${EnvironmentTypeAbbreviation}"
          MetricNamespace: PRX/Augury
          MetricValue: "1"
  AuguryActualsAreBehindAlarm:
    Type: "AWS::CloudWatch::Alarm"
    Properties:
      ActionsEnabled: true
      AlarmName: !Sub "[Augury][Worker][ActiveJob] ${EnvironmentType} Augury actuals are behind"
      AlarmActions:
        - !Ref OpsErrorMessagesSnsTopicArn
      InsufficientDataActions:
        - !Ref OpsErrorMessagesSnsTopicArn
      OKActions:
        - !Ref OpsErrorMessagesSnsTopicArn
      AlarmDescription: Augury actuals are behind
      ComparisonOperator: LessThanThreshold
      EvaluationPeriods: 3
      MetricName: ActualsIngestJobInvocationMetric
      Namespace: AWS/ECS
      Period: 300
      Statistic: Sum
      Threshold: 1
      TreatMissingData: breaching

# stacks/container-apps/augury-alarms.yml
AWSTemplateFormatVersion: "2010-09-09"
Description: Augury alarms
Parameters:
  OpsWarnMessagesSnsTopicArn:
    Type: String
  OpsErrorMessagesSnsTopicArn:
    Type: String
  OpsFatalMessagesSnsTopicArn:
    Type: String
  EnvironmentType:
    Type: String
  EnvironmentTypeAbbreviation:
    Type: String
  AuguryWorkerLogGroupName:
    Type: String
Resources:
  ActualsIngestJobInvocationMetricFilter:
    Type: "AWS::Logs::MetricFilter"
    Properties:
      FilterPattern: '[ImpressionsFetchJob] Success'
      LogGroupName: !Ref AuguryWorkerLogGroupName
      MetricTransformations:
        - MetricName: !Sub "ActualsIngestJobInvocationCount${EnvironmentTypeAbbreviation}"
          MetricNamespace: PRX/Augury
          MetricValue: "1"
  AuguryActualsAreBehindAlarm:
    Type: "AWS::CloudWatch::Alarm"
    Properties:
      ActionsEnabled: true
      AlarmName: !Sub "[Augury][Worker][ActiveJob] ${EnvironmentType} Augury actuals are behind"
      AlarmActions:
        - !Ref OpsErrorMessagesSnsTopicArn
      InsufficientDataActions:
        - !Ref OpsErrorMessagesSnsTopicArn
      OKActions:
        - !Ref OpsErrorMessagesSnsTopicArn
      AlarmDescription: Augury actuals are behind
      ComparisonOperator: LessThanThreshold
      EvaluationPeriods: 3
      MetricName: !Sub "ActualsIngestJobInvocationCount${EnvironmentTypeAbbreviation}"
      Namespace: AWS/ECS
      Period: 300
      Statistic: Sum
      Threshold: 1
      TreatMissingData: breaching

Rename and match the metrics name
Rename and match the metrics name
