summary

package
v0.0.0-...-a345a4b Latest Latest
Warning

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

Go to latest
Published: Aug 4, 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)"
)

Variables

This section is empty.

Functions

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 interface{})

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 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 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)

	Summary(name string)
}

LogCollector collects infos into summary log.

func NewLogCollector

func NewLogCollector(log 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