Documentation ¶
Index ¶
- func AddLogOptionalFields(ctx context.Context, logOptFields LogOptionalFields) context.Context
- func FormatLog(flat map[string]interface{}) string
- func GetLogsEventsIndex(deploymentID string) (uint64, error)
- func GetStatusEventsIndex(deploymentID string) (uint64, error)
- func LogsEvents(ctx context.Context, deploymentID string, waitIndex uint64, ...) ([]json.RawMessage, uint64, error)
- func NewContext(ctx context.Context, logOptFields LogOptionalFields) context.Context
- func PublishAndLogAlienTaskStatusChange(ctx context.Context, deploymentID, taskID, taskExecutionID string, ...) (string, error)
- func PublishAndLogAttributeValueChange(ctx context.Context, ...) (string, error)
- func PublishAndLogCustomCommandStatusChange(ctx context.Context, deploymentID, taskID, status string) (string, error)
- func PublishAndLogDeploymentStatusChange(ctx context.Context, deploymentID, status string) (string, error)
- func PublishAndLogInstanceStatusChange(ctx context.Context, deploymentID, nodeName, instance, status string) (string, error)
- func PublishAndLogMapAttributeValueChange(ctx context.Context, deploymentID, nodeName, instanceName string, ...) error
- func PublishAndLogScalingStatusChange(ctx context.Context, deploymentID, taskID, status string) (string, error)
- func PublishAndLogWorkflowStatusChange(ctx context.Context, deploymentID, taskID, workflowID, status string) (string, error)
- func PublishAndLogWorkflowStepStatusChange(ctx context.Context, deploymentID, taskID string, wfStepInfo *WorkflowStepInfo, ...) (string, error)
- func PurgeDeploymentEvents(ctx context.Context, deploymentID string) error
- func PurgeDeploymentLogs(ctx context.Context, deploymentID string) error
- func StatusEvents(ctx context.Context, deploymentID string, waitIndex uint64, ...) ([]json.RawMessage, uint64, error)
- type BufferedLogEntryWriter
- type FieldType
- type Info
- type InfoType
- type LogEntry
- type LogEntryDraft
- type LogLevel
- type LogOptionalFields
- type StatusChangeType
- type WorkflowStepInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddLogOptionalFields ¶
func AddLogOptionalFields(ctx context.Context, logOptFields LogOptionalFields) context.Context
AddLogOptionalFields adds given log optional fields to existing one in the given context if any
Existing fields are overwritten in case of collision
func FormatLog ¶
FormatLog allows to format the flat map log representation in the following format :[Timestamp][Level][DeploymentID][WorkflowID]ExecutionIDTaskExecutionIDNodeIDInstanceIDInterfaceNameOperationName[TypeID]Content
func GetLogsEventsIndex ¶
GetLogsEventsIndex returns the latest index of LogEntry events for a given deployment
func GetStatusEventsIndex ¶
GetStatusEventsIndex returns the latest index of InstanceStatus events for a given deployment
func LogsEvents ¶
func LogsEvents(ctx context.Context, deploymentID string, waitIndex uint64, timeout time.Duration) ([]json.RawMessage, uint64, error)
LogsEvents allows to return logs from Consul KV storage for all, or a given deployment
func NewContext ¶
func NewContext(ctx context.Context, logOptFields LogOptionalFields) context.Context
NewContext returns a new Context that carries value logOptFields.
func PublishAndLogAlienTaskStatusChange ¶
func PublishAndLogAlienTaskStatusChange(ctx context.Context, deploymentID, taskID, taskExecutionID string, wfStepInfo *WorkflowStepInfo, status string) (string, error)
PublishAndLogAlienTaskStatusChange publishes a status change for a task execution and log this change into the log API
PublishAndLogAlienTaskStatusChange returns the published event id
func PublishAndLogAttributeValueChange ¶
func PublishAndLogAttributeValueChange(ctx context.Context, deploymentID, nodeName, instanceName, attributeName, value, status string) (string, error)
PublishAndLogAttributeValueChange publishes a value change for a given attribute instance of a given node and log this change into the log API
PublishAndLogAttributeValueChange returns the published event id
func PublishAndLogCustomCommandStatusChange ¶
func PublishAndLogCustomCommandStatusChange(ctx context.Context, deploymentID, taskID, status string) (string, error)
PublishAndLogCustomCommandStatusChange publishes a status change for a custom command and log this change into the log API
PublishAndLogCustomCommandStatusChange returns the published event id
func PublishAndLogDeploymentStatusChange ¶
func PublishAndLogDeploymentStatusChange(ctx context.Context, deploymentID, status string) (string, error)
PublishAndLogDeploymentStatusChange publishes a status change for a given deployment and log this change into the log API
PublishAndLogDeploymentStatusChange returns the published event id
func PublishAndLogInstanceStatusChange ¶
func PublishAndLogInstanceStatusChange(ctx context.Context, deploymentID, nodeName, instance, status string) (string, error)
PublishAndLogInstanceStatusChange publishes a status change for a given instance of a given node and log this change into the log API
PublishAndLogInstanceStatusChange returns the published event id
func PublishAndLogMapAttributeValueChange ¶
func PublishAndLogMapAttributeValueChange(ctx context.Context, deploymentID, nodeName, instanceName string, attributesValues map[string]string, status string) error
PublishAndLogMapAttributeValueChange publishes a map attribute/value change for a given attribute instance of a given node and log this change into the log API This function doesn't return any published event id
func PublishAndLogScalingStatusChange ¶
func PublishAndLogScalingStatusChange(ctx context.Context, deploymentID, taskID, status string) (string, error)
PublishAndLogScalingStatusChange publishes a status change for a scaling task and log this change into the log API
PublishAndLogScalingStatusChange returns the published event id
func PublishAndLogWorkflowStatusChange ¶
func PublishAndLogWorkflowStatusChange(ctx context.Context, deploymentID, taskID, workflowID, status string) (string, error)
PublishAndLogWorkflowStatusChange publishes a status change for a workflow task and log this change into the log API
PublishAndLogWorkflowStatusChange returns the published event id
func PublishAndLogWorkflowStepStatusChange ¶
func PublishAndLogWorkflowStepStatusChange(ctx context.Context, deploymentID, taskID string, wfStepInfo *WorkflowStepInfo, status string) (string, error)
PublishAndLogWorkflowStepStatusChange publishes a status change for a workflow step execution and log this change into the log API
PublishAndLogWorkflowStepStatusChange returns the published event id
func PurgeDeploymentEvents ¶
PurgeDeploymentEvents deletes all events for a given deployment
func PurgeDeploymentLogs ¶
PurgeDeploymentLogs deletes all logs for a given deployment
Types ¶
type BufferedLogEntryWriter ¶
A BufferedLogEntryWriter is a Writer that buffers writes and flushes its buffer as an event log on a regular basis (every 5s)
func NewBufferedLogEntryWriter ¶
func NewBufferedLogEntryWriter() BufferedLogEntryWriter
NewBufferedLogEntryWriter returns a BufferedLogEntryWriter used to register log entry
type FieldType ¶
type FieldType int
FieldType is allowed/expected additional info types
const ( // WorkFlowID is the field type representing the workflow ID in log entry WorkFlowID FieldType = iota // ExecutionID is the field type representing the execution ID in log entry ExecutionID // NodeID is the field type representing the node ID in log entry NodeID // InstanceID is the field type representing the instance ID in log entry InstanceID // InterfaceName is the field type representing the interface ID in log entry InterfaceName // OperationName is the field type representing the operation ID in log entry OperationName // TypeID is the field type representing the type ID in log entry TypeID // TaskExecutionID is the field type representing the task execution ID in log entry TaskExecutionID )
type Info ¶
type Info map[InfoType]interface{}
Info allows to provide custom/specific additional information for event
type InfoType ¶
type InfoType int
InfoType represents Event status change information type
const ( // EDeploymentID is event information related to deploymentIS EDeploymentID InfoType = iota // EStatus is event information related to status EStatus // ETimestamp is event timestamp ETimestamp // EType is type event information EType // EWorkflowID is event information related to workflow EWorkflowID // ETaskID is event information related to task ETaskID // ENodeID is event information related to node ENodeID // EInstanceID is event information related to instance EInstanceID // EOperationName is event information related to operation EOperationName // ETargetNodeID is event information related to target node ETargetNodeID // ETargetInstanceID is event information related to target instance ETargetInstanceID // ETaskExecutionID is event information related to task execution ETaskExecutionID // EWorkflowStepID is event information related to workflow step EWorkflowStepID // EAttributeName is event information related to attribute name EAttributeName // EAttributeValue is event information related to attribute value EAttributeValue )
type LogEntry ¶
type LogEntry struct {
// contains filtered or unexported fields
}
LogEntry is the log entry representation
func SimpleLogEntry ¶
SimpleLogEntry allows to return a LogEntry instance with log level and deploymentID
func (LogEntry) RegisterAsString ¶
RegisterAsString allows to register a log entry with string content
func (LogEntry) Registerf ¶
Registerf allows to register a log entry with formats according to a format specifier.
This is basically a convenient function around RegisterAsString(fmt.Sprintf()).
func (LogEntry) RunBufferedRegistration ¶
func (e LogEntry) RunBufferedRegistration(buf BufferedLogEntryWriter, quit chan bool)
RunBufferedRegistration allows to run a registration with a buffered writer
type LogEntryDraft ¶
type LogEntryDraft struct {
// contains filtered or unexported fields
}
LogEntryDraft is a partial LogEntry with only optional fields. It has to be completed with level and deploymentID
func WithContextOptionalFields ¶
func WithContextOptionalFields(ctx context.Context) *LogEntryDraft
WithContextOptionalFields allows to return a LogEntry instance with additional fields comming from the context
func (LogEntryDraft) NewLogEntry ¶
func (e LogEntryDraft) NewLogEntry(level LogLevel, deploymentID string) *LogEntry
NewLogEntry allows to build a log entry from a draft
type LogLevel ¶
type LogLevel int
LogLevel x ENUM( INFO, DEBUG, WARN, ERROR )
func ParseLogLevel ¶
ParseLogLevel attempts to convert a string to a LogLevel
type LogOptionalFields ¶
type LogOptionalFields map[FieldType]interface{}
LogOptionalFields are log's additional info
func FromContext ¶
func FromContext(ctx context.Context) (LogOptionalFields, bool)
FromContext returns a copy of the LogOptionalFields value stored in ctx, if any.
type StatusChangeType ¶
type StatusChangeType int
StatusChangeType x ENUM( Instance, Deployment, CustomCommand, Scaling, Workflow, WorkflowStep AlienTask, AttributeValue )
const ( // StatusChangeTypeInstance is a StatusChangeType of type Instance StatusChangeTypeInstance StatusChangeType = iota // StatusChangeTypeDeployment is a StatusChangeType of type Deployment StatusChangeTypeDeployment // StatusChangeTypeCustomCommand is a StatusChangeType of type CustomCommand StatusChangeTypeCustomCommand // StatusChangeTypeScaling is a StatusChangeType of type Scaling StatusChangeTypeScaling // StatusChangeTypeWorkflow is a StatusChangeType of type Workflow StatusChangeTypeWorkflow // StatusChangeTypeWorkflowStep is a StatusChangeType of type WorkflowStep StatusChangeTypeWorkflowStep // StatusChangeTypeAlienTask is a StatusChangeType of type AlienTask StatusChangeTypeAlienTask // StatusChangeTypeAttributeValue is a StatusChangeType of type AttributeValue StatusChangeTypeAttributeValue )
func ParseStatusChangeType ¶
func ParseStatusChangeType(name string) (StatusChangeType, error)
ParseStatusChangeType attempts to convert a string to a StatusChangeType
func (StatusChangeType) String ¶
func (i StatusChangeType) String() string
type WorkflowStepInfo ¶
type WorkflowStepInfo struct { WorkflowName string `json:"workflow_name,omitempty"` InstanceName string `json:"instance_name,omitempty"` NodeName string `json:"node_name,omitempty"` StepName string `json:"step_name,omitempty"` OperationName string `json:"operation_name,omitempty"` TargetNodeID string `json:"target_node_id,omitempty"` TargetInstanceID string `json:"target_instance_id,omitempty"` }
WorkflowStepInfo represents specific workflow step event information