monitoring

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package monitoring provides monitoring functionality.

Index

Constants

View Source
const (
	// TreeIDLabel is the monitoring label used to represent a tree ID.
	// TODO(codingllama): Consider using TreeIDLabel in place of log ID.
	TreeIDLabel = "tree_id"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

type Counter interface {
	Inc(labelVals ...string)
	Add(val float64, labelVals ...string)
	Value(labelVals ...string) float64
}

Counter is a metric class for numeric values that increase.

type Gauge

type Gauge interface {
	Inc(labelVals ...string)
	Dec(labelVals ...string)
	Add(val float64, labelVals ...string)
	Set(val float64, labelVals ...string)
	// Value retrieves the value for a particular set of labels.
	// This is only really useful for testing implementations.
	Value(labelVals ...string) float64
}

Gauge is a metric class for numeric values that can go up and down.

type Histogram

type Histogram interface {
	Observe(val float64, labelVals ...string)
	// Info retrieves the count and sum of observations for a particular set of labels.
	// This is only really useful for testing implementations.
	Info(labelVals ...string) (uint64, float64)
}

Histogram is a metric class that tracks the distribution of a collection of observations.

type InertDistribution

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

InertDistribution is an internal-only implementation of the Distribution interface.

func (*InertDistribution) Info

func (m *InertDistribution) Info(labelVals ...string) (uint64, float64)

Info returns count, sum for the distribution.

func (*InertDistribution) Observe

func (m *InertDistribution) Observe(val float64, labelVals ...string)

Observe adds a single observation to the distribution.

type InertFloat

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

InertFloat is an internal-only implementation of both the Counter and Gauge interfaces.

func (*InertFloat) Add

func (m *InertFloat) Add(val float64, labelVals ...string)

Add adds the given amount to the value.

func (*InertFloat) Dec

func (m *InertFloat) Dec(labelVals ...string)

Dec subtracts 1 from the value.

func (*InertFloat) Inc

func (m *InertFloat) Inc(labelVals ...string)

Inc adds 1 to the value.

func (*InertFloat) Set

func (m *InertFloat) Set(val float64, labelVals ...string)

Set sets the value.

func (*InertFloat) Value

func (m *InertFloat) Value(labelVals ...string) float64

Value returns the current value.

type InertMetricFactory

type InertMetricFactory struct{}

InertMetricFactory creates inert metrics for testing.

func (InertMetricFactory) NewCounter

func (imf InertMetricFactory) NewCounter(name, help string, labelNames ...string) Counter

NewCounter creates a new inert Counter.

func (InertMetricFactory) NewGauge

func (imf InertMetricFactory) NewGauge(name, help string, labelNames ...string) Gauge

NewGauge creates a new inert Gauge.

func (InertMetricFactory) NewHistogram

func (imf InertMetricFactory) NewHistogram(name, help string, labelNames ...string) Histogram

NewHistogram creates a new inert Histogram.

type MetricFactory

type MetricFactory interface {
	NewCounter(name, help string, labelNames ...string) Counter
	NewGauge(name, help string, labelNames ...string) Gauge
	NewHistogram(name, help string, labelNames ...string) Histogram
}

MetricFactory allows the creation of different types of metric.

type RPCStatsInterceptor

type RPCStatsInterceptor struct {
	ReqCount          Counter
	ReqSuccessCount   Counter
	ReqSuccessLatency Histogram
	ReqErrorCount     Counter
	ReqErrorLatency   Histogram
	// contains filtered or unexported fields
}

RPCStatsInterceptor provides a gRPC interceptor that records statistics about the RPCs passing through it.

func NewRPCStatsInterceptor

func NewRPCStatsInterceptor(timeSource util.TimeSource, prefix string, mf MetricFactory) *RPCStatsInterceptor

NewRPCStatsInterceptor creates a new RPCStatsInterceptor for the given application/component, with a specified time source.

func (*RPCStatsInterceptor) Interceptor

Interceptor returns a UnaryServerInterceptor that can be registered with an RPC server and will record request counts / errors and latencies for that servers handlers

Directories

Path Synopsis
Package prometheus provides a Prometheus-based implementation of the MetricFactory abstraction.
Package prometheus provides a Prometheus-based implementation of the MetricFactory abstraction.
etcdiscover
The etcdiscover binary monitors etcd to track the set of instances that support a gRPC service, and updates a file so that Prometheus can track those instances.
The etcdiscover binary monitors etcd to track the set of instances that support a gRPC service, and updates a file so that Prometheus can track those instances.

Jump to

Keyboard shortcuts

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