insight

package
v0.0.0-...-227008e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2022 License: Apache-2.0 Imports: 20 Imported by: 8

Documentation

Overview

tidb-insight project pd.go

process

tidb-insight project tidb.go

tidb-insight project tikv.go

Index

Constants

This section is empty.

Variables

View Source
var (
	// GitBranch is initialized during make
	GitBranch = "Not Provided"

	// GitCommit is initialized during make
	GitCommit = "Not Provided"
)

Version infomation

Functions

func GetProcPath

func GetProcPath(paths ...string) string

func GetSysUptime

func GetSysUptime() (float64, float64, error)

Types

type BlockDev

type BlockDev struct {
	Name       string     `json:"name,omitempty"`
	Partition  bool       `json:"partition,omitempty"`
	Mount      MountInfo  `json:"mount,omitempty"`
	UUID       string     `json:"uuid,omitempty"`
	Sectors    uint64     `json:"sectors,omitempty"`
	Size       uint64     `json:"size,omitempty"`
	SubDev     []BlockDev `json:"subdev,omitempty"`
	Holder     []string   `json:"holder_of,omitempty"`
	Slave      []string   `json:"slave_of,omitempty"`
	Rotational string     `json:"rotational,omitempty"`
}

BlockDev is similar to blkDev_cxt in lsblk (from util-linux) contains metadata of a block device

func GetPartitionStats

func GetPartitionStats() []BlockDev

type ChronyStat

type ChronyStat struct {
	ReferenceID    string  `json:"referenceid,omitempty"`
	Stratum        int     `json:"stratum,omitempty"`
	RefTime        string  `json:"ref_time,omitempty"`
	SystemTime     string  `json:"system_time,omitempty"`
	LastOffset     float64 `json:"last_offset,omitempty"` // millisecond
	RMSOffset      float64 `json:"rms_offset,omitempty"`  // millisecond
	Frequency      float64 `json:"frequency,omitempty"`   // millisecond
	ResidualFreq   string  `json:"residual_freq,omitempty"`
	Skew           string  `json:"skew,omitempty"`
	RootDelay      float64 `json:"root_delay,omitempty"`      // millisecond
	RootDispersion float64 `json:"root_dispersion,omitempty"` // millisecond
	UpdateInterval float64 `json:"update_interval,omitempty"` // millisecond
	LeapStatus     string  `json:"leap_status,omitempty"`
}

type InsightInfo

type InsightInfo struct {
	Meta       Meta            `json:"meta"`
	SysInfo    sysinfo.SysInfo `json:"sysinfo,omitempty"`
	NTP        TimeStat        `json:"ntp,omitempty"`
	ChronyStat ChronyStat      `json:"chrony,omitempty"`
	Partitions []BlockDev      `json:"partitions,omitempty"`
	ProcStats  []ProcessStat   `json:"proc_stats,omitempty"`
	EpollExcl  bool            `json:"epoll_exclusive,omitempty"`
	SysConfig  *SysCfg         `json:"system_configs,omitempty"`
	DMesg      []*kmsg.Msg     `json:"dmesg,omitempty"`
	Sockets    []Socket        `json:"sockets,omitempty"`
}

InsightInfo are information gathered from the system

func (*InsightInfo) GetInfo

func (info *InsightInfo) GetInfo(opts Options)

type Meta

type Meta struct {
	Timestamp time.Time  `json:"timestamp"`
	UPTime    float64    `json:"uptime,omitempty"`
	IdleTime  float64    `json:"idle_time,omitempty"`
	SiVer     string     `json:"sysinfo_ver"`
	GitBranch string     `json:"git_branch"`
	GitCommit string     `json:"git_commit"`
	GoVersion string     `json:"go_version"`
	TiDBVer   []TiDBMeta `json:"tidb"`
	TiKVVer   []TiKVMeta `json:"tikv"`
	PDVer     []PDMeta   `json:"pd"`
}

Meta are information about insight itself

type MountInfo

type MountInfo struct {
	MountPoint string `json:"mount_point,omitempty"`
	FSType     string `json:"filesystem,omitempty"`
	// Mount options used to mount this device
	Options string `json:"mount_options,omitempty"`
}

MountInfo is the metadata of a mounted device

type Options

type Options struct {
	Pid    string
	Proc   bool
	Syscfg bool // collect kernel configs or not
	Dmesg  bool // collect kernel logs or not
}

type PDMeta

type PDMeta struct {
	Pid        int32  `json:"pid,omitempty"`
	ReleaseVer string `json:"release_version,omitempty"`
	GitCommit  string `json:"git_commit,omitempty"`
	GitBranch  string `json:"git_branch,omitempty"`
	BuildTime  string `json:"utc_build_time,omitempty"`
}

PDMeta is the metadata struct of a PD server

type ProcessStat

type ProcessStat struct {
	Name      string                  `json:"name"`
	Pid       int32                   `json:"pid"`
	Exec      string                  `json:"exec"`
	Cmdline   string                  `json:"cmd"`
	Status    string                  `json:"status"`
	StartTime float64                 `json:"start_time"`
	CPUTimes  *cpu.TimesStat          `json:"cpu_times"`
	Memory    *process.MemoryInfoStat `json:"memory"`
	Rlimit    []RlimitUsage           `json:"resource_limit"`
}

ProcessStat contains basic info of a running process

func GetProcessStats

func GetProcessStats(pidList []string) []ProcessStat

type RlimitUsage

type RlimitUsage struct {
	Resource string `json:"resource"`
	Soft     int64  `json:"soft"`
	Hard     int64  `json:"hard"`
	Used     uint64 `json:"used"`
}

RlimitUsage is the resource limit usage of a process

type SecLimitField

type SecLimitField struct {
	Domain string `json:"domain"`
	Type   string `json:"type"`
	Item   string `json:"item"`
	Value  int    `json:"value"`
}

SecLimitField is the config field in security limit file

type Socket

type Socket struct {
	Family     uint8  `json:"family"`
	State      uint8  `json:"state"`
	SourceAddr string `json:"source_addr"`
	SourcePort uint16 `json:"source_port"`
	DestAddr   string `json:"dest_addr"`
	DestPort   uint16 `json:"dest_port"`
}

func GetIPV4Sockets

func GetIPV4Sockets(states ...uint8) ([]Socket, error)

type SysCfg

type SysCfg struct {
	SecLimit []SecLimitField   `json:"sec_limit,omitempty"`
	SysCtl   map[string]string `json:"sysctl,omitempty"`
}

SysCfg are extra system configs we collected

type TiDBMeta

type TiDBMeta struct {
	Pid        int32  `json:"pid,omitempty"`
	ReleaseVer string `json:"release_version,omitempty"`
	GitCommit  string `json:"git_commit,omitempty"`
	GitBranch  string `json:"git_branch,omitempty"`
	BuildTime  string `json:"utc_build_time,omitempty"`
	GoVersion  string `json:"go_version,omitempty"`
}

TiDBMeta is the metadata struct of TiDB server

type TiKVMeta

type TiKVMeta struct {
	Pid         int32  `json:"pid,omitempty"`
	ReleaseVer  string `json:"release_version,omitempty"`
	GitCommit   string `json:"git_commit,omitempty"`
	GitBranch   string `json:"git_branch,omitempty"`
	BuildTime   string `json:"utc_build_time,omitempty"`
	RustVersion string `json:"rust_version,omitempty"`
}

TiKVMeta is the metada struct of a TiKV server

type TimeStat

type TimeStat struct {
	Ver       string  `json:"version,omitempty"`
	Sync      string  `json:"sync,omitempty"`
	Stratum   int     `json:"stratum,omitempty"`
	Precision int     `json:"precision,omitempty"`
	Rootdelay float64 `json:"rootdelay,omitempty"`
	Rootdisp  float64 `json:"rootdisp,omitempty"`
	Refid     string  `json:"refid,omitempty"`
	Peer      int     `json:"peer,omitempty"`
	TC        int     `json:"tc,omitempty"`
	Mintc     int     `json:"mintc,omitempty"`
	Offset    float64 `json:"offset,omitempty"`
	Frequency float64 `json:"frequency,omitempty"`
	Jitter    float64 `json:"jitter,omitempty"`
	ClkJitter float64 `json:"clk_jitter,omitempty"`
	ClkWander float64 `json:"clk_wander,omitempty"`
	Status    string  `json:"status,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL