statistic

package
v1.2.3-hotfix-20240916 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Decimal128ToFloat64Scale = 5
	Float64PrecForMemorySize = 3
	Float64PrecForCU         = 4
)
View Source
const (
	StatsArrayVersion0 = iota // raw statistics

	StatsArrayVersion1 = 1 // float64 array
	StatsArrayVersion2 = 2 // float64 array + plus one elem OutTrafficBytes
	StatsArrayVersion3 = 3 // ... + 1 elem: ConnType
	StatsArrayVersion4 = 4 // ... + 2 elem: OutPacketCount, CU

	StatsArrayVersionLatest // same value as last variable StatsArrayVersion#
)
View Source
const (
	StatsArrayIndexVersion = iota
	StatsArrayIndexTimeConsumed
	StatsArrayIndexMemorySize
	StatsArrayIndexS3IOInputCount
	StatsArrayIndexS3IOOutputCount // index: 4
	StatsArrayIndexOutTrafficBytes // index: 5
	StatsArrayIndexConnType        // index: 6
	StatsArrayIndexOutPacketCnt    // index: 7, version: 4
	StatsArrayIndexCU              // index: 8, version: 4

	StatsArrayLength
)
View Source
const (
	StatsArrayLengthV1 = 5
	StatsArrayLengthV2 = 6
	StatsArrayLengthV3 = 7
	StatsArrayLengthV4 = 9
)
View Source
const StatsArrayVersion = StatsArrayVersionLatest

Variables

View Source
var DefaultStatsArray = *initStatsArray
View Source
var DefaultStatsArrayJsonString = initStatsArray.ToJsonString()

Functions

func ContextWithStatsInfo added in v1.0.1

func ContextWithStatsInfo(requestCtx context.Context, stats *StatsInfo) context.Context

func EnsureStatsInfoCanBeFound added in v1.0.1

func EnsureStatsInfoCanBeFound(ctx context.Context, from context.Context) context.Context

EnsureStatsInfoCanBeFound ensure a statement statistic is set in context, if not, copy one from another context, this function is copied from EnsureStatementProfiler

func StatsArrayToJsonString

func StatsArrayToJsonString(arr []float64) []byte

StatsArrayToJsonString return json arr format example: [1,0,0,0,0] got `[1,0,0,0,0]` [1,2,3,4,5] got `[1,2,3.000,4,5]` [2,1,2,3,4,5] got `[2,3.000,4,5,6.000,7]`

Types

type ConnType

type ConnType float64
const (
	ConnTypeUnknown  ConnType = 0
	ConnTypeInternal ConnType = 1
	ConnTypeExternal ConnType = 2
)

type StatsArray

type StatsArray [StatsArrayLength]float64

func NewStatsArray

func NewStatsArray() *StatsArray

func NewStatsArrayV1

func NewStatsArrayV1() *StatsArray

func NewStatsArrayV2

func NewStatsArrayV2() *StatsArray

func NewStatsArrayV3

func NewStatsArrayV3() *StatsArray

func NewStatsArrayV4 added in v1.1.2

func NewStatsArrayV4() *StatsArray

func (*StatsArray) Add

func (s *StatsArray) Add(delta *StatsArray) *StatsArray

Add do add two stats array together except for Element ConnType, which idx = StatsArrayIndexConnType, just keep s[StatsArrayIndexConnType] value.

func (*StatsArray) GetCU added in v1.1.2

func (s *StatsArray) GetCU() float64

func (*StatsArray) GetConnType

func (s *StatsArray) GetConnType() float64

func (*StatsArray) GetMemorySize

func (s *StatsArray) GetMemorySize() float64

func (*StatsArray) GetOutPacketCount added in v1.1.2

func (s *StatsArray) GetOutPacketCount() float64

func (*StatsArray) GetOutTrafficBytes

func (s *StatsArray) GetOutTrafficBytes() float64

func (*StatsArray) GetS3IOInputCount

func (s *StatsArray) GetS3IOInputCount() float64

func (*StatsArray) GetS3IOOutputCount

func (s *StatsArray) GetS3IOOutputCount() float64

func (*StatsArray) GetTimeConsumed

func (s *StatsArray) GetTimeConsumed() float64

func (*StatsArray) GetVersion

func (s *StatsArray) GetVersion() float64

func (*StatsArray) Init

func (s *StatsArray) Init() *StatsArray

func (*StatsArray) InitIfEmpty

func (s *StatsArray) InitIfEmpty() *StatsArray

func (*StatsArray) Reset

func (s *StatsArray) Reset() *StatsArray

func (*StatsArray) ToJsonString

func (s *StatsArray) ToJsonString() []byte

func (*StatsArray) WithCU added in v1.1.2

func (s *StatsArray) WithCU(v float64) *StatsArray

func (*StatsArray) WithConnType

