statement

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: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QuerySchemas

func QuerySchemas(db *gorm.DB) ([]string, error)

Types

type Detail

type Detail struct {
	SchemaName         string `json:"schema_name"`
	Digest             string `json:"digest"`
	DigestText         string `json:"digest_text"`
	AggSumLatency      int    `json:"sum_latency"`
	AggExecCount       int    `json:"exec_count"`
	AggAvgAffectedRows int    `json:"avg_affected_rows"`
	AggAvgTotalKeys    int    `json:"avg_total_keys"`

	AggTableNames string `json:"agg_table_names"`
	// Schemas is extracted from table_names column
	// table_names example: "d1.t1,d2.t2", we extract the "d1,d2" as schemas
	AggSchemas string `json:"schemas"`

	QuerySampleText string `json:"query_sample_text"`
	LastSeen        string `json:"last_seen"`

	Plans []*Plan `json:"plans"`
}

Detail represents the detail of a statement

func QueryStatementDetail

func QueryStatementDetail(db *gorm.DB, schema, beginTime, endTime, digest string) (*Detail, error)

Sample params: schemas: "tpcc" beginTime: "2020-02-13 10:30:00" endTime: "2020-02-13 11:00:00" digest: "bcaa7bdb37e24d03fb48f20cc32f4ff3f51c0864dc378829e519650df5c7b923"

func (*Detail) AfterFind

func (detail *Detail) AfterFind() (err error)

type Node

type Node struct {
	Address         string `json:"address"`
	SumLatency      int    `json:"sum_latency"`
	ExecCount       int    `json:"exec_count"`
	AvgLatency      int    `json:"avg_latency"`
	MaxLatency      int    `json:"max_latency"`
	AvgMem          int    `json:"avg_mem"`
	SumBackoffTimes int    `json:"sum_backoff_times"`
}

Node represents the statement in each node

func QueryStatementNodes

func QueryStatementNodes(db *gorm.DB, schema, beginTime, endTime, digest string) (result []*Node, err error)

Sample params: schemas: "tpcc" beginTime: "2020-02-13 10:30:00" endTime: "2020-02-13 11:00:00" digest: "bcaa7bdb37e24d03fb48f20cc32f4ff3f51c0864dc378829e519650df5c7b923"

type Overview

type Overview struct {
	SchemaName         string `json:"schema_name"`
	Digest             string `json:"digest"`
	DigestText         string `json:"digest_text"`
	AggSumLatency      int    `json:"sum_latency"`
	AggAvgLatency      int    `json:"avg_latency"`
	AggExecCount       int    `json:"exec_count"`
	AggAvgAffectedRows int    `json:"avg_affected_rows"`
	AggAvgMem          int    `json:"avg_mem"`

	AggTableNames string `json:"agg_table_names"`
	// Schemas is extracted from table_names column
	// table_names example: "d1.t1,d2.t2", we extract the "d1,d2" as schemas
	AggSchemas string `json:"schemas"`
}

Overview represents the overview of a statement

func QueryStatementsOverview

func QueryStatementsOverview(db *gorm.DB, schemas []string, beginTime, endTime string) (result []*Overview, err error)

Sample params: schemas: ["tpcc", "test"] beginTime: "2020-02-13 10:30:00" endTime: "2020-02-13 11:00:00"

func (*Overview) AfterFind

func (overview *Overview) AfterFind() (err error)

type Plan

type Plan struct {
	PlanDigest string `json:"digest"`
	Plan       string `json:"content"`
}

type Service

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

func NewService

func NewService(config *config.Config, tidbForwarder *tidb.Forwarder) *Service

func (*Service) Register

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

type TimeRange

type TimeRange struct {
	BeginTime string `json:"begin_time"`
	EndTime   string `json:"end_time"`
}

TimeRange represents a range of time

func QueryTimeRanges

func QueryTimeRanges(db *gorm.DB) (result []*TimeRange, err error)

Jump to

Keyboard shortcuts

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