logstats

package
v0.19.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogStats

type LogStats struct {
	Ctx            context.Context
	Method         string
	TabletType     string
	StmtType       string
	SQL            string
	BindVariables  map[string]*querypb.BindVariable
	StartTime      time.Time
	EndTime        time.Time
	ShardQueries   uint64
	RowsAffected   uint64
	RowsReturned   uint64
	PlanTime       time.Duration
	ExecuteTime    time.Duration
	CommitTime     time.Duration
	Error          error
	TablesUsed     []string
	SessionUUID    string
	CachedPlan     bool
	ActiveKeyspace string // ActiveKeyspace is the selected keyspace `use ks`
}

LogStats records the stats for a single vtgate query

func NewLogStats

func NewLogStats(ctx context.Context, methodName, sql, sessionUUID string, bindVars map[string]*querypb.BindVariable) *LogStats

NewLogStats constructs a new LogStats with supplied Method and ctx field values, and the StartTime field set to the present time.

func (*LogStats) ContextHTML

func (stats *LogStats) ContextHTML() safehtml.HTML

ContextHTML returns the HTML version of the context that was used, or "". This is a method on LogStats instead of a field so that it doesn't need to be passed by value everywhere.

func (*LogStats) EffectiveCaller

func (stats *LogStats) EffectiveCaller() string

EffectiveCaller returns the effective caller stored in LogStats.Ctx

func (*LogStats) ErrorStr

func (stats *LogStats) ErrorStr() string

ErrorStr returns the error string or ""

func (*LogStats) EventTime

func (stats *LogStats) EventTime() time.Time

EventTime returns the time the event was created.

func (*LogStats) ImmediateCaller

func (stats *LogStats) ImmediateCaller() string

ImmediateCaller returns the immediate caller stored in LogStats.Ctx

func (*LogStats) Logf

func (stats *LogStats) Logf(w io.Writer, params url.Values) error

Logf formats the log record to the given writer, either as tab-separated list of logged fields or as JSON.

func (*LogStats) RemoteAddrUsername

func (stats *LogStats) RemoteAddrUsername() (string, string)

RemoteAddrUsername returns some parts of CallInfo if set

func (*LogStats) SaveEndTime

func (stats *LogStats) SaveEndTime()

SaveEndTime sets the end time of this request to now

func (*LogStats) TotalTime

func (stats *LogStats) TotalTime() time.Duration

TotalTime returns how long this query has been running

Jump to

Keyboard shortcuts

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