metrics

package
v0.0.0-...-0e5ff0a Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(pathFile string) map[interface{}]interface{}

func UnmarshalEvents

func UnmarshalEvents(raw map[interface{}]interface{}, field string) map[string][]*EventRule

func UnmarshalTrackingEvents

func UnmarshalTrackingEvents(arr []interface{}, events []*Event)

Types

type Event

type Event struct {
	Stats

	Label string `json:"label"`
	// contains filtered or unexported fields
}

func NewEvent

func NewEvent(key string, rules []*EventRule) *Event

func (*Event) Rules

func (event *Event) Rules() []*EventRule

type EventRule

type EventRule struct {
	Field    Field
	Operator Operator
	Value    string
}

type Field

type Field string
const (
	FROM    Field = "from"
	TO      Field = "to"
	VALUE   Field = "value"
	DEPLOY  Field = "deploy"
	METHOD  Field = "method"
	UNKNOWN Field = ""
)

type Operator

type Operator string
const (
	EQ   Operator = "="
	LT   Operator = "<="
	GT   Operator = ">="
	NONE Operator = ""
)

type RawCache

type RawCache struct {
	Stats  map[string]*Stats
	Backup map[string]interface{}
	// contains filtered or unexported fields
}

func NewRawCache

func NewRawCache(backupFile string, restore bool, backupFrequency int64) *RawCache

func (*RawCache) LoadBackup

func (cache *RawCache) LoadBackup() map[string]interface{}

func (*RawCache) Ready

func (cache *RawCache) Ready() bool

func (*RawCache) Save

func (cache *RawCache) Save()

func (*RawCache) SetReady

func (cache *RawCache) SetReady()

type Stats

type Stats struct {
	Current     *big.Int `json:"-"`
	Count       string   `json:"count"`
	Interval    uint64   `json:"interval"`
	Timestamp   uint64   `json:"timestamp"`
	BlockNumber string   `json:"block"`
}

func NewStats

func NewStats() *Stats

func (*Stats) Add

func (stats *Stats) Add(incr *big.Int)

func (*Stats) Decrement

func (stats *Stats) Decrement()

func (*Stats) Increment

func (stats *Stats) Increment(timestamp uint64, number *big.Int)

func (*Stats) Substract

func (stats *Stats) Substract(incr *big.Int)

func (*Stats) Update

func (stats *Stats) Update(incr *big.Int, timestamp uint64, number string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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