Documentation ¶
Index ¶
- func EscapeMetricName(metricName string) string
- type ActionType
- type CacheMetrics
- type HistogramOptions
- type MatchType
- type MetricMapper
- func (m *MetricMapper) GetMapping(statsdMetric string, statsdMetricType MetricType) (*MetricMapping, prometheus.Labels, bool)
- func (m *MetricMapper) InitFromFile(fileName string) error
- func (m *MetricMapper) InitFromYAMLString(fileContents string) error
- func (m *MetricMapper) UseCache(cache MetricMapperCache)
- type MetricMapperCache
- type MetricMapperCacheResult
- type MetricMapping
- type MetricType
- type ObserverType
- type SummaryOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EscapeMetricName ¶ added in v0.15.0
EscapeMetricName replaces invalid characters in the metric name with "_" Valid characters are a-z, A-Z, 0-9, and _
Types ¶
type ActionType ¶
type ActionType string
const ( ActionTypeMap ActionType = "map" ActionTypeDrop ActionType = "drop" ActionTypeDefault ActionType = "" )
func (*ActionType) UnmarshalYAML ¶
func (t *ActionType) UnmarshalYAML(unmarshal func(interface{}) error) error
type CacheMetrics ¶ added in v0.19.0
type CacheMetrics struct { CacheLength prometheus.Gauge CacheGetsTotal prometheus.Counter CacheHitsTotal prometheus.Counter }
func NewCacheMetrics ¶ added in v0.19.0
func NewCacheMetrics(reg prometheus.Registerer) *CacheMetrics
type HistogramOptions ¶ added in v0.15.0
type HistogramOptions struct {
Buckets []float64 `yaml:"buckets"`
}
type MetricMapper ¶
type MetricMapper struct { Registerer prometheus.Registerer Defaults mapperConfigDefaults `yaml:"defaults"` Mappings []MetricMapping `yaml:"mappings"` FSM *fsm.FSM MappingsCount prometheus.Gauge Logger log.Logger // contains filtered or unexported fields }
func (*MetricMapper) GetMapping ¶
func (m *MetricMapper) GetMapping(statsdMetric string, statsdMetricType MetricType) (*MetricMapping, prometheus.Labels, bool)
func (*MetricMapper) InitFromFile ¶
func (m *MetricMapper) InitFromFile(fileName string) error
func (*MetricMapper) InitFromYAMLString ¶
func (m *MetricMapper) InitFromYAMLString(fileContents string) error
func (*MetricMapper) UseCache ¶ added in v0.20.1
func (m *MetricMapper) UseCache(cache MetricMapperCache)
UseCache tells the mapper to use a cache that implements the MetricMapperCache interface. This cache MUST be thread-safe!
type MetricMapperCache ¶ added in v0.10.1
type MetricMapperCache interface { // Get a cached result Get(metricKey string) (interface{}, bool) // Add a statsd MetricMapperResult to the cache Add(metricKey string, result interface{}) // Add an item to the cache // Reset clears the cache for config reloads Reset() }
MetricMapperCache MUST be thread-safe and should be instrumented with CacheMetrics
type MetricMapperCacheResult ¶ added in v0.10.1
type MetricMapperCacheResult struct { Mapping *MetricMapping Matched bool Labels prometheus.Labels }
type MetricMapping ¶
type MetricMapping struct { Match string `yaml:"match"` Name string `yaml:"name"` Labels prometheus.Labels `yaml:"labels"` ObserverType ObserverType `yaml:"observer_type"` TimerType ObserverType `yaml:"timer_type,omitempty"` // DEPRECATED - field only present to preserve backwards compatibility in configs. Always empty LegacyBuckets []float64 `yaml:"buckets"` LegacyQuantiles []metricObjective `yaml:"quantiles"` MatchType MatchType `yaml:"match_type"` HelpText string `yaml:"help"` Action ActionType `yaml:"action"` MatchMetricType MetricType `yaml:"match_metric_type"` Ttl time.Duration `yaml:"ttl"` SummaryOptions *SummaryOptions `yaml:"summary_options"` HistogramOptions *HistogramOptions `yaml:"histogram_options"` // contains filtered or unexported fields }
func (*MetricMapping) UnmarshalYAML ¶ added in v0.17.0
func (m *MetricMapping) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML is a custom unmarshal function to allow use of deprecated config keys observer_type will override timer_type
type MetricType ¶
type MetricType string
const ( MetricTypeCounter MetricType = "counter" MetricTypeGauge MetricType = "gauge" MetricTypeObserver MetricType = "observer" MetricTypeTimer MetricType = "timer" // DEPRECATED )
func (*MetricType) UnmarshalYAML ¶
func (m *MetricType) UnmarshalYAML(unmarshal func(interface{}) error) error
type ObserverType ¶ added in v0.17.0
type ObserverType string
const ( ObserverTypeHistogram ObserverType = "histogram" ObserverTypeSummary ObserverType = "summary" ObserverTypeDefault ObserverType = "" )
func (*ObserverType) UnmarshalYAML ¶ added in v0.17.0
func (t *ObserverType) UnmarshalYAML(unmarshal func(interface{}) error) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.