Documentation ¶
Index ¶
- Constants
- Variables
- func DistroEventsForId(id string) db.Q
- func DistroEventsInOrder(id string) db.Q
- func HostEventsForId(id string) db.Q
- func HostEventsInOrder(id string) db.Q
- func LogDistroAdded(distroId, userId string, data interface{})
- func LogDistroEvent(distroId string, eventType string, eventData DistroEventData)
- func LogDistroModified(distroId, userId string, data interface{})
- func LogDistroRemoved(distroId, userId string, data interface{})
- func LogHostCreated(hostId string)
- func LogHostDNSNameSet(hostId string, dnsName string)
- func LogHostEvent(hostId string, eventType string, eventData HostEventData)
- func LogHostProvisioned(hostId string)
- func LogHostRunningTaskCleared(hostId string, taskId string)
- func LogHostRunningTaskSet(hostId string, taskId string)
- func LogHostStatusChanged(hostId string, oldStatus string, newStatus string)
- func LogHostTaskPidSet(hostId string, taskPid string)
- func LogProvisionFailed(hostId string, setupLog string)
- func LogTaskAbortRequest(taskId string, userId string)
- func LogTaskActivated(taskId string, userId string)
- func LogTaskCreated(taskId string)
- func LogTaskDeactivated(taskId string, userId string)
- func LogTaskDispatched(taskId, hostId string)
- func LogTaskEvent(taskId string, eventType string, eventData TaskEventData)
- func LogTaskFinished(taskId string, status string)
- func LogTaskRestarted(taskId string, userId string)
- func LogTaskScheduled(taskId string, scheduledTime time.Time)
- func LogTaskStarted(taskId string)
- func LogTaskUndispatched(taskId, hostId string)
- func MostRecentDistroEvents(id string, n int) db.Q
- func MostRecentHostEvents(id string, n int) db.Q
- func MostRecentTaskEvents(id string, n int) db.Q
- func TaskEventsForId(id string) db.Q
- func TaskEventsInOrder(id string) db.Q
- type DBEventLogger
- type Data
- type DataWrapper
- type DistroEventData
- type Event
- type EventLogger
- type HostEventData
- type TaskEventData
Constants ¶
View Source
const ( // resource type ResourceTypeDistro = "DISTRO" // event types EventDistroAdded = "DISTRO_ADDED" EventDistroModified = "DISTRO_MODIFIED" EventDistroRemoved = "DISTRO_REMOVED" )
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" )
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 (
// db constants
Collection = "event_log"
)
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") )
Functions ¶
func DistroEventsInOrder ¶
func HostEventsInOrder ¶
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 LogHostEvent ¶
func LogHostEvent(hostId string, eventType string, eventData HostEventData)
func LogHostProvisioned ¶
func LogHostProvisioned(hostId string)
func LogHostRunningTaskSet ¶
func LogHostStatusChanged ¶
func LogHostTaskPidSet ¶
func LogProvisionFailed ¶
func LogTaskAbortRequest ¶
func LogTaskActivated ¶
func LogTaskCreated ¶
func LogTaskCreated(taskId string)
func LogTaskDeactivated ¶
func LogTaskDispatched ¶
func LogTaskDispatched(taskId, hostId string)
func LogTaskEvent ¶
func LogTaskEvent(taskId string, eventType string, eventData TaskEventData)
func LogTaskFinished ¶
func LogTaskRestarted ¶
func LogTaskScheduled ¶
func LogTaskStarted ¶
func LogTaskStarted(taskId string)
func LogTaskUndispatched ¶
func LogTaskUndispatched(taskId, hostId string)
func TaskEventsInOrder ¶
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 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.
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"` }
type EventLogger ¶
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"` SetupLog string `bson:"log,omitempty" json:"setup_log,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"` }
implements EventData
func (HostEventData) IsValid ¶
func (self HostEventData) 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
Click to show internal directories.
Click to hide internal directories.