vmpusher

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	VMURL   string
	VMUser  string
	VMPass  string
	Levels  map[string]JSONLineMetric
	Flows   map[string]JSONLineMetric
	Context context.Context
}

Config allows to configure a vmpusher controller with New()

type Controller

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

Controller handles the communication with the victoria metrics server

func New

func New(conf Config) *Controller

New returns an initialized and ready to use Controller

func (*Controller) AddFlowValue

func (c *Controller) AddFlowValue(site, station string, lat, long float64, t time.Time, flow float64)

AddFlowValue will add a water flow value of a given station into the internal buffer

func (*Controller) AddLevelValue

func (c *Controller) AddLevelValue(site, station string, lat, long float64, t time.Time, level float64)

AddLevelValue will add a water level value of a given station into the internal buffer

func (*Controller) GetFlowsBuffer

func (c *Controller) GetFlowsBuffer() (levels map[string]JSONLineMetric)

GetFlowsBuffer returns the current flows buffer

func (*Controller) GetLevelsBuffer

func (c *Controller) GetLevelsBuffer() (levels map[string]JSONLineMetric)

GetLevelsBuffer returns the current levels buffer

func (*Controller) Send

func (c *Controller) Send() (nbMetrics, nbValues int, err error)

Send will push all the values within the internal buffer to victoria metrics and flush the buffer if successfull

type JSONLineMetric

type JSONLineMetric struct {
	Metric     map[string]string `json:"metric"`
	Values     []float64         `json:"values"`
	Timestamps []int64           `json:"timestamps"`
}

JSONLineMetric represents a given metric with N values in the JSON line (streaming) format

Jump to

Keyboard shortcuts

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