func (s *StatsArray) WithConnType(v ConnType) *StatsArray

func (*StatsArray) WithMemorySize

func (s *StatsArray) WithMemorySize(v float64) *StatsArray

func (*StatsArray) WithOutPacketCount added in v1.1.2

func (s *StatsArray) WithOutPacketCount(v float64) *StatsArray

func (*StatsArray) WithOutTrafficBytes

func (s *StatsArray) WithOutTrafficBytes(v float64) *StatsArray

func (*StatsArray) WithS3IOInputCount

func (s *StatsArray) WithS3IOInputCount(v float64) *StatsArray

func (*StatsArray) WithS3IOOutputCount

func (s *StatsArray) WithS3IOOutputCount(v float64) *StatsArray

func (*StatsArray) WithTimeConsumed

func (s *StatsArray) WithTimeConsumed(v float64) *StatsArray

func (*StatsArray) WithVersion

func (s *StatsArray) WithVersion(v float64) *StatsArray

WithVersion set the version array in StatsArray, please carefully to use.

type StatsInfo added in v1.0.1

type StatsInfo struct {
	ParseDuration     time.Duration `json:"ParseDuration"`
	PlanDuration      time.Duration `json:"PlanDuration"`
	CompileDuration   time.Duration `json:"CompileDuration"`
	ExecutionDuration time.Duration `json:"ExecutionDuration"`
	// Statistics on the time consumption of the output operator in generating data for query statements
	OutputDuration int64 `json:"OutputDuration"`

	IOAccessTimeConsumption int64

	// Local FileService blocking wait time
	LocalFSReadIOMergerTimeConsumption int64

	// S3 FileService blocking wait time
	S3FSPrefetchFileIOMergerTimeConsumption int64
	S3FSReadIOMergerTimeConsumption         int64

	ParseStartTime     time.Time `json:"ParseStartTime"`
	PlanStartTime      time.Time `json:"PlanStartTime"`
	CompileStartTime   time.Time `json:"CompileStartTime"`
	ExecutionStartTime time.Time `json:"ExecutionStartTime"`
	ExecutionEndTime   time.Time `json:"ExecutionEndTime"`

	WaitActiveCost time.Duration `json:"WaitActive"`
}

statistic info of sql

func StatsInfoFromContext added in v1.0.1

func StatsInfoFromContext(requestCtx context.Context) *StatsInfo

func (*StatsInfo) AddIOAccessTimeConsumption added in v1.1.1

func (stats *StatsInfo) AddIOAccessTimeConsumption(d time.Duration)

func (*StatsInfo) AddLocalFSReadIOMergerTimeConsumption added in v1.2.0

func (stats *StatsInfo) AddLocalFSReadIOMergerTimeConsumption(d time.Duration)

func (*StatsInfo) AddOutputTimeConsumption added in v1.2.3

func (stats *StatsInfo) AddOutputTimeConsumption(d time.Duration)

func (*StatsInfo) AddS3FSPrefetchFileIOMergerTimeConsumption added in v1.2.0

func (stats *StatsInfo) AddS3FSPrefetchFileIOMergerTimeConsumption(d time.Duration)

func (*StatsInfo) AddS3FSReadIOMergerTimeConsumption added in v1.2.0

func (stats *StatsInfo) AddS3FSReadIOMergerTimeConsumption(d time.Duration)

func (*StatsInfo) CompileEnd added in v1.0.1

func (stats *StatsInfo) CompileEnd()

func (*StatsInfo) CompileStart added in v1.0.1

func (stats *StatsInfo) CompileStart()

func (*StatsInfo) ExecutionEnd added in v1.0.1

func (stats *StatsInfo) ExecutionEnd()

func (*StatsInfo) ExecutionStart added in v1.0.1

func (stats *StatsInfo) ExecutionStart()

func (*StatsInfo) IOMergerTimeConsumption added in v1.2.0

func (stats *StatsInfo) IOMergerTimeConsumption() int64

func (*StatsInfo) PlanEnd added in v1.0.1

func (stats *StatsInfo) PlanEnd()

func (*StatsInfo) PlanStart added in v1.0.1

func (stats *StatsInfo) PlanStart()

func (*StatsInfo) Reset added in v1.0.1

func (stats *StatsInfo) Reset()

reset StatsInfo into zero state

func (*StatsInfo) ResetIOAccessTimeConsumption added in v1.2.3

func (stats *StatsInfo) ResetIOAccessTimeConsumption()

func (*StatsInfo) ResetIOMergerTimeConsumption added in v1.2.3

func (stats *StatsInfo) ResetIOMergerTimeConsumption()

func (*StatsInfo) SetWaitActiveCost added in v1.2.0

func (stats *StatsInfo) SetWaitActiveCost(cost time.Duration)

Jump to

Keyboard shortcuts

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