示例#1
0
// GetQueryzRows returns a list of QueryDetailzRow sorted by start time
func (ql *QueryList) GetQueryzRows() []QueryDetailzRow {
	ql.mu.Lock()
	rows := []QueryDetailzRow{}
	for _, qd := range ql.queryDetails {
		row := QueryDetailzRow{
			Query:       qd.conn.Current(),
			ContextHTML: callinfo.HTMLFromContext(qd.ctx),
			Start:       qd.start,
			Duration:    time.Now().Sub(qd.start),
			ConnID:      qd.connID,
		}
		rows = append(rows, row)
	}
	ql.mu.Unlock()
	sort.Sort(byStartTime(rows))
	return rows
}
示例#2
0
文件: logstats.go 项目: yab/vitess
// 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 (stats *LogStats) ContextHTML() template.HTML {
	return callinfo.HTMLFromContext(stats.ctx)
}
示例#3
0
// ContextHTML returns the HTML version of the context that was used, or "".
// This is a method on SQLQueryStats instead of a field so that it doesn't need
// to be passed by value everywhere.
func (stats *SQLQueryStats) ContextHTML() template.HTML {
	return callinfo.HTMLFromContext(stats.context)
}