event

package
v0.0.0-...-ee3d319 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResourceTypeAdmin     = "ADMIN"
	EventTypeValueChanged = "CONFIG_VALUE_CHANGED"
)
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"
	EventHostStarted              = "HOST_STARTED"
	EventHostAgentDeployed        = "HOST_AGENT_DEPLOYED"
	EventHostAgentDeployFailed    = "HOST_AGENT_DEPLOY_FAILED"
	EventHostStatusChanged        = "HOST_STATUS_CHANGED"
	EventHostDNSNameSet           = "HOST_DNS_NAME_SET"
	EventHostProvisionError       = "HOST_PROVISION_ERROR"
	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 (
	GithubPullRequestSubscriberType = "github_pull_request"
	JIRAIssueSubscriberType         = "jira-issue"
	JIRACommentSubscriberType       = "jira-comment"
	EvergreenWebhookSubscriberType  = "evergreen-webhook"
	EmailSubscriberType             = "email"
	SlackSubscriberType             = "slack"
)
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"
	TaskPriorityChanged  = "TASK_PRIORITY_CHANGED"
	TaskJiraAlertCreated = "TASK_JIRA_ALERT_CREATED"
)
View Source
const (
	EventTaskSystemInfo  = "TASK_SYSTEM_INFO"
	EventTaskProcessInfo = "TASK_PROCESS_INFO"
)
View Source
const (
	SubscriptionsCollection = "subscriptions"
)

Variables

View Source
var (
	TimestampKey    = bsonutil.MustHaveTag(EventLogEntry{}, "Timestamp")
	ResourceIdKey   = bsonutil.MustHaveTag(EventLogEntry{}, "ResourceId")
	ResourceTypeKey = bsonutil.MustHaveTag(EventLogEntry{}, "ResourceType")

	TypeKey = bsonutil.MustHaveTag(EventLogEntry{}, "EventType")
	DataKey = bsonutil.MustHaveTag(EventLogEntry{}, "Data")
)
View Source
var (
	TaskSystemResourceDataSysInfoKey = bsonutil.MustHaveTag(TaskSystemResourceData{}, "SystemInfo")

	SysInfoCPUKey        = bsonutil.MustHaveTag(message.SystemInfo{}, "CPU")
	SysInfoCPUPercentKey = bsonutil.MustHaveTag(message.SystemInfo{}, "CPUPercent")
	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")

	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 AdminEventsBefore

func AdminEventsBefore(before time.Time, n int) db.Q

func AllRecentHostEventsMatchStatus

func AllRecentHostEventsMatchStatus(hostId string, n int, status string) bool

func ByGuid

func ByGuid(guid string) db.Q

func CountProcessEvents

func CountProcessEvents(taskID string) (int, error)

CountProcessEvents returns the total number of process tree metrics events captured for the specified task. If taskId is "", then this will return a count of all process metrics captured.

func CountSystemEvents

func CountSystemEvents(taskId string) (int, error)

CountSystemEvents returns the total number of system metrics events captured for the specified task. If taskId is "", then this will return a count of all system events captured.

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 LogAdminEvent

func LogAdminEvent(section string, before, after evergreen.ConfigSection, user string) error

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 LogHostAgentDeployFailed

func LogHostAgentDeployFailed(hostId string)

func LogHostAgentDeployed

func LogHostAgentDeployed(hostId string)

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 LogHostProvisionError

func LogHostProvisionError(hostId string)

func LogHostProvisioned

func LogHostProvisioned(hostId string)

func LogHostRunningTaskCleared

func LogHostRunningTaskCleared(hostId string, taskId string)

func LogHostRunningTaskSet

func LogHostRunningTaskSet(hostId string, taskId string)

func LogHostStarted

func LogHostStarted(hostId string)

func LogHostStatusChanged

func LogHostStatusChanged(hostId, oldStatus, newStatus, user string, logs 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 LogJiraIssueCreated

func LogJiraIssueCreated(taskId, jiraIssue 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 LogTaskPriority

func LogTaskPriority(taskId, user string, priority int64)

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 NewEventFromType

func NewEventFromType(resourceType string) interface{}

func RecentAdminEvents

func RecentAdminEvents(n int) db.Q

Admin Events RecentAdminEvents returns the N most recent admin events

func RecentSchedulerEvents

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

func RevertConfig

func RevertConfig(guid string, user string) error

RevertConfig reverts one config section to the before state of the specified GUID in the event log

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, ts time.Time, limit, sort int) db.Q

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

If the sort value is less than 0, the query will return all matching events that occur before the specified time, and otherwise will return all matching events that occur after the specified time.

func TaskSystemInfoEvents

func TaskSystemInfoEvents(taskID string, ts time.Time, limit, sort int) db.Q

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

If the sort value is less than 0, the query will return all matching events that occur before the specified time, and otherwise will return all matching events that occur after the specified time.

func UnprocessedEvents

func UnprocessedEvents() bson.M

UnprocessedEvents returns a bson.M query to fetch all unprocessed events

func UpdateExecutions

func UpdateExecutions(hostId, taskId string, execution int) error

UpdateExecutions updates host events to track multiple executions of the same task

Types

type AdminEventData

type AdminEventData struct {
	GUID    string           `bson:"guid" json:"guid"`
	User    string           `bson:"user" json:"user"`
	Section string           `bson:"section" json:"section"`
	Changes ConfigDataChange `bson:"changes" json:"changes"`
}

AdminEventData holds all potential data properties of a logged admin event

type ConfigDataChange

type ConfigDataChange struct {
	Before evergreen.ConfigSection `bson:"before" json:"before"`
	After  evergreen.ConfigSection `bson:"after" json:"after"`
}

type DBEventLogger

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

func NewDBEventLogger

func NewDBEventLogger(collection string) *DBEventLogger

func (*DBEventLogger) LogEvent

func (l *DBEventLogger) LogEvent(event *EventLogEntry) error

func (*DBEventLogger) MarkProcessed

func (l *DBEventLogger) MarkProcessed(event *EventLogEntry) error

type DistroEventData

type DistroEventData struct {
	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.

type EventLogEntry

type EventLogEntry struct {
	ID           bson.ObjectId `bson:"_id" json:"-"`
	ResourceType string        `bson:"r_type,omitempty" json:"resource_type,omitempty"`
	ProcessedAt  time.Time     `bson:"processed_at,omitempty" json:"processed_at,omitempty"`

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

func Find

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

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

func FindAdmin

func FindAdmin(query db.Q) ([]EventLogEntry, error)

func (*EventLogEntry) Processed

func (e *EventLogEntry) Processed() (bool, time.Time)

Processed is whether or not this event has been processed. An event which has been processed has successfully have notifications intents created and stored, but does not indicate whether or not these notifications have been successfully sent to all recipients If true, the time is the time that this event was marked as processed. If false, time is the zero time

func (*EventLogEntry) SetBSON

func (e *EventLogEntry) SetBSON(raw bson.Raw) error

type EventLogger

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

type GithubPullRequestSubscriber

type GithubPullRequestSubscriber struct {
	Owner    string `bson:"owner"`
	Repo     string `bson:"repo"`
	PRNumber int    `bson:"pr_number"`
	Ref      string `bson:"ref"`
}

type GroupedSubscribers

type GroupedSubscribers struct {
	Type        string                `bson:"_id"`
	Subscribers []SubscriberWithRegex `bson:"subscribers"`
}

func FindSubscribers

func FindSubscribers(subscriptionType, triggerType string, selectors []Selector) ([]GroupedSubscribers, error)

FindSubscribers finds all subscriptions that match the given information

type HostEventData

type HostEventData struct {
	AgentRevision string        `bson:"a_rev,omitempty" json:"agent_revision,omitempty"`
	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"`
	Execution     string        `bson:"execution,omitempty" json:"execution,omitempty"`
	MonitorOp     string        `bson:"monitor_op,omitempty" json:"monitor,omitempty"`
	User          string        `bson:"usr" json:"user,omitempty"`
	Successful    bool          `bson:"successful,omitempty" json:"successful"`
	Duration      time.Duration `bson:"duration,omitempty" json:"duration"`
}

implements EventData

type SchedulerEventData

type SchedulerEventData struct {
	TaskQueueInfo TaskQueueInfo `bson:"tq_info" json:"task_queue_info"`
	DistroId      string        `bson:"d_id" json:"distro_id"`
}

implements EventData

type Selector

type Selector struct {
	Type string `bson:"type"`
	Data string `bson:"data"`
}

type Subscriber

type Subscriber struct {
	Type string `bson:"type"`
	// sad violin
	Target interface{} `bson:"target"`
}

func (*Subscriber) SetBSON

func (s *Subscriber) SetBSON(raw bson.Raw) error

type SubscriberWithRegex

type SubscriberWithRegex struct {
	Subscriber     Subscriber `bson:"subscriber"`
	RegexSelectors []Selector `bson:"regex_selectors"`
}

type Subscription

type Subscription struct {
	ID             bson.ObjectId `bson:"_id"`
	Type           string        `bson:"type"`
	Trigger        string        `bson:"trigger"`
	Selectors      []Selector    `bson:"selectors,omitempty"`
	RegexSelectors []Selector    `bson:"regex_selectors,omitempty"`
	Subscriber     Subscriber    `bson:"subscriber"`
}

func (*Subscription) Remove

func (s *Subscription) Remove() error

func (*Subscription) Upsert

func (s *Subscription) Upsert() error

type TaskEventData

type TaskEventData struct {
	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"`
	JiraIssue string `bson:"jira,omitempty" json:"jira,omitempty"`

	Timestamp time.Time `bson:"ts,omitempty" json:"timestamp,omitempty"`
	Priority  int64     `bson:"pri,omitempty" json:"priority,omitempty"`
}

implements Data

type TaskProcessResourceData

type TaskProcessResourceData struct {
	//TODO: EVG-3061 remove the following line
	ResourceType string                 `bson:"r_type,omitempty" json:"resource_type,omitempty"`
	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).

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 {
	//TODO: EVG-3061 remove the following line
	ResourceType string              `bson:"r_type,omitempty" json:"resource_type,omitempty"`
	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.

type WebhookSubscriber

type WebhookSubscriber struct {
	URL    string `bson:"url"`
	Secret []byte `bson:"secret"`
}

Jump to

Keyboard shortcuts

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