compilerproxylog

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package compilerproxylog provides compiler_proxy INFO log parser.

Index

Constants

View Source
const (
	// Compiling is normal compiling (-c).
	Compiling CompileMode = iota

	// Precompiling is precompiling header (-c for header).
	Precompiling

	// Linking is other compilation mode.
	Linking

	// NumCompileMode is number of CompilerMode.
	NumCompileMode int = iota
)

Variables

This section is empty.

Functions

func ClassifyByCompileMode

func ClassifyByCompileMode(tl []*TaskLog) [NumCompileMode][]*TaskLog

ClassifyByCompileMode classifies TaskLog by CompileMode.

func ClassifyByResponse

func ClassifyByResponse(tl []*TaskLog) map[string][]*TaskLog

ClassifyByResponse classifies TaskLog by response.

func DurationDistribution

func DurationDistribution(st time.Time, tl []*TaskLog) []time.Duration

DurationDistribution returns duration distribution by # of tasks.

Types

type ByDuration

type ByDuration struct{ TaskLogs }

ByDuration sorts a list of TaskLogs by duration.

func (ByDuration) Less

func (tl ByDuration) Less(i, j int) bool

Less is used to sort a list of TaskLogs by Duration.

type ByPending

type ByPending struct{ TaskLogs }

ByPending sorts a list of TaskLogs by pending.

func (ByPending) Less

func (tl ByPending) Less(i, j int) bool

Less is used to sort a list of TaskLogs by Pending.

type ByRunDuration

type ByRunDuration struct{ TaskLogs }

ByRunDuration sorts a list of TaskLogs by run duration.

func (ByRunDuration) Less

func (tl ByRunDuration) Less(i, j int) bool

Less is used to sort a list of TaskLogs by RunDuration.

type CompileMode

type CompileMode int

CompileMode is mode of compilation.

func (CompileMode) String

func (cm CompileMode) String() string

type CompilerProxyLog

type CompilerProxyLog struct {
	// Filename is a filename of the compiler_proxy INFO log.
	Filename string

	// Created is a timestamp when the compiler_proxy INFO log was created.
	Created time.Time

	// Closed is a timestamp when the compiler_proxy INFO log was closed.
	Closed time.Time

	// Machine is a machine where the compiler_proxy INFO log was created.
	Machine string

	// GomaRevision is goma revision of the compiler_proxy.
	GomaRevision string

	// GomaVersion is goma version of the compiler_proxy if it is released one.
	GomaVersion string

	// CompilerProxyIDPrefix is compiler_proxy_id prefix.
	CompilerProxyIDPrefix string

	// BuildIDs is build_id appeared in compiler_proxy log.
	// on bot, it will be one build id.
	BuildIDs []string

	// GomaFlags is goma configuration flags.
	GomaFlags string

	// GomaLimits is goma limits.
	GomaLimits string

	// CrashDump is crash dump filename if any.
	CrashDump string

	// Stats is compiler_proxy stats.
	Stats string

	// Histogram is compiler_proxy histogram.
	Histogram string

	// HTTPErrors is http errors detected in compiler proxy log.
	// value is task id.
	HTTPErrors map[HTTPError][]string
	// contains filtered or unexported fields
}

CompilerProxyLog represents parsed compiler_proxy INFO log.

func Parse

func Parse(fname string, rd io.Reader) (*CompilerProxyLog, error)

Parse parses compiler_proxy.

func (*CompilerProxyLog) Duration

func (cpl *CompilerProxyLog) Duration() time.Duration

Duration returns duration of running time of compiler_proxy.

func (*CompilerProxyLog) TaskLogs

func (cpl *CompilerProxyLog) TaskLogs() []*TaskLog

TaskLogs reports TaskLogs sorted by task id.

type GlogParser

type GlogParser struct {

	// Created is a timestamp when the log file is created.
	Created time.Time
	// Machine is a machine name where the log file is created.
	Machine string
	// contains filtered or unexported fields
}

GlogParser is a parser of glog.

func NewGlogParser

func NewGlogParser(rd io.Reader) (*GlogParser, error)

NewGlogParser creates new GlogParser on rd.

func (*GlogParser) Err

func (gp *GlogParser) Err() error

Err returns last error.

func (*GlogParser) Logline

func (gp *GlogParser) Logline() Logline

Logline returns last Logline parsed by Next().

func (*GlogParser) Next

func (gp *GlogParser) Next() bool

Next scans next Logline. return true if Logline exists.

type HTTPError

type HTTPError struct {
	Op   string
	Code int
	Resp string
}

HTTPError is a http error detected by compiler proxy.

type LogLevel

type LogLevel int

LogLevel is glog logging level.

const (

	// Info is INFO level.
	Info LogLevel
	// Warning is WARNING level.
	Warning
	// Error is ERROR level.
	Error
	// Fatal is FATAL level.
	Fatal
)

func (LogLevel) String

func (lv LogLevel) String() string

type Logline

type Logline struct {
	// Level is logging level.
	Level LogLevel
	// Timestamp is time of log.
	Timestamp time.Time
	// ThreadID is thread id.
	ThreadID string
	// Lines is log text lines. len(Lines) >= 1.
	Lines []string
}

Logline is one logical log line.

func ParseLogline

func ParseLogline(line []byte) (Logline, error)

ParseLogline parses one line as Logline.

type TaskLog

type TaskLog struct {
	// ID is task id.
	ID string

	// BuildID is build id for the task.
	BuildID string

	// Desc is task description. (e.g. input_filename).
	Desc string

	// CompileMode is compile mode of the task.
	CompileMode CompileMode

	// AcceptTime is a time when this task is accepted by compiler_proxy.
	AcceptTime time.Time

	// StartTime is a time when compiler_proxy started to handle this task.
	StartTime time.Time

	// EndTime is a time when compiler_proxy finished to handle this task.
	EndTime time.Time

	// Logs are logs associated with the task.
	Logs []Logline

	// HTTPErrors are http errors happened in the task.
	HTTPErrors []HTTPError

	// Response is a response type of the task. (e.g. "goma success").
	Response string
}

TaskLog is a Task's log.

func (*TaskLog) Duration

func (t *TaskLog) Duration() time.Duration

Duration is total task duration (i.e. gomacc time).

func (*TaskLog) Pending

func (t *TaskLog) Pending() time.Duration

Pending is pending duration until the task is handled as CompileTask.

func (*TaskLog) RunDuration

func (t *TaskLog) RunDuration() time.Duration

RunDuration is task duration of CompileTask.

type TaskLogs

type TaskLogs []*TaskLog

TaskLogs is a list of TaskLogs. It would be used to sort a list of TaskLogs by id.

func (TaskLogs) Len

func (tl TaskLogs) Len() int

func (TaskLogs) Less

func (tl TaskLogs) Less(i, j int) bool

func (TaskLogs) Swap

func (tl TaskLogs) Swap(i, j int)

Jump to

Keyboard shortcuts

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