events

package
v0.0.0-...-5db00e0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2017 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package events is a generated protocol buffer package.

It is generated from these files:

events.proto

It has these top-level messages:

Metadata
Outputs
SystemLog
Event
CreateEventResponse

Index

Constants

This section is empty.

Variables

View Source
var Marshaler = &jsonpb.Marshaler{
	EnumsAsInts:  false,
	EmitDefaults: false,
	Indent:       "\t",
}

Marshaler provides a default JSON marshaler.

View Source
var Type_name = map[int32]string{
	0:  "UNKNOWN",
	1:  "TASK_STATE",
	2:  "TASK_START_TIME",
	3:  "TASK_END_TIME",
	4:  "TASK_OUTPUTS",
	5:  "TASK_METADATA",
	6:  "EXECUTOR_START_TIME",
	7:  "EXECUTOR_END_TIME",
	8:  "EXECUTOR_EXIT_CODE",
	11: "EXECUTOR_STDOUT",
	12: "EXECUTOR_STDERR",
	13: "SYSTEM_LOG",
}
View Source
var Type_value = map[string]int32{
	"UNKNOWN":             0,
	"TASK_STATE":          1,
	"TASK_START_TIME":     2,
	"TASK_END_TIME":       3,
	"TASK_OUTPUTS":        4,
	"TASK_METADATA":       5,
	"EXECUTOR_START_TIME": 6,
	"EXECUTOR_END_TIME":   7,
	"EXECUTOR_EXIT_CODE":  8,
	"EXECUTOR_STDOUT":     11,
	"EXECUTOR_STDERR":     12,
	"SYSTEM_LOG":          13,
}

Functions

func Marshal

func Marshal(ev *Event) (string, error)

Marshal marshals the event to JSON.

func RegisterEventServiceServer

func RegisterEventServiceServer(s *grpc.Server, srv EventServiceServer)

func TailLogs

func TailLogs(ctx context.Context, taskID string, attempt, index uint32, size int64, interval time.Duration, out Writer) (stdout, stderr io.Writer)

TailLogs returns stdout/err io.Writers which will track the tail of the content (up to "size") and emit events. Events are rate limited by "interval", e.g. a max of one event every 5 seconds.

func Unmarshal

func Unmarshal(b []byte, ev *Event) error

Unmarshal unmarshals the event from JSON.

Types

type CreateEventResponse

type CreateEventResponse struct {
}

func (*CreateEventResponse) Descriptor

func (*CreateEventResponse) Descriptor() ([]byte, []int)

func (*CreateEventResponse) ProtoMessage

func (*CreateEventResponse) ProtoMessage()

func (*CreateEventResponse) Reset

func (m *CreateEventResponse) Reset()

func (*CreateEventResponse) String

func (m *CreateEventResponse) String() string

type ErrLogger

type ErrLogger struct {
	Writer
	Log *logger.Logger
}

ErrLogger writes an error message to the given logger when an event write fails.

func (*ErrLogger) Write

func (e *ErrLogger) Write(ev *Event) error

type Event

type Event struct {
	Id        string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
	Timestamp string `protobuf:"bytes,2,opt,name=timestamp" json:"timestamp,omitempty"`
	// Types that are valid to be assigned to Data:
	//	*Event_State
	//	*Event_StartTime
	//	*Event_EndTime
	//	*Event_Outputs
	//	*Event_Metadata
	//	*Event_ExitCode
	//	*Event_Stdout
	//	*Event_Stderr
	//	*Event_SystemLog
	Data    isEvent_Data `protobuf_oneof:"data"`
	Attempt uint32       `protobuf:"varint,16,opt,name=attempt" json:"attempt,omitempty"`
	Index   uint32       `protobuf:"varint,17,opt,name=index" json:"index,omitempty"`
	Type    Type         `protobuf:"varint,18,opt,name=type,enum=events.Type" json:"type,omitempty"`
}

func NewEndTime

func NewEndTime(taskID string, attempt uint32, t time.Time) *Event

NewEndTime creates a task end time event.

func NewExecutorEndTime

func NewExecutorEndTime(taskID string, attempt uint32, index uint32, t time.Time) *Event

NewExecutorEndTime creates an executor end time event. for the executor at the given index.

func NewExecutorStartTime

func NewExecutorStartTime(taskID string, attempt uint32, index uint32, t time.Time) *Event

