Documentation ¶
Index ¶
- Constants
- Variables
- func FormatFromRequest(req *logical.Request) string
- func NamespaceLabel(ns *namespace.Namespace) metrics.Label
- func TTLBucket(ttl time.Duration) string
- type ClusterMetricSink
- func (m *ClusterMetricSink) AddDurationWithLabels(key []string, d time.Duration, labels []Label)
- func (m *ClusterMetricSink) AddSample(key []string, val float32)
- func (m *ClusterMetricSink) AddSampleWithLabels(key []string, val float32, labels []Label)
- func (m *ClusterMetricSink) IncrCounterWithLabels(key []string, val float32, labels []Label)
- func (m *ClusterMetricSink) MeasureSinceWithLabels(key []string, start time.Time, labels []Label)
- func (m *ClusterMetricSink) NewGaugeCollectionProcess(key []string, id []Label, collector GaugeCollector, logger log.Logger) (*GaugeCollectionProcess, error)
- func (m *ClusterMetricSink) SetDefaultClusterName(clusterName string)
- func (m *ClusterMetricSink) SetGauge(key []string, val float32)
- func (m *ClusterMetricSink) SetGaugeWithLabels(key []string, val float32, labels []Label)
- type GaugeCollectionProcess
- type GaugeCollector
- type GaugeLabelValues
- type GaugeMetric
- type GaugeMetrics
- type Label
- type LeaseExpiryLabel
- type Metrics
- type MetricsHelper
- func (m *MetricsHelper) AddGaugeLoopMetric(key []string, val float32, labels []Label)
- func (m *MetricsHelper) CreateMetricsCacheKeyName(key []string, val float32, labels []Label) string
- func (m *MetricsHelper) GenericResponse() *logical.Response
- func (m *MetricsHelper) PrometheusResponse() *logical.Response
- func (m *MetricsHelper) ResponseForFormat(format string) *logical.Response
- type SinkWrapper
- type TelemetryConstConfig
Constants ¶
const ( OpenMetricsMIMEType = "application/openmetrics-text" PrometheusSchemaMIMEType = "prometheus/telemetry" // ErrorContentType is the content type returned by an error response. ErrorContentType = "text/plain" )
const OverflowBucket = "+Inf"
const (
PrometheusMetricFormat = "prometheus"
)
Variables ¶
var LogicalTableSizeName []string = []string{"core", "mount_table", "num_entries"}
LogicalTableSizeName is a set of gauge metric keys for logical mount table sizes
var PhysicalTableSizeName []string = []string{"core", "mount_table", "size"}
PhysicalTableSizeName is a set of gauge metric keys for physical mount table sizes
Functions ¶
func FormatFromRequest ¶
func NamespaceLabel ¶
NamespaceLabel creates a metrics label for the given Namespace: root is "root"; others are path with the final '/' removed.
Types ¶
type ClusterMetricSink ¶
type ClusterMetricSink struct { // ClusterName is either the cluster ID, or a name provided // in the telemetry configuration stanza. // // Because it may be set after the Core is initialized, we need // to protect against concurrent access. ClusterName atomic.Value MaxGaugeCardinality int GaugeInterval time.Duration // Sink is the go-metrics instance to send to. Sink metrics.MetricSink // Constants that are helpful for metrics within the metrics sink TelemetryConsts TelemetryConstConfig }
ClusterMetricSink serves as a shim around go-metrics and inserts a "cluster" label.
It also provides a mechanism to limit the cardinality of the labels on a gauge (at each reporting interval, which isn't sufficient if there is variability in which labels are the top N) and a backoff mechanism for gauge computation.
func BlackholeSink ¶
func BlackholeSink() *ClusterMetricSink
BlackholeSink is a default suitable for use in unit tests.
func NewClusterMetricSink ¶
func NewClusterMetricSink(clusterName string, sink metrics.MetricSink) *ClusterMetricSink
func (*ClusterMetricSink) AddDurationWithLabels ¶
func (m *ClusterMetricSink) AddDurationWithLabels(key []string, d time.Duration, labels []Label)
func (*ClusterMetricSink) AddSample ¶
func (m *ClusterMetricSink) AddSample(key []string, val float32)
func (*ClusterMetricSink) AddSampleWithLabels ¶
func (m *ClusterMetricSink) AddSampleWithLabels(key []string, val float32, labels []Label)
func (*ClusterMetricSink) IncrCounterWithLabels ¶
func (m *ClusterMetricSink) IncrCounterWithLabels(key []string, val float32, labels []Label)
func (*ClusterMetricSink) MeasureSinceWithLabels ¶
func (m *ClusterMetricSink) MeasureSinceWithLabels(key []string, start time.Time, labels []Label)
func (*ClusterMetricSink) NewGaugeCollectionProcess ¶
func (m *ClusterMetricSink) NewGaugeCollectionProcess( key []string, id []Label, collector GaugeCollector, logger log.Logger, ) (*GaugeCollectionProcess, error)
NewGaugeCollectionProcess creates a new collection process for the callback function given as an argument, and starts it running. A label should be provided for metrics *about* this collection process.
The Run() method must be called to start the process.
func (*ClusterMetricSink) SetDefaultClusterName ¶
func (m *ClusterMetricSink) SetDefaultClusterName(clusterName string)
SetDefaultClusterName changes the cluster name from its default value, if it has not previously been configured.
func (*ClusterMetricSink) SetGauge ¶
func (m *ClusterMetricSink) SetGauge(key []string, val float32)
func (*ClusterMetricSink) SetGaugeWithLabels ¶
func (m *ClusterMetricSink) SetGaugeWithLabels(key []string, val float32, labels []Label)
type GaugeCollectionProcess ¶
type GaugeCollectionProcess struct {
// contains filtered or unexported fields
}
A GaugeCollectionProcess is responsible for one particular gauge metric. It handles a delay on initial startup; limiting the cardinality; and exponential backoff on the requested interval.
func NewGaugeCollectionProcess ¶
func NewGaugeCollectionProcess( key []string, id []Label, collector GaugeCollector, m metrics.MetricSink, gaugeInterval time.Duration, maxGaugeCardinality int, logger log.Logger, ) (*GaugeCollectionProcess, error)
NewGaugeCollectionProcess creates a new collection process for the callback function given as an argument, and starts it running. A label should be provided for metrics *about* this collection process.
The Run() method must be called to start the process.
func (*GaugeCollectionProcess) Run ¶
func (p *GaugeCollectionProcess) Run()
Run should be called as a goroutine.
func (*GaugeCollectionProcess) Stop ¶
func (p *GaugeCollectionProcess) Stop()
Stop the collection process
type GaugeCollector ¶
type GaugeCollector = func(context.Context) ([]GaugeLabelValues, error)
GaugeCollector is a callback function that returns an unfiltered set of label-value pairs. It may be cancelled if it takes too long.
type GaugeLabelValues ¶
GaugeLabelValues is one gauge in a set sharing a single key, that are measured in a batch.
type GaugeMetric ¶
type GaugeMetrics ¶
type LeaseExpiryLabel ¶
type Metrics ¶
type Metrics interface { SetGaugeWithLabels(key []string, val float32, labels []Label) IncrCounterWithLabels(key []string, val float32, labels []Label) AddSampleWithLabels(key []string, val float32, labels []Label) AddDurationWithLabels(key []string, d time.Duration, labels []Label) MeasureSinceWithLabels(key []string, start time.Time, labels []Label) }
type MetricsHelper ¶
type MetricsHelper struct { PrometheusEnabled bool LoopMetrics GaugeMetrics // contains filtered or unexported fields }
func NewMetricsHelper ¶
func NewMetricsHelper(inMem *metrics.InmemSink, enablePrometheus bool) *MetricsHelper
func (*MetricsHelper) AddGaugeLoopMetric ¶
func (m *MetricsHelper) AddGaugeLoopMetric(key []string, val float32, labels []Label)
func (*MetricsHelper) CreateMetricsCacheKeyName ¶
func (m *MetricsHelper) CreateMetricsCacheKeyName(key []string, val float32, labels []Label) string
func (*MetricsHelper) GenericResponse ¶
func (m *MetricsHelper) GenericResponse() *logical.Response
func (*MetricsHelper) PrometheusResponse ¶
func (m *MetricsHelper) PrometheusResponse() *logical.Response
func (*MetricsHelper) ResponseForFormat ¶
func (m *MetricsHelper) ResponseForFormat(format string) *logical.Response
type SinkWrapper ¶
type SinkWrapper struct {
metrics.MetricSink
}
SinkWrapper implements `metricsutil.Metrics` using an instance of armon/go-metrics `MetricSink` as the underlying implementation.
func (SinkWrapper) AddDurationWithLabels ¶
func (s SinkWrapper) AddDurationWithLabels(key []string, d time.Duration, labels []Label)
func (SinkWrapper) MeasureSinceWithLabels ¶
func (s SinkWrapper) MeasureSinceWithLabels(key []string, start time.Time, labels []Label)