Documentation
¶
Index ¶
- Constants
- Variables
- func ContextWithStatsInfo(requestCtx context.Context, stats *StatsInfo) context.Context
- func EnsureStatsInfoCanBeFound(ctx context.Context, from context.Context) context.Context
- func StatsArrayToJsonString(arr []float64) []byte
- type ConnType
- type StatsArray
- func (s *StatsArray) Add(delta *StatsArray) *StatsArray
- func (s *StatsArray) GetConnType() float64
- func (s *StatsArray) GetMemorySize() float64
- func (s *StatsArray) GetOutTrafficBytes() float64
- func (s *StatsArray) GetS3IOInputCount() float64
- func (s *StatsArray) GetS3IOOutputCount() float64
- func (s *StatsArray) GetTimeConsumed() float64
- func (s *StatsArray) GetVersion() float64
- func (s *StatsArray) Init() *StatsArray
- func (s *StatsArray) InitIfEmpty() *StatsArray
- func (s *StatsArray) Reset() *StatsArray
- func (s *StatsArray) ToJsonString() []byte
- func (s *StatsArray) WithConnType(v ConnType) *StatsArray
- func (s *StatsArray) WithMemorySize(v float64) *StatsArray
- func (s *StatsArray) WithOutTrafficBytes(v float64) *StatsArray
- func (s *StatsArray) WithS3IOInputCount(v float64) *StatsArray
- func (s *StatsArray) WithS3IOOutputCount(v float64) *StatsArray
- func (s *StatsArray) WithTimeConsumed(v float64) *StatsArray
- func (s *StatsArray) WithVersion(v float64) *StatsArray
- type StatsInfo
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
View Source
var DefaultStatsArrayJsonString = initStatsArray.ToJsonString()
Functions ¶
func ContextWithStatsInfo ¶ added in v1.0.1
func EnsureStatsInfoCanBeFound ¶ added in v1.0.1
EnsureStatsInfoCanBeFound ensure a statement statistic is set in context, if not, copy one from another context, this function is copied from EnsureStatementProfiler
func StatsArrayToJsonString ¶
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 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 (*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()
Click to show internal directories.
Click to hide internal directories.