Documentation ¶
Index ¶
- func NewHandler(ctx context.Context, svr *server.Server) (http.Handler, server.ServiceGroup)
- func TopNRegions(regions []*core.RegionInfo, less func(a, b *core.RegionInfo) bool, n int) []*core.RegionInfo
- type Health
- type HotStoreStats
- type MetaStore
- type PeerStats
- type Recommendation
- type RegionHeap
- type RegionInfo
- type RegionsInfo
- type StoreInfo
- type StoreStatus
- type StoresInfo
- type Trend
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
NewHandler creates a HTTP handler for API.
func TopNRegions ¶
func TopNRegions(regions []*core.RegionInfo, less func(a, b *core.RegionInfo) bool, n int) []*core.RegionInfo
TopNRegions returns top n regions according to the given rule.
Types ¶
type Health ¶
type Health struct { Name string `json:"name"` MemberID uint64 `json:"member_id"` ClientUrls []string `json:"client_urls"` Health bool `json:"health"` }
Health reflects the cluster's health.
type HotStoreStats ¶
type HotStoreStats struct { BytesWriteStats map[uint64]float64 `json:"bytes-write-rate,omitempty"` BytesReadStats map[uint64]float64 `json:"bytes-read-rate,omitempty"` KeysWriteStats map[uint64]float64 `json:"keys-write-rate,omitempty"` KeysReadStats map[uint64]float64 `json:"keys-read-rate,omitempty"` }
HotStoreStats is used to record the status of hot stores.
type PeerStats ¶
type PeerStats struct { Name string `json:"name"` ID string `json:"id"` State string `json:"state"` StartTime time.Time `json:"startTime"` LeaderInfo struct { Leader string `json:"leader"` Uptime string `json:"uptime"` StartTime time.Time `json:"startTime"` } `json:"leaderInfo"` RecvAppendRequestCnt int `json:"recvAppendRequestCnt"` SendAppendRequestCnt int `json:"sendAppendRequestCnt"` }
PeerStats is the etcd peers' stats.
type Recommendation ¶
type Recommendation struct { Module string `json:"module"` Level string `json:"level"` Description string `json:"description"` Instruction string `json:"instruction"` }
Recommendation contains a potential problem and possible way to deal with it.
type RegionHeap ¶
type RegionHeap struct {
// contains filtered or unexported fields
}
RegionHeap implements heap.Interface, used for selecting top n regions.
func (*RegionHeap) Len ¶
func (h *RegionHeap) Len() int
func (*RegionHeap) Less ¶
func (h *RegionHeap) Less(i, j int) bool
func (*RegionHeap) Min ¶
func (h *RegionHeap) Min() *core.RegionInfo
Min returns the minimum region from the heap.
func (*RegionHeap) Pop ¶
func (h *RegionHeap) Pop() interface{}
Pop removes the minimum element (according to Less) from the heap and returns it.
func (*RegionHeap) Push ¶
func (h *RegionHeap) Push(x interface{})
Push pushes an element x onto the heap.
func (*RegionHeap) Swap ¶
func (h *RegionHeap) Swap(i, j int)
type RegionInfo ¶
type RegionInfo struct { ID uint64 `json:"id"` StartKey string `json:"start_key"` EndKey string `json:"end_key"` RegionEpoch *metapb.RegionEpoch `json:"epoch,omitempty"` Peers []*metapb.Peer `json:"peers,omitempty"` Leader *metapb.Peer `json:"leader,omitempty"` DownPeers []*pdpb.PeerStats `json:"down_peers,omitempty"` PendingPeers []*metapb.Peer `json:"pending_peers,omitempty"` WrittenBytes uint64 `json:"written_bytes"` ReadBytes uint64 `json:"read_bytes"` WrittenKeys uint64 `json:"written_keys"` ReadKeys uint64 `json:"read_keys"` ApproximateSize int64 `json:"approximate_size"` ApproximateKeys int64 `json:"approximate_keys"` }
RegionInfo records detail region info for api usage.
func InitRegion ¶
func InitRegion(r *core.RegionInfo, s *RegionInfo) *RegionInfo
InitRegion init a new api RegionInfo from the core.RegionInfo.
func NewRegionInfo ¶
func NewRegionInfo(r *core.RegionInfo) *RegionInfo
NewRegionInfo create a new api RegionInfo.
type RegionsInfo ¶
type RegionsInfo struct { Count int `json:"count"` Regions []*RegionInfo `json:"regions"` }
RegionsInfo contains some regions with the detailed region info.
type StoreInfo ¶
type StoreInfo struct { Store *MetaStore `json:"store"` Status *StoreStatus `json:"status"` }
StoreInfo contains information about a store.
type StoreStatus ¶
type StoreStatus struct { Capacity typeutil.ByteSize `json:"capacity,omitempty"` Available typeutil.ByteSize `json:"available,omitempty"` UsedSize typeutil.ByteSize `json:"used_size,omitempty"` LeaderCount int `json:"leader_count,omitempty"` LeaderWeight float64 `json:"leader_weight,omitempty"` LeaderScore float64 `json:"leader_score,omitempty"` LeaderSize int64 `json:"leader_size,omitempty"` RegionCount int `json:"region_count,omitempty"` RegionWeight float64 `json:"region_weight,omitempty"` RegionScore float64 `json:"region_score,omitempty"` RegionSize int64 `json:"region_size,omitempty"` SendingSnapCount uint32 `json:"sending_snap_count,omitempty"` ReceivingSnapCount uint32 `json:"receiving_snap_count,omitempty"` ApplyingSnapCount uint32 `json:"applying_snap_count,omitempty"` IsBusy bool `json:"is_busy,omitempty"` StartTS *time.Time `json:"start_ts,omitempty"` LastHeartbeatTS *time.Time `json:"last_heartbeat_ts,omitempty"` Uptime *typeutil.Duration `json:"uptime,omitempty"` }
StoreStatus contains status about a store.
type StoresInfo ¶
StoresInfo records stores' info.