summary

package
v1.1.0-beta.0...-cea46f1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0, Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

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 AdjustStartTimeToEarlierTime

func AdjustStartTimeToEarlierTime(t time.Duration)

func CollectDuration

func CollectDuration(name string, t time.Duration)

CollectDuration collects log time field.

func CollectFailureUnit

func CollectFailureUnit(name string, reason error)

CollectFailureUnit collects fail reason.

func CollectInt

func CollectInt(name string, t int)

CollectInt collects log int field.

func CollectSuccessUnit

func CollectSuccessUnit(name string, unitCount int, arg any)

CollectSuccessUnit collects success time costs.

func CollectUint

func CollectUint(name string, t uint64)

CollectUint collects log uint64 field.

func InitCollector

func InitCollector(
	hasLogFile bool,
)

InitCollector initilize global collector instance.

func Log

func Log(msg string, fields ...zap.Field)

Log outputs log.

func NowDureTime

func NowDureTime() time.Duration

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.

func SetUnit

func SetUnit(unit string)

SetUnit set unit "backup/restore" for summary log.

func Summary

func Summary(name string)

Summary outputs summary log.

Types

type LogCollector

type LogCollector interface {
	SetUnit(unit string)

	CollectSuccessUnit(name string, unitCount int, arg any)

	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.

Jump to

Keyboard shortcuts

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