Documentation ¶
Overview ¶
Package monitoring provides monitoring functionality.
Index ¶
- Constants
- func ExpBuckets(base, mult float64, buckets uint) []float64
- func LatencyBuckets() []float64
- func PercentileBuckets(inc int64) []float64
- func SetStartSpan(f startSpanFunc)
- func StartSpan(ctx context.Context, name string) (context.Context, func())
- type Counter
- type Gauge
- type Histogram
- type InertDistribution
- type InertFloat
- type InertMetricFactory
- func (imf InertMetricFactory) NewCounter(name, help string, labelNames ...string) Counter
- func (imf InertMetricFactory) NewGauge(name, help string, labelNames ...string) Gauge
- func (imf InertMetricFactory) NewHistogram(name, help string, labelNames ...string) Histogram
- func (imf InertMetricFactory) NewHistogramWithBuckets(name, help string, _ []float64, labelNames ...string) Histogram
- type MetricFactory
- type RPCStatsInterceptor
Constants ¶
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 ¶
func ExpBuckets ¶ added in v1.3.6
ExpBuckets returns the specified number of histogram buckets with exponentially increasing thresholds. The thresholds vary between base and base * mult^(buckets-1).
func LatencyBuckets ¶ added in v1.3.0
func LatencyBuckets() []float64
LatencyBuckets returns a reasonable range of histogram upper limits for most latency-in-seconds usecases. The thresholds increase exponentially from 0.04 seconds to ~282 days.
func PercentileBuckets ¶ added in v1.3.0
PercentileBuckets returns a range of buckets for 0.0-100.0% use cases. in specified integer increments. The increment must be at least 1%, which prevents creating very large metric exports.
func SetStartSpan ¶ added in v1.3.0
func SetStartSpan(f startSpanFunc)
SetStartSpan sets the function used to start tracing spans. This may be used to add runtime support for different tracing implementation.
func StartSpan ¶ added in v1.3.0
StartSpan starts a new tracing span using the given message. The returned context should be used for all child calls within the span, and the returned func should be called to close the span.
The default implementation of this method is a no-op; insert a real tracing span implementation by setting this global variable to the relevant function at start of day.
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) 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.
func (InertMetricFactory) NewHistogramWithBuckets ¶ added in v1.3.0
func (imf InertMetricFactory) NewHistogramWithBuckets(name, help string, _ []float64, labelNames ...string) Histogram
NewHistogramWithBuckets creates a new inert Histogram with supplied buckets. The buckets are not actually used.
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 NewHistogramWithBuckets(name, help string, buckets []float64, 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 clock.TimeSource, prefix string, mf MetricFactory) *RPCStatsInterceptor
NewRPCStatsInterceptor creates a new RPCStatsInterceptor for the given application/component, with a specified time source.
func (*RPCStatsInterceptor) Interceptor ¶
func (r *RPCStatsInterceptor) Interceptor() grpc.UnaryServerInterceptor
Interceptor returns a UnaryServerInterceptor that can be registered with an RPC server and will record request counts / errors and latencies for that servers handlers
Source Files ¶
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. |