monitor

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ERR_INVALID_VENDOR = errors.New("invalid vendor")
	ERR_MISSING_CONFIG = errors.New("config is missing")
)

Errors

Functions

func Count

func Count(name string, value int64, tags MapTag) (errs []error)

Count from global.

func Gauge

func Gauge(name string, value float64, tags MapTag) (errs []error)

Gauge from global.

func Histogram

func Histogram(name string, startTime time.Time, tags MapTag) (errs []error)

Histogram from global.

func NewGlobal

func NewGlobal(v Vendor, conf Config) error

NewGlobal acts like New but will add the result into global, so user can directly call the function.

func NewGlobals

func NewGlobals(vs []Vendor, conf Config) (errs []error)

NewGlobals is multi NewGlobal.

Types

type Config

type Config struct {
	Datadog *Datadog
}

Config provides list of monitor's vendor that can be used. It will prioritize from top to bottom and only choose one.

type Datadog

type Datadog struct {
	Host       string
	Namespace  string
	GlobalTags MapTag
	// contains filtered or unexported fields
}

Datadog is config for datadog's log.

func (*Datadog) Count

func (mo *Datadog) Count(name string, val int64, tags MapTag) error

Count from Datadog.

func (*Datadog) Gauge

func (mo *Datadog) Gauge(name string, val float64, tags MapTag) error

Gauge from Datadog.

func (*Datadog) Histogram

func (mo *Datadog) Histogram(name string, startTime time.Time, tags MapTag) error

Histogram from Datadog.

type MapTag

type MapTag map[string]string

MapTag is default standard for all monitor's tag.

Cons: performance issue due convert from MapTag to desired type.

func MergeTags

func MergeTags(fi, se MapTag) MapTag

MergeTags merges two tags into one new tag. It will prioritize the first(fi) then second(se).

type Monitor

type Monitor interface {
	// Count tracks how many event occur.
	Count(name string, value int64, tags MapTag) error

	// Gauge tracks event's time.
	Gauge(name string, value float64, tags MapTag) error

	// Histogram tracks statistical distribution.
	Histogram(name string, startTime time.Time, tags MapTag) error
}

Monitor provides list of standard's monitor functions.

func New

func New(v Vendor, conf Config) (monitor Monitor, err error)

New creates a log base on selected vendor.

type Vendor

type Vendor string

Alias

const (
	// Vendors
	DATADOG Vendor = "datadog"

	// Supports
	DATADOG_TAG_DELIMITER = ":"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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