event

package
v0.0.0-...-1d50e38 Latest Latest
Warning

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

Go to latest
Published: May 30, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// resource type
	ResourceTypeDistro = "DISTRO"

	// event types
	EventDistroAdded    = "DISTRO_ADDED"
	EventDistroModified = "DISTRO_MODIFIED"
	EventDistroRemoved  = "DISTRO_REMOVED"
)
View Source
const (
	// db constants
	AllLogCollection  = "event_log"
	TaskLogCollection = "task_event_log"
)
View Source
const (
	// resource type
	ResourceTypeHost = "HOST"

	// event types
	EventHostCreated              = "HOST_CREATED"
	EventHostStatusChanged        = "HOST_STATUS_CHANGED"
	EventHostDNSNameSet           = "HOST_DNS_NAME_SET"
	EventHostProvisionFailed      = "HOST_PROVISION_FAILED"
	EventHostProvisioned          = "HOST_PROVISIONED"
	EventHostRunningTaskSet       = "HOST_RUNNING_TASK_SET"
	EventHostRunningTaskCleared   = "HOST_RUNNING_TASK_CLEARED"
	EventHostTaskPidSet           = "HOST_TASK_PID_SET"
	EventHostMonitorFlag          = "HOST_MONITOR_FLAG"
	EventTaskFinished             = "HOST_TASK_FINISHED"
	EventHostTeardown             = "HOST_TEARDOWN"
	EventHostTerminatedExternally = "HOST_TERMINATED_EXTERNALLY"
)
View Source
const (
	// resource type
	ResourceTypeScheduler = "SCHEDULER"

	// event types
	EventSchedulerRun = "SCHEDULER_RUN"
)
View Source
const (
	// resource type
	ResourceTypeTask = "TASK"

	// event types
	TaskCreated      = "TASK_CREATED"
	TaskDispatched   = "TASK_DISPATCHED"
	TaskUndispatched = "TASK_UNDISPATCHED"
	TaskStarted      = "TASK_STARTED"
	TaskFinished     = "TASK_FINISHED"
	TaskRestarted    = "TASK_RESTARTED"
	TaskActivated    = "TASK_ACTIVATED"
	TaskDeactivated  = "TASK_DEACTIVATED"
	TaskAbortRequest = "TASK_ABORT_REQUEST"
	TaskScheduled    = "TASK_SCHEDULED"
)
View Source
const (
	EventTaskSystemInfo  = "TASK_SYSTEM_INFO"
	EventTaskProcessInfo = "TASK_PROCESS_INFO"
)

Variables

