metrics

package module
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: Apache-2.0 Imports: 13 Imported by: 48

README

Ziti Metrics Library

This is a metrics library which is built on, and extends the go-metrics library.

It extends it by adding the following:

  1. Support for interval counters. These collect event counts related to a given identifier, over a given interval. The interval buckets are flushed regularly. These are good for things like collecting usage data.
  2. A Dispose method is defined on metrics, so they can be cleaned up, for metrics tied to transient entities.
  3. Reference counted metrics

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gauge

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

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
	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))

	IsValidMetric(name string) bool
	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 UsageCounter added in v1.1.0

type UsageCounter interface {
	Metric
	Update(source UsageSource, usageType string, time time.Time, value uint64)
}

A UsageCounter allows tracking usage bucketized by some interval

type UsageRegistry

type UsageRegistry interface {
	Registry
	PollWithoutUsageMetrics() *metrics_pb.MetricsMessage
	IntervalCounter(name string, intervalSize time.Duration) IntervalCounter
	UsageCounter(name string, intervalSize time.Duration) UsageCounter
	FlushToHandler(handler Handler)
	StartReporting(eventSink Handler, reportInterval time.Duration, msgQueueSize int)
}

UsageRegistry extends registry to allow collecting usage metrics

func NewUsageRegistry

func NewUsageRegistry(sourceId string, tags map[string]string, closeNotify <-chan struct{}) UsageRegistry

type UsageSource added in v1.1.0

type UsageSource interface {
	GetIntervalId() string
	GetTags() map[string]string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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