systemreports

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

View Source
const (
	JobSuccess string = "success"
	JobFailed  string = "failure"
	JobWarning string = "warning"
	JobStarted string = "started"
	JobDone    string = "done"
)

Variables

This section is empty.

Functions

func IsEqual

func IsEqual(lhs, rhs IReporter) bool

IsEqual are two IReporter objects equal

func NewNoReportSender added in v0.0.12

func NewNoReportSender() *noReportSender

NewNoReportSender returns a Sender that sends no reports

It stands in for a proper report sender when the client needs no reports to be sent

Types

type BaseReport

type BaseReport struct {
	CustomerGUID string     `json:"customerGUID"` // customerGUID as declared in environment
	Reporter     string     `json:"reporter"`     // component reporting the event
	Target       string     `json:"target"`       // wlid, cluster,etc. - which component this event is applicable on
	Status       string     `json:"status"`       // Action scope: Before action use "started", after action use "failure/success". Reporter scope: Before action use "started", after action use "done".
	ActionName   string     `json:"action"`       // Stage action. short description of the action to-be-done. When defining an action
	Errors       []string   `json:"errors,omitempty"`
	ActionID     string     `json:"actionID"`               // Stage counter of the E2E process. initialize at 1. The number is increased when sending job report
	ActionIDN    int        `json:"numSeq"`                 // The ActionID in number presentation
	JobID        string     `json:"jobID"`                  // UID received from the eventReceiver after first report (the initializing is part of the first report)
	ParentAction string     `json:"parentAction,omitempty"` // Parent JobID
	Details      string     `json:"details,omitempty"`      // Details of the action
	Timestamp    time.Time  `json:"timestamp"`              //
	Mutex        sync.Mutex `json:"-"`                      // ignore
}

func NewBaseReport

func NewBaseReport(customerGUID, reporter string) *BaseReport

NewBaseReport return pointer to new BaseReport obj

func (*BaseReport) AddError

func (report *BaseReport) AddError(er string)

func (*BaseReport) DoSetActionName

func (report *BaseReport) DoSetActionName(actionName string)

func (*BaseReport) DoSetDetails

func (report *BaseReport) DoSetDetails(details string)

func (*BaseReport) DoSetStatus

func (report *BaseReport) DoSetStatus(status string)

func (*BaseReport) GetActionID

func (report *BaseReport) GetActionID() string

func (*BaseReport) GetActionIDN

func (report *BaseReport) GetActionIDN() int

func (*BaseReport) GetActionName

func (report *BaseReport) GetActionName() string

============================================ GET ============================================

func (*BaseReport) GetCustomerGUID

func (report *BaseReport) GetCustomerGUID() string

func (*BaseReport) GetDetails

func (report *BaseReport) GetDetails() string

func (*BaseReport) GetErrorList

func (report *BaseReport) GetErrorList() []string

func (*BaseReport) GetJobID

func (report *BaseReport) GetJobID() string

func (*BaseReport) GetNextActionId

func (report *BaseReport) GetNextActionId() string

func (*BaseReport) GetParentAction

func (report *BaseReport) GetParentAction() string

func (*BaseReport) GetReportID

func (report *BaseReport) GetReportID() string

func (*BaseReport) GetReporter

func (report *BaseReport) GetReporter() string

func (*BaseReport) GetStatus

func (report *BaseReport) GetStatus() string

func (*BaseReport) GetTarget

func (report *BaseReport) GetTarget() string

func (*BaseReport) GetTimestamp

func (report *BaseReport) GetTimestamp() time.Time

func (*BaseReport) NKeys

func (ae *BaseReport) NKeys() int

func (*BaseReport) NextActionID

func (report *BaseReport) NextActionID()

func (*BaseReport) SetActionID

func (report *BaseReport) SetActionID(actionID string)

func (*BaseReport) SetActionIDN

func (report *BaseReport) SetActionIDN(actionIDN int)

func (*BaseReport) SetActionName

func (report *BaseReport) SetActionName(actionName string)

func (*BaseReport) SetCustomerGUID

func (report *BaseReport) SetCustomerGUID(customerGUID string)

func (*BaseReport) SetDetails

func (report *BaseReport) SetDetails(details string)

func (*BaseReport) SetJobID

func (report *BaseReport) SetJobID(jobID string)

func (*BaseReport) SetParentAction

func (report *BaseReport) SetParentAction(parentAction string)

func (*BaseReport) SetReporter

func (report *BaseReport) SetReporter(reporter string)

func (*BaseReport) SetStatus

func (report *BaseReport) SetStatus(status string)

func (*BaseReport) SetTarget

func (report *BaseReport) SetTarget(target string)

func (*BaseReport) SetTimestamp

func (report *BaseReport) SetTimestamp(timestamp time.Time)

func (*BaseReport) SimpleReportAnnotations

func (report *BaseReport) SimpleReportAnnotations(setParent bool, setCurrent bool) (string, string)

func (*BaseReport) UnmarshalJSONObject

func (reporter *BaseReport) UnmarshalJSONObject(dec *gojay.Decoder, key string) (err error)

type IReporter

type IReporter interface {
	// createReport() BaseReport
	GetReportID() string
	/* a multiple errors can occur but these error are not critical,
	errorString will be added to a vector of errors so the error flow until the critical error will be clear
	*/
	AddError(errorString string)
	GetNextActionId() string
	NextActionID()
	/*
		SimpleReportAnnotations - create an object that can be passed on as annotation and serialize it.

		This objects can be shared between the different microservices processing the same workload.

		thus this will save the jobID,it's latest actionID.
		@Input:
		setParent- set parentJobID to the jobID
		setCurrent - set the jobID to the current jobID

		@returns:
		 jsonAsString, nextActionID
	*/
	SimpleReportAnnotations(setParent bool, setCurrent bool) (string, string)

	// set methods
	SetReporter(string)
	SetStatus(string)
	SetActionName(string)
	SetTarget(string)
	SetActionID(string)
	SetJobID(string)
	SetParentAction(string)
	SetTimestamp(time.Time)
	SetActionIDN(int)
	SetCustomerGUID(string)
	SetDetails(string)

	// get methods
	GetReporter() string
	GetStatus() string
	GetActionName() string
	GetTarget() string
	GetErrorList() []string
	GetActionID() string
	GetJobID() string
	GetParentAction() string
	GetTimestamp() time.Time
	GetActionIDN() int
	GetCustomerGUID() string
	GetDetails() string
}

IReporter reporter interface

type JobsAnnotations

type JobsAnnotations struct {
	/* jobID: context   eg. if a certain job has multiple stages
	  eg. attach namespace>attach wlid in ns
	  so obj when pod is cached should look like:
	  {
		  jobID#1: {
			"attach namespace"
		  }
	  }
	  - SHOULD BE RETHINK
	*/
	// JobIDsContex map[string]string `json:"jobIDsContex,omitempty"`
	CurrJobID    string `json:"jobID"`       //simplest case (for now till we have a better idea)
	ParentJobID  string `json:"parentJobID"` //simplest case (for now till we have a better idea)
	LastActionID string `json:"actionID"`    //simplest case (for now till we have a better idea) used to pass as defining ordering between multiple components
}

JobsAnnotations job annotation

type StatusType

type StatusType string

Statuses type

Jump to

Keyboard shortcuts

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