

# Monitoring Amazon OpenSearch Memory with Amazon CloudWatch

You can monitor Amazon OpenSearch Memory using CloudWatch. CloudWatch collects the service's event-driven data points and turns them into readable, near real-time metrics. CloudWatch retains these statistics for 15 months, so that you can review historical performance and usage.

You can also set alarms that watch for certain thresholds, and send notifications or take actions when those thresholds are met. For more information about CloudWatch alarms, see the [Amazon CloudWatch User Guide](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/).

**Topics**
+ [OpenSearch Memory metrics](#memory-cloudwatch-metrics)
+ [Usage metrics](#memory-cloudwatch-usage)

## OpenSearch Memory metrics
<a name="memory-cloudwatch-metrics"></a>

OpenSearch Memory reports the following metrics in the `AWS/OpenSearchMemory` namespace.


| Metric | Description | 
| --- | --- | 
| Invocations | The number of API requests made against a space. Includes failed requests, except requests that fail before OpenSearch Memory confirms that the space exists in your account.<br />**Relevant statistics**: Sum<br />**Dimensions**: `SpaceId`, `Operation`<br />**Operation values**: Event and memory operations: `BatchGetEvent`, `CreateEvent`, `DeleteEvent`, `GetEvent`, `ListEvents`, `SearchEvents`, `CreateMemory`, `DeleteMemory`, `GetMemory`, `ListMemories`, `SearchMemories`, and `UpdateMemory`. Space operations: `CreateSpace`, `GetSpace`, `UpdateSpace`, and `DeleteSpace`.<br />**Frequency**: Event-driven, once per qualifying API request. | 
| Latency | The server-side time, in milliseconds, taken to process an API request against a space.<br />**Relevant statistics**: Average, Minimum, Maximum, p50, p90, p99<br />**Dimensions**: `SpaceId`, `Operation`<br />**Operation values**: Event and memory operations: `BatchGetEvent`, `CreateEvent`, `DeleteEvent`, `GetEvent`, `ListEvents`, `SearchEvents`, `CreateMemory`, `DeleteMemory`, `GetMemory`, `ListMemories`, `SearchMemories`, and `UpdateMemory`. Space operations: `CreateSpace`, `GetSpace`, `UpdateSpace`, and `DeleteSpace`.<br />**Frequency**: Event-driven, once per qualifying API request. | 
| UserErrors | The number of event and memory API requests that result in a 4xx response other than throttling, such as invalid input, access denied, or a missing resource.<br />**Relevant statistics**: Sum<br />**Dimensions**: `SpaceId`, `Operation`<br />**Frequency**: Event-driven, once per qualifying failed request. | 
| SystemErrors | The number of event and memory API requests that fail because the service encounters an error during ingestion, retrieval, search, or another event or memory operation. These requests result in a 5xx response.<br />**Relevant statistics**: Sum<br />**Dimensions**: `SpaceId`, `Operation`<br />**Frequency**: Event-driven, once per qualifying failed request. | 
| CharactersIngested | The number of searchable characters that you write through successful `CreateEvent`, `CreateMemory`, and content-changing `UpdateMemory` operations.<br />**Relevant statistics**: Sum<br />**Dimensions**: `SpaceId`<br />**Frequency**: Event-driven, once per successful write with more than zero characters. | 
| InputTokenUsage | The number of input tokens consumed by model calls during memory extraction and consolidation.<br />**Relevant statistics**: Sum<br />**Dimensions**: `SpaceId`, `StrategyName`, `ModelId`<br />**Frequency**: Event-driven, once per model call with a positive input token count. | 
| OutputTokenUsage | The number of output tokens generated by model calls during memory extraction and consolidation.<br />**Relevant statistics**: Sum<br />**Dimensions**: `SpaceId`, `StrategyName`, `ModelId`<br />**Frequency**: Event-driven, once per model call with a positive output token count. | 
| MemoryVisibilityLatency | The time, in milliseconds, from when OpenSearch Memory receives the latest input event until at least one resulting memory is written.<br />**Relevant statistics**: Average, Minimum, Maximum, p50, p90, p99<br />**Dimensions**: `SpaceId`, `StrategyName`<br />**Frequency**: Event-driven, once per successful memory write with at least one accepted record. | 
| MemoriesExtracted | The number of memories extracted from your events.<br />**Relevant statistics**: Sum<br />**Dimensions**: `SpaceId`, `StrategyName`<br />**Frequency**: Event-driven, once per completed extraction. | 

## Usage metrics
<a name="memory-cloudwatch-usage"></a>

CloudWatch usage metrics track API usage in your account. OpenSearch Memory publishes the following metric in the `AWS/Usage` namespace.


| Metric | Description | 
| --- | --- | 
| CallCount | The number of event, memory, and space API operations performed in your account. This metric has no unit.<br />**Relevant statistics**: Sum<br />**Dimensions**: `Service=OpenSearch Memory`, `Class=None`, `Type=API`, `Resource={{API operation}}`<br />**Frequency**: Event-driven. CloudWatch reports totals in 60-second periods. | 

The `Resource` dimension has one of the following values:
+ Event and memory operations – `BatchGetEvent`, `CreateEvent`, `DeleteEvent`, `GetEvent`, `ListEvents`, `SearchEvents`, `CreateMemory`, `DeleteMemory`, `GetMemory`, `ListMemories`, `SearchMemories`, and `UpdateMemory`
+ Space operations – `CreateSpace`, `GetSpace`, `ListSpaces`, `UpdateSpace`, and `DeleteSpace`