View Source
var (
	// bson fields for the event struct
	TimestampKey  = bsonutil.MustHaveTag(Event{}, "Timestamp")
	ResourceIdKey = bsonutil.MustHaveTag(Event{}, "ResourceId")
	TypeKey       = bsonutil.MustHaveTag(Event{}, "EventType")
	DataKey       = bsonutil.MustHaveTag(Event{}, "Data")

	// resource type key.  this doesn't exist a part of the event struct,
	// but has to be the same for all of the event types
	ResourceTypeKey = bsonutil.MustHaveTag(HostEventData{}, "ResourceType")
)
View Source
var (
	TaskSystemResourceDataSysInfoKey      = bsonutil.MustHaveTag(TaskSystemResourceData{}, "SystemInfo")
	TaskSystemResourceDataResourceTypeKey = bsonutil.MustHaveTag(TaskSystemResourceData{}, "ResourceType")

	SysInfoCPUKey      = bsonutil.MustHaveTag(message.SystemInfo{}, "CPU")
	SysInfoNumCPUKey   = bsonutil.MustHaveTag(message.SystemInfo{}, "NumCPU")
	SysInfoVMStatKey   = bsonutil.MustHaveTag(message.SystemInfo{}, "VMStat")
	SysInfoNetStatKey  = bsonutil.MustHaveTag(message.SystemInfo{}, "NetStat")
	SysInfoPartionsKey = bsonutil.MustHaveTag(message.SystemInfo{}, "Partitions")
	SysInfoUsageKey    = bsonutil.MustHaveTag(message.SystemInfo{}, "Usage")
	SysInfoIoStatKey   = bsonutil.MustHaveTag(message.SystemInfo{}, "IOStat")
	SysInfoErrorsKey   = bsonutil.MustHaveTag(message.SystemInfo{}, "Errors")

	SysInfoCPUTimesStatCPUKey         = bsonutil.MustHaveTag(message.SystemInfo{}.CPU, "CPU")
	SysInfoCPUTimesStatUserKey        = bsonutil.MustHaveTag(message.SystemInfo{}.CPU, "User")
	SysInfoCPUTimesStatSystemKey      = bsonutil.MustHaveTag(message.SystemInfo{}.CPU, "System")
	SysInfoCPUTimesStatIdleKey        = bsonutil.MustHaveTag(message.SystemInfo{}.CPU, "Idle")
	SysInfoCPUTimesStatNiceKey        = bsonutil.MustHaveTag(message.SystemInfo{}.CPU, "Nice")
	SysInfoCPUTimesStatIowaitKey      = bsonutil.MustHaveTag(message.SystemInfo{}.CPU, "Iowait")
	SysInfoCPUTimesStatIrqKey         = bsonutil.MustHaveTag(message.SystemInfo{}.CPU, "Irq")
	SysInfoCPUTimesStatSoftirqKey     = bsonutil.MustHaveTag(message.SystemInfo{}.CPU, "Softirq")
	SysInfoCPUTimesStatStealKey       = bsonutil.MustHaveTag(message.SystemInfo{}.CPU, "Steal")
	SysInfoCPUTimesStatGuestNiceKey   = bsonutil.MustHaveTag(message.SystemInfo{}.CPU, "GuestNice")
	SysInfoCPUTimesStatGuestStolenKey = bsonutil.MustHaveTag(message.SystemInfo{}.CPU, "Stolen")

	SysInfoVMStatTotalKey        = bsonutil.MustHaveTag(message.SystemInfo{}.VMStat, "Total")
	SysInfoVMStatAvailableKey    = bsonutil.MustHaveTag(message.SystemInfo{}.VMStat, "Available")
	SysInfoVMStatUsedKey         = bsonutil.MustHaveTag(message.SystemInfo{}.VMStat, "Used")
	SysInfoVMStatUsedPercentKey  = bsonutil.MustHaveTag(message.SystemInfo{}.VMStat, "UsedPercent")
	SysInfoVMStatFreeKey         = bsonutil.MustHaveTag(message.SystemInfo{}.VMStat, "Free")
	SysInfoVMStatActiveKey       = bsonutil.MustHaveTag(message.SystemInfo{}.VMStat, "Active")
	SysInfoVMStatInactiveKey     = bsonutil.MustHaveTag(message.SystemInfo{}.VMStat, "Inactive")
	SysInfoVMStatWiredKey        = bsonutil.MustHaveTag(message.SystemInfo{}.VMStat, "Wired")
	SysInfoVMStatBuffersKey      = bsonutil.MustHaveTag(message.SystemInfo{}.VMStat, "Buffers")
	SysInfoVMStatCachedKey       = bsonutil.MustHaveTag(message.SystemInfo{}.VMStat, "Cached")
	SysInfoVMStatWritebackKey    = bsonutil.MustHaveTag(message.SystemInfo{}.VMStat, "Writeback")
	SysInfoVMStatDirtyKey        = bsonutil.MustHaveTag(message.SystemInfo{}.VMStat, "Dirty")
	SysInfoVMStatWritebackTmpKey = bsonutil.MustHaveTag(message.SystemInfo{}.VMStat, "WritebackTmp")
	SysInfoVMStatSharedKey       = bsonutil.MustHaveTag(message.SystemInfo{}.VMStat, "Shared")
	SysInfoVMStatSlabKey         = bsonutil.MustHaveTag(message.SystemInfo{}.VMStat, "Slab")
	SysInfoVMStatPageTablesKey   = bsonutil.MustHaveTag(message.SystemInfo{}.VMStat, "PageTables")
	SysInfoVMStatSwapCachedKey   = bsonutil.MustHaveTag(message.SystemInfo{}.VMStat, "SwapCached")

	SysInfoNetIOCountersNameKey        = bsonutil.MustHaveTag(message.SystemInfo{}.NetStat, "Name")
	SysInfoNetIOCountersBytesSentKey   = bsonutil.MustHaveTag(message.SystemInfo{}.NetStat, "BytesSent")
	SysInfoNetIOCountersBytesRecvKey   = bsonutil.MustHaveTag(message.SystemInfo{}.NetStat, "BytesRecv")
	SysInfoNetIOCountersPacketsSentKey = bsonutil.MustHaveTag(message.SystemInfo{}.NetStat, "PacketsSent")
	SysInfoNetIOCountersPacketsRecvKey = bsonutil.MustHaveTag(message.SystemInfo{}.NetStat, "PacketsRecv")
	SysInfoNetIOCountersErrinKey       = bsonutil.MustHaveTag(message.SystemInfo{}.NetStat, "Errin")
	SysInfoNetIOCountersErroutKey      = bsonutil.MustHaveTag(message.SystemInfo{}.NetStat, "Errout")
	SysInfoNetIOCountersDropinKey      = bsonutil.MustHaveTag(message.SystemInfo{}.NetStat, "Dropin")
	SysInfoNetIOCountersDropoutKey     = bsonutil.MustHaveTag(message.SystemInfo{}.NetStat, "Dropout")
	SysInfoNetIOCountersFifoinKey      = bsonutil.MustHaveTag(message.SystemInfo{}.NetStat, "Fifoin")
	SysInfoNetIOCountersFifooutKey     = bsonutil.MustHaveTag(message.SystemInfo{}.NetStat, "Fifoout")

	SysInfoPartitionStatDeviceKey     = bsonutil.MustHaveTag(message.SystemInfo{}.Partitions, "Device")
	SysInfoPartitionStatMountpointKey = bsonutil.MustHaveTag(message.SystemInfo{}.Partitions, "Mountpoint")
	SysInfoPartitionStatFSTypeKey     = bsonutil.MustHaveTag(message.SystemInfo{}.Partitions, "Fstype")
	SysInfoPartitionStatOptsKey       = bsonutil.MustHaveTag(message.SystemInfo{}.Partitions, "Opts")

	SysInfoUsageStatPathKey              = bsonutil.MustHaveTag(message.SystemInfo{}.Usage, "Path")
	SysInfoUsageStatFSTypeKey            = bsonutil.MustHaveTag(message.SystemInfo{}.Usage, "Fstype")
	SysInfoUsageStatTotalKey             = bsonutil.MustHaveTag(message.SystemInfo{}.Usage, "Total")
	SysInfoUsageStatFreeKey              = bsonutil.MustHaveTag(message.SystemInfo{}.Usage, "Free")
	SysInfoUsageStatUsedKey              = bsonutil.MustHaveTag(message.SystemInfo{}.Usage, "Used")
	SysInfoUsageStatUsedPercentKey       = bsonutil.MustHaveTag(message.SystemInfo{}.Usage, "UsedPercent")
	SysInfoUsageStatInodesTotalKey       = bsonutil.MustHaveTag(message.SystemInfo{}.Usage, "InodesTotal")
	SysInfoUsageStatInodesUsedKey        = bsonutil.MustHaveTag(message.SystemInfo{}.Usage, "InodesUsed")
	SysInfoUsageStatInodesFreeKey        = bsonutil.MustHaveTag(message.SystemInfo{}.Usage, "InodesFree")
	SysInfoUsageStatInodesUsedPercentKey = bsonutil.MustHaveTag(message.SystemInfo{}.Usage, "InodesUsedPercent")

	SysInfoDiskIOCountersReadCountKey        = bsonutil.MustHaveTag(message.SystemInfo{}.IOStat, "ReadCount")
	SysInfoDiskIOCountersMergedReadCountKey  = bsonutil.MustHaveTag(message.SystemInfo{}.IOStat, "MergedReadCount")
	SysInfoDiskIOCountersWriteCountKey       = bsonutil.MustHaveTag(message.SystemInfo{}.IOStat, "WriteCount")
	SysInfoDiskIOCountersMergedWriteCountKey = bsonutil.MustHaveTag(message.SystemInfo{}.IOStat, "MergedWriteCount")
	SysInfoDiskIOCountersReadBytesKey        = bsonutil.MustHaveTag(message.SystemInfo{}.IOStat, "ReadBytes")
	SysInfoDiskIOCountersWriteBytesKey       = bsonutil.MustHaveTag(message.SystemInfo{}.IOStat, "WriteBytes")
	SysInfoDiskIOCountersReadTimeKey         = bsonutil.MustHaveTag(message.SystemInfo{}.IOStat, "ReadTime")
	SysInfoDiskIOCountersWriteTimeKey        = bsonutil.MustHaveTag(message.SystemInfo{}.IOStat, "WriteTime")
	SysInfoDiskIOCountersIopsInProgressKey   = bsonutil.MustHaveTag(message.SystemInfo{}.IOStat, "IopsInProgress")
	SysInfoDiskIOCountersIoTimeKey           = bsonutil.MustHaveTag(message.SystemInfo{}.IOStat, "IoTime")
	SysInfoDiskIOCountersWeigtedIoKey        = bsonutil.MustHaveTag(message.SystemInfo{}.IOStat, "WeightedIO")
	SysInfoDiskIOCountersNameKey             = bsonutil.MustHaveTag(message.SystemInfo{}.IOStat, "Name")
	SysInfoDiskIOCountersSerialNumberKey     = bsonutil.MustHaveTag(message.SystemInfo{}.IOStat, "SerialNumber")
)
View Source
var (
	TaskProcessResourceDataSysInfoKey      = bsonutil.MustHaveTag(TaskProcessResourceData{}, "Processes")
	TaskProcessResourceDataResourceTypeKey = bsonutil.MustHaveTag(TaskProcessResourceData{}, "ResourceType")

	ProcInfoPidKey     = bsonutil.MustHaveTag(message.ProcessInfo{}, "Pid")
	ProcInfoParentKey  = bsonutil.MustHaveTag(message.ProcessInfo{}, "Parent")
	ProcInfoThreadsKey = bsonutil.MustHaveTag(message.ProcessInfo{}, "Threads")
	ProcInfoCommandKey = bsonutil.MustHaveTag(message.ProcessInfo{}, "Command")
	ProcInfoErrorsKey  = bsonutil.MustHaveTag(message.ProcessInfo{}, "Errors")

	ProcInfoCPUKey            = bsonutil.MustHaveTag(message.ProcessInfo{}, "CPU")
	ProcInfoIoStatKey         = bsonutil.MustHaveTag(message.ProcessInfo{}, "IoStat")
	ProcInfoMemoryKey         = bsonutil.MustHaveTag(message.ProcessInfo{}, "Memory")
	ProcInfoMemoryPlatformKey = bsonutil.MustHaveTag(message.ProcessInfo{}, "MemoryPlatform")
	ProcInfoNetStatKey        = bsonutil.MustHaveTag(message.ProcessInfo{}, "NetStat")

	ProcInfoCPUTimesStatCPUKey         = bsonutil.MustHaveTag(message.ProcessInfo{}.CPU, "CPU")
	ProcInfoCPUTimesStatUserKey        = bsonutil.MustHaveTag(message.ProcessInfo{}.CPU, "User")
	ProcInfoCPUTimesStatSystemKey      = bsonutil.MustHaveTag(message.ProcessInfo{}.CPU, "System")
	ProcInfoCPUTimesStatIdleKey        = bsonutil.MustHaveTag(message.ProcessInfo{}.CPU, "Idle")
	ProcInfoCPUTimesStatNiceKey        = bsonutil.MustHaveTag(message.ProcessInfo{}.CPU, "Nice")
	ProcInfoCPUTimesStatIowaitKey      = bsonutil.MustHaveTag(message.ProcessInfo{}.CPU, "Iowait")
	ProcInfoCPUTimesStatIrqKey         = bsonutil.MustHaveTag(message.ProcessInfo{}.CPU, "Irq")
	ProcInfoCPUTimesStatSoftirqKey     = bsonutil.MustHaveTag(message.ProcessInfo{}.CPU, "Softirq")
	ProcInfoCPUTimesStatStealKey       = bsonutil.MustHaveTag(message.ProcessInfo{}.CPU, "Steal")
	ProcInfoCPUTimesStatGuestNiceKey   = bsonutil.MustHaveTag(message.ProcessInfo{}.CPU, "GuestNice")
	ProcInfoCPUTimesStatGuestStolenKey = bsonutil.MustHaveTag(message.ProcessInfo{}.CPU, "Stolen")

	ProcInfoIoStatReadCountKey  = bsonutil.MustHaveTag(message.ProcessInfo{}.IoStat, "ReadCount")
	ProcInfoIoStatReadBytesKey  = bsonutil.MustHaveTag(message.ProcessInfo{}.IoStat, "ReadBytes")
	ProcInfoIoStatWriteCountKey = bsonutil.MustHaveTag(message.ProcessInfo{}.IoStat, "WriteCount")
	ProcInfoIoStatWriteBytesKey = bsonutil.MustHaveTag(message.ProcessInfo{}.IoStat, "WriteBytes")

	ProcInfoNetStatNameKey        = bsonutil.MustHaveTag(message.ProcessInfo{}.NetStat, "Name")
	ProcInfoNetStatBytesSentKey   = bsonutil.MustHaveTag(message.ProcessInfo{}.NetStat, "BytesSent")
	ProcInfoNetStatBytesRecvKey   = bsonutil.MustHaveTag(message.ProcessInfo{}.NetStat, "BytesRecv")
	ProcInfoNetStatPacketsSentKey = bsonutil.MustHaveTag(message.ProcessInfo{}.NetStat, "PacketsSent")
	ProcInfoNetStatPacketsRecvKey = bsonutil.MustHaveTag(message.ProcessInfo{}.NetStat, "PacketsRecv")
	ProcInfoNetStatErrinKey       = bsonutil.MustHaveTag(message.ProcessInfo{}.NetStat, "Errin")
	ProcInfoNetStatErroutKey      = bsonutil.MustHaveTag(message.ProcessInfo{}.NetStat, "Errout")
	ProcInfoNetStatDropinKey      = bsonutil.MustHaveTag(message.ProcessInfo{}.NetStat, "Dropin")
	ProcInfoNetStatDropoutKey     = bsonutil.MustHaveTag(message.ProcessInfo{}.NetStat, "Dropout")
	ProcInfoNetStatFifoinKey      = bsonutil.MustHaveTag(message.ProcessInfo{}.NetStat, "Fifoin")
	ProcInfoNetStatFifooutKey     = bsonutil.MustHaveTag(message.ProcessInfo{}.NetStat, "Fifoout")

	ProcInfoMemInfoStatRSSKey  = bsonutil.MustHaveTag(message.ProcessInfo{}.Memory, "RSS")
	ProcInfoMemInfoStatVMSKey  = bsonutil.MustHaveTag(message.ProcessInfo{}.Memory, "VMS")
	ProcInfoMemInfoStatSwapKey = bsonutil.MustHaveTag(message.ProcessInfo{}.Memory, "Swap")
)

