diff --git a/pkg/keyvisual/input/api.go b/pkg/keyvisual/input/api.go index 0122b21ccb..cc39f5c77e 100644 --- a/pkg/keyvisual/input/api.go +++ b/pkg/keyvisual/input/api.go @@ -29,6 +29,8 @@ type RegionInfo struct { ReadBytes uint64 `json:"read_bytes"` WrittenKeys uint64 `json:"written_keys"` ReadKeys uint64 `json:"read_keys"` + WriteQueryNum uint64 `json:"write_query_num"` + ReadQueryNum uint64 `json:"read_query_num"` ApproximateSize int64 `json:"approximate_size"` ApproximateKeys int64 `json:"approximate_keys"` } @@ -72,6 +74,14 @@ func (rs *RegionsInfo) GetValues(tag regionpkg.StatTag) []uint64 { for i, region := range rs.Regions { values[i] = region.ReadKeys } + case regionpkg.WriteQueryNum: + for i, region := range rs.Regions { + values[i] = region.WriteQueryNum + } + case regionpkg.ReadQueryNum: + for i, region := range rs.Regions { + values[i] = region.ReadQueryNum + } case regionpkg.Integration: for i, region := range rs.Regions { values[i] = region.WrittenBytes + region.ReadBytes diff --git a/pkg/keyvisual/region/tag.go b/pkg/keyvisual/region/tag.go index 81eaab33bf..2cc7b4920a 100644 --- a/pkg/keyvisual/region/tag.go +++ b/pkg/keyvisual/region/tag.go @@ -16,6 +16,10 @@ const ( WrittenKeys // ReadKeys is the number of keys read to the data per minute. ReadKeys + // WriteQueryNum is write query num from this region + WriteQueryNum + // ReadQueryNum is read query num from this region + ReadQueryNum ) // IntoTag converts a string into a StatTag. @@ -33,6 +37,10 @@ func IntoTag(typ string) StatTag { return WrittenKeys case "read_keys": return ReadKeys + case "write_query_num": + return WriteQueryNum + case "read_query_num": + return ReadQueryNum default: return WrittenBytes } @@ -50,13 +58,17 @@ func (tag StatTag) String() string { return "written_keys" case ReadKeys: return "read_keys" + case WriteQueryNum: + return "write_query_num" + case ReadQueryNum: + return "read_query_num" default: panic("unreachable") } } // StorageTags is the order of tags during storage. -var StorageTags = []StatTag{WrittenBytes, ReadBytes, WrittenKeys, ReadKeys} +var StorageTags = []StatTag{WrittenBytes, ReadBytes, WrittenKeys, ReadKeys, WriteQueryNum, ReadQueryNum} // ResponseTags is the order of tags when responding. var ResponseTags = append([]StatTag{Integration}, StorageTags...) diff --git a/pkg/keyvisual/service.go b/pkg/keyvisual/service.go index 0e5b74a6ce..99612385ba 100644 --- a/pkg/keyvisual/service.go +++ b/pkg/keyvisual/service.go @@ -222,7 +222,7 @@ func (s *Service) Stop(ctx context.Context) error { // @Param endkey query string false "The end of the key range" // @Param starttime query int false "The start of the time range (Unix)" // @Param endtime query int false "The end of the time range (Unix)" -// @Param type query string false "Main types of data" Enums(written_bytes, read_bytes, written_keys, read_keys, integration) +// @Param type query string false "Main types of data" Enums(written_bytes, read_bytes, written_keys, read_keys, write_query_num, read_query_num, integration) // @Success 200 {object} matrix.Matrix // @Router /keyvisual/heatmaps [get] // @Security JwtAuth diff --git a/ui/lib/apps/KeyViz/components/KeyVizToolbar.tsx b/ui/lib/apps/KeyViz/components/KeyVizToolbar.tsx index ed5d732a90..2a28be6eee 100644 --- a/ui/lib/apps/KeyViz/components/KeyVizToolbar.tsx +++ b/ui/lib/apps/KeyViz/components/KeyVizToolbar.tsx @@ -89,6 +89,14 @@ class KeyVizToolbar extends Component { }, { text: t('keyviz.toolbar.view_type.read_keys'), value: 'read_keys' }, { text: t('keyviz.toolbar.view_type.write_keys'), value: 'written_keys' }, + { + text: t('keyviz.toolbar.view_type.read_query_num'), + value: 'read_query_num', + }, + { + text: t('keyviz.toolbar.view_type.write_query_num'), + value: 'write_query_num', + }, { text: t('keyviz.toolbar.view_type.all'), value: 'integration' }, ] diff --git a/ui/lib/apps/KeyViz/heatmap/types.ts b/ui/lib/apps/KeyViz/heatmap/types.ts index c365b19e7e..cca2f2640f 100644 --- a/ui/lib/apps/KeyViz/heatmap/types.ts +++ b/ui/lib/apps/KeyViz/heatmap/types.ts @@ -9,6 +9,8 @@ export type DataTag = | 'read_bytes' | 'written_keys' | 'read_keys' + | `write_query_num` + | `read_query_num` export type HeatmapRange = { starttime?: number diff --git a/ui/lib/apps/KeyViz/heatmap/utils.ts b/ui/lib/apps/KeyViz/heatmap/utils.ts index e9bf076a5e..de55ba656a 100644 --- a/ui/lib/apps/KeyViz/heatmap/utils.ts +++ b/ui/lib/apps/KeyViz/heatmap/utils.ts @@ -14,6 +14,10 @@ export function tagUnit(tag: DataTag): string { return 'keys/min' case 'written_keys': return 'keys/min' + case 'read_query_num': + return 'qps/min' + case 'write_query_num': + return 'qps/min' } } diff --git a/ui/lib/apps/KeyViz/translations/en.yaml b/ui/lib/apps/KeyViz/translations/en.yaml index b5c53263fb..ceb10fba42 100644 --- a/ui/lib/apps/KeyViz/translations/en.yaml +++ b/ui/lib/apps/KeyViz/translations/en.yaml @@ -10,6 +10,8 @@ keyviz: write_bytes: Write (bytes) read_keys: Read (keys) write_keys: Write (keys) + read_query_num: Read(qps) + write_query_num: Write(qps) all: All settings: title: Settings diff --git a/ui/lib/apps/KeyViz/translations/zh.yaml b/ui/lib/apps/KeyViz/translations/zh.yaml index f6bc78921c..a112b3664c 100644 --- a/ui/lib/apps/KeyViz/translations/zh.yaml +++ b/ui/lib/apps/KeyViz/translations/zh.yaml @@ -10,6 +10,8 @@ keyviz: write_bytes: 写入字节量 read_keys: 读取次数 write_keys: 写入次数 + read_query_num: 读查询次数 + write_query_num: 写查询次数 all: 所有 settings: title: 设置