Documentation
¶
Index ¶
- func NewHandler(_ context.Context, svr *server.Server) (http.Handler, apiutil.APIServiceGroup, error)
- func TopNRegions(regions []*core.RegionInfo, less func(a, b *core.RegionInfo) bool, n int) []*core.RegionInfo
- type Health
- type HistoryHotRegionsRequest
- type HotStoreStats
- type MetaPeer
- type MetaStore
- type PDPeerStats
- type Progress
- type RegionHeap
- type RegionInfo
- type RegionsInfo
- type ReplicationStatus
- type SlowTrend
- type StoreInfo
- type StoreStatus
- type StoresInfo
- type Trend
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
func NewHandler(_ context.Context, svr *server.Server) (http.Handler, apiutil.APIServiceGroup, error)
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. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it.
type HistoryHotRegionsRequest ¶
type HistoryHotRegionsRequest struct {
StartTime int64 `json:"start_time,omitempty"`
EndTime int64 `json:"end_time,omitempty"`
RegionIDs []uint64 `json:"region_ids,omitempty"`
StoreIDs []uint64 `json:"store_ids,omitempty"`
PeerIDs []uint64 `json:"peer_ids,omitempty"`
IsLearners []bool `json:"is_learners,omitempty"`
IsLeaders []bool `json:"is_leaders,omitempty"`
HotRegionTypes []string `json:"hot_region_type,omitempty"`
}
HistoryHotRegionsRequest wrap request condition from tidb. it is request from tidb
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"`
QueryWriteStats map[uint64]float64 `json:"query-write-rate,omitempty"`
QueryReadStats map[uint64]float64 `json:"query-read-rate,omitempty"`
}
HotStoreStats is used to record the status of hot stores.
type MetaPeer ¶
type MetaPeer struct {
*metapb.Peer
// RoleName is `Role.String()`.
// Since Role is serialized as int by json by default,
// introducing it will make the output of pd-ctl easier to identify Role.
RoleName string `json:"role_name"`
// IsLearner is `Role == "Learner"`.
// Since IsLearner was changed to Role in kvproto in 5.0, this field was introduced to ensure api compatibility.
IsLearner bool `json:"is_learner,omitempty"`
}
MetaPeer is api compatible with *metapb.Peer. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it.
type PDPeerStats ¶
PDPeerStats is api compatible with *pdpb.PeerStats. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it.
type Progress ¶
type Progress struct {
Action string `json:"action"`
StoreID uint64 `json:"store_id,omitempty"`
Progress float64 `json:"progress"`
CurrentSpeed float64 `json:"current_speed"`
LeftSeconds float64 `json:"left_seconds"`
}
Progress contains status about a progress.
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 []MetaPeer `json:"peers,omitempty"`
Leader MetaPeer `json:"leader,omitempty"`
DownPeers []PDPeerStats `json:"down_peers,omitempty"`
PendingPeers []MetaPeer `json:"pending_peers,omitempty"`
CPUUsage uint64 `json:"cpu_usage"`
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"`
Buckets []string `json:"buckets,omitempty"`
ReplicationStatus *ReplicationStatus `json:"replication_status,omitempty"`
}
RegionInfo records detail region info for api usage. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it.
func InitRegion ¶
func InitRegion(r *core.RegionInfo, s *RegionInfo) *RegionInfo
InitRegion init a new API RegionInfo from the core.RegionInfo.
func NewAPIRegionInfo ¶
func NewAPIRegionInfo(r *core.RegionInfo) *RegionInfo
NewAPIRegionInfo create a new API RegionInfo.
func (*RegionInfo) Adjust ¶
func (r *RegionInfo) Adjust()
Adjust is only used in testing, in order to compare the data from json deserialization.
type RegionsInfo ¶
type RegionsInfo struct {
Count int `json:"count"`
Regions []RegionInfo `json:"regions"`
}
RegionsInfo contains some regions with the detailed region info.
func (*RegionsInfo) Adjust ¶
func (s *RegionsInfo) Adjust()
Adjust is only used in testing, in order to compare the data from json deserialization.
type ReplicationStatus ¶
ReplicationStatus represents the replication mode status of the region. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it.
type SlowTrend ¶
type SlowTrend struct {
// CauseValue is the slow trend detecting raw input, it changes by the performance and pressure along time of the store.
// The value itself is not important, what matter is:
// - The comparition result from store to store.
// - The change magnitude along time (represented by CauseRate).
// Currently it's one of store's internal latency (duration of waiting in the task queue of raftstore.store).
CauseValue float64 `json:"cause_value"`
// CauseRate is for mesuring the change magnitude of CauseValue of the store,
// - CauseRate > 0 means the store is become slower currently
// - CauseRate < 0 means the store is become faster currently
// - CauseRate == 0 means the store's performance and pressure does not have significant changes
CauseRate float64 `json:"cause_rate"`
// ResultValue is the current gRPC QPS of the store.
ResultValue float64 `json:"result_value"`
// ResultRate is for mesuring the change magnitude of ResultValue of the store.
ResultRate float64 `json:"result_rate"`
}
SlowTrend contains slow trend information about a store.
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"`
Available typeutil.ByteSize `json:"available"`
UsedSize typeutil.ByteSize `json:"used_size"`
LeaderCount int `json:"leader_count"`
LeaderWeight float64 `json:"leader_weight"`
LeaderScore float64 `json:"leader_score"`
LeaderSize int64 `json:"leader_size"`
RegionCount int `json:"region_count"`
RegionWeight float64 `json:"region_weight"`
RegionScore float64 `json:"region_score"`
RegionSize int64 `json:"region_size"`
LearnerCount int `json:"learner_count,omitempty"`
WitnessCount int `json:"witness_count,omitempty"`
SlowScore uint64 `json:"slow_score,omitempty"`
SlowTrend *SlowTrend `json:"slow_trend,omitempty"`
SendingSnapCount uint32 `json:"sending_snap_count,omitempty"`
ReceivingSnapCount uint32 `json:"receiving_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.
Source Files
¶
- admin.go
- checker.go
- cluster.go
- config.go
- diagnostic.go
- health.go
- hot_status.go
- label.go
- log.go
- member.go
- metric.go
- middleware.go
- min_resolved_ts.go
- operator.go
- plugin.go
- pprof.go
- region.go
- region_label.go
- replication_mode.go
- router.go
- rule.go
- scheduler.go
- server.go
- service_gc_safepoint.go
- service_middleware.go
- stats.go
- status.go
- store.go
- trend.go
- tso.go
- unsafe_operation.go
- version.go