stats

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package stats used to record pl metrics

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLog

func InitLog()

func SetStats

func SetStats(st Stats)

func WriteEvent

func WriteEvent(event *ChangeEvent, tags map[string]string)

func WriteMetric

func WriteMetric(tags map[string]string, pt, ptDrop, ptError float64, cost time.Duration)

func WriteUpdateTime

func WriteUpdateTime(tags map[string]string)

Types

type ChangeEvent

type ChangeEvent struct {
	Name              string
	Category          point.Category
	NS, NSOld         string
	Script, ScriptOld string

	Op EventOP //

	CompileError string
	Time         time.Time
	// contains filtered or unexported fields
}

func (ChangeEvent) String

func (event ChangeEvent) String() string

type EventOP

type EventOP string
const (
	StatsTimeFormat = "2006-01-02T15:04:05.999Z07:00"

	EventOpAdd                EventOP = "ADD"
	EventOpUpdate             EventOP = "UPDATE"
	EventOpDelete             EventOP = "DELETE"
	EventOpIndex              EventOP = "INDEX"
	EventOpIndexUpdate        EventOP = "INDEX_UPDATE"
	EventOpIndexDelete        EventOP = "INDEX_DELETE"
	EventOpIndexDeleteAndBack EventOP = "INDEX_DELETE_AND_BACK"
	EventOpCompileError       EventOP = "COMPILE_ERROR"

	DefaultSubSystem = "pipeline"
)

type RecEvent

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

func (*RecEvent) Read

func (event *RecEvent) Read(events []*ChangeEvent) []*ChangeEvent

func (*RecEvent) ReadChan

func (event *RecEvent) ReadChan() <-chan *ChangeEvent

func (*RecEvent) Write

func (event *RecEvent) Write(change *ChangeEvent, tags map[string]string)

type RecMetric

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

func (*RecMetric) Metrics

func (rec *RecMetric) Metrics() []prometheus.Collector

func (*RecMetric) WriteMetric

func (rec *RecMetric) WriteMetric(tags map[string]string, pt, ptDrop, ptError float64, cost time.Duration)

func (*RecMetric) WriteUpdateTime

func (rec *RecMetric) WriteUpdateTime(tags map[string]string)

type RecStats

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

func NewRecStats

func NewRecStats(ns, subsystem string, labelNames []string, eventSize int) *RecStats

func (*RecStats) Metrics

func (stats *RecStats) Metrics() []prometheus.Collector

func (*RecStats) ReadEvents

func (stats *RecStats) ReadEvents(events []*ChangeEvent) []*ChangeEvent

func (*RecStats) WriteEvent

func (stats *RecStats) WriteEvent(event *ChangeEvent, tags map[string]string)

func (*RecStats) WriteMetric

func (stats *RecStats) WriteMetric(tags map[string]string, pt, ptDrop, ptError float64, cost time.Duration)

func (*RecStats) WriteUpdateTime

func (stats *RecStats) WriteUpdateTime(tags map[string]string)

type Stats

type Stats interface {
	Metrics() []prometheus.Collector
	WriteMetric(tags map[string]string, pt, ptDrop, ptError float64, cost time.Duration)

	WriteEvent(event *ChangeEvent, tags map[string]string)
	ReadEvents(events []*ChangeEvent) []*ChangeEvent

	WriteUpdateTime(tags map[string]string)
}

Jump to

Keyboard shortcuts

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