Functions

func DistroEventsForId

func DistroEventsForId(id string) db.Q

Distro Events

func DistroEventsInOrder

func DistroEventsInOrder(id string) db.Q

func HostEventsForId

func HostEventsForId(id string) db.Q

Host Events

func HostEventsInOrder

func HostEventsInOrder(id string) db.Q

func LogDistroAdded

func LogDistroAdded(distroId, userId string, data interface{})

func LogDistroEvent

func LogDistroEvent(distroId string, eventType string, eventData DistroEventData)

func LogDistroModified

func LogDistroModified(distroId, userId string, data interface{})

func LogDistroRemoved

func LogDistroRemoved(distroId, userId string, data interface{})

func LogHostCreated

func LogHostCreated(hostId string)

func LogHostDNSNameSet

func LogHostDNSNameSet(hostId string, dnsName string)

func LogHostEvent

func LogHostEvent(hostId string, eventType string, eventData HostEventData)

func LogHostProvisioned

func LogHostProvisioned(hostId string)

func LogHostRunningTaskCleared

func LogHostRunningTaskCleared(hostId string, taskId string)

func LogHostRunningTaskSet

func LogHostRunningTaskSet(hostId string, taskId string)

func LogHostStatusChanged

func LogHostStatusChanged(hostId string, oldStatus string, newStatus string)

