statistic

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	Decimal128ToFloat64Scale = 5
	Float64PrecForMemorySize = 3
)
View Source
const (
	StatsArrayVersion = StatsArrayVersion3

	StatsArrayVersion0 = 0 // raw statistics
	StatsArrayVersion1 = 1 // float64 array
	StatsArrayVersion2 = 2 // float64 array + plus one elem OutTrafficBytes
	StatsArrayVersion3 = 3 // ... + one elem: ConnType
)
View Source
const (
	StatsArrayIndexVersion = iota
	StatsArrayIndexTimeConsumed
	StatsArrayIndexMemorySize
	StatsArrayIndexS3IOInputCount
	StatsArrayIndexS3IOOutputCount // index: 4
	StatsArrayIndexOutTrafficBytes // index: 5
	StatsArrayIndexConnType        // index: 6

	StatsArrayLength
)
View Source
const (
	StatsArrayLengthV1 = 5
	StatsArrayLengthV2 = 6
	StatsArrayLengthV3 = 7
)

Variables

View Source
var DefaultStatsArray = *initStatsArray.Init()
View Source
var DefaultStatsArrayJsonString = initStatsArray.Init().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 (*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) GetConnType

func (s *StatsArray) GetConnType() float64

func (*StatsArray) GetMemorySize

func (s *StatsArray) GetMemorySize() 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) WithConnType

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

func (*StatsArray) WithMemorySize

func (s *StatsArray) WithMemorySize(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"`

	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"`
}

statistic info of sql

func StatsInfoFromContext added in v1.0.1

func StatsInfoFromContext(requestCtx context.Context) *StatsInfo

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) 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

Jump to

Keyboard shortcuts

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