Documentation
¶
Index ¶
- func EscapeMetricName(metricName string) string
- type ActionType
- type CacheMetrics
- type HistogramOptions
- type MapperConfigDefaults
- type MatchType
- type MaybeFloat64
- 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 MetricObjective
- 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 MapperConfigDefaults ¶ added in v0.23.2
type MapperConfigDefaults struct {
ObserverType ObserverType `yaml:"observer_type"`
MatchType MatchType `yaml:"match_type"`
GlobDisableOrdering bool `yaml:"glob_disable_ordering"`
Ttl time.Duration `yaml:"ttl"`
SummaryOptions SummaryOptions `yaml:"summary_options"`
HistogramOptions HistogramOptions `yaml:"histogram_options"`
}
func (*MapperConfigDefaults) UnmarshalYAML ¶ added in v0.23.2
func (d *MapperConfigDefaults) 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 MaybeFloat64 ¶ added in v0.24.0
func (*MaybeFloat64) MarshalYAML ¶ added in v0.24.0
func (m *MaybeFloat64) MarshalYAML() (interface{}, error)
func (*MaybeFloat64) UnmarshalYAML ¶ added in v0.24.0
func (m *MaybeFloat64) UnmarshalYAML(unmarshal func(interface{}) error) error
type MetricMapper ¶
type MetricMapper struct {
Registerer prometheus.Registerer
Defaults MapperConfigDefaults `yaml:"defaults"`
Mappings []MetricMapping `yaml:"mappings"`
FSM *fsm.FSM
MappingsCount prometheus.Gauge
Logger *slog.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"`
HonorLabels bool `yaml:"honor_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"`
Scale MaybeFloat64 `yaml:"scale"`
// 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 MetricObjective ¶ added in v0.23.2
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
type SummaryOptions ¶ added in v0.15.0
type SummaryOptions struct {
Quantiles []MetricObjective `yaml:"quantiles"`
MaxAge time.Duration `yaml:"max_age"`
AgeBuckets uint32 `yaml:"age_buckets"`
BufCap uint32 `yaml:"buf_cap"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.