telemetry

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type      EventType
	Timestamp time.Time
	Name      string
	Info      LogInfo
}

An Event is created, when a flunc starts, ends or generates a log message.

type EventStore

type EventStore struct {
	// contains filtered or unexported fields
}

An EventStore stores Events.

func Instrument

func Instrument(c *job.Config) (flunc.Flunc, *EventStore, error)

func NewBuilder

func NewBuilder() (job.ConfigBuilder, *EventStore)

NewBuilder returns a ConfigBuilder that instruments the execution tree for gathering telemetry information. It also returns an EventStore that gets populated with Events during execution.

func (*EventStore) Get

func (e *EventStore) Get() []Event

Get returns a copy of all Events in the store.

func (*EventStore) Reset

func (e *EventStore) Reset() []Event

Reset clears all events and returns a copy of all events that have been cleared.

type EventType

type EventType uint
const (
	EventStart EventType = iota
	EventLog
	EventEnd
	EventFailed
)

func (EventType) String

func (e EventType) String() string

type LogInfo

type LogInfo struct {
	File, Message string
	Line          int
}

type NamedConfigBuilder

type NamedConfigBuilder interface {
	Sequential(nodeName string) job.Group
	Parallel(nodeName string) job.Group
	Job(nodeName string, name string) job.Group
	Output(nodeName string, o *job.Output) interface{}
	JobLogger(nodeName string, jobName string) interface{}
	HostLogger(nodeName string, jobName string, h *job.Host) interface{}
	Timeout(nodeName string, timeout time.Duration) interface{}
	SCP(nodeName string, scp *job.ScpData) interface{}
	Hosts(nodeName string) job.Group
	Host(nodeName string, c *job.Config, h *job.Host) job.Group
	ErrorSafeguard(nodeName string, child interface{}) interface{}
	ContextBounds(nodeName string, child interface{}) interface{}
	Retry(nodeName string, child interface{}, retries uint) interface{}
	Templating(nodeName string, c *job.Config, h *job.Host) interface{}
	SSHClient(nodeName string, host, user, keyFile, password string, keyboardInteractive map[string]string) interface{}
	Forwarding(nodeName string, f *job.Forwarding) interface{}
	Tunnel(nodeName string, f *job.Forwarding) interface{}
	Commands(nodeName string, cmd *job.Command) job.Group
	Command(nodeName string, cmd *job.Command) interface{}
	LocalCommand(nodeName string, cmd *job.Command) interface{}
	Stdout(nodeName string, o *job.Output) interface{}
	Stderr(nodeName string, o *job.Output) interface{}
}

NamedConfigBuilder is an interface for ConfigBuilders, that assign names to the generated nodes.

type NamingBuilder

type NamingBuilder struct {
	NamedConfigBuilder
	Counter counter
}

NamingBuilder is a ConfigBuilder that assigns each node a unique name. The name of the current node is passed to the child ConfigBuilder.

func (*NamingBuilder) Command

func (t *NamingBuilder) Command(cmd *job.Command) interface{}

func (*NamingBuilder) Commands

func (t *NamingBuilder) Commands(cmd *job.Command) job.Group

func (*NamingBuilder) ContextBounds

func (t *NamingBuilder) ContextBounds(child interface{}) interface{}

func (*NamingBuilder) ErrorSafeguard

func (t *NamingBuilder) ErrorSafeguard(child interface{}) interface{}

func (*NamingBuilder) Forwarding

func (t *NamingBuilder) Forwarding(f *job.Forwarding) interface{}

func (*NamingBuilder) Host

func (t *NamingBuilder) Host(c *job.Config, h *job.Host) job.Group

func (*NamingBuilder) HostLogger

func (t *NamingBuilder) HostLogger(jobName string, h *job.Host) interface{}

func (*NamingBuilder) Hosts

func (t *NamingBuilder) Hosts() job.Group

func (*NamingBuilder) Job

func (t *NamingBuilder) Job(name string) job.Group

func (*NamingBuilder) JobLogger

func (t *NamingBuilder) JobLogger(jobName string) interface{}

func (*NamingBuilder) LocalCommand

func (t *NamingBuilder) LocalCommand(cmd *job.Command) interface{}

func (*NamingBuilder) Output

func (t *NamingBuilder) Output(o *job.Output) interface{}

func (*NamingBuilder) Parallel

func (t *NamingBuilder) Parallel() job.Group

func (*NamingBuilder) Retry

func (t *NamingBuilder) Retry(child interface{}, retries uint) interface{}

func (*NamingBuilder) SCP

func (t *NamingBuilder) SCP(scp *job.ScpData) interface{}

func (*NamingBuilder) SSHClient

func (t *NamingBuilder) SSHClient(host, user, keyFile, password string, keyboardInteractive map[string]string) interface{}

func (*NamingBuilder) Sequential

func (t *NamingBuilder) Sequential() job.Group

func (*NamingBuilder) Stderr

func (t *NamingBuilder) Stderr(o *job.Output) interface{}

func (*NamingBuilder) Stdout

func (t *NamingBuilder) Stdout(o *job.Output) interface{}

func (*NamingBuilder) Templating

func (t *NamingBuilder) Templating(c *job.Config, h *job.Host) interface{}

func (*NamingBuilder) Timeout

func (t *NamingBuilder) Timeout(timeout time.Duration) interface{}

func (*NamingBuilder) Tunnel

func (t *NamingBuilder) Tunnel(f *job.Forwarding) interface{}

type NodeStatus

type NodeStatus int

NodeStatus describes the status of a node.

const (
	// Execution didn't start yet.
	StateReady NodeStatus = iota
	// Node is currently executed.
	StateRunning
	// Execution completed.
	StateCompleted
	// Execution failed.
	StateFailed
)

type Timing

type Timing struct {
	JobRuntime time.Duration
	Hosts      map[*job.Host]*timingNode
	// contains filtered or unexported fields
}

func NewTiming

func NewTiming(c *job.Config) (*Timing, error)

NewTiming generates a new Timing from the given config.

func (*Timing) Apply

func (v *Timing) Apply(event Event)

Apply applies an event to the Timing.

func (*Timing) ApplyChan

func (v *Timing) ApplyChan(events <-chan Event)

ApplyChan progressivly applies the job events sent through the channel to the Timing.

func (*Timing) ApplyStore

func (v *Timing) ApplyStore(events []Event)

ApplyStore applies all events to the Timing.

type Visualization

type Visualization struct {
	// contains filtered or unexported fields
}

Visualization shows the execution tree of a job in a specific state.

func NewVisualization

func NewVisualization(c *job.Config) (*Visualization, error)

NewVisualization generates a new Visualization from the given config.

func (*Visualization) Apply

func (v *Visualization) Apply(event Event)

Apply applies an event to the visualization.

func (*Visualization) ApplyChan

func (v *Visualization) ApplyChan(events <-chan Event)

ApplyChan progressivly applies the job events sent through the channel to the visualization.

func (*Visualization) ApplyStore

func (v *Visualization) ApplyStore(events []Event)

ApplyStore applies all events to the visualization.

func (*Visualization) String

func (v *Visualization) String() string

Jump to

Keyboard shortcuts

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