Documentation ¶
Index ¶
- Constants
- func AdjustStartTimeToEarlierTime(t time.Duration)
- func CollectDuration(name string, t time.Duration)
- func CollectFailureUnit(name string, reason error)
- func CollectInt(name string, t int)
- func CollectSuccessUnit(name string, unitCount int, arg interface{})
- func CollectUint(name string, t uint64)
- func InitCollector(hasLogFile bool)
- func Log(msg string, fields ...zap.Field)
- func NowDureTime() time.Duration
- func SetLogCollector(l LogCollector)
- func SetSuccessStatus(success bool)
- func SetUnit(unit string)
- func Summary(name string)
- type LogCollector
Constants ¶
View Source
const ( // BackupUnit tells summary in backup BackupUnit = "backup" // RestoreUnit tells summary in restore RestoreUnit = "restore" // TotalKV is a field we collect during backup/restore TotalKV = "total kv" // TotalBytes is a field we collect during backup/restore TotalBytes = "total bytes" // BackupDataSize is a field we collect after backup finish BackupDataSize = "backup data size(after compressed)" // RestoreDataSize is a field we collection after restore finish RestoreDataSize = "restore data size(after compressed)" // SkippedKVCountByCheckpoint is a field we skip during backup/restore SkippedKVCountByCheckpoint = "skipped kv count by checkpoint" // SkippedBytesByCheckpoint is a field we skip during backup/restore SkippedBytesByCheckpoint = "skipped bytes by checkpoint" )
Variables ¶
This section is empty.
Functions ¶
func CollectDuration ¶
CollectDuration collects log time field.
func CollectFailureUnit ¶
CollectFailureUnit collects fail reason.
func CollectSuccessUnit ¶
CollectSuccessUnit collects success time costs.
func InitCollector ¶
func InitCollector( hasLogFile bool, )
InitCollector initilize global collector instance.
func NowDureTime ¶
NowDureTime returns the duration between start time and current time
func SetLogCollector ¶
func SetLogCollector(l LogCollector)
SetLogCollector allow pass LogCollector outside.
func SetSuccessStatus ¶
func SetSuccessStatus(success bool)
SetSuccessStatus sets final success status.
Types ¶
type LogCollector ¶
type LogCollector interface { SetUnit(unit string) CollectSuccessUnit(name string, unitCount int, arg interface{}) CollectFailureUnit(name string, reason error) CollectDuration(name string, t time.Duration) CollectInt(name string, t int) CollectUInt(name string, t uint64) SetSuccessStatus(success bool) NowDureTime() time.Duration AdjustStartTimeToEarlierTime(t time.Duration) Summary(name string) Log(msg string, fields ...zap.Field) }
LogCollector collects infos into summary log.
func NewLogCollector ¶
func NewLogCollector(logf logFunc) LogCollector
NewLogCollector returns a new LogCollector.
Click to show internal directories.
Click to hide internal directories.