Documentation ¶
Overview ¶
Package event models events in the system, which trigger actions to occur. Events are processed asynchronously by a job in the units package.
Index ¶
- Constants
- Variables
- func AdminEventsBefore(before time.Time, n int) db.Q
- func AllRecentHostEventsAreSystemFailed(ctx context.Context, hostId string, n int) bool
- func ByAdminGuid(guid string) db.Q
- func CopyProjectSubscriptions(oldProject, newProject string) error
- func CountUnprocessedEvents() (int, error)
- func GetEventTypesForHost(hostID string, tag string) ([]string, error)
- func GetSubscriptionTarget[T any](s Subscription) (*T, error)
- func HasNoRecentStoppedHostEvent(id string, ts time.Time) (bool, error)
- func HostEvents(opts HostEventsOpts) db.Q
- func IsValidOwnerType(in string) bool
- func LogAdminEvent(section string, before, after evergreen.ConfigSection, user string) error
- func LogBuildGithubCheckFinishedEvent(id, status string)
- func LogBuildStateChangeEvent(id, status string)
- func LogCommitQueueConcludeTest(patchID, status string)
- func LogCommitQueueConcludeWithErrorMessage(patchID, status, errMsg string)
- func LogCommitQueueEnqueueFailed(patchID string, err error)
- func LogCommitQueueStartTestEvent(patchID string)
- func LogContainerTaskDispatched(taskID string, execution int, podID string)
- func LogContainerTaskFinished(taskID string, execution int, podID, status string)
- func LogDistroAMIModified(distroId, userId string)
- func LogDistroAdded(distroId, userId string, data interface{})
- func LogDistroEvent(distroId string, eventType string, eventData DistroEventData)
- func LogDistroModified(distroId, userId string, before, after interface{})
- func LogDistroRemoved(distroId, userId string, data interface{})
- func LogHostAgentDeployFailed(hostId string, err error)
- func LogHostAgentDeployed(hostId string)
- func LogHostAgentMonitorDeployFailed(hostId string, err error)
- func LogHostAgentMonitorDeployed(hostId string)
- func LogHostConvertedProvisioning(hostID, method string)
- func LogHostConvertingProvisioning(hostID, method, user string)
- func LogHostConvertingProvisioningError(hostId string, err error)
- func LogHostCreated(hostId string)
- func LogHostCreatedError(hostID, logs string)
- func LogHostDNSNameSet(hostId string, dnsName string)
- func LogHostEvent(hostId string, eventType string, eventData HostEventData)
- func LogHostJasperRestartError(hostId string, err error)
- func LogHostJasperRestarted(hostId, revision string)
- func LogHostJasperRestarting(hostId, user string)
- func LogHostModifyError(hostID, logs string)
- func LogHostModifySucceeded(hostID, source string)
- func LogHostProvisionError(hostId string)
- func LogHostProvisionFailed(hostId string, setupLogs string)
- func LogHostProvisioned(hostId string)
- func LogHostRunningTaskCleared(hostId string, taskId string, taskExecution int)
- func LogHostRunningTaskSet(hostId string, taskId string, taskExecution int)
- func LogHostScriptExecuteFailed(hostID string, err error)
- func LogHostScriptExecuted(hostID string, logs string)
- func LogHostStartError(hostID, source, logs string)
- func LogHostStartSucceeded(hostID string, source string)
- func LogHostStatusChanged(hostId, oldStatus, newStatus, user string, logs string)
- func LogHostStopError(hostID, source, logs string)
- func LogHostStopSucceeded(hostID, source string)
- func LogHostTaskDispatched(taskId string, execution int, hostId string)
- func LogHostTaskFinished(taskId string, execution int, hostId, status string)
- func LogHostTaskUndispatched(taskId string, execution int, hostId string)
- func LogHostTemporaryExemptionExpirationWarningSent(hostID string)
- func LogHostTerminatedExternally(hostId, oldStatus string)
- func LogJiraIssueCreated(taskId string, execution int, jiraIssue string)
- func LogManyEvents(events []EventLogEntry) error
- func LogManyHostsCreated(hostIDs []string)
- func LogManyTaskAbortRequests(taskIds []string, userId string)
- func LogManyTaskPriority(taskIds []string, userId string, priority int64)
- func LogManyTasksBlocked(ctx context.Context, data []TaskBlockedData)
- func LogManyUnorderedEventsWithContext(ctx context.Context, events []EventLogEntry) error
- func LogMergeTaskUnscheduled(taskId string, execution int, userID string)
- func LogPatchChildrenCompletionEvent(id, status, author string)
- func LogPatchStateChangeEvent(id, newStatus string)
- func LogPodAssignedTask(id, taskID string, execution int)
- func LogPodEvent(id string, kind PodEventType, data PodData)
- func LogPodRunningTaskCleared(id, taskID string, execution int)
- func LogPodStatusChanged(id, oldStatus, newStatus, reason string)
- func LogSpawnHostIdleNotification(hostID string)
- func LogSpawnhostExpirationWarningSent(hostID string)
- func LogTaskAbortRequest(taskId string, execution int, userId string)
- func LogTaskActivated(taskId string, execution int, userId string)
- func LogTaskContainerAllocated(taskId string, execution int, containerAllocatedTime time.Time)
- func LogTaskCreated(taskId string, execution int)
- func LogTaskDependenciesOverridden(taskId string, execution int, userID string)
- func LogTaskFinished(taskId string, execution int, status string)
- func LogTaskPriority(taskId string, execution int, userId string, priority int64)
- func LogTaskRestarted(taskId string, execution int, userId string)
- func LogTaskStarted(taskId string, execution int)
- func LogUserEvent(user string, eventType UserEventType, before, after interface{}) error
- func LogVersionChildrenCompletionEvent(id, status, author string)
- func LogVersionGithubCheckFinishedEvent(id, newStatus string)
- func LogVersionStateChangeEvent(id, newStatus string)
- func LogVolumeExpirationWarningSent(volumeID string)
- func LogVolumeMigrationFailed(hostID string, err error)
- func MostRecentPodEvents(id string, n int) db.Q
- func MostRecentTaskEvents(id string, n int) db.Q
- func RecentAdminEvents(n int) db.Q
- func RemoveSubscription(id string) error
- func ResourceTypeKeyIs(key string) bson.M
- func RevertConfig(ctx context.Context, guid string, user string) error
- func TaskEventsForId(id string) db.Q
- func TaskEventsInOrder(id string) db.Q
- type AdminEventData
- type Attributes
- type BuildEventData
- type ChildPatchSubscriber
- type CommitQueueEventData
- type ConfigDataChange
- type DistroEventData
- type EventLogEntry
- func Find(query db.Q) ([]EventLogEntry, error)
- func FindAdmin(query db.Q) ([]EventLogEntry, error)
- func FindAllByResourceID(resourceID string) ([]EventLogEntry, error)
- func FindByID(eventID string) (*EventLogEntry, error)
- func FindLastProcessedEvent() (*EventLogEntry, error)
- func FindLatestAMIModifiedDistroEvent(id string) (EventLogEntry, error)
- func FindLatestPrimaryDistroEvents(id string, n int, before time.Time) ([]EventLogEntry, error)
- func FindPaginatedWithTotalCount(query db.Q, limit, page int) ([]EventLogEntry, int, error)
- func FindUnprocessedEvents(limit int) ([]EventLogEntry, error)
- func GetPaginatedHostEvents(opts PaginatedHostEventsOpts) ([]EventLogEntry, int, error)
- func GetTaskActivatedEvent(taskId string, execution int, userId string) EventLogEntry
- func GetTaskDeactivatedEvent(taskId string, execution int, userId string) EventLogEntry
- func MostRecentPaginatedPodEvents(id string, limit, page int) ([]EventLogEntry, int, error)
- type Filter
- type GithubCheckSubscriber
- type GithubMergeSubscriber
- type GithubPullRequestSubscriber
- type HostEventData
- type HostEventsOpts
- type JIRAIssueSubscriber
- type OwnerType
- type PRInfo
- type PaginatedHostEventsOpts
- type PatchEventData
- type PodData
- type PodEventType
- type Selector
- type Subscriber
- func NewEmailSubscriber(t string) Subscriber
- func NewEnqueuePatchSubscriber() Subscriber
- func NewGithubCheckAPISubscriber(s GithubCheckSubscriber) Subscriber
- func NewGithubMergeAPISubscriber(s GithubMergeSubscriber) Subscriber
- func NewGithubStatusAPISubscriber(s GithubPullRequestSubscriber) Subscriber
- func NewRunChildPatchSubscriber(s ChildPatchSubscriber) Subscriber
- func NewSlackSubscriber(t string) Subscriber
- type Subscription
- func CreateOrUpdateGeneralSubscription(resourceType string, id string, subscriber Subscriber, user string) (*Subscription, error)
- func FindSubscriptionByID(id string) (*Subscription, error)
- func FindSubscriptionsByAttributes(resourceType string, eventAttributes Attributes) ([]Subscription, error)
- func FindSubscriptionsByOwner(owner string, ownerType OwnerType) ([]Subscription, error)
- func NewBuildBreakSubscriptionByOwner(owner string, sub Subscriber) Subscription
- func NewCommitQueueSubscriptionByOwner(owner string, sub Subscriber) Subscription
- func NewExpiringBuildOutcomeSubscriptionByVersion(versionID string, sub Subscriber) Subscription
- func NewExpiringPatchChildOutcomeSubscription(id string, sub Subscriber) Subscription
- func NewExpiringPatchOutcomeSubscription(id string, sub Subscriber) Subscription
- func NewExpiringPatchSuccessSubscription(id string, sub Subscriber) Subscription
- func NewFirstTaskFailureInVersionSubscriptionByOwner(owner string, sub Subscriber) Subscription
- func NewGithubCheckBuildOutcomeSubscriptionByVersion(versionID string, sub Subscriber) Subscription
- func NewParentPatchSubscription(id string, sub Subscriber) Subscription
- func NewPatchOutcomeSubscriptionByOwner(owner string, sub Subscriber) Subscription
- func NewSpawnHostIdleWarningSubscription(hostId string, sub Subscriber) Subscription
- func NewSpawnHostOutcomeByOwner(owner string, sub Subscriber) Subscription
- func NewSpawnhostExpirationSubscription(owner string, sub Subscriber) Subscription
- func NewSubscriptionByID(resourceType, trigger, id string, sub Subscriber) Subscription
- func NewSubscriptionByOwner(owner string, sub Subscriber, resourceType, trigger string) Subscription
- func NewVersionGithubCheckOutcomeSubscription(id string, sub Subscriber) Subscription
- type TaskBlockedData
- type TaskEventData
- type UnmarshalEventLogEntry
- type UserEventType
- type VersionEventData
- type WebhookHeader
- type WebhookSubscriber
Constants ¶
const ( ResourceTypeAdmin = "ADMIN" EventTypeValueChanged = "CONFIG_VALUE_CHANGED" )
const ( ResourceTypeBuild = "BUILD" BuildStateChange = "STATE_CHANGE" BuildGithubCheckFinished = "GITHUB_CHECK_FINISHED" )
const ( ResourceTypeCommitQueue = "COMMIT_QUEUE" CommitQueueEnqueueFailed = "ENQUEUE_FAILED" CommitQueueStartTest = "START_TEST" CommitQueueConcludeTest = "CONCLUDE_TEST" )
const ( // resource type ResourceTypeDistro = "DISTRO" // event types EventDistroAdded = "DISTRO_ADDED" EventDistroModified = "DISTRO_MODIFIED" EventDistroAMIModfied = "DISTRO_AMI_MODIFIED" EventDistroRemoved = "DISTRO_REMOVED" )
const ( // resource type ResourceTypeHost = "HOST" // event types EventHostCreated = "HOST_CREATED" EventHostCreatedError = "HOST_CREATED_ERROR" EventHostStarted = "HOST_STARTED" EventHostStopped = "HOST_STOPPED" EventHostModified = "HOST_MODIFIED" EventHostAgentDeployed = "HOST_AGENT_DEPLOYED" EventHostAgentDeployFailed = "HOST_AGENT_DEPLOY_FAILED" EventHostAgentMonitorDeployed = "HOST_AGENT_MONITOR_DEPLOYED" EventHostAgentMonitorDeployFailed = "HOST_AGENT_MONITOR_DEPLOY_FAILED" EventHostJasperRestarting = "HOST_JASPER_RESTARTING" EventHostJasperRestarted = "HOST_JASPER_RESTARTED" EventHostJasperRestartError = "HOST_JASPER_RESTART_ERROR" EventHostConvertingProvisioning = "HOST_CONVERTING_PROVISIONING" EventHostConvertedProvisioning = "HOST_CONVERTED_PROVISIONING" EventHostConvertingProvisioningError = "HOST_CONVERTING_PROVISIONING_ERROR" 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" EventHostTaskFinished = "HOST_TASK_FINISHED" EventHostTerminatedExternally = "HOST_TERMINATED_EXTERNALLY" EventHostExpirationWarningSent = "HOST_EXPIRATION_WARNING_SENT" EventHostTemporaryExemptionExpirationWarningSent = "HOST_TEMPORARY_EXEMPTION_EXPIRATION_WARNING_SENT" EventSpawnHostIdleNotification = "HOST_IDLE_NOTIFICATION" EventHostScriptExecuted = "HOST_SCRIPT_EXECUTED" EventHostScriptExecuteFailed = "HOST_SCRIPT_EXECUTE_FAILED" EventVolumeExpirationWarningSent = "VOLUME_EXPIRATION_WARNING_SENT" EventVolumeMigrationFailed = "VOLUME_MIGRATION_FAILED" )
const ( ResourceTypePatch = "PATCH" PatchStateChange = "STATE_CHANGE" PatchChildrenCompletion = "CHILDREN_FINISHED" )
const ( EventResourceTypeProject = "PROJECT" EventTypeProjectModified = "PROJECT_MODIFIED" EventTypeProjectAdded = "PROJECT_ADDED" EventTypeProjectAttachedToRepo = "PROJECT_ATTACHED_TO_REPO" EventTypeProjectDetachedFromRepo = "PROJECT_DETACHED_FROM_REPO" )
const ( GithubPullRequestSubscriberType = "github_pull_request" GithubCheckSubscriberType = "github_check" GithubMergeSubscriberType = "github_merge" JIRAIssueSubscriberType = "jira-issue" JIRACommentSubscriberType = "jira-comment" EvergreenWebhookSubscriberType = "evergreen-webhook" EmailSubscriberType = "email" SlackSubscriberType = "slack" EnqueuePatchSubscriberType = "enqueue-patch" SubscriberTypeNone = "none" RunChildPatchSubscriberType = "run-child-patch" )
const ( OwnerTypePerson OwnerType = "person" OwnerTypeProject OwnerType = "project" TaskDurationKey = "task-duration-secs" TaskPercentChangeKey = "task-percent-change" BuildDurationKey = "build-duration-secs" BuildPercentChangeKey = "build-percent-change" VersionDurationKey = "version-duration-secs" VersionPercentChangeKey = "version-percent-change" TestRegexKey = "test-regex" RenotifyIntervalKey = "renotify-interval" GeneralSubscriptionPatchOutcome = "patch-outcome" GeneralSubscriptionPatchFirstFailure = "patch-first-failure" GeneralSubscriptionBuildBreak = "build-break" GeneralSubscriptionSpawnhostExpiration = "spawnhost-expiration" GeneralSubscriptionSpawnHostOutcome = "spawnhost-outcome" GeneralSubscriptionCommitQueue = "commit-queue" ObjectTask = "task" ObjectVersion = "version" ObjectBuild = "build" ObjectHost = "host" ObjectPatch = "patch" TriggerOutcome = "outcome" // TriggerFamilyOutcome indicates that a patch or version completed, // and all their child patches (if there are any) have also completed. TriggerFamilyOutcome = "family-outcome" TriggerGithubCheckOutcome = "github-check-outcome" TriggerFailure = "failure" TriggerFamilyFailure = "family-failure" TriggerSuccess = "success" TriggerFamilySuccess = "family-success" TriggerRegression = "regression" TriggerExceedsDuration = "exceeds-duration" TriggerSuccessfulExceedsDuration = "successful-exceeds-duration" TriggerRuntimeChangeByPercent = "runtime-change" TriggerExpiration = "expiration" TriggerPatchStarted = "started" TriggerTaskFirstFailureInVersion = "first-failure-in-version" TriggerTaskStarted = "task-started" TriggerSpawnHostIdle = "spawn-host-idle" )
const ( SelectorObject = "object" SelectorID = "id" SelectorProject = "project" SelectorOwner = "owner" SelectorRequester = "requester" SelectorStatus = "status" SelectorDisplayName = "display-name" SelectorBuildVariant = "build-variant" SelectorInVersion = "in-version" SelectorInBuild = "in-build" )
const ( // resource type ResourceTypeTask = "TASK" // event types TaskCreated = "TASK_CREATED" TaskDispatched = "TASK_DISPATCHED" TaskUndispatched = "TASK_UNDISPATCHED" TaskStarted = "TASK_STARTED" TaskFinished = "TASK_FINISHED" TaskBlocked = "TASK_BLOCKED" TaskRestarted = "TASK_RESTARTED" TaskActivated = "TASK_ACTIVATED" TaskDeactivated = "TASK_DEACTIVATED" TaskAbortRequest = "TASK_ABORT_REQUEST" ContainerAllocated = "CONTAINER_ALLOCATED" TaskPriorityChanged = "TASK_PRIORITY_CHANGED" TaskJiraAlertCreated = "TASK_JIRA_ALERT_CREATED" TaskDependenciesOverridden = "TASK_DEPENDENCIES_OVERRIDDEN" MergeTaskUnscheduled = "MERGE_TASK_UNSCHEDULED" )
const ( ResourceTypeVersion = "VERSION" VersionStateChange = "STATE_CHANGE" VersionGithubCheckFinished = "GITHUB_CHECK_FINISHED" VersionChildrenCompletion = "CHILDREN_FINISHED" )
const EventCollection = "events"
const (
ResourceTypeUser = "USER"
)
const (
SubscriptionsCollection = "subscriptions"
)
Variables ¶
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") )
var SubscriberTypes = []string{ GithubPullRequestSubscriberType, GithubCheckSubscriberType, GithubMergeSubscriberType, JIRAIssueSubscriberType, JIRACommentSubscriberType, EvergreenWebhookSubscriberType, EmailSubscriberType, SlackSubscriberType, EnqueuePatchSubscriberType, RunChildPatchSubscriberType, }
Functions ¶
func AllRecentHostEventsAreSystemFailed ¶
AllRecentHostEventsAreSystemFailed returns true if all recent host events are system failures, and false if any are not.
func ByAdminGuid ¶
ByAdminGuid returns a query for the admin events with the given guid.
func CopyProjectSubscriptions ¶
CopyProjectSubscriptions copies subscriptions from the first project for the second project.
func CountUnprocessedEvents ¶
func GetEventTypesForHost ¶
GetEventTypesForHost returns the event types that have occurred on the host.
func GetSubscriptionTarget ¶
func GetSubscriptionTarget[T any](s Subscription) (*T, error)
GetSubscriptionTarget asserts a type on the subscription's subscriber's target and if it is not found, returns an error.
func HasNoRecentStoppedHostEvent ¶
HasNoRecentStoppedHostEvent returns true if no host event exists that is more recent than the passed in time stamp.
func HostEvents ¶
func HostEvents(opts HostEventsOpts) db.Q
HostEvents builds a query that can be used to return the n = opts.Limit events that satisfy the filters and sorting method provided in opts.
func IsValidOwnerType ¶
func LogAdminEvent ¶
func LogAdminEvent(section string, before, after evergreen.ConfigSection, user string) error
func LogBuildGithubCheckFinishedEvent ¶
func LogBuildGithubCheckFinishedEvent(id, status string)
func LogBuildStateChangeEvent ¶
func LogBuildStateChangeEvent(id, status string)
func LogCommitQueueConcludeTest ¶
func LogCommitQueueConcludeTest(patchID, status string)
func LogCommitQueueConcludeWithErrorMessage ¶
func LogCommitQueueConcludeWithErrorMessage(patchID, status, errMsg string)
func LogCommitQueueStartTestEvent ¶
func LogCommitQueueStartTestEvent(patchID string)
func LogContainerTaskDispatched ¶
LogContainerTaskDispatched logs an event for a container task being dispatched to a pod.
func LogContainerTaskFinished ¶
LogContainerTaskFinished logs an event for a container task being marked finished. If it was assigned to run on a pod, it logs an additional pod event indicating that its assigned task has finished.
func LogDistroAMIModified ¶
func LogDistroAMIModified(distroId, userId string)
LogDistroAMIModified logs when the default region's AMI is modified.
func LogDistroAdded ¶
func LogDistroAdded(distroId, userId string, data interface{})
LogDistroAdded should take in DistroData in order to preserve the ProviderSettingsList
func LogDistroEvent ¶
func LogDistroEvent(distroId string, eventType string, eventData DistroEventData)
func LogDistroModified ¶
func LogDistroModified(distroId, userId string, before, after interface{})
LogDistroModified should take in DistroData in order to preserve the ProviderSettingsList
func LogDistroRemoved ¶
func LogDistroRemoved(distroId, userId string, data interface{})
LogDistroRemoved should take in DistroData in order to preserve the ProviderSettingsList
func LogHostAgentDeployed ¶
func LogHostAgentDeployed(hostId string)
func LogHostAgentMonitorDeployed ¶
func LogHostAgentMonitorDeployed(hostId string)
func LogHostConvertedProvisioning ¶
func LogHostConvertedProvisioning(hostID, method string)
func LogHostConvertingProvisioning ¶
func LogHostConvertingProvisioning(hostID, method, user string)
func LogHostCreated ¶
func LogHostCreated(hostId string)
LogHostCreated logs an event indicating that the host was created.
func LogHostCreatedError ¶
func LogHostCreatedError(hostID, logs string)
LogHostCreatedError logs an event indicating that the host errored while it was being created.
func LogHostDNSNameSet ¶
func LogHostEvent ¶
func LogHostEvent(hostId string, eventType string, eventData HostEventData)
func LogHostJasperRestarted ¶
func LogHostJasperRestarted(hostId, revision string)
func LogHostJasperRestarting ¶
func LogHostJasperRestarting(hostId, user string)
func LogHostModifyError ¶
func LogHostModifyError(hostID, logs string)
LogHostModifyError logs an event indicating that the host errored while being modified.
func LogHostModifySucceeded ¶
func LogHostModifySucceeded(hostID, source string)
LogHostModifySucceeded logs an event indicating that the host was successfully modified.
func LogHostProvisionError ¶
func LogHostProvisionError(hostId string)
LogHostProvisionError is used to log each failed provision attempt
func LogHostProvisionFailed ¶
LogHostProvisionFailed is used when Evergreen gives up on provisioning a host after several retries.
func LogHostProvisioned ¶
func LogHostProvisioned(hostId string)
func LogHostRunningTaskSet ¶
func LogHostScriptExecuted ¶
func LogHostStartError ¶
func LogHostStartError(hostID, source, logs string)
LogHostStartError logs an event indicating that the host errored while starting.
func LogHostStartSucceeded ¶
LogHostStartSucceeded logs an event indicating that the host was successfully started.
func LogHostStatusChanged ¶
func LogHostStopError ¶
func LogHostStopError(hostID, source, logs string)
LogHostStopError logs an event indicating that the host errored while stopping.
func LogHostStopSucceeded ¶
func LogHostStopSucceeded(hostID, source string)
LogHostStopSucceeded logs an event indicating that the host was successfully stopped.
func LogHostTaskDispatched ¶
LogHostTaskDispatched logs an event for a host task being dispatched.
func LogHostTaskFinished ¶
LogHostTaskFinished logs an event for a host task being marked finished. If it was assigned to run on a host, it logs an additional host event indicating that its assigned task has finished.
func LogHostTaskUndispatched ¶
LogHostTaskUndispatched logs an event for a host being marked undispatched.
func LogHostTemporaryExemptionExpirationWarningSent ¶
func LogHostTemporaryExemptionExpirationWarningSent(hostID string)
LogHostTemporaryExemptionExpirationWarningSent logs an event warning about the host's temporary exemption, which is about to expire.
func LogHostTerminatedExternally ¶
func LogHostTerminatedExternally(hostId, oldStatus string)
func LogJiraIssueCreated ¶
func LogManyEvents ¶
func LogManyEvents(events []EventLogEntry) error
func LogManyHostsCreated ¶
func LogManyHostsCreated(hostIDs []string)
LogManyHostsCreated is the same as LogHostCreated but for multiple hosts.
func LogManyTaskAbortRequests ¶
LogManyTaskAbortRequests updates the DB with task abort request events.
func LogManyTaskPriority ¶
LogManyTaskPriority updates the DB with a task started events.
func LogManyTasksBlocked ¶
func LogManyTasksBlocked(ctx context.Context, data []TaskBlockedData)
LogManyTasksBlocked logs many task blocked events.
func LogManyUnorderedEventsWithContext ¶
func LogManyUnorderedEventsWithContext(ctx context.Context, events []EventLogEntry) error
LogManyUnorderedEventsWithContext logs many events without any ordering on insertion. Do not use this if the events must be inserted in order.
func LogMergeTaskUnscheduled ¶
LogMergeTaskUnscheduled updates the DB with a merge task unscheduled event.
func LogPatchChildrenCompletionEvent ¶
func LogPatchChildrenCompletionEvent(id, status, author string)
func LogPatchStateChangeEvent ¶
func LogPatchStateChangeEvent(id, newStatus string)
func LogPodAssignedTask ¶
LogPodAssignedTask logs an event indicating that the pod has been assigned a task to run.
func LogPodEvent ¶
func LogPodEvent(id string, kind PodEventType, data PodData)
LogPodEvent logs an event for a pod to the event log.
func LogPodRunningTaskCleared ¶
LogPodRunningTaskCleared logs an event indicating that the pod's current running task has been cleared, so it is no longer assigned to run the task.
func LogPodStatusChanged ¶
func LogPodStatusChanged(id, oldStatus, newStatus, reason string)
LogPodStatusChanged logs an event indicating that the pod's status has been updated.
func LogSpawnHostIdleNotification ¶
func LogSpawnHostIdleNotification(hostID string)
LogSpawnHostIdleNotification logs an event for the spawn host being idle.
func LogSpawnhostExpirationWarningSent ¶
func LogSpawnhostExpirationWarningSent(hostID string)
func LogTaskAbortRequest ¶
LogTaskAbortRequest updates the DB with a task abort request event.
func LogTaskActivated ¶
LogTaskActivated updates the DB with a task activated event.
func LogTaskContainerAllocated ¶
LogTaskContainerAllocated updates the DB with a container allocated event.
func LogTaskCreated ¶
func LogTaskDependenciesOverridden ¶
LogTaskDependenciesOverridden updates the DB with a task dependencies overridden event.
func LogTaskFinished ¶
LogTaskFinished logs an event indicating that the task has finished.
func LogTaskPriority ¶
func LogTaskRestarted ¶
LogTaskRestarted updates the DB with a task restarted event.
func LogTaskStarted ¶
func LogUserEvent ¶
func LogUserEvent(user string, eventType UserEventType, before, after interface{}) error
LogUserEvent logs a DB User change to the event log collection.
func LogVersionChildrenCompletionEvent ¶
func LogVersionChildrenCompletionEvent(id, status, author string)
func LogVersionGithubCheckFinishedEvent ¶
func LogVersionGithubCheckFinishedEvent(id, newStatus string)
func LogVersionStateChangeEvent ¶
func LogVersionStateChangeEvent(id, newStatus string)
func LogVolumeExpirationWarningSent ¶
func LogVolumeExpirationWarningSent(volumeID string)
func LogVolumeMigrationFailed ¶
LogVolumeMigrationFailed is used when a volume is unable to migrate to a new host.
func MostRecentPodEvents ¶
MostRecentPodEvents creates a query to find the n most recent pod events for the given pod ID.
func RecentAdminEvents ¶
Admin Events RecentAdminEvents returns the N most recent admin events
func RemoveSubscription ¶
func ResourceTypeKeyIs ¶
func RevertConfig ¶
RevertConfig reverts one config section to the before state of the specified GUID in the event log
func TaskEventsInOrder ¶
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 Attributes ¶
type Attributes struct { Object []string ID []string Project []string Owner []string Requester []string Status []string DisplayName []string BuildVariant []string InVersion []string InBuild []string }
Attributes describes the properties of an event to be matched with subscription filters.
func (*Attributes) ToSelectorMap ¶
func (a *Attributes) ToSelectorMap() map[string][]string
ToSelectorMap returns a map of selector types to the values they correspond to in Attributes.
type BuildEventData ¶
type ChildPatchSubscriber ¶
type CommitQueueEventData ¶
type ConfigDataChange ¶
type ConfigDataChange struct { Before evergreen.ConfigSection `bson:"before" json:"before"` After evergreen.ConfigSection `bson:"after" json:"after"` }
type DistroEventData ¶
type DistroEventData struct { DistroId string `bson:"d_id,omitempty" json:"d_id,omitempty"` User string `bson:"user,omitempty" json:"user,omitempty"` Before interface{} `bson:"before" json:"before"` After interface{} `bson:"after" json:"after"` // Fields used by legacy UI Data interface{} `bson:"dstr,omitempty" json:"dstr,omitempty"` UserId string `bson:"u_id,omitempty" json:"u_id,omitempty"` }
DistroEventData implements EventData.
type EventLogEntry ¶
type EventLogEntry struct { ID string `bson:"_id" json:"-"` ResourceType string `bson:"r_type,omitempty" json:"resource_type,omitempty"` ProcessedAt time.Time `bson:"processed_at" json:"processed_at"` Timestamp time.Time `bson:"ts" json:"timestamp"` Expirable bool `bson:"expirable,omitempty" json:"expirable,omitempty"` 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(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 FindAllByResourceID ¶
func FindAllByResourceID(resourceID string) ([]EventLogEntry, error)
func FindByID ¶
func FindByID(eventID string) (*EventLogEntry, error)
FindByID finds a single event matching the given event ID.
func FindLastProcessedEvent ¶
func FindLastProcessedEvent() (*EventLogEntry, error)
func FindLatestAMIModifiedDistroEvent ¶
func FindLatestAMIModifiedDistroEvent(id string) (EventLogEntry, error)
FindLatestAMIModifiedDistroEvent returns the most recent AMI event. Returns an empty struct if nothing exists.
func FindLatestPrimaryDistroEvents ¶
FindLatestPrimaryDistroEvents return the most recent non-AMI events for the distro. The before parameter returns only events before the specified time and is used for pagination on the UI.
func FindUnprocessedEvents ¶
func FindUnprocessedEvents(limit int) ([]EventLogEntry, error)
FindUnprocessedEvents returns all unprocessed events in EventCollection. Events are considered unprocessed if their "processed_at" time IsZero
func GetPaginatedHostEvents ¶
func GetPaginatedHostEvents(opts PaginatedHostEventsOpts) ([]EventLogEntry, int, error)
GetPaginatedHostEvents returns a limited and paginated list of host events for the given filters sorted in ascending or descending order by timestamp, as well as the total number of host events.
func GetTaskActivatedEvent ¶
func GetTaskActivatedEvent(taskId string, execution int, userId string) EventLogEntry
GetTaskActivatedEvent retrieves the task activated event.
func GetTaskDeactivatedEvent ¶
func GetTaskDeactivatedEvent(taskId string, execution int, userId string) EventLogEntry
GetTaskDeactivatedEvent retrieves the task deactivated event.
func MostRecentPaginatedPodEvents ¶
func MostRecentPaginatedPodEvents(id string, limit, page int) ([]EventLogEntry, int, error)
MostRecentPaginatedPodEvents returns a limited and paginated list of pod events for the given pod ID sorted in descending order by timestamp as well as the total number of events.
func (*EventLogEntry) Log ¶
func (e *EventLogEntry) Log() error
func (*EventLogEntry) MarkProcessed ¶
func (e *EventLogEntry) MarkProcessed() error
func (*EventLogEntry) MarshalBSON ¶
func (e *EventLogEntry) MarshalBSON() ([]byte, 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) UnmarshalBSON ¶
func (e *EventLogEntry) UnmarshalBSON(in []byte) error
type Filter ¶
type Filter struct { Object string `bson:"object,omitempty"` ID string `bson:"id,omitempty"` Project string `bson:"project,omitempty"` Owner string `bson:"owner,omitempty"` Requester string `bson:"requester,omitempty"` Status string `bson:"status,omitempty"` DisplayName string `bson:"display_name,omitempty"` BuildVariant string `bson:"build_variant,omitempty"` InVersion string `bson:"in_version,omitempty"` InBuild string `bson:"in_build,omitempty"` }
Filter specifies the event properties that are of interest.
func (*Filter) FromSelectors ¶
FromSelectors sets the filter's properties from the selectors' data.
type GithubCheckSubscriber ¶
type GithubCheckSubscriber struct { Owner string `bson:"owner"` Repo string `bson:"repo"` Ref string `bson:"ref"` }
func (*GithubCheckSubscriber) String ¶
func (s *GithubCheckSubscriber) String() string
type GithubMergeSubscriber ¶
type GithubPullRequestSubscriber ¶
type GithubPullRequestSubscriber struct { Owner string `bson:"owner"` Repo string `bson:"repo"` PRNumber int `bson:"pr_number"` Ref string `bson:"ref"` ChildId string `bson:"child"` Type string `bson:"type"` }
func (*GithubPullRequestSubscriber) String ¶
func (s *GithubPullRequestSubscriber) String() string
type HostEventData ¶
type HostEventData struct { AgentRevision string `bson:"a_rev,omitempty" json:"agent_revision,omitempty"` AgentBuild string `bson:"a_build,omitempty" json:"agent_build,omitempty"` JasperRevision string `bson:"j_rev,omitempty" json:"jasper_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"` ProvisioningMethod string `bson:"prov_method" json:"provisioning_method,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"` // Source is the source of a host modification. Only set in specific // conditions where a notification may need to know the cause of a host // being modified. Source string `bson:"source,omitempty" json:"source,omitempty"` }
implements EventData
type HostEventsOpts ¶
HostEventsOpts represent filter arguments to the HostEvents function.
type JIRAIssueSubscriber ¶
type JIRAIssueSubscriber struct { Project string `bson:"project"` IssueType string `bson:"issue_type"` }
func (*JIRAIssueSubscriber) String ¶
func (s *JIRAIssueSubscriber) String() string
type PaginatedHostEventsOpts ¶
type PaginatedHostEventsOpts struct { ID string Tag string Limit int Page int SortAsc bool EventTypes []string }
PaginatedHostEventsOpts represent filter arguments to the GetPaginatedHostEvents function.
type PatchEventData ¶
type PodData ¶
type PodData struct { OldStatus string `bson:"old_status,omitempty" json:"old_status,omitempty"` NewStatus string `bson:"new_status,omitempty" json:"new_status,omitempty"` Reason string `bson:"reason,omitempty" json:"reason,omitempty"` // Fields related to pods running tasks TaskID string `bson:"task_id,omitempty" json:"task_id,omitempty"` TaskExecution int `bson:"task_execution,omitempty" json:"task_execution,omitempty"` TaskStatus string `bson:"task_status,omitempty" json:"task_status,omitempty"` }
PodData contains information relevant to a pod event.
type PodEventType ¶
type PodEventType string
PodEventType represents a type of event related to a pod.
const ( // ResourceTypePod represents a pod as a resource associated with events. ResourceTypePod = "POD" // EventPodStatusChange represents an event where a pod's status is // modified. EventPodStatusChange PodEventType = "STATUS_CHANGE" // EventPodAssignedTask represents an event where a pod is assigned a task // to run. EventPodAssignedTask PodEventType = "ASSIGNED_TASK" // EventPodClearedTask represents an event where a pod's current running // task is cleared. EventPodClearedTask PodEventType = "CLEARED_TASK" // EventPodFinishedTask represents an event where a pod's assigned task has // finished running. EventPodFinishedTask PodEventType = "CONTAINER_TASK_FINISHED" )
type Subscriber ¶
type Subscriber struct { Type string `bson:"type"` // sad violin Target interface{} `bson:"target"` }
func NewEmailSubscriber ¶
func NewEmailSubscriber(t string) Subscriber
func NewEnqueuePatchSubscriber ¶
func NewEnqueuePatchSubscriber() Subscriber
func NewGithubCheckAPISubscriber ¶
func NewGithubCheckAPISubscriber(s GithubCheckSubscriber) Subscriber
func NewGithubMergeAPISubscriber ¶
func NewGithubMergeAPISubscriber(s GithubMergeSubscriber) Subscriber
func NewGithubStatusAPISubscriber ¶
func NewGithubStatusAPISubscriber(s GithubPullRequestSubscriber) Subscriber
func NewRunChildPatchSubscriber ¶
func NewRunChildPatchSubscriber(s ChildPatchSubscriber) Subscriber
func NewSlackSubscriber ¶
func NewSlackSubscriber(t string) Subscriber
func (*Subscriber) MarshalBSON ¶
func (s *Subscriber) MarshalBSON() ([]byte, error)
func (*Subscriber) String ¶
func (s *Subscriber) String() string
func (*Subscriber) UnmarshalBSON ¶
func (s *Subscriber) UnmarshalBSON(in []byte) error
func (*Subscriber) Validate ¶
func (s *Subscriber) Validate() error
type Subscription ¶
type Subscription struct { ID string `bson:"_id"` ResourceType string `bson:"type"` Trigger string `bson:"trigger"` Selectors []Selector `bson:"selectors,omitempty"` RegexSelectors []Selector `bson:"regex_selectors,omitempty"` Filter Filter `bson:"filter"` Subscriber Subscriber `bson:"subscriber"` OwnerType OwnerType `bson:"owner_type"` Owner string `bson:"owner"` TriggerData map[string]string `bson:"trigger_data,omitempty"` LastUpdated time.Time `bson:"last_updated,omitempty"` }
func CreateOrUpdateGeneralSubscription ¶
func CreateOrUpdateGeneralSubscription(resourceType string, id string, subscriber Subscriber, user string) (*Subscription, error)
func FindSubscriptionByID ¶
func FindSubscriptionByID(id string) (*Subscription, error)
func FindSubscriptionsByAttributes ¶
func FindSubscriptionsByAttributes(resourceType string, eventAttributes Attributes) ([]Subscription, error)
FindSubscriptionsByAttributes finds all subscriptions of matching resourceType, and whose filter and regex selectors match the attributes of the event.
func FindSubscriptionsByOwner ¶
func FindSubscriptionsByOwner(owner string, ownerType OwnerType) ([]Subscription, error)
func NewBuildBreakSubscriptionByOwner ¶
func NewBuildBreakSubscriptionByOwner(owner string, sub Subscriber) Subscription
func NewCommitQueueSubscriptionByOwner ¶
func NewCommitQueueSubscriptionByOwner(owner string, sub Subscriber) Subscription
func NewExpiringBuildOutcomeSubscriptionByVersion ¶
func NewExpiringBuildOutcomeSubscriptionByVersion(versionID string, sub Subscriber) Subscription
func NewExpiringPatchChildOutcomeSubscription ¶
func NewExpiringPatchChildOutcomeSubscription(id string, sub Subscriber) Subscription
func NewExpiringPatchOutcomeSubscription ¶
func NewExpiringPatchOutcomeSubscription(id string, sub Subscriber) Subscription
func NewExpiringPatchSuccessSubscription ¶
func NewExpiringPatchSuccessSubscription(id string, sub Subscriber) Subscription
func NewFirstTaskFailureInVersionSubscriptionByOwner ¶
func NewFirstTaskFailureInVersionSubscriptionByOwner(owner string, sub Subscriber) Subscription
func NewGithubCheckBuildOutcomeSubscriptionByVersion ¶
func NewGithubCheckBuildOutcomeSubscriptionByVersion(versionID string, sub Subscriber) Subscription
func NewParentPatchSubscription ¶
func NewParentPatchSubscription(id string, sub Subscriber) Subscription
func NewPatchOutcomeSubscriptionByOwner ¶
func NewPatchOutcomeSubscriptionByOwner(owner string, sub Subscriber) Subscription
func NewSpawnHostIdleWarningSubscription ¶
func NewSpawnHostIdleWarningSubscription(hostId string, sub Subscriber) Subscription
NewSpawnHostIdleWarningSubscription returns a subscription for the spawn host.
func NewSpawnHostOutcomeByOwner ¶
func NewSpawnHostOutcomeByOwner(owner string, sub Subscriber) Subscription
func NewSpawnhostExpirationSubscription ¶
func NewSpawnhostExpirationSubscription(owner string, sub Subscriber) Subscription
func NewSubscriptionByID ¶
func NewSubscriptionByID(resourceType, trigger, id string, sub Subscriber) Subscription
func NewSubscriptionByOwner ¶
func NewSubscriptionByOwner(owner string, sub Subscriber, resourceType, trigger string) Subscription
func NewVersionGithubCheckOutcomeSubscription ¶
func NewVersionGithubCheckOutcomeSubscription(id string, sub Subscriber) Subscription
func (*Subscription) String ¶
func (s *Subscription) String() string
func (*Subscription) UnmarshalBSON ¶
func (d *Subscription) UnmarshalBSON(in []byte) error
func (*Subscription) Upsert ¶
func (s *Subscription) Upsert() error
func (*Subscription) Validate ¶
func (s *Subscription) Validate() error
func (*Subscription) ValidateSelectors ¶
func (s *Subscription) ValidateSelectors() error
type TaskBlockedData ¶
type TaskBlockedData struct { ID string `bson:"-" json:"-"` Execution int `bson:"-" json:"-"` BlockedOn string `bson:"-" json:"-"` }
TaskBlockedData is event data for logging a single task blocked event.
type TaskEventData ¶
type TaskEventData struct { Execution int `bson:"execution" json:"execution"` HostId string `bson:"h_id,omitempty" json:"host_id,omitempty"` PodID string `bson:"pod_id,omitempty" json:"pod_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"` BlockedOn string `bson:"blocked_on,omitempty" json:"blocked_on,omitempty"` Timestamp time.Time `bson:"ts,omitempty" json:"timestamp,omitempty"` Priority int64 `bson:"pri,omitempty" json:"priority,omitempty"` }
implements Data
type UnmarshalEventLogEntry ¶
type UnmarshalEventLogEntry struct { ID interface{} `bson:"_id" json:"-"` ResourceType string `bson:"r_type,omitempty" json:"resource_type,omitempty"` ProcessedAt time.Time `bson:"processed_at" json:"processed_at"` Timestamp time.Time `bson:"ts" json:"timestamp"` Expirable bool `bson:"expirable,omitempty" json:"expirable,omitempty"` ResourceId string `bson:"r_id" json:"resource_id"` EventType string `bson:"e_type" json:"event_type"` Data mgobson.Raw `bson:"data" json:"data"` }
type UserEventType ¶
type UserEventType string
UserEventType represents types of changes possible to a DB user.
const ( UserEventTypeRolesUpdate UserEventType = "USER_ROLES_UPDATED" UserEventTypeFavoriteProjectsUpdate UserEventType = "USER_FAVORITE_PROJECTS_UPDATED" )
type VersionEventData ¶
type WebhookHeader ¶
type WebhookSubscriber ¶
type WebhookSubscriber struct { URL string `bson:"url"` Secret []byte `bson:"secret"` Retries int `bson:"retries"` MinDelayMS int `bson:"min_delay_ms"` TimeoutMS int `bson:"timeout_ms"` Headers []WebhookHeader `bson:"headers"` }
func (*WebhookSubscriber) GetHeader ¶
func (s *WebhookSubscriber) GetHeader(key string) string
GetHeader gets the value for the given key.
func (*WebhookSubscriber) String ¶
func (s *WebhookSubscriber) String() string