Skip to content

Monitoring and alerting ​

This document outlines some of the Monitoring and Alerting standards within Luna.

Architecture ​

The follow represents how alerts are intended to be sent from the AWS resources to the relevant Slack Channels

monitoring-and-alerting-architecture

The following Miro diagram explains in more depth the architecture that describes how monitoring and alerting is intended to work.

Explanation ​

We will be taking a service / client based approach for monitoring and alerting - meaning each microservice will have its own monitoring and alerting.

Each environment has centralised SNS alert topics that all services publish to. These topics are subscribed to by AWS Chatbot and forward alerts to the corresponding Slack channels:

  • ${Environment}-critical-alerts → #env-critical-alerts
  • ${Environment}-error-alerts → #env-error-alerts
  • ${Environment}-warning-alerts → #env-warning-alerts

You can find these Slack channels in the Platform Slack Workspace - they are public.

Services do not need to create their own SNS topics for alarms. Instead, each alarm's AlarmActions should reference the appropriate centralised alert topic(s) directly.

Alerts levels ​

Currently there are three levels for alerts - and the alerts will therefore end up in either for the 3 slack channels. These levels are:

  • Critical
  • Error
  • Warning

Explanation of levels ​

This is what we want to mean by each level:

  • Critical level is when there is an alert that requires immediate attention and investigation as soon as possible. This alert likely blocks critical business functionality that affects invoicing, engagements, actuals.

For example - 5xx or errors in the invoices commands function - invoices can't be created or updated is critical. Or engagements streams errors / timeouts indicates data won't be getting to important reports which is critical

  • Error level is when there is an alert that will require investigation but it is not business critical and users can retry or wait for a fix. This alert is something that should be investigated when possible, but doesn't require immediate eyes or investigation.

For example - errors in the skills commands function - users cannot create skills or perspectives is an error but it is not critical - users can wait for a fix or try again later.

  • Warning level is when there is an alert where action might be taken. The warning alert might provide some useful information that an error may happen in the future without action. Depending on the frequency or alarm action may or may not be taken

For example - lambda memory reaching 95% utilisation - there lambda still runs, there are no errors - but we may taken an action soon to increase that lambdas memory or we might, after investigation, realise that the lambda is sufficently provisioned and we wont have an increase in memory consuption given our data size growth and processing requirements.

SLAs ​

Each level of alert has a Service Level Agreement associated with it.

  • Critical - immediate action (ASAP)
  • Error - action within 48 hours
  • Warning action within a week

Action should start with investigation and then can proceed into ticket creation or bug fixing.

Responding to an Alert ​

The individual on support should be responding to alerts on these channels - but of course these are open to everyone to join and response to. Since each environment has it's own alerts channels. There are two main sets of channels that need to be responsed to for alerts. These are as follows

Staging:

  • #staging-critical-alerts
  • #staging-error-alerts
  • #staging-warning-alerts

Production:

  • #production-critical-alerts
  • #production-error-alerts
  • #production-warning-alerts

Production ​

Alerts on production are the more important alerts to respond to - as they come from the production environment. Follow this process for responding to them:

  1. Mark the alarm / alert with the 👀 emoji to indicate you're looking into it
  2. Investigate the cause of this alert - looking in the logs is a good start
  3. Post findings in the thread of that alert
  4. If you believe there is an issue that needs to be resolved, create a alert bug ticket (please use this ticket template) - check in with POs to verify this issue and then this ticket can be classified with an appropriate priority level and picked up.
  5. Post ticket number or the resolution of the alarm
    1. e.g. PLRS-XXX has been created, it's a P1 and will be picked up ASAP
    2. e.g. This is a false positive - incorrect logging is in this service - have removed the log line
    3. e.g. This is a false positives - alarms thresholds are incorrect for what is happening
    4. e.g. Message has been replayed and has been processed correctly
  6. Once the alarm / alert has been responded to mark the alarm message with a ✅ to indicate it is resolved

Staging ​

Alerts on staging require less response time - but could be useful in seeing if something is wrong before it goes to production. You should following this process:

  1. Mark the alarm / alert with the 👀 emoji to indicate you're looking into it
  2. Investigate the cause of this alert - looking in the logs is a good start
  3. Investigate if this alarm is also going off in production - if it is - response there instead
    1. Post findings that this is also happening in production
  4. If this alarm is not going off in production
    1. Investigate if someone is testing something in a non-conventional way
    2. Check if anything has been deployed to staging recently that could have caused this and inform the author of the MR that this alarm has happened so they can look into it
    3. Determine if this is caused by bad data - if this happens frequently enough - a datacopyback could fix it
  5. Once the alarm / alert has been responded to mark the alarm message with a ✅ to indicate it is resolved

Alerts ​

Every alert will originate from a CloudWatch metric. These are provided for us from AWS or can be created ourselves as custom metrics or metric filters. From a metric, an alarm can be created and configured. The alarm will trigger an SNS message to indicate when the alarm is in "alarmed" state. These SNS topics for these messages will be subscribed via the AWS Chatbot configuration - and this will enable them to be sent to our slack channels.

Monitoring ​

Each service will have a dashboard to monitor its performance, errors, and the health of the service. There will likely be similar metrics we want to monitor for each service. These are:

  • Lambda Memory Utilisation
  • Performance (lambda durations)
  • Error / Success rate
  • Lambda invocations and throttles

Other metrics we may want to monitor will be service specific - e.g. DLQ count or Stream performance. (not all services have these so set these up as required)

Naming Conventions ​

The following naming conventions should apply to monitoring and alerting

Metrics ​

Metrics should have the following naming convention:

ENV-SERVICE-RESOURCE-METRIC

Where:

  • ENV - is the environment e.g. staging
  • SERVICE - is the name of the service this is for e.g. invoices
  • RESOURCE - is the AWS resource within the service the metric is for e.g. querier-function
  • METRIC - is the name of the metric e.g. errorlogcount

GOOD:

  • production-invoices-querier-function-errorlogcount
  • staging-engagements-subscriber-timeoutcount

BAD:

  • production-invoices-errors
  • staging-contacts-queue-timeout-metric

Alarms ​

Alarms should have the following naming convention

METRIC_NAME-alarm

Where:

  • METRIC_NAME - is the naming convention for the metric

Therefore this becomes:

ENV-SERVICE-RESOURCE-METRIC-alarm

GOOD:

  • production-invoices-querier-function-errorlogcount-alarm
  • production-invoices-querier-function-duration-alarm

BAD:

  • production-invoices-querier-function-errorlogcount-alert
  • production-invoices-querier-alarm

Alert Topics ​

Alert topics are centralised per environment and shared across all services. You do not need to create per-alarm topics. The centralised topics follow this naming convention:

ENV-LEVEL-alerts

Where:

  • ENV - is the environment e.g. staging, production
  • LEVEL - is the alert level: critical, error, or warning

The centralised topics are:

  • ${Environment}-critical-alerts
  • ${Environment}-error-alerts
  • ${Environment}-warning-alerts

These are defined in the alerts infrastructure stack and should be referenced directly in your alarm's AlarmActions.

Dashboards ​

Dashboards produced should have the following naming conventions:

SERVICE-service...XXX--dashboard

Where:

  • SERVICE - is the service name
  • ...XXX - is an optional addition describing a specific for that servuce

ENV is missing here This is because dashboards will only be on each AWS account

GOOD:

  • invoices-service-dashboard
  • invoices-service-performance-dashboard

BAD:

  • invoices
  • lambda-dashboard
  • invoices-engagements-async-service

Examples / Guides ​

To get started setting up alerts following the Setting up Alerting on a Service guide

Made with ❤️ by the Luna team