Documentation ¶
Overview ¶
Package stats used to record pl metrics
Index ¶
- Constants
- func InitLog()
- func Metrics() []prometheus.Collector
- func StatsKey(category point.Category, ns, name string) string
- func UpdateScriptStatsMeta(category point.Category, ns, name, script string, enable, deleted bool, ...)
- func WriteEvent(event *ChangeEvent)
- func WriteScriptStats(category point.Category, ns, name string, pt, ptDrop, ptError uint64, ...)
- type ChangeEvent
- type EventOP
- type ScriptChangeEvent
- type ScriptMeta
- type ScriptStats
- type ScriptStatsROnly
- type Stats
- func (stats *Stats) ReadEvent() []ChangeEvent
- func (stats *Stats) ReadStats() []ScriptStatsROnly
- func (stats *Stats) UpdateScriptStatsMeta(category point.Category, ns, name, script string, enable, deleted bool, ...)
- func (stats *Stats) WriteEvent(event *ChangeEvent)
- func (stats *Stats) WriteScriptStats(category point.Category, ns, name string, pt, ptDrop, ptError uint64, ...)
Constants ¶
View Source
const ( StatsTimeFormat = "2006-01-02T15:04:05.999Z07:00" MaxEventLen int = 100 MaxErrorCount int = 100 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" )
Variables ¶
This section is empty.
Functions ¶
func Metrics ¶
func Metrics() []prometheus.Collector
func UpdateScriptStatsMeta ¶
func WriteEvent ¶
func WriteEvent(event *ChangeEvent)
Types ¶
type ChangeEvent ¶
type ChangeEvent struct { Name string Category point.Category NS, NSOld string Script, ScriptOld string Op EventOP // CompileError string Time time.Time }
func ReadEvent ¶
func ReadEvent() []ChangeEvent
func (ChangeEvent) String ¶
func (event ChangeEvent) String() string
type ScriptChangeEvent ¶
func (*ScriptChangeEvent) Read ¶
func (event *ScriptChangeEvent) Read() []ChangeEvent
func (*ScriptChangeEvent) Write ¶
func (event *ScriptChangeEvent) Write(change *ChangeEvent)
type ScriptMeta ¶
type ScriptStats ¶
type ScriptStats struct {
// contains filtered or unexported fields
}
func (*ScriptStats) Read ¶
func (stats *ScriptStats) Read() *ScriptStatsROnly
func (*ScriptStats) UpdateMeta ¶
func (stats *ScriptStats) UpdateMeta(script string, enable, deleted bool, err ...string)
func (*ScriptStats) WriteErr ¶
func (stats *ScriptStats) WriteErr(err string)
func (*ScriptStats) WritePtCount ¶
func (stats *ScriptStats) WritePtCount(pt, ptDrop, ptError uint64, cost int64)
type ScriptStatsROnly ¶
type ScriptStatsROnly struct {
Pt, PtDrop, PtError uint64
TotalCost int64 // ns
MetaTS time.Time
Script string
FirstTS time.Time
ScriptTS time.Time
ScriptUpdateTimes uint64
Category point.Category
NS, Name string
Enable bool
Deleted bool
CompileError string
}
func (ScriptStatsROnly) String ¶
func (statsR ScriptStatsROnly) String() string
type Stats ¶
type Stats struct {
// contains filtered or unexported fields
}
func (*Stats) ReadEvent ¶
func (stats *Stats) ReadEvent() []ChangeEvent
func (*Stats) ReadStats ¶
func (stats *Stats) ReadStats() []ScriptStatsROnly
func (*Stats) UpdateScriptStatsMeta ¶
func (*Stats) WriteEvent ¶
func (stats *Stats) WriteEvent(event *ChangeEvent)
Click to show internal directories.
Click to hide internal directories.