mapper

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 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"`

	TimerType        TimerType         `yaml:"timer_type"`
	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
}

type MetricType

type MetricType string
const (
	MetricTypeCounter MetricType = "counter"
	MetricTypeGauge   MetricType = "gauge"
	MetricTypeTimer   MetricType = "timer"
)

func (*MetricType) UnmarshalYAML

func (m *MetricType) 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"`
}

type TimerType

type TimerType string
const (
	TimerTypeHistogram TimerType = "histogram"
	TimerTypeSummary   TimerType = "summary"
	TimerTypeDefault   TimerType = ""
)

func (*TimerType) UnmarshalYAML

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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