Queries the performance monitoring data of an ApsaraDB for Redis instance.
Operation description
You can also query the performance monitoring data of an instance in the ApsaraDB for Redis console. For more information, see Metrics .
Debugging
Authorization information
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
InstanceId | string | Yes | The ID of the instance. | r-bp1zxszhcgatnx**** |
StartTime | string | Yes | The beginning of the time range to query. Specify the time in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC. | 2022-11-06T00:00:00Z |
EndTime | string | Yes | The end of the time range to query. The end time must be later than the start time. Specify the time in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.
| 2022-11-06T00:30:00Z |
IntervalForHistory | string | Yes | The interval at which to collect monitoring data. Unit: minutes. Set the value to | 01m |
MonitorKeys | string | No | The monitoring metrics. Separate the metrics with commas (,). Take CpuUsage as an example:
For more information about monitoring metrics and their descriptions, see Additional description of MonitorKeys. Note
| memoryUsage |
NodeId | string | No | The ID of the node in the instance. You can set this parameter to query the data of a specified node.
| r-bp1zxszhcgatnx****-db-0#1679**** |
NodeRole | string | No | If you want to query the metrics of the read replicas in a cloud-native read/write splitting instance, you must set this parameter to READONLY and specify NodeId. Note
In other cases, you do not need to specify this parameter or you can set this parameter to MASTER.
| READONLY |
Additional description of MonitorKeys
When you call the operation, you must specify the parameters in the MonitorKeys column of the following table. The system returns submetrics. General monitoring metrics and command-related monitoring metrics are available for instances.
General monitoring metrics
In this example, the CpuUsage metric is used to describe how to use a general monitoring metric.
-
Cluster or read/write splitting instances:
- To query the overall CPU utilization of all data nodes, you must specify CpuUsage$db.
- To query the CPU utilization of all proxy nodes, you must specify CpuUsage$proxy.
- To query the CPU utilization of a single data node or proxy node, you must specify CpuUsage and NodeId.
-
Standard master-replica instances: Specify only CpuUsage.
MonitorKeys | Submetric | Unit | Description | Applicable scope |
CpuUsage | CpuUsage | % | The CPU utilization. Valid values: 0 to 100. | |
NoteIf the RedisCpuUsage parameter is specified or returned for your instance in the previous request, you can continue to use the parameter. |
| |||
MemoryUsage | memoryUsage | % | The memory usage. |
|
quotaMemory | quotaMemory | Bytes | The total memory of the data shard. |
|
UsedMemory | UsedMemory | Bytes | The amount of used memory, which includes the memory consumed by data and cache. |
|
Tair_PmemUsage | PmemUsage | % | The Persistent Memory (PMem) usage, the amount of PMem used, and the total amount of PMem. |
These submetrics are available only for persistent memory-optimized instances.|
DB
Database aggregation
These submetrics are available only for DRAM-based instances that are deployed in classic (local disk-based) mode.|
DB
Database aggregation
DB
DB
Database aggregation
Proxy
Proxy node aggregation
DB
Database aggregation
DB
DB
Database aggregation
Proxy
Proxy node aggregation
DB
Database aggregation
DB
Database aggregation
Proxy
Proxy node aggregation
DB
Database aggregation
DB
Database aggregation
DB
Proxy
Proxy node aggregation
Proxy
Command-related monitoring metrics (expand to view the metrics)
Command-related monitoring metrics are supported only when you query a specific database. When you query the monitoring data of a specific database, you must specify the MonitorKeys and NodeId parameters. Note Monitoring metrics related to extended data structures of Tair are available only for DRAM-based instances that are deployed in classic (local-disk based) mode.
MonitorKeys | Submetric | Unit | Description |
Redis_Keys_Monitor | del, dump, exists, expire, expireat, move, persist, pexpire, pexpireat, pttl, randomkey, rename, renamenx, restore, sort, ttl, type, and scan | Counts/s | The monitoring information about the use of key-value related commands, such as the number of times DEL and EXISTS are executed per second. |
Redis_String_Monitor | append, bitcount, bitop, decr, decrby, get, getbit, getrange, getset, incr, incrby, incrbyfloat, mget, mset, msetnx, psetex, set, setbit, setex, setnx, setrange, and strlen | Counts/s | The monitoring information about the use of string-related commands, such as the number of times APPEND and MGET are executed per second. |
Redis_Hashes_Monitor | hdel, hexists, hget, hgetall, hincrby, hincrbyfloat, hkeys, hlen, hmget, hmset, hset, hsetnx, hvals, and hscan | Counts/s | The monitoring information about the use of hash-related commands, such as the number of times HGET and HDEL are executed per second. |
Redis_Lists_Monitor | blpop, brpop, brpoplpush, lindex, linsert, llen, lpop, lpush, lpushx, lrange, lrem, lset, ltrim, rpop, rpoplpush, rpush, and rpushx | Counts/s | The monitoring information about the use of list-related commands, such as the number of times BLPOP and BRPOP are executed per second. |
Redis_Sets_Monitor | sadd, scard, sdiff, sdiffstore, sinter, sinterstore, sismember, smembers, smove, spop, srandmember, srem, sunion, sunionstore, and sscan | Counts/s | The monitoring information about the use of set-related commands, such as the number of times SADD and SCARD are executed per second. |
Redis_Zset_Monitor | zadd, zcard, zcount, zincrby, zrange, zrangebyscore, zrank, zrem, zremrangebyrank, zremrangebyscore, zrevrange, zrevrangebyscore, zrevrank, zscore, zunionstore, zinterstore, zscan, zrangebylex, zlexcount, zremrangebylex, zpopmin, zpopmax, bzpopmin, and bzpopmax | Counts/s | The monitoring information about the use of zset-related commands, such as the number of times ZADD and ZCARD are executed per second. |
Redis_Hyperlog_Monitor | pfadd, pfcount, and pfmerge | Counts/s | The monitoring information about the use of HyperLogLog-related commands, such as the number of times PFADD and PFCOUNT are executed per second. |
Redis_Pub_Sub_Monitor | psubscribe, publish, pubsub, punsubscribe, subscribe, and unsubscribe | Counts/s | The monitoring information about the use of commands related to the Pub/Sub command group, such as the number of times PUBLISH and SUBSCRIBE are executed per second. |
Redis_Transaction_Monitor | discard, exec, multi, unwatch, and watch | Counts/s | The monitoring information about the use of transaction-related commands, such as the number of times WATCH and MULTI are executed per second. |
Redis_Scripting_Monitor | eval, evalsha, and script | Counts/s | The monitoring information about the use of scripting-related commands, such as the number of times EVAL and EVALSHA are executed per second. |
Calls_Monitor | flushall_calls, flushdb_calls, and keys_calls | Counts | The cumulative number of times FLUSHALL, FLUSHDB, and KEYS are executed per second. |
Redis_Connection_Monitor | auth, echo, ping, quit, and select | Counts/s | The monitoring information about the use of connection-related commands, such as the number of times AUTH and ECHO are executed per second. |
Redis_Server_Monitor | bgsave, client, command, config, dbsize, debug, flushall, flushdb, info, monitor, slowlog, and time | Counts/s | The monitoring information about the use of server-related commands, such as the number of times BGSAVE and CONFIG are executed per second. |
Redis_Geo_Monitor | geoadd, geohash, geopos, geodist, georadius, and georadiusbymember | Counts/s | The monitoring information about the use of geo-related commands, such as the number of times GEOADD and GEOHASH are executed per second. |
Redis_Streams_Monitor | xinfo, xadd, xtrim, xdel, xrange, xrevrange, xlen, xread, xgroup, xreadgroup, xack, xclaim, and xpending | Counts/s | The monitoring information about the use of stream-related commands, such as the number of times XINFO and XADD are executed per second. |
Counts/s | Lua , EVAL、SCRIPT 。 | ||
Redis_TairDoc_Monitor | jsondel, jsonget, jsonmget, jsonset, jsontype, jsonnumincrby, jsonstrappend, jsonstrlen, jsonarrappend, jsonarrpop, jsonarrinsert, jsonarrlen, and jsonarrtrim | Counts/s | The monitoring information about the use of Doc-related commands, such as the number of times JSON.SET and JSON.GET are executed per second. |
Redis_TairHash_Monitor | exhset, exhsetnx, exhmset, exhexpireat, exhexpire, exhmsetwithopts, exhpexpireat, exhpexpire, exhpttl, exhttl, exhver, exhsetver, exhincrby, exhincrbyfloat, exhget, exhgetwithver, exhmget, exhdel, exhlen, exhexists, exhkeys, exhvals, exhgetall, exhmgetwithver, exhsterlen, and exhscan | Counts/s | The monitoring information about the use of exHash-related commands, such as the number of times EXHSET and EXHMSET are executed per second. |
Redis_TairString_Monitor | cas, cad, exset, exget, exsetver, exincrby, exincrbyfloat, excas, and excad | Counts/s | The monitoring information about the use of exString-related commands, such as the number of times EXSET and EXGET are executed per second. |
Redis_TairGis_Monitor | gisadd, gisget, gisdel, gissearch, giscontains, gisintersects, and gisgetall | Counts/s | The monitoring information about the use of GIS-related commands, such as the number of times GIS.ADD, GIS.GET, and GIS.DEL are executed per second. |
Redis_TairBloom_Monitor | bfadd, bfmadd, bfexists, bfmexists, bfinsert, bfreserve, and bfdebug | Counts/s | The monitoring information about the use of Bloom-related commands, such as the number of times BF.RESERVE and BF.ADD are executed per second. |
Response parameters
Examples
Sample success responses
JSON
format
{
"MonitorHistory": "\"{\\\"2022-11-06T00:00:00Z\\\":{\\\"memoryUsage\\\":\\\"6.67\\\"},\\\"2022-11-06T00:00:05Z\\\":{\\\"memoryUsage\\\":\\\"6.67\\\"},\\\"2022-11-06T00:00:10Z\\\":{\\\"memoryUsage\\\":\\\"6.67\\\"},\\\"2022-11-06T00:00:15Z\\\":{\\\"memoryUsage\\\":\\\"6.67\\\"},\\\"2022-11-06T00:00:20Z\\\":{\\\"memoryUsage\\\":\\\"6.67\\\"},\\\"2022-11-06T00:00:25Z\\\":{\\\"memoryUsage\\\":\\\"6.67\\\"}}\"",
"RequestId": "F0997EE8-F4C2-4503-9168-85177ED7****"
}
Error codes
HTTP status code | Error code | Error message |
---|---|---|
400 | InvalidStartTime.Malformed | The Specified parameter "StartTime" is not valid. |
400 | InvalidEndTime.Malformed | The Specified parameter "EndTime" is not valid. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-05-08 | The Error code has changed. The request parameters of the API has changed | View Change Details |