metric

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MetricFileNameSuffix represents the suffix of the metric file.
	MetricFileNameSuffix = "metrics.log"
	// MetricIdxSuffix represents the suffix of the metric index file.
	MetricIdxSuffix = ".idx"
	// FileLockSuffix represents the suffix of the lock file.
	FileLockSuffix = ".lck"
	// FilePidPrefix represents the pid flag of filename.
	FilePidPrefix = "pid"
)

Variables

This section is empty.

Functions

func FormMetricFileName

func FormMetricFileName(serviceName string, withPid bool) string

Generate the metric file name from the service name.

func InitTask

func InitTask() (err error)

Types

type DefaultMetricLogWriter

type DefaultMetricLogWriter struct {
	// contains filtered or unexported fields
}

func (*DefaultMetricLogWriter) Close

func (d *DefaultMetricLogWriter) Close() error

func (*DefaultMetricLogWriter) Write

func (d *DefaultMetricLogWriter) Write(ts uint64, items []*base.MetricItem) error

type DefaultMetricSearcher

type DefaultMetricSearcher struct {
	// contains filtered or unexported fields
}

func (*DefaultMetricSearcher) FindByTimeAndResource

func (s *DefaultMetricSearcher) FindByTimeAndResource(beginTimeMs uint64, endTimeMs uint64, resource string) ([]*base.MetricItem, error)

func (*DefaultMetricSearcher) FindFromTimeWithMaxLines

func (s *DefaultMetricSearcher) FindFromTimeWithMaxLines(beginTimeMs uint64, maxLines uint32) ([]*base.MetricItem, error)

type MetricLogReader

type MetricLogReader interface {
	ReadMetrics(nameList []string, fileNo uint32, startOffset uint64, maxLines uint32) ([]*base.MetricItem, error)

	ReadMetricsByEndTime(nameList []string, fileNo uint32, startOffset uint64, beginMs uint64, endMs uint64, resource string) ([]*base.MetricItem, error)
}

type MetricLogWriter

type MetricLogWriter interface {
	Write(ts uint64, items []*base.MetricItem) error
}

MetricLogWriter writes and flushes metric items to current metric log.

func NewDefaultMetricLogWriter

func NewDefaultMetricLogWriter(maxSize uint64, maxFileAmount uint32) (MetricLogWriter, error)

func NewDefaultMetricLogWriterOfApp

func NewDefaultMetricLogWriterOfApp(maxSize uint64, maxFileAmount uint32, appName string) (MetricLogWriter, error)

type MetricSearcher

type MetricSearcher interface {
	FindByTimeAndResource(beginTimeMs uint64, endTimeMs uint64, resource string) ([]*base.MetricItem, error)

	FindFromTimeWithMaxLines(beginTimeMs uint64, maxLines uint32) ([]*base.MetricItem, error)
}

MetricSearcher searches metric items from the metric log file under given condition.

func NewDefaultMetricSearcher

func NewDefaultMetricSearcher(baseDir, baseFilename string) (MetricSearcher, error)

Jump to

Keyboard shortcuts

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