mapper

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2020 License: Apache-2.0 Imports: 12 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeMetricName added in v0.15.0

func EscapeMetricName(metricName string) string

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 CacheOption added in v0.15.0

type CacheOption func(*cacheOptions)

func WithCacheType added in v0.15.0

func WithCacheType(cacheType string) CacheOption

type HistogramOptions added in v0.15.0

type HistogramOptions struct {
	Buckets []float64 `yaml:"buckets"`
}

type MatchType

type MatchType string
const (
	MatchTypeGlob    MatchType = "glob"
	MatchTypeRegex   MatchType = "regex"
	MatchTypeDefault MatchType = ""
)

func (*MatchType) UnmarshalYAML

func (t *MatchType) UnmarshalYAML(unmarshal func(interface{}) error) error

type MetricMapper

type MetricMapper struct {
	Defaults mapperConfigDefaults `yaml:"defaults"`
	Mappings []MetricMapping      `yaml:"mappings"`
	FSM      *fsm.FSM

	MappingsCount prometheus.Gauge
	// contains filtered or unexported fields
}

func (*MetricMapper) GetMapping

func (m *MetricMapper) GetMapping(statsdMetric string, statsdMetricType MetricType) (*MetricMapping, prometheus.Labels, bool)

func (*MetricMapper) InitCache added in v0.10.1

func (m *MetricMapper) InitCache(cacheSize int, options ...CacheOption)

func (*MetricMapper) InitFromFile

func (m *MetricMapper) InitFromFile(fileName string, cacheSize int, options ...CacheOption) error

func (*MetricMapper) InitFromYAMLString

func (m *MetricMapper) InitFromYAMLString(fileContents string, cacheSize int, options ...CacheOption) error

type MetricMapperCache added in v0.10.1

type MetricMapperCache interface {
	Get(metricString string, metricType MetricType) (*MetricMapperCacheResult, bool)
	AddMatch(metricString string, metricType MetricType, mapping *MetricMapping, labels prometheus.Labels)
	AddMiss(metricString string, metricType MetricType)
}

type MetricMapperCacheResult added in v0.10.1

type MetricMapperCacheResult struct {
	Mapping *MetricMapping
	Matched bool
	Labels  prometheus.Labels
}

type MetricMapperLRUCache added in v0.10.1

type MetricMapperLRUCache struct {
	MetricMapperCache
	// contains filtered or unexported fields
}

func NewMetricMapperCache added in v0.10.1

func NewMetricMapperCache(size int) (*MetricMapperLRUCache, error)

func (*MetricMapperLRUCache) AddMatch added in v0.10.1

func (m *MetricMapperLRUCache) AddMatch(metricString string, metricType MetricType, mapping *MetricMapping, labels prometheus.Labels)

func (*MetricMapperLRUCache) AddMiss added in v0.10.1

func (m *MetricMapperLRUCache) AddMiss(metricString string, metricType MetricType)

func (*MetricMapperLRUCache) Get added in v0.10.1

func (m *MetricMapperLRUCache) Get(metricString string, metricType MetricType) (*MetricMapperCacheResult, bool)

type MetricMapperNoopCache added in v0.10.1

type MetricMapperNoopCache struct {
	MetricMapperCache
}

func NewMetricMapperNoopCache added in v0.10.1

func NewMetricMapperNoopCache() *MetricMapperNoopCache

func (*MetricMapperNoopCache) AddMatch added in v0.10.1

func (m *MetricMapperNoopCache) AddMatch(metricString string, metricType MetricType, mapping *MetricMapping, labels prometheus.Labels)

func (*MetricMapperNoopCache) AddMiss added in v0.10.1

func (m *MetricMapperNoopCache) AddMiss(metricString string, metricType MetricType)

func (*MetricMapperNoopCache) Get added in v0.10.1

func (m *MetricMapperNoopCache) Get(metricString string, metricType MetricType) (*MetricMapperCacheResult, bool)

type MetricMapperRRCache added in v0.15.0

type MetricMapperRRCache struct {
	MetricMapperCache
	// contains filtered or unexported fields
}

func NewMetricMapperRRCache added in v0.15.0

func NewMetricMapperRRCache(size int) (*MetricMapperRRCache, error)

func (*MetricMapperRRCache) AddMatch added in v0.15.0

func (m *MetricMapperRRCache) AddMatch(metricString string, metricType MetricType, mapping *MetricMapping, labels prometheus.Labels)

func (*MetricMapperRRCache) AddMiss added in v0.15.0

func (m *MetricMapperRRCache) AddMiss(metricString string, metricType MetricType)

func (*MetricMapperRRCache) Get added in v0.15.0

func (m *MetricMapperRRCache) Get(metricString string, metricType MetricType) (*MetricMapperCacheResult, bool)

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

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"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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