metrics

package
v0.15.26 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EventHandlerRegistry = cowslice.NewCowSlice(make([]Handler, 0))

Functions

func AddLatencyProbe added in v0.15.10

func AddLatencyProbe(ch channel2.Channel, interval time.Duration, handler LatencyHandler)

func AddLatencyProbeResponder added in v0.15.10

func AddLatencyProbeResponder(ch channel2.Channel)

func Init added in v0.12.0

func Init(cfg *Config)

func LoadInfluxConfig

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

func LoadOutputFileConfig added in v0.13.1

func LoadOutputFileConfig(src map[interface{}]interface{}) (*outputfileConfig, error)

func ProbeLatency

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

send regular latency probes

Types

type Config

type Config struct {
	Source         string
	Tags           map[string]string
	ReportInterval time.Duration
	EventSink      Handler
	// contains filtered or unexported fields
}

func LoadConfig

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

type Formatter added in v0.13.1

type Formatter interface {
	WriteTo(msg *metrics_pb.MetricsMessage, out io.Writer) error
}

type Gauge added in v0.14.23

type Gauge interface {
	metrics.Gauge
	Metric
}

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

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 NewDispatchWrapper added in v0.12.0

func NewDispatchWrapper(deletage func(event event.Event)) Handler

func NewInfluxDBMetricsHandler

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

NewInfluxDBMetricsHandler creates a new HandlerTypeInfluxDB metrics ChannelReporter

func NewOutputFileMetricsHandler added in v0.13.1

func NewOutputFileMetricsHandler(cfg *outputfileConfig) (Handler, error)

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

type HandlerType

type HandlerType string

HandlerType is used to define known handler types

const (
	HandlerTypeInfluxDB HandlerType = "influxdb"
	HandlerTypeJSONFile HandlerType = "jsonfile"
	HandlerTypeFile     HandlerType = "file"
)

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 JsonFormatter added in v0.13.1

type JsonFormatter struct{}

func (*JsonFormatter) WriteTo added in v0.13.1

func (formatter *JsonFormatter) WriteTo(msg *metrics_pb.MetricsMessage, out io.Writer) error

type LatencyHandler added in v0.15.10

type LatencyHandler interface {
	LatencyReported(latency time.Duration)
	ChannelClosed()
}

type LatencyResponder added in v0.15.10

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

LatencyResponder responds to latency messages with LatencyResponse messages.

func (*LatencyResponder) ContentType added in v0.15.10

func (self *LatencyResponder) ContentType() int32

func (*LatencyResponder) HandleReceive added in v0.15.10

func (self *LatencyResponder) HandleReceive(msg *channel2.Message, _ channel2.Channel)

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 NilHandler added in v0.15.19

type NilHandler struct{}

func (NilHandler) AcceptMetrics added in v0.15.19

func (NilHandler) AcceptMetrics(message *metrics_pb.MetricsMessage)

type PlainTextFormatter added in v0.13.1

type PlainTextFormatter struct {
}

func (PlainTextFormatter) WriteTo added in v0.13.1

type Registry

type Registry interface {
	SourceId() string
	Gauge(name string) Gauge
	FuncGauge(name string, f func() int64) Gauge
	Meter(name string) Meter
	Histogram(name string) Histogram
	Timer(name string) Timer
	EachMetric(visitor func(name string, metric Metric))
	Poll() *metrics_pb.MetricsMessage
	DisposeAll()
}

Registry allows for configuring and accessing metrics for a fabric application

func NewRegistry

func NewRegistry(sourceId string, tags map[string]string) Registry

type Timer

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

type UsageRegistry added in v0.13.1

type UsageRegistry interface {
	Registry
	IntervalCounter(name string, intervalSize time.Duration) IntervalCounter
	SetEventSink(eventSink Handler)
	Flush()
}

UsageRegistry extends registry to allow collecting usage metrics

func NewUsageRegistry added in v0.13.1

func NewUsageRegistry(sourceId string, tags map[string]string, reportInterval time.Duration, eventSink Handler, closeNotify <-chan struct{}) UsageRegistry

func NewUsageRegistryFromConfig added in v0.13.1

func NewUsageRegistryFromConfig(config *Config, closeNotify chan struct{}) UsageRegistry

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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