NewExecutorStartTime creates an executor start time event for the executor at the given index.

func NewExitCode

func NewExitCode(taskID string, attempt uint32, index uint32, x int32) *Event

NewExitCode creates an executor exit code event for the executor at the given index.

func NewMetadata

func NewMetadata(taskID string, attempt uint32, m map[string]string) *Event

NewMetadata creates a task metadata log event.

func NewOutputs

func NewOutputs(taskID string, attempt uint32, f []*tes.OutputFileLog) *Event

NewOutputs creates a task output file log event.

func NewStartTime

func NewStartTime(taskID string, attempt uint32, t time.Time) *Event

NewStartTime creates a task start time event.

func NewState

func NewState(taskID string, attempt uint32, s tes.State) *Event

NewState creates a state change event.

func NewStderr

func NewStderr(taskID string, attempt uint32, index uint32, s string) *Event

NewStderr creates an executor stderr chunk event for the executor at the given index.

func NewStdout

func NewStdout(taskID string, attempt uint32, index uint32, s string) *Event

NewStdout creates an executor stdout chunk event for the executor at the given index.

func NewSystemLog

func NewSystemLog(taskID string, attempt uint32, index uint32, lvl string, msg string, fields map[string]string) *Event

NewSystemLog creates an system log event.

func (*Event) Descriptor

func (*Event) Descriptor() ([]byte, []int)

func (*Event) GetAttempt

func (m *Event) GetAttempt() uint32

func (*Event) GetData

func (m *Event) GetData() isEvent_Data

func (*Event) GetEndTime

func (m *Event) GetEndTime() string

func (*Event) GetExitCode

func (m *Event) GetExitCode() int32

func (*Event) GetId

func (m *Event) GetId() string

func (*Event) GetIndex

func (m *Event) GetIndex() uint32

func (*Event) GetMetadata

func (m *Event) GetMetadata() *Metadata

func (*Event) GetOutputs

func (m *Event) GetOutputs() *Outputs

func (*Event) GetStartTime

func (m *Event) GetStartTime() string

func (*Event) GetState

func (m *Event) GetState() tes.State

func (*Event) GetStderr

func (m *Event) GetStderr() string

func (*Event) GetStdout

func (m *Event) GetStdout() string

func (*Event) GetSystemLog

func (m *Event) GetSystemLog() *SystemLog

func (*Event) GetTimestamp

func (m *Event) GetTimestamp() string

func (*Event) GetType

func (m *Event) GetType() Type

func (*Event) ProtoMessage

func (*Event) ProtoMessage()

func (*Event) Reset

func (m *Event) Reset()

func (*Event) String

func (m *Event) String() string

func (*Event) XXX_OneofFuncs

func (*Event) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

type EventServiceClient

type EventServiceClient interface {
	CreateEvent(ctx context.Context, in *Event, opts ...grpc.CallOption) (*CreateEventResponse, error)
}

func NewEventServiceClient

func NewEventServiceClient(cc *grpc.ClientConn) EventServiceClient

type EventServiceServer

type EventServiceServer interface {
	CreateEvent(context.Context, *Event) (*CreateEventResponse, error)
}

type Event_EndTime

type Event_EndTime struct {
	EndTime string `protobuf:"bytes,5,opt,name=end_time,json=endTime,oneof"`
}

type Event_ExitCode

type Event_ExitCode struct {
	ExitCode int32 `protobuf:"varint,10,opt,name=exit_code,json=exitCode,oneof"`
}

type Event_Metadata

type Event_Metadata struct {
	Metadata *Metadata `protobuf:"bytes,7,opt,name=metadata,oneof"`
}

type Event_Outputs

type Event_Outputs struct {
	Outputs *Outputs `protobuf:"bytes,6,opt,name=outputs,oneof"`
}

type Event_StartTime

type Event_StartTime struct {
	StartTime string `protobuf:"bytes,4,opt,name=start_time,json=startTime,oneof"`
}

type Event_State

type Event_State struct {
	State tes.State `protobuf:"varint,3,opt,name=state,enum=tes.State,oneof"`
}

type Event_Stderr

type Event_Stderr struct {
	Stderr string `protobuf:"bytes,14,opt,name=stderr,oneof"`
}

type Event_Stdout

type Event_Stdout struct {
	Stdout string `protobuf:"bytes,13,opt,name=stdout,oneof"`
}

type Event_SystemLog

type Event_SystemLog struct {
	SystemLog *SystemLog `protobuf:"bytes,15,opt,name=system_log,json=systemLog,oneof"`
}

type ExecutorGenerator

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

ExecutorGenerator is a type that generates Events for an Executor of a Task

func NewExecutorGenerator

func NewExecutorGenerator(taskID string, attempt uint32, index uint32) *ExecutorGenerator

NewExecutorGenerator returns a ExecutorGenerator instance.

func (*ExecutorGenerator) Debug

func (eg *ExecutorGenerator) Debug(msg string, args ...interface{}) *Event

Debug creates a debug level system log message.

func (*ExecutorGenerator) EndTime

func (eg *ExecutorGenerator) EndTime(t time.Time) *Event

EndTime updates an executor's end time log.

func (*ExecutorGenerator) Error

func (eg *ExecutorGenerator) Error(msg string, args ...interface{}) *Event

Error creates an error level system log message.

func (*ExecutorGenerator) ExitCode

func (eg *ExecutorGenerator) ExitCode(x int) *Event

ExitCode updates an executor's exit code log.

func (*ExecutorGenerator) Info

func (eg *ExecutorGenerator) Info(msg string, args ...interface{}) *Event

Info creates an info level system log message.

func (*ExecutorGenerator) StartTime

func (eg *ExecutorGenerator) StartTime(t time.Time) *Event

StartTime updates an executor's start time log.

func (*ExecutorGenerator) Stderr

func (eg *ExecutorGenerator) Stderr(s string) *Event

Stderr appends to an executor's stderr log.

func (*ExecutorGenerator) Stdout

func (eg *ExecutorGenerator) Stdout(s string) *Event

Stdout appends to an executor's stdout log.

type ExecutorWriter

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

ExecutorWriter is a type that generates and writes executor events.

func NewExecutorWriter

func NewExecutorWriter(taskID string, attempt uint32, index uint32, logLevel string, w Writer) *ExecutorWriter

NewExecutorWriter returns a ExecutorWriter instance.

func (*ExecutorWriter) Debug

func (ew *ExecutorWriter) Debug(msg string, args ...interface{}) error

Debug writes a debug level system log message.

func (*ExecutorWriter) EndTime

func (ew *ExecutorWriter) EndTime(t time.Time) error

EndTime updates the task's end time log.

func (*ExecutorWriter) Error

func (ew *ExecutorWriter) Error(msg string, args ...interface{}) error

Error writes an error level system log message.

func (*ExecutorWriter) ExitCode

func (ew *ExecutorWriter) ExitCode(x int) error

ExitCode updates an executor's exit code log.

func (*ExecutorWriter) Info

func (ew *ExecutorWriter) Info(msg string, args ...interface{}) error

Info writes an info level system log message.

func (*ExecutorWriter) StartTime

func (ew *ExecutorWriter) StartTime(t time.Time) error

StartTime updates the task's start time log.

func (*ExecutorWriter) Stderr

func (ew *ExecutorWriter) Stderr(s string) error

Stderr appends to an executor's stderr log.

func (*ExecutorWriter) Stdout

func (ew *ExecutorWriter) Stdout(s string) error

Stdout appends to an executor's stdout log.

func (*ExecutorWriter) TailLogs

func (ew *ExecutorWriter) TailLogs(ctx context.Context, size int64, interval time.Duration) (stdout, stderr io.Writer)

TailLogs returns stdout/err io.Writers which will track the tail of the content (up to "size") and emit events. Events are rate limited by "interval", e.g. a max of one event every 5 seconds.

type KafkaReader

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

KafkaReader reads events to a Kafka topic and writes them to a Writer.

func NewKafkaReader

func NewKafkaReader(conf config.Kafka, w Writer) (*KafkaReader, error)

NewKafkaReader creates a new event reader for reading events from a Kafka topic and writing them to the given Writer.

func (*KafkaReader) Close

func (k *KafkaReader) Close() error

Close closes the Kafka reader, cleaning up resources.

type KafkaWriter

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

KafkaWriter writes events to a Kafka topic.

func NewKafkaWriter

func NewKafkaWriter(conf config.Kafka) (*KafkaWriter, error)

NewKafkaWriter creates a new event writer for writing events to a Kafka topic.

func (*KafkaWriter) Close

func (k *KafkaWriter) Close() error

Close closes the Kafka producer, cleaning up resources.

func (*KafkaWriter) Write

func (k *KafkaWriter) Write(ev *Event) error

Write writes the event. Events may be sent in batches in the background by the Kafka client library. Currently stdout, stderr, and system log events are dropped.

type Logger

type Logger struct {
	Log *logger.Logger
}

Logger writes events to a funnel logger.

func (*Logger) Close

func (el *Logger) Close() error

Close closes the writer.

func (*Logger) Write

func (el *Logger) Write(ev *Event) error

Write writes an event to the logger.

type Metadata

type Metadata struct {
	Value map[string]string `` /* 130-byte string literal not displayed */
}

func (*Metadata) Descriptor

func (*Metadata) Descriptor() ([]byte, []int)

func (*Metadata) GetValue

func (m *Metadata) GetValue() map[string]string

func (*Metadata) ProtoMessage

func (*Metadata) ProtoMessage()

func (*Metadata) Reset

func (m *Metadata) Reset()

func (*Metadata) String

func (m *Metadata) String() string

type Outputs

type Outputs struct {
	Value []*tes.OutputFileLog `protobuf:"bytes,1,rep,name=value" json:"value,omitempty"`
}

func (*Outputs) Descriptor

func (*Outputs) Descriptor() ([]byte, []int)

func (*Outputs) GetValue

func (m *Outputs) GetValue() []*tes.OutputFileLog

func (*Outputs) ProtoMessage

func (*Outputs) ProtoMessage()

func (*Outputs) Reset

func (m *Outputs) Reset()

func (*Outputs) String

func (m *Outputs) String() string

type RPCWriter

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

RPCWriter is a type which writes Events to RPC.

func NewRPCWriter

func NewRPCWriter(conf config.RPC) (*RPCWriter, error)

NewRPCWriter returns a new RPCWriter instance.

func (*RPCWriter) Close

func (r *RPCWriter) Close() error

Close closes the writer.

func (*RPCWriter) Write

func (r *RPCWriter) Write(e *Event) error

Write writes the event. The RPC call may timeout, based on the timeout given by the configuration in NewRPCWriter.

type SystemLog

type SystemLog struct {
	Msg    string            `protobuf:"bytes,1,opt,name=msg" json:"msg,omitempty"`
	Level  string            `protobuf:"bytes,2,opt,name=level" json:"level,omitempty"`
	Fields map[string]string `` /* 132-byte string literal not displayed */
}

func (*SystemLog) Descriptor

func (*SystemLog) Descriptor() ([]byte, []int)

func (*SystemLog) GetFields

func (m *SystemLog) GetFields() map[string]string

func (*SystemLog) GetLevel

func (m *SystemLog) GetLevel() string

func (*SystemLog) GetMsg

func (m *SystemLog) GetMsg() string

func (*SystemLog) ProtoMessage

func (*SystemLog) ProtoMessage()

func (*SystemLog) Reset

func (m *SystemLog) Reset()

func (*SystemLog) String

func (m *SystemLog) String() string

type SystemLogGenerator

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

SystemLogGenerator is a type that emulates the logger interface and outputs Events.

func (*SystemLogGenerator) Debug

func (sle *SystemLogGenerator) Debug(msg string, args ...interface{}) *Event

Debug creates an Event for a 'debug' level log message

func (*SystemLogGenerator) Error

func (sle *SystemLogGenerator) Error(msg string, args ...interface{}) *Event

Error creates an Event for an 'error' level log message

func (*SystemLogGenerator) Info

func (sle *SystemLogGenerator) Info(msg string, args ...interface{}) *Event

Info creates an Event for an 'info' level log message

type SystemLogWriter

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

SystemLogWriter is a type that emulates the logger interface and outputs Events.

func (*SystemLogWriter) Debug

func (sle *SystemLogWriter) Debug(msg string, args ...interface{}) error

Debug writes an for a 'debug' level log message

func (*SystemLogWriter) Error

func (sle *SystemLogWriter) Error(msg string, args ...interface{}) error

Error writes an Event for an 'error' level log message

func (*SystemLogWriter) Info

func (sle *SystemLogWriter) Info(msg string, args ...interface{}) error

Info writes an Event for an 'info' level log message

type TaskBuilder

type TaskBuilder struct {
	*tes.Task
}

TaskBuilder aggregates events into an in-memory Task object.

func (TaskBuilder) Close

func (tb TaskBuilder) Close() error

Close is a noop.

func (TaskBuilder) Write

func (tb TaskBuilder) Write(ev *Event) error

Write updates the Task object.

type TaskGenerator

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

TaskGenerator is a type that generates Events for a given Task execution attempt.

func NewTaskGenerator

func NewTaskGenerator(taskID string, attempt uint32) *TaskGenerator

NewTaskGenerator creates a TaskGenerator instance.

func (*TaskGenerator) Debug

func (eg *TaskGenerator) Debug(msg string, args ...interface{}) *Event

Debug creates a debug level system log message.

func (*TaskGenerator) EndTime

func (eg *TaskGenerator) EndTime(t time.Time) *Event

EndTime updates the task's end time log.

func (*TaskGenerator) Error

func (eg *TaskGenerator) Error(msg string, args ...interface{}) *Event

Error creates an error level system log message.

func (*TaskGenerator) Info

func (eg *TaskGenerator) Info(msg string, args ...interface{}) *Event

Info creates an info level system log message.

func (*TaskGenerator) Metadata

func (eg *TaskGenerator) Metadata(m map[string]string) *Event

Metadata updates the task's metadata log.

func (*TaskGenerator) Outputs

func (eg *TaskGenerator) Outputs(f []*tes.OutputFileLog) *Event

Outputs updates the task's output file log.

func (*TaskGenerator) StartTime

func (eg *TaskGenerator) StartTime(t time.Time) *Event

StartTime updates the task's start time log.

func (*TaskGenerator) State

func (eg *TaskGenerator) State(s tes.State) *Event

State sets the state of the task.

type TaskWriter

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

TaskWriter is a type that generates and writes task events.

func NewTaskWriter

func NewTaskWriter(taskID string, attempt uint32, logLevel string, w Writer) *TaskWriter

NewTaskWriter returns a TaskWriter instance.

func (*TaskWriter) Close

func (ew *TaskWriter) Close() error

Close closes the writer.

func (*TaskWriter) Debug

func (ew *TaskWriter) Debug(msg string, args ...interface{}) error

Debug creates a debug level system log message.

func (*TaskWriter) EndTime

func (ew *TaskWriter) EndTime(t time.Time) error

EndTime updates the task's end time log.

func (*TaskWriter) Error

func (ew *TaskWriter) Error(msg string, args ...interface{}) error

Error creates an error level system log message.

func (*TaskWriter) Info

func (ew *TaskWriter) Info(msg string, args ...interface{}) error

Info creates an info level system log message.

func (*TaskWriter) Metadata

func (ew *TaskWriter) Metadata(m map[string]string) error

Metadata updates the task's metadata log.

func (*TaskWriter) NewExecutorWriter

func (ew *TaskWriter) NewExecutorWriter(index uint32) *ExecutorWriter

NewExecutorWriter returns a new ExecutorEventWriter instance that inherits its config from the Task

func (*TaskWriter) Outputs

func (ew *TaskWriter) Outputs(f []*tes.OutputFileLog) error

Outputs updates the task's output file log.

func (*TaskWriter) StartTime

func (ew *TaskWriter) StartTime(t time.Time) error

StartTime updates the task's start time log.

func (*TaskWriter) State

func (ew *TaskWriter) State(s tes.State) error

State sets the state of the task.

type Type

type Type int32
const (
	Type_UNKNOWN             Type = 0
	Type_TASK_STATE          Type = 1
	Type_TASK_START_TIME     Type = 2
	Type_TASK_END_TIME       Type = 3
	Type_TASK_OUTPUTS        Type = 4
	Type_TASK_METADATA       Type = 5
	Type_EXECUTOR_START_TIME Type = 6
	Type_EXECUTOR_END_TIME   Type = 7
	Type_EXECUTOR_EXIT_CODE  Type = 8
	Type_EXECUTOR_STDOUT     Type = 11
	Type_EXECUTOR_STDERR     Type = 12
	Type_SYSTEM_LOG          Type = 13
)

func (Type) EnumDescriptor

func (Type) EnumDescriptor() ([]byte, []int)

func (Type) String

func (x Type) String() string

type Writer

type Writer interface {
	Write(*Event) error
	Close() error
}

Writer provides write access to a task's events

func MultiWriter

func MultiWriter(ws ...Writer) Writer

MultiWriter writes events to all the given writers.

Jump to

Keyboard shortcuts

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