execstats

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FlowsMetadata

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

FlowsMetadata contains metadata extracted from flows that comprise a single physical plan. This information is stored in sql.flowInfo and is analyzed by TraceAnalyzer.

func NewFlowsMetadata

func NewFlowsMetadata(flows map[base.SQLInstanceID]*execinfrapb.FlowSpec) *FlowsMetadata

NewFlowsMetadata creates a FlowsMetadata for the given physical plan information.

type NodeLevelStats

type NodeLevelStats struct {
	NetworkBytesSentGroupedByNode map[base.SQLInstanceID]int64
	MaxMemoryUsageGroupedByNode   map[base.SQLInstanceID]int64
	MaxDiskUsageGroupedByNode     map[base.SQLInstanceID]int64
	KVBytesReadGroupedByNode      map[base.SQLInstanceID]int64
	KVRowsReadGroupedByNode       map[base.SQLInstanceID]int64
	KVTimeGroupedByNode           map[base.SQLInstanceID]time.Duration
	NetworkMessagesGroupedByNode  map[base.SQLInstanceID]int64
	ContentionTimeGroupedByNode   map[base.SQLInstanceID]time.Duration
}

NodeLevelStats returns all the flow level stats that correspond to the given traces and flow metadata. TODO(asubiotto): Flatten this struct, we're currently allocating a map per

stat.

type QueryLevelStats

type QueryLevelStats struct {
	NetworkBytesSent int64
	MaxMemUsage      int64
	MaxDiskUsage     int64
	KVBytesRead      int64
	KVRowsRead       int64
	KVTime           time.Duration
	NetworkMessages  int64
	ContentionTime   time.Duration
	Regions          []string
}

QueryLevelStats returns all the query level stats that correspond to the given traces and flow metadata. NOTE: When adding fields to this struct, be sure to update Accumulate.

func GetQueryLevelStats

func GetQueryLevelStats(
	trace []tracingpb.RecordedSpan, deterministicExplainAnalyze bool, flowsMetadata []*FlowsMetadata,
) (QueryLevelStats, error)

GetQueryLevelStats returns all the top-level stats in a QueryLevelStats struct. GetQueryLevelStats tries to process as many stats as possible. If errors occur while processing stats, GetQueryLevelStats returns the combined errors to the caller but continues calculating other stats.

func (*QueryLevelStats) Accumulate

func (s *QueryLevelStats) Accumulate(other QueryLevelStats)

Accumulate accumulates other's stats into the receiver.

type TraceAnalyzer

type TraceAnalyzer struct {
	*FlowsMetadata
	// contains filtered or unexported fields
}

TraceAnalyzer is a struct that helps calculate top-level statistics from a flow metadata and an accompanying trace of the flows' execution.

func NewTraceAnalyzer

func NewTraceAnalyzer(flowsMetadata *FlowsMetadata) *TraceAnalyzer

NewTraceAnalyzer creates a TraceAnalyzer with the corresponding physical plan. Call AddTrace to calculate meaningful stats.

func (*TraceAnalyzer) AddTrace

func (a *TraceAnalyzer) AddTrace(trace []tracingpb.RecordedSpan, makeDeterministic bool) error

AddTrace adds the stats from the given trace to the TraceAnalyzer.

If makeDeterministic is set, statistics that can vary from run to run are set to fixed values; see ComponentStats.MakeDeterministic.

func (*TraceAnalyzer) GetNodeLevelStats

func (a *TraceAnalyzer) GetNodeLevelStats() NodeLevelStats

GetNodeLevelStats returns the node level stats calculated and stored in the TraceAnalyzer.

func (*TraceAnalyzer) GetQueryLevelStats

func (a *TraceAnalyzer) GetQueryLevelStats() QueryLevelStats

GetQueryLevelStats returns the query level stats calculated and stored in TraceAnalyzer.

func (*TraceAnalyzer) ProcessStats

func (a *TraceAnalyzer) ProcessStats() error

ProcessStats calculates node level and query level stats for the trace and stores them in TraceAnalyzer. If errors occur while calculating stats, ProcessStats returns the combined errors to the caller but continues calculating other stats.

Jump to

Keyboard shortcuts

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