func LogHostTaskPidSet

func LogHostTaskPidSet(hostId string, taskPid string)

func LogHostTeardown

func LogHostTeardown(hostId, teardownLogs string, success bool, duration time.Duration)

func LogHostTerminatedExternally

func LogHostTerminatedExternally(hostId string)

func LogMonitorOperation

func LogMonitorOperation(hostId string, op string)

func LogProvisionFailed

func LogProvisionFailed(hostId string, setupLogs string)

func LogSchedulerEvent

func LogSchedulerEvent(eventData SchedulerEventData)

LogSchedulerEvent takes care of logging the statistics about the scheduler at a given time. The ResourceId is the time that the scheduler runs.

func LogTaskAbortRequest

func LogTaskAbortRequest(taskId string, userId string)

func LogTaskActivated

func LogTaskActivated(taskId string, userId string)

func LogTaskCreated

func LogTaskCreated(taskId string)

func LogTaskDeactivated

func LogTaskDeactivated(taskId string, userId string)

func LogTaskDispatched

func LogTaskDispatched(taskId, hostId string)

func LogTaskEvent

func LogTaskEvent(taskId string, eventType string, eventData TaskEventData)

func LogTaskFinished

func LogTaskFinished(taskId string, hostId, status string)

func LogTaskProcessData

