Back to godoc.org
egt.run/observer

Package observer

v0.0.0-...-52b21a1
Latest Go to latest

The highest tagged major version is .

Published: Apr 7, 2020 | License: ISC | Module: egt.run/observer

Index

Constants

const (
	LogKeyRole      = "role"
	LogKeyHost      = "host"
	LogKeyReqID     = "req_id"
	LogKeyTimestamp = "ts"
	LogKeyMsg       = "msg"
)

func End

func End(l Logger, event string)

End event recording.

func LastFile

func LastFile(dir, ext string) (string, error)

LastFile in a directory.

func Start

func Start(l Logger, event string)

Start recording an event.

type Event

type Event struct {
	Role      string  `json:"role"`
	Host      string  `json:"host"`
	RequestID string  `json:"req_id"`
	Time      decTime `json:"ts"`
	Msg       string  `json:"msg"`
}

func FilterByRequestID

func FilterByRequestID(evs []*Event, id string) []*Event

func ParseEvents

func ParseEvents(rdr io.Reader) ([]*Event, error)

ParseEvents in a reader line by line.

func ParseEventsFile

func ParseEventsFile(pth string) ([]*Event, error)

ParseEventsFile is a convenience wrapper around ParseEvents to work with a file.

type EventSet

type EventSet struct {
	RoleTimings map[string]time.Duration
	HostTimings map[string]time.Duration
	MsgTimings  []*Timing
}

func NewEventSet

func NewEventSet(events []*Event) *EventSet

type Logger

type Logger interface {
	Printf(msg string, vals ...interface{})
}

type RequestDetail

type RequestDetail struct {
	Duration time.Duration
	RolePath []*Timing
}

RequestDetail describes at a higher level the route the request took across hosts/roles and the total time.

func RequestDetailFromEvents

func RequestDetailFromEvents(evs []*Event) *RequestDetail

type Timing

type Timing struct {
	Msg      string
	Duration time.Duration
}

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier