summarize

package
v0.0.0-...-4f35aff Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const HotQueryCount = 10

Variables

This section is empty.

Functions

func Run

func Run(files []string, hotMetric string, showGraph bool, outputFormat string, launchWebServer bool)

Types

type ColumnInformation

type ColumnInformation struct {
	Name string
	Pos  Position
}

func ColumnInfoFromString

func ColumnInfoFromString(s string) (*ColumnInformation, error)

func (*ColumnInformation) String

func (ci *ColumnInformation) String() string

type ColumnUsage

type ColumnUsage struct {
	Percentage float64
	Count      int
}

type FailuresSummary

type FailuresSummary struct {
	Error string
	Count int
}

type Highlighter

type Highlighter func(out io.Writer, query string) error

type PlanAnalysis

type PlanAnalysis struct {
	PassThrough  int
	SimpleRouted int
	Complex      int
	Unplannable  int
	// contains filtered or unexported fields
}

type Position

type Position int
const (
	Join Position = iota
	JoinRange
	Where
	WhereRange
	Grouping
)

func PositionFromString

func PositionFromString(s string) (Position, error)

func (Position) String

func (p Position) String() string

type QueryPattern

type QueryPattern struct {
	Type           string
	Table          string
	Predicates     []string
	UpdatedColumns []string
}

type QuerySummary

type QuerySummary struct {
	Q TracedQuery
	RouteCalls,
	RowsSent,
	RowsInMemory,
	ShardsQueried int
}

type Summary

type Summary struct {
	Tables       []*TableSummary
	Failures     []FailuresSummary
	Transactions []TransactionSummary
	HotQueries   []keys.QueryAnalysisResult

	AnalyzedFiles []string

	Joins       []joinDetails
	HasRowCount bool
	// contains filtered or unexported fields
}

func NewSummary

func NewSummary(hotMetric string) (*Summary, error)

func (*Summary) AddTable

func (s *Summary) AddTable(table *TableSummary)

func (*Summary) GetTable

func (s *Summary) GetTable(name string) *TableSummary

func (*Summary) PrintMarkdown

func (s *Summary) PrintMarkdown(out io.Writer, now time.Time) error

type SummaryOutput

type SummaryOutput struct {
	Summary
	DateOfAnalysis string
}

type TableSummary

type TableSummary struct {
	Table            string
	ReadQueryCount   int
	WriteQueryCount  int
	ColumnUses       map[string]ColumnUsage
	JoinPredicates   []operators.JoinPredicate
	Failed           bool
	RowCount         int
	ReferencedTables []*dbinfo.ForeignKey
}

func (TableSummary) GetColumns

func (TableSummary) GetColumnsSlice

func (ts TableSummary) GetColumnsSlice() []TemplateColumn

func (TableSummary) IsEmpty

func (ts TableSummary) IsEmpty() bool

func (TableSummary) UseCount

func (ts TableSummary) UseCount() int

type TemplateColumn

type TemplateColumn struct {
	ColInfo ColumnInformation
	Usage   ColumnUsage
}

type Trace

type Trace struct {
	OperatorType       string  `json:"OperatorType"`
	Variant            string  `json:"Variant"`
	NoOfCalls          int     `json:"NoOfCalls"`
	AvgNumberOfRows    float64 `json:"AvgNumberOfRows"`
	MedianNumberOfRows float64 `json:"MedianNumberOfRows"`
	ShardsQueried      int     `json:"ShardsQueried"`
	Inputs             []Trace `json:"Inputs,omitempty"`
}

Trace represents the recursive structure of the Trace field

func (*Trace) TotalRows

func (trace *Trace) TotalRows() int

type TracedQuery

type TracedQuery struct {
	Trace      Trace  `json:"Trace"`
	Query      string `json:"Query"`
	LineNumber string `json:"LineNumber"`
}

TracedQuery represents the structure of each element in the JSON file

type TransactionSummary

type TransactionSummary struct {
	Count   int
	Queries []QueryPattern

	// Joins contain a list of columns that are joined together.
	// Each outer slice is one set of columns that are joined together.
	Joins [][]string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