myvar

package
v0.0.0-...-693abe4 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2019 License: MIT Imports: 9 Imported by: 0

README

myvar

a common variable exportor for monitor, support influxdb as backend

Documentation

Index

Constants

View Source
const (
	INT uint8 = 1 << iota
	FLOAT
	STRING
)

Variable type

Variables

This section is empty.

Functions

func Flush

func Flush(tt ...time.Time) error

Flush write all the points in cache into influxdb

func GetDatabase

func GetDatabase() string

func Publish

func Publish(name string, tags map[string]string, fields map[string]interface{}) error

Publish a raw influxdb points

func SetDatabase

func SetDatabase(db string)

SetDatabase initialize the default database

func SetFlushInterval

func SetFlushInterval(dur time.Duration)

SetFlushInterval change the flush interval

func SetGlobalTag

func SetGlobalTag(key, value string)

SetGlobalTag set global tag list, used by each variable

func SetInfluxdb

func SetInfluxdb(addr string) (err error)

SetInfluxdb initialize the influxdb address

Types

type Float

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

Float variable

func NewFloat

func NewFloat(measurement string, tags map[string]string, name string) *Float

NewFloat create a new float variable

func (*Float) Add

func (f *Float) Add(delta float64)

func (*Float) Free

func (f *Float) Free()

func (*Float) Set

func (f *Float) Set(v float64)

func (*Float) Value

func (f *Float) Value() float64

type Int

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

func NewInt

func NewInt(measurement string, tags map[string]string, name string) *Int

func (*Int) Add

func (n *Int) Add(v int64)

func (*Int) Free

func (n *Int) Free()

func (*Int) Incr

func (n *Int) Incr()

func (*Int) Set

func (n *Int) Set(v int64)

func (*Int) Value

func (n *Int) Value() int64

type Map

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

func NewMap

func NewMap(measurement string, tags map[string]string) *Map

func (Map) DelEntry

func (m Map) DelEntry(k interface{})

func (*Map) Free

func (m *Map) Free()

func (*Map) Get

func (m *Map) Get(key string) (interface{}, bool)

func (Map) GetData

func (m Map) GetData() sync.Map

func (Map) RangeFunc

func (m Map) RangeFunc(f func(key, value interface{}) bool)

func (*Map) Set

func (m *Map) Set(key string, value interface{}) *Map

type String

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

func NewString

func NewString(measurement string, tags map[string]string, name string) *String

func (*String) Free

func (s *String) Free()

func (*String) Set

func (s *String) Set(v string)

func (*String) Value

func (s *String) Value() string

type Var

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

func (Var) GetMeasurement

func (v Var) GetMeasurement() string

func (Var) GetName

func (v Var) GetName() string

func (Var) GetTags

func (v Var) GetTags() models.Tags

func (Var) GetValue

func (v Var) GetValue() interface{}

Jump to

Keyboard shortcuts

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