func LogTaskProcessData(taskId string, procs []*message.ProcessInfo)

LogTaskProcessData saves a slice of ProcessInfo objects to the event log under the specified task.

func LogTaskRestarted

func LogTaskRestarted(taskId string, userId string)

func LogTaskScheduled

func LogTaskScheduled(taskId string, scheduledTime time.Time)

func LogTaskStarted

func LogTaskStarted(taskId string)

func LogTaskSystemData

func LogTaskSystemData(taskId string, info *message.SystemInfo)

LogTaskSystemData saves a SystemInfo object to the event log for a task.

func LogTaskUndispatched

func LogTaskUndispatched(taskId, hostId string)

func MostRecentDistroEvents

func MostRecentDistroEvents(id string, n int) db.Q

func MostRecentHostEvents

func MostRecentHostEvents(id string, n int) db.Q

func MostRecentTaskEvents

func MostRecentTaskEvents(id string, n int) db.Q

func RecentSchedulerEvents

func RecentSchedulerEvents(distroId string, n int) db.Q

func SchedulerEventsForId

func SchedulerEventsForId(distroId string) db.Q

Scheduler Events

func TaskEventsForId

func TaskEventsForId(id string) db.Q

Task Events

func TaskEventsInOrder

func TaskEventsInOrder(id string) db.Q

