Skip to content

Commit

Permalink
Merge pull request #665 from hudongdong129 hdd_redis_Commandstats
Browse files Browse the repository at this point in the history
[task]feature:Optimize Redis info [section] and Add Redis command statistics
  • Loading branch information
hudongdong129 authored Feb 22, 2023
2 parents a76ba1c + 1ebab8a commit 8eac649
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public RedisClusterCollectImpl() {

public Map<String, String> getRedisInfo(Metrics metrics) {
StatefulRedisClusterConnection<String, String> connection = getConnection(metrics.getRedis());
String info = connection.sync().info();
String info = connection.sync().info(metrics.getName());
Map<String, String> valueMap = parseInfo(info);
if (Objects.equals(metrics.getName(), CLUSTER_INFO)) {
String clusterNodes = connection.sync().clusterInfo();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public RedisSingleCollectImpl() {
*/
public Map<String, String> getRedisInfo(Metrics metrics) {
StatefulRedisConnection<String, String> connection = getConnection(metrics.getRedis());
String info = connection.sync().info();
String info = connection.sync().info(metrics.getName());
Map<String, String> valueMap = parseInfo(info);
if (log.isDebugEnabled()) {
log.debug("[RedisSingleCollectImpl] fetch redis info");
Expand Down
32 changes: 32 additions & 0 deletions manager/src/main/resources/define/app/app-redis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,38 @@ metrics:
password: ^_^password^_^
timeout: ^_^timeout^_^

- name: commandstats
priority: 9
fields:
- field: cmdstat_set
type: 1
- field: cmdstat_get
type: 1
- field: cmdstat_setnx
type: 1
- field: cmdstat_hset
type: 1
- field: cmdstat_hget
type: 1
- field: cmdstat_lpush
type: 1
- field: cmdstat_rpush
type: 1
- field: cmdstat_lpop
type: 1
- field: cmdstat_rpop
type: 1
- field: cmdstat_llen
type: 1
protocol: redis
redis:
host: ^_^host^_^
port: ^_^port^_^
username: ^_^username^_^
password: ^_^password^_^
timeout: ^_^timeout^_^


- name: keyspace
priority: 9
fields:
Expand Down
33 changes: 33 additions & 0 deletions manager/src/main/resources/define/app/app-redis_cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,39 @@ metrics:
timeout: ^_^timeout^_^
pattern: ^_^pattern^_^

- name: commandstats
priority: 9
fields:
- field: cmdstat_set
type: 1
- field: cmdstat_get
type: 1
- field: cmdstat_setnx
type: 1
- field: cmdstat_hset
type: 1
- field: cmdstat_hget
type: 1
- field: cmdstat_lpush
type: 1
- field: cmdstat_rpush
type: 1
- field: cmdstat_lpop
type: 1
- field: cmdstat_rpop
type: 1
- field: cmdstat_llen
type: 1
protocol: redis
redis:
host: ^_^host^_^
port: ^_^port^_^
username: ^_^username^_^
password: ^_^password^_^
timeout: ^_^timeout^_^
pattern: ^_^pattern^_^


- name: keyspace
priority: 9
fields:
Expand Down

0 comments on commit 8eac649

Please sign in to comment.