metrics

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadInfluxConfig

func LoadInfluxConfig(src map[interface{}]interface{}) (*influxConfig, error)

func LoadJSONFileConfig

func LoadJSONFileConfig(src map[interface{}]interface{}) (*jsonfileConfig, error)

func ProbeLatency

func ProbeLatency(ch channel2.Channel, histogram Histogram, interval time.Duration)

send regular latency probes

func ProcessLinkEvent

func ProcessLinkEvent(links map[string]interface{}, name string, val interface{}) map[string]interface{}

Types

type Config

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

func LoadConfig

func LoadConfig(srcmap map[interface{}]interface{}) (*Config, error)

type EventController

type EventController interface {
	Handler

	// AddHandler adds the given arbitrary handler to the event controller
	AddHandler(handler Handler)

	// RemoveHandler removes the given handler from the event controller
	RemoveHandler(handler Handler)

	// Shutdown stops the event controller
	Shutdown()
}

EventController allows for sending metrics to multiple Handlers

func NewEventController

func NewEventController(cfg *Config) EventController

NewEventController creates a new EventController instance

type Handler

type Handler interface {
	// AcceptMetrics is called when new metrics become available
	AcceptMetrics(message *metrics_pb.MetricsMessage)
}

Handler represents a sink for metric events

func NewChannelReporter

func NewChannelReporter(ch channel2.Channel) Handler

NewChannelReporter creates a metrics handler which sends metrics messages out on the given channel

func NewInfluxDBMetricsHandler

func NewInfluxDBMetricsHandler(cfg *influxConfig) (Handler, error)

NewInfluxDBMetricsHandler creates a new HandlerTypeInfluxDB metrics ChannelReporter

func NewJsonFileMetricsHandler

func NewJsonFileMetricsHandler(cfg *jsonfileConfig) (Handler, error)

Message handler that write node and link metrics to a file in json format

type HandlerType

type HandlerType string

HandlerType is used define known handler types

const (
	// HandlerTypeInfluxDB represents the HandlerTypeInfluxDB reporter
	HandlerTypeInfluxDB HandlerType = "influxdb"
)
const (
	HandlerTypeJSONFile HandlerType = "jsonfile"
)

type Histogram

type Histogram interface {
	Metric
	Clear()
	Update(int64)
}

Histogram represents a metric which is measuring the distribution of values for some measurement

type IntervalCounter

type IntervalCounter interface {
	Metric
	Update(intervalId string, time time.Time, value uint64)
}

IntervalCounter allows tracking counters which are bucketized by some interval

type Meter

type Meter interface {
	Metric
	Mark(int64)
}

Meter represents a metric which is measuring a count and a rate

type Metric

type Metric interface {
	Dispose()
}

Metric is the base functionality for all metrics types

type Registry

type Registry interface {
	SourceId() string
	Meter(name string) Meter
	Histogram(name string) Histogram
	Timer(name string) Timer
	IntervalCounter(name string, intervalSize time.Duration) IntervalCounter
	Each(visitor func(name string, metric Metric))
	EventController() EventController
}

Registry allows for configuring and accessing metrics for a fabric application

func NewRegistry

func NewRegistry(sourceId string, tags map[string]string, reportInterval time.Duration, cfg *Config) Registry

NewRegistry create a new metrics registry instance

type Timer

type Timer interface {
	Metric
	// Clear()
	Update(time.Duration)
	Time(func())
}

Histogram represents a metric which is measuring the distribution of values for some measurement

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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