func TaskProcessInfoEvents

func TaskProcessInfoEvents(taskId string, n int) db.Q

TaskProcessInfoEvents builds a query for process info, which returns information about each process (and children) spawned during task execution.

func TaskSystemInfoEvents

func TaskSystemInfoEvents(taskId string, n int) db.Q

TaskSystemInfoEvents builds a query for system info, (e.g. aggregate information about the system as a whole) collected during a task.

Types

type DBEventLogger

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

func NewDBEventLogger

func NewDBEventLogger(collection string) *DBEventLogger

func (*DBEventLogger) LogEvent

func (self *DBEventLogger) LogEvent(event Event) error

type Data

type Data interface {
	IsValid() bool
}

type DataWrapper

type DataWrapper struct {
	Data
}

func (DataWrapper) GetBSON

func (dw DataWrapper) GetBSON() (interface{}, error)

func (DataWrapper) MarshalJSON

func (dw DataWrapper) MarshalJSON() ([]byte, error)

MarshalJSON returns proper JSON encoding by uncovering the Data interface.

func (*DataWrapper) SetBSON

func (dw *DataWrapper) SetBSON(raw bson.Raw) error

type DistroEventData

type DistroEventData struct {
	// necessary for IsValid
	ResourceType string      `bson:"r_type" json:"resource_type"`
	DistroId     string      `bson:"d_id,omitempty" json:"d_id,omitempty"`
	UserId       string      `bson:"u_id,omitempty" json:"u_id,omitempty"`
	Data         interface{} `bson:"dstr,omitempty" json:"dstr,omitempty"`
}

DistroEventData implements EventData.

func (DistroEventData) IsValid

func (d DistroEventData) IsValid() bool

type Event

type Event struct {
	Timestamp  time.Time   `bson:"ts" json:"timestamp"`
	ResourceId string      `bson:"r_id" json:"resource_id"`
	EventType  string      `bson:"e_type" json:"event_type"`
	Data       DataWrapper `bson:"data" json:"data"`
}

func Find

func Find(coll string, query db.Q) ([]Event, error)

Find takes a collection storing events and a query, generated by one of the query functions, and returns a slice of events.

type EventLogger

type EventLogger interface {
	LogEvent(event *Event) error
}

type HostEventData

type HostEventData struct {
	// necessary for IsValid
	ResourceType string `bson:"r_type" json:"resource_type"`

	OldStatus  string        `bson:"o_s,omitempty" json:"old_status,omitempty"`
	NewStatus  string        `bson:"n_s,omitempty" json:"new_status,omitempty"`
	Logs       string        `bson:"log,omitempty" json:"logs,omitempty"`
	Hostname   string        `bson:"hn,omitempty" json:"hostname,omitempty"`
	TaskId     string        `bson:"t_id,omitempty" json:"task_id,omitempty"`
	TaskPid    string        `bson:"t_pid,omitempty" json:"task_pid,omitempty"`
	TaskStatus string        `bson:"t_st,omitempty" json:"task_status,omitempty"`
	MonitorOp  string        `bson:"monitor_op,omitempty" json:"monitor,omitempty"`
	Successful bool          `bson:"successful,omitempty" json:"successful"`
	Duration   time.Duration `bson:"duration,omitempty" json:"duration"`
}

implements EventData

func (HostEventData) IsValid

func (self HostEventData) IsValid() bool

type SchedulerEventData

type SchedulerEventData struct {
	// necessary for IsValid
	ResourceType  string        `bson:"r_type" json:"resource_type"`
	TaskQueueInfo TaskQueueInfo `bson:"tq_info" json:"task_queue_info"`
	DistroId      string        `bson:"d_id" json:"distro_id"`
}

implements EventData

func (SchedulerEventData) IsValid

func (sed SchedulerEventData) IsValid() bool

type TaskEventData

type TaskEventData struct {
	// necessary for IsValid
	ResourceType string    `bson:"r_type" json:"resource_type"`
	HostId       string    `bson:"h_id,omitempty" json:"host_id,omitempty"`
	UserId       string    `bson:"u_id,omitempty" json:"user_id,omitempty"`
	Status       string    `bson:"s,omitempty" json:"status,omitempty"`
	Timestamp    time.Time `bson:"ts,omitempty" json:"timestamp,omitempty"`
}

implements Data

func (TaskEventData) IsValid

func (self TaskEventData) IsValid() bool

type TaskProcessResourceData

type TaskProcessResourceData struct {
	ResourceType string                 `bson:"r_type" json:"resource_type"`
	Processes    []*message.ProcessInfo `bson:"processes" json:"processes"`
}

TaskProcessResourceData wraps a slice of grip/message.ProcessInfo structs in a type that implements the event.Data interface. ProcessInfo structs represent system resource usage information for a single process (PID).

func (TaskProcessResourceData) IsValid

func (d TaskProcessResourceData) IsValid() bool

IsValid is part of the Data interface used in the conversion of Event documents from to TaskProcessResourceData..

type TaskQueueInfo

type TaskQueueInfo struct {
	TaskQueueLength  int           `bson:"tq_l" json:"task_queue_length"`
	NumHostsRunning  int           `bson:"n_h" json:"num_hosts_running"`
	ExpectedDuration time.Duration `bson:"ex_d" json:"expected_duration,"`
}

type TaskSystemResourceData

type TaskSystemResourceData struct {
	ResourceType string              `bson:"r_type" json:"resource_type"`
	SystemInfo   *message.SystemInfo `bson:"system_info" json:"system_info" yaml:"system_info"`
}

TaskSystemResourceData wraps a grip/message.SystemInfo struct in a type that implements the event.Data interface. SystemInfo structs capture aggregated system metrics (cpu, memory, network) for the system as a whole.

func (TaskSystemResourceData) IsValid

func (d TaskSystemResourceData) IsValid() bool

IsValid is part of the Data interface used in the conversion of Event documents from to TaskSystemResourceData.

Jump to

Keyboard shortcuts

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