diagnose

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Category names.
	CategoryHeader   = "header"
	CategoryDiagnose = "diagnose"
	CategoryLoad     = "load"
	CategoryOverview = "overview"
	CategoryTiDB     = "TiDB"
	CategoryPD       = "PD"
	CategoryTiKV     = "TiKV"
	CategoryConfig   = "config"
	CategoryError    = "error"
)
View Source
const TemplateIndex = `` /* 2634-byte string literal not displayed */
View Source
const TemplateTable = `` /* 2608-byte string literal not displayed */

Variables

View Source
var TemplateInfos = []utils.TemplateInfo{
	{Name: "sql-diagnosis/index", Text: TemplateIndex},
	{Name: "sql-diagnosis/table", Text: TemplateTable},
}

Functions

func CompareTables

func CompareTables(tables1, tables2 []*TableDef) ([]*TableDef, []TableRowDef)

func GetReportEndTables

func GetReportEndTables(startTime, endTime string, db *gorm.DB, sqliteDB *dbstore.DB, reportID uint, progress, totalTableCount *int32) ([]*TableDef, []TableRowDef)

func GetReportHeaderTables

func GetReportHeaderTables(startTime, endTime string, db *gorm.DB, sqliteDB *dbstore.DB, reportID uint, progress, totalTableCount *int32) ([]*TableDef, []TableRowDef)

func GetReportTablesIn2Range

func GetReportTablesIn2Range(startTime1, endTime1, startTime2, endTime2 string, db *gorm.DB, sqliteDB *dbstore.DB, reportID uint, progress, totalTableCount *int32) ([]*TableDef, []TableRowDef)

func Migrate

func Migrate(db *dbstore.DB)

func NewReport

func NewReport(db *dbstore.DB, startTime, endTime time.Time, compareStartTime, compareEndTime *time.Time) (uint, error)

func RoundFloatString

func RoundFloatString(s string) string

func SaveReportContent

func SaveReportContent(db *dbstore.DB, reportID uint, content string) error

func UpdateReportProgress

func UpdateReportProgress(db *dbstore.DB, reportID uint, progress int) error

Types

type AvgMaxMinTableDef

type AvgMaxMinTableDef struct {
	Comment string
	// contains filtered or unexported fields
}

type Report

type Report struct {
	gorm.Model
	Progress         int        `json:"progress"` // 0~100
	Content          string     `json:"content"`
	StartTime        time.Time  `json:"start_time"`
	EndTime          time.Time  `json:"end_time"`
	CompareStartTime *time.Time `json:"compare_start_time"`
	CompareEndTime   *time.Time `json:"compare_end_time"`
}

func GetReport

func GetReport(db *dbstore.DB, reportID uint) (*Report, error)

type ReportRes

type ReportRes struct {
	ReportID uint `json:"report_id"`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(config *config.Config, tidbForwarder *tidb.Forwarder, db *dbstore.DB, t *template.Template) *Service

func (*Service) Register

func (s *Service) Register(r *gin.RouterGroup, auth *user.AuthService)

type TableDef

type TableDef struct {
	Category  []string // The category of the table, such as [TiDB]
	Title     string
	CommentEN string // English Comment
	CommentCN string // Chinese comment

	Column []string // Column name
	Rows   []TableRowDef
	// contains filtered or unexported fields
}

func GenerateDiffTable

func GenerateDiffTable(dr diffRows) *TableDef

func GenerateReportError

func GenerateReportError(errRows []TableRowDef) *TableDef

func GetCPUUsageTable

func GetCPUUsageTable(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetClusterHardwareInfoTable

func GetClusterHardwareInfoTable(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetClusterInfoTable

func GetClusterInfoTable(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetCompareHeaderTimeTable

func GetCompareHeaderTimeTable(startTime1, endTime1, startTime2, endTime2 string) *TableDef

func GetCompareReportTablesForDisplay

func GetCompareReportTablesForDisplay(startTime1, endTime1, startTime2, endTime2 string, db *gorm.DB, sqliteDB *dbstore.DB, reportID uint) []*TableDef

func GetDiagnoseReport

func GetDiagnoseReport(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetGoroutinesCountTable

func GetGoroutinesCountTable(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetHeaderTimeTable

func GetHeaderTimeTable(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetLoadTable

func GetLoadTable(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetPDClusterStatusTable

func GetPDClusterStatusTable(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetPDConfigInfo

func GetPDConfigInfo(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetPDCurrentConfig

func GetPDCurrentConfig(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetPDEtcdStatusTable

func GetPDEtcdStatusTable(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetPDSchedulerInfo

func GetPDSchedulerInfo(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetPDTimeConsumeTable

func GetPDTimeConsumeTable(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetProcessMemUsageTable

func GetProcessMemUsageTable(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetReportTables

func GetReportTables(startTime, endTime string, db *gorm.DB, sqliteDB *dbstore.DB, reportID uint) []*TableDef

func GetReportTablesForDisplay

func GetReportTablesForDisplay(startTime, endTime string, db *gorm.DB, sqliteDB *dbstore.DB, reportID uint) []*TableDef

func GetStoreStatusTable

func GetStoreStatusTable(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetTiDBCurrentConfig

func GetTiDBCurrentConfig(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetTiDBDDLOwner

func GetTiDBDDLOwner(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetTiDBGCConfigInfo

func GetTiDBGCConfigInfo(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetTiDBTimeConsumeTable

func GetTiDBTimeConsumeTable(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetTiDBTxnTableData

func GetTiDBTxnTableData(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetTiKVCacheHitTable

func GetTiKVCacheHitTable(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetTiKVCopInfo

func GetTiKVCopInfo(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetTiKVCurrentConfig

func GetTiKVCurrentConfig(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetTiKVErrorTable

func GetTiKVErrorTable(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetTiKVGCInfo

func GetTiKVGCInfo(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetTiKVRaftInfo

func GetTiKVRaftInfo(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetTiKVRegionSizeInfo

func GetTiKVRegionSizeInfo(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetTiKVRocksDBTimeConsumeTable

func GetTiKVRocksDBTimeConsumeTable(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetTiKVSchedulerInfo

func GetTiKVSchedulerInfo(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetTiKVSnapshotInfo

func GetTiKVSnapshotInfo(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetTiKVStoreInfo

func GetTiKVStoreInfo(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetTiKVTaskInfo

func GetTiKVTaskInfo(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetTiKVThreadCPUTable

func GetTiKVThreadCPUTable(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetTiKVTotalTimeConsumeTable

func GetTiKVTotalTimeConsumeTable(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetTotalErrorTable

func GetTotalErrorTable(startTime, endTime string, db *gorm.DB) (TableDef, error)

func GetTotalTimeConsumeTable

func GetTotalTimeConsumeTable(startTime, endTime string, db *gorm.DB) (TableDef, error)

func (TableDef) ColumnWidth

func (t TableDef) ColumnWidth() []int

type TableRowDef

type TableRowDef struct {
	Values    []string
	SubValues [][]string // SubValues need fold default.

	Comment string
	// contains filtered or unexported fields
}

func NewTableRowDef

func NewTableRowDef(values []string, subValues [][]string) TableRowDef

Jump to

Keyboard shortcuts

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