Documentation ¶
Index ¶
- type Checker
- type CheckerManager
- type LongTermChecker
- type TimeRecorder
- func (tr *TimeRecorder) CtxElapse(ctx context.Context, msg string) time.Duration
- func (tr *TimeRecorder) CtxRecord(ctx context.Context, msg string) time.Duration
- func (tr *TimeRecorder) Elapse(msg string) time.Duration
- func (tr *TimeRecorder) ElapseSpan() time.Duration
- func (tr *TimeRecorder) Record(msg string) time.Duration
- func (tr *TimeRecorder) RecordSpan() time.Duration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
func NewChecker ¶
func NewChecker(name string, manager *CheckerManager) *Checker
type CheckerManager ¶
type CheckerManager struct {
// contains filtered or unexported fields
}
CheckerManager checks members in same group silent for certain period of time print warning msg if there are item(s) that not reported
func GetCheckerManger ¶
func GetCheckerManger(groupName string, duration time.Duration, fn func([]string)) *CheckerManager
GetGroupChecker returns the GroupChecker with related group name if no exist GroupChecker has the provided name, a new instance will be created with provided params otherwise the params will be ignored
func (*CheckerManager) Register ¶
func (gc *CheckerManager) Register(name string, checker *Checker)
func (*CheckerManager) Remove ¶
func (gc *CheckerManager) Remove(name string)
Remove deletes name from watch list
type LongTermChecker ¶
type LongTermChecker struct {
// contains filtered or unexported fields
}
LongTermChecker checks we receive at least one msg in d duration. If not, checker will print a warn message.
func NewLongTermChecker ¶
func NewLongTermChecker(ctx context.Context, name string, d time.Duration, warn string) *LongTermChecker
NewLongTermChecker creates a long term checker specified name, checking interval and warning string to print
type TimeRecorder ¶
type TimeRecorder struct {
// contains filtered or unexported fields
}
TimeRecorder provides methods to record time duration
func NewTimeRecorder ¶
func NewTimeRecorder(header string) *TimeRecorder
NewTimeRecorder creates a new TimeRecorder
func NewTimeRecorderWithTrace ¶
func NewTimeRecorderWithTrace(ctx context.Context, header string) *TimeRecorder
NewTimeRecorderWithCtx creates a new TimeRecorder with context's traceID,
func (*TimeRecorder) Elapse ¶
func (tr *TimeRecorder) Elapse(msg string) time.Duration
Elapse calculates the time span from the beginning of this TimeRecorder
func (*TimeRecorder) ElapseSpan ¶
func (tr *TimeRecorder) ElapseSpan() time.Duration
ElapseSpan returns the duration from the beginning
func (*TimeRecorder) Record ¶
func (tr *TimeRecorder) Record(msg string) time.Duration
Record calculates the time span from previous Record call
func (*TimeRecorder) RecordSpan ¶
func (tr *TimeRecorder) RecordSpan() time.Duration
RecordSpan returns the duration from last record