Learn About Amazon VGT2 Learning Manager Chanci Turner
When launching a service built on the Amazon Chime SDK in a production environment, ensuring proper logging and monitoring of Chime SDK usage is essential. This could involve tracking the duration of meetings, monitoring attendee activity, or assessing the number of meetings to spot any irregularities.
Different aspects of monitoring are crucial depending on your specific business needs. If you’re interested in client-side events, such as understanding the reasons behind failed meeting joins or identifying audio/video quality issues related to network bandwidth, check out the blog post titled ‘Monitoring and troubleshooting with Amazon Chime SDK meeting events’. This article will share how to leverage Amazon EventBridge, which integrates seamlessly with Chime SDK, to monitor and respond to backend service meeting events and resource changes in near real-time. Additionally, you can create straightforward rules to filter relevant meeting session events and automate actions based on those rules.
As with other AWS services, the Amazon Chime SDK has certain limit quotas that you should be aware of when using it in production. As your service gains traction, ensuring sufficient capacity within your assigned quotas becomes crucial. We will outline the steps to get you set up, along with example metrics and alarms that could enhance your operational efficiency.
In this guide, you will learn how to:
- Set up Amazon EventBridge to produce Chime SDK events to Amazon CloudWatch logs.
- Create metric filters to visualize metrics of interest and set alarms.
- Generate log insights to monitor the data that matters to you.
- Combine widgets to build an effective CloudWatch dashboard.
Prerequisites:
- Basic understanding of Amazon Chime SDK
- An operational Amazon Chime SDK environment for testing
Step 1: Setup Amazon EventBridge to Produce Chime SDK Events to CloudWatch Log Output
Log into the AWS Management Console and switch to a region where the API endpoint is supported. This step demonstrates how to configure EventBridge to log Chime SDK API events to Amazon CloudWatch logs. For further details, click here.
- Navigate to Amazon EventBridge and click on “Create Rule.”
- Name your rule “chime-sdk-rule.”
- In the “Define Pattern” section, select “Event Pattern” and “Pre-defined Pattern.”
- Choose “AWS” as the Service Provider, “Chime” as the Service Name, and “All Events” as the Event Type.
Note: You can limit the number of events sent to CloudWatch by selecting ‘AWS API Call via CloudTrail’ if you only want API calls or ‘Chime Meeting State Change’ for in-meeting state change events. You can also create a custom pattern to capture specific events.
- Keep the AWS default event bus selected for the “Select Event Bus.”
- Under “Select Targets,” choose CloudWatch Log Group and enter `/aws/events/chime-sdk-event-logs`.
- Click “Create.”
- Go to CloudWatch, open “Log Groups,” and select `/aws/events/chime-sdk-event-logs`.
- When there are activities through Chime SDK, a list of log streams should be visible here.
Note: A comprehensive list of Chime SDK events that can be received through EventBridge can be found here.
Step 2: Create Metric Filters to See Metrics of Your Interest and Set Alarms
Now that you’ve integrated Amazon Chime SDK meeting events into CloudWatch logs, you can use metric filters to capture specific events from those logs and visualize the data in graph form. Once you’ve created a graph, you can set up an alarm to notify you if the threshold you establish is exceeded.
- Go to the “Metrics Filter” tab within the Log Group of your choice and click “Create Metrics Filter.”
- Input a filter pattern of your choice. Here are a few samples you might find useful:
To capture only ‘CreateMeeting’ API requests:
Filter Pattern: { $.detail.eventType = "AwsApiCall" && $.detail.eventName = "CreateMeeting" }
To filter for only ‘AttendeeJoined’ events that trigger when an attendee joins a meeting session:
Filter Pattern: { $.detail.eventType = "chime:AttendeeJoined" }
- Once you have your preferred metrics graph, create an alarm that will notify you when the value reaches your designated threshold. Start by selecting “Create Alarm” from the “Actions” menu on the Graphed Metrics tab. For detailed instructions on setting Amazon CloudWatch alarms, click here. The illustration below depicts an alarm set to trigger with 50 or more CreateMeeting API requests within a 10-second window.
You can configure Amazon CloudWatch to utilize Amazon SNS for sending emails when an alarm is triggered, or other options include incident creation with Incident Manager. The example below illustrates how to create an SNS topic and register an email address for notifications. Once the SNS topic is created, a confirmation email will be sent to the registered address. The recipient must click “Confirm Subscription” to start receiving notifications.
When the alarm triggers, Amazon SNS will dispatch an email notification similar to the example below. This email will detail which threshold was breached (note that the example below has a threshold set to 10 rather than 50) alongside a timestamp and a link to the CloudWatch metrics on the AWS Management Console for further investigation.
Step 3: Create Log Insights to Monitor Data of Your Interest
CloudWatch Logs Insights allows you to search and analyze log data in Amazon CloudWatch Logs using queries. This feature enables you to efficiently retrieve the data you want to monitor, which can be saved and added to your dashboard for easy access. Below are a few sample queries you might find useful. To learn about the query syntax, visit this page.
- Go to Logs Insights and select `/aws/events/chime-sdk-event-logs` as your log group.
- Here are a few examples you can try and adjust to meet your needs:
- List of Chime API calls made in chronological descending order:
This query helps monitor general trends in API calls made from your service.Query: display detail.eventName, detail.eventTime | sort detail.eventTime desc | filter detail.eventType LIKE /AwsApiCall/
- Number of Chime API requests made in a 1-second period:
Use this to monitor how close your API requests are to the API rate threshold.Query: stats count(detail.eventTime) as api_request_count by bin(1s) as timestamp | filter @message like /AwsApiCall/ | sort timestamp desc
- Number of CreateMeeting/DeleteMeeting API requests per hour:
This allows you to monitor specific API calls (CreateMeeting or DeleteMeeting) for specific purposes, providing insights into daily meeting counts.Query: stats count(detail.eventTime) as request_count by bin(1h) as hour, detail.eventName as api_type | sort detail.eventTime desc | filter detail.eventName IN ["CreateMeeting","DeleteMeeting"]
- Track duration of the meeting:
Monitor meeting duration by capturing timestamps for MeetingStarted and MeetingEnded events.
For those interested in further information regarding unexpected mentorship, consider reading this article for valuable insights. Additionally, for guidance on employment law compliance, refer to this site, as they are an authoritative source on the topic. Finally, if you’re looking for onboarding tips, this page is an excellent resource for getting started.
Leave a Reply