

# Monitoring Amazon Q Business and Amazon Q Apps with Amazon CloudWatch
<a name="monitoring-cloudwatch"></a>

You can monitor Amazon Q Business and Amazon Q Apps with Amazon CloudWatch, which collects raw data and processes it into readable, near real-time metrics. These statistics are kept for 15 months, so that you can access historical information and gain a better perspective on how your web application or service is performing. You can also set alarms that watch for certain thresholds, and send notifications or take actions when those thresholds are met. For more information, see the [Amazon CloudWatch User Guide](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/).

**Topics**
+ [Using CloudWatch Metrics](#using-metrics)
+ [Viewing metrics](#how-to-access)
+ [Creating a CloudWatch alarm](alarms.md)
+ [Amazon Q Business chat metrics](qbusiness-metrics-chat.md)
+ [Amazon Q Business API operation metrics](qbusiness-metrics-api.md)
+ [Amazon Q Business index metrics](qbusiness-metrics-index.md)
+ [Amazon Q Apps metrics](qapps-metrics.md)

## Using CloudWatch Metrics
<a name="using-metrics"></a>

To use metrics, you must specify the following information:
+ The metric namespace. A *namespace* is a CloudWatch container Amazon Q uses to publish its metrics into. If you are using the CloudWatch [ListMetrics](https://docs.aws.amazon.com//AmazonCloudWatch/latest/APIReference/API_ListMetrics.html) API or the [list-metrics](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudwatch/list-metrics.html) command to view the metrics for Amazon Q Business or Amazon Q Apps, specify `AWS/QBusiness` or `AWS/QApps` for the namespace.
+ The metric dimension. A *dimension* is a name-value pair that helps you to uniquely identify a metric. Common dimension names include:
  + `ApplicationId` - Identifies the specific Amazon Q Business application
  + `IndexId` - Identifies the specific index (for index-related metrics)
  + `DataSourceId` - Identifies the specific data source (for data source metrics)
  + `PluginId` - Identifies the specific plugin (for plugin-related metrics)
  + `API name` - Identifies the specific API operation (for performance metrics like Chat)
  + `MethodType` - Identifies the specific method being called (for API operation metrics)
  + `UsefulnessReason` - Identifies feedback categories (for feedback metrics)
+ The metric name. For example, `DocumentsIndexed`.

You can get monitoring data for Amazon Q Business or Q Apps with the AWS Management Console, the AWS CLI, or the CloudWatch API. You can also use the CloudWatch API through one of the AWS SDKs or the CloudWatch API tools. The console displays a series of graphs based on the raw data from the CloudWatch API. Depending on your needs, you might prefer to use either the graphs displayed in the console or retrieved from the API.

### 
<a name="how-do-i"></a>

The following table shows some common uses for the metrics. These are suggestions to get you started, not a comprehensive list.


| How do I? | Relevant metrics | 
| --- | --- | 
|  How do I track how many documents were indexed successfully?  |  Use the `DocumentsIndexed` metrics.  | 
|  How do I monitor end user experience for Amazon Q Business?  |  Use the `ThumbsUpCount` and `ThumbsDownCount` metrics.  | 
|  How do I track how many users used Q Apps  |  Use the `ActiveUsers` metric.  | 
|  How do I track API operation success rates?  |  Use the `success` and `failure` metrics with appropriate `MethodType` dimensions.  | 
|  How do I monitor individual API operation performance?  |  Use the `latency` metric with specific `MethodType` dimensions.  | 
|  How do I monitor chat response performance and latency?  |  Use the `TimeToFirstToken` and `Latency` metrics with API name dimension set to "Chat".  | 

You must have the appropriate CloudWatch permissions to monitor Amazon Q Business with CloudWatch. For more information, see [Identity and access management for Amazon CloudWatch](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/auth-and-access-control-cw.html) in the *Amazon CloudWatch User Guide*.

## Viewing metrics
<a name="how-to-access"></a>

The following steps show how to access Amazon Q Business or Amazon Q Apps metrics using the CloudWatch console.

**To view metrics (console)**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch).

1. Choose **Metrics**, choose the **All Metrics** tab, and then choose **AWS/QBusiness** or **AWS/QApps**.
**Note**  
Some Q Apps metrics might be emitted using a different namespace.

1. Choose the metric dimension.

1. Choose the metric that you want from the list, and choose a time period for the graph.

# Creating a CloudWatch alarm
<a name="alarms"></a>

You can create a CloudWatch alarm that sends an Amazon Simple Notification Service (Amazon SNS) message when the alarm changes state. An alarm watches a single metric over a time period that you specify. It performs one or more actions based on the value of the metric relative to a given threshold over a number of time periods. The action is a notification sent to an Amazon SNS topic or an Auto Scaling policy.

Alarms invoke actions for sustained state changes only. CloudWatch alarms don't invoke actions simply because they are in a particular state. The state must have changed and have been maintained for a specified number of time periods. 

To create an alarm based on an Amazon Q Business or Q Apps metric, see [Create a CloudWatch Alarm Based on a CloudWatch Metric](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ConsoleAlarms.html).

**To set an alarm (console)**

1. Sign in to the AWS Management Console and open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose **Alarms**, and choose **Create Alarm**. This opens the **Create Alarm Wizard**. 

1. Choose **Select metric**.

1. In the **All metrics** tab, choose an AWS/QBusiness or AWS/QApps metric for your application, index, and data source. Also set the time as set number of hours, days, weeks, or custom.

1. Choose your statistic. For example, **Average**. Also choose your alarm trigger time period as a set number of minutes, hours, per day, or custom.

1. Choose your threshold to trigger the alarm, whether to use a static value or a band and the condition to meet for the threshold.

1. Choose the alarm state for the trigger, whether the metric must fall outside your set threshold, or another state. Select who/which email to send the alarm notification to.

1. Choose **Next**. Add a name and optional description for your alarm. Choose **Next**. 

1. Choose **Create Alarm**. 

**Note**  
You can use the `Sum` statistic to aggregate all metrics with the unit `Count`. For more information on CloudWatch statistics and how to use them, see [CloudWatch statistics definitions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html) in the *Amazon CloudWatch User Guide*.

# Amazon Q Business chat metrics
<a name="qbusiness-metrics-chat"></a>

The following table shows the [Chat and conversation management](conversation-api.md) metrics that Amazon Q Business sends to CloudWatch in real time. 


| Metric name | Unit | Description | 
| --- | --- | --- | 
|  `ActionErrorCount`  |  Count  |  The number of errors because of actions. Valid dimensions: `ApplicationId`, `PluginId`  | 
|  `ActionInvocationCount`  |  Count  |  The number of actions invoked. Valid dimensions: `ApplicationId`, `PluginId`  | 
|  `BlockedChatMessages`  |  Count  | The number of chat messages that were blocked by Amazon Q Business due to an admin guardrail configuration. For example, a `BlockedTopic` or `Blocked Phrase`. .  Valid dimensions: `ApplicationId`  | 
|  `ChatMessages`  |  Count  |  The number of chat messages This metric is emitted every time a chat message is processed. Valid dimensions: `ApplicationId`  | 
|  `ChatMessagesWithAttachment`  |  Count  |  The number of chat messages with file uploads. Valid dimensions: `ApplicationId`  | 
|  `ChatMessagesWithNoAnswer`  |  Count  |  The number of chat messages that resulted in no answer.  Valid dimensions: `ApplicationId`  | 
|  `HallucinatedChatMessages`  |  Count  |  The number of system-generated chat messages with hallucination.  You can create a hallucination rate metric by combining this metric with the `ChatMessages` metric.  Valid dimensions: `ApplicationId`  | 
|  `TimeToFirstToken`  |  Milliseconds  |  The time taken to generate the first token in a chat response. This metric measures the initial response latency for chat interactions. Valid dimensions: `API name`, `ApplicationId`  | 
|  `Latency`  |  Milliseconds  |  The total time taken to complete a chat API request from start to finish. This metric measures the end-to-end response time for chat interactions. Valid dimensions: `API name`, `ApplicationId`  | 
|  `DailyActiveUsers`  |  Count  |  The number of active users from the previous day.  This metric is calculated using the *Maximum* statistic. For more information, see [CloudWatch statistics definitions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html).  Valid dimensions: `ApplicationId`  | 
|  `MonthlyActiveUsers`  |  Count  |  The total number of unique month-to-date active users. This metric will be calculated from the 00:00 UTC on the first day of the month till 00:00 UTC from the current day.  This metric is calculated using the *Maximum* statistic. For more information, see [CloudWatch statistics definitions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html).  Valid dimensions: `ApplicationId`  | 
|  `WeeklyActiveUsers`  |  Count  |  The total number of unique week-to-date active users. This metric will be calculated from 00:00 UTC on Sunday till 00:00 UTC from the current day.  This metric is calculated using the *Maximum* statistic. For more information, see [CloudWatch statistics definitions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html).  Valid dimensions: `ApplicationId`  | 
|  `NewConversations`  |  Count  |  The number of new conversations started.  Valid dimensions: `ApplicationId`  | 
|  `ThumbsDownCount`  |  Count  |  The feedback count for thumbs down. Valid dimensions: `ApplicationId`, `UsefulnessReason`  | 
|  `ThumbsUpCount`  |  Count  |  The feedback count for thumbs up. Valid dimensions: `ApplicationId`, `UsefulnessReason`  | 

# Amazon Q Business API operation metrics
<a name="qbusiness-metrics-api"></a>

The following table shows the API operation metrics that Amazon Q Business sends to CloudWatch.


| Metric name | Unit | Description | 
| --- | --- | --- | 
|  `success`  |  Count  |  The number of successful API operation calls. This metric is emitted for each successful API operation execution. Valid dimensions: `MethodType`, `ApplicationId`  | 
|  `failure`  |  Count  |  The number of failed API operation calls. This metric is emitted for each failed API operation execution. Valid dimensions: `MethodType`, `ApplicationId`  | 
|  `latency`  |  Milliseconds  |  The time taken to complete an API operation call. This metric measures the response time for individual API operations. Valid dimensions: `MethodType`, `ApplicationId`  | 

The `MethodType` dimension can include values such as:
+ `ListPlugins`
+ (Additional method types may be available depending on API usage)

# Amazon Q Business index metrics
<a name="qbusiness-metrics-index"></a>

The following table shows the [Index](concepts-terms.md#index) metrics that Amazon Q Business sends to CloudWatch in real time.


| Metric name | Unit | Description | 
| --- | --- | --- | 
|  `DocumentCount`  |  Count  |  The number of documents. This metric is published every 15 minutes. Valid dimensions: `ApplicationId`, `IndexId`  | 
|  `DocumentsIndexed`  |  Count  |  The number of documents that were indexed. Valid dimensions: `ApplicationId`, `IndexId`, `DataSourceId`  | 
|  `DocumentsFailedToIndex`  |  Count  |  The number of documents that failed to index. Valid dimensions: `ApplicationId`, `IndexId`, `DataSourceId`  | 
|  `DocumentsFailedToIndexDueToCDE`  |  Count  |  The number of documents that failed to index because of custom document enrichment. Valid dimensions: `ApplicationId`, `IndexId`, `DataSourceId`  | 
|  `ExtractedTextSize`  |  MB  |  Size of the extracted text Valid dimensions: `ApplicationId`, `IndexId`   | 
| MonthlyDataSyncDuration | Count |  Duration of data synchronization operations over a monthly period. Valid dimensions: `ApplicationId`, `IndexId`, `DataSourceId`  | 

# Amazon Q Apps metrics
<a name="qapps-metrics"></a>

The following table shows the metrics that Amazon Q Apps sends to CloudWatch in real time.


| Metric name | Unit | Description | Namespace | 
| --- | --- | --- | --- | 
|  `ActiveQAppsUsers`  |  Count  |  The number of Active Q App users. A user is a person who creates, edits or runs the apps. The metric is emitted once every day on UTC midnight. Valid dimensions: `ApplicationId`  |  AWS/QApps  | 
|  `ActiveQAppsCreators`  |  Count  |  The number of Active Q App creators. A creator is a user who creates a Q App in any way, including through magic wand, magic builder, create blank app or duplicate an app. The metric is emitted once every day on UTC midnight. Valid dimensions: `ApplicationId`  |  AWS/QApps  | 
|  `QAppCreated`  |  Count  |  The number of Q Apps created. This metric is emitted every time a Q App is created Valid dimensions: `ApplicationId`  |  AWS/QApps  | 
|  `ActiveQApps`  |  Count  |  The number of active Q Apps. The active Q App is defined as the app being created, updated or run. Valid dimensions: `ApplicationId`  |  AWS/QApps  | 
|  `QAppPublished`  |  Count  |  The number of Q Apps that are shared to the library. This metric is emitted every time a Q App is shared to the library. Valid dimensions: `ApplicationId`  |  AWS/QApps  | 
|  `QAppExecuted`  |  Count  |  The number of Q Apps run. This metric is emitted every time a Q App is run. Valid dimensions: `ApplicationId`  |  AWS/QApps  | 
|  `ResourceCount (QAppCountPerApplication)`  |  Count  |  The number of total Q Apps in the application environment. This metric is emitted every 5 minutes with Resource dimension populated as `QAppCountPerApplication`.  Valid dimensions: `Resouce, ResourceId, Service, Type`.  |  Usage  | 
|  `ResourceCount (QAppCountPerUser)`  |  Count  |  The number of total users set up for the application environment. This metric is emitted every 5 minutes with Resource dimension populated as `QAppCountPerUser`. Valid dimensions: `Resource, ResourceId, Service, Type`.  |  Usage  | 