config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MetricConfigs []MetricParser `yaml:"metric_configs,omitempty"`

	// Catchall
	XXX map[string]string `yaml:",inline"`

	Original string
}

func Load

func Load(s string) (*Config, error)

Load parses the YAML input s into a Config.

func LoadFile

func LoadFile(filename string) (*Config, error)

LoadFile parses the given YAML file into a Config.

type ErrorInvalidMetricType

type ErrorInvalidMetricType struct{}

func (ErrorInvalidMetricType) Error

func (this ErrorInvalidMetricType) Error() string

type LabelDef

type LabelDef struct {
	Name  LabelValueDef `yaml:"name,omitempty"`
	Value LabelValueDef `yaml:"value,omitempty"`

	// Optional parameter: specify a default value for a missing key
	Default    string
	HasDefault bool
	// contains filtered or unexported fields
}

func (*LabelDef) MarshalYAML

func (this *LabelDef) MarshalYAML() (interface{}, error)

MarshalYAML implements the yaml.Marshaler interface.

func (*LabelDef) UnmarshalYAML

func (this *LabelDef) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type LabelValueDef

type LabelValueDef struct {
	FieldType        LabelValueType
	Literal          string
	CaptureGroup     int
	CaptureGroupName string
}

Defines a type which sets ascii label values

func (*LabelValueDef) MarshalYAML

func (this *LabelValueDef) MarshalYAML() (interface{}, error)

MarshalYAML implements the yaml.Marshaler interface.

func (*LabelValueDef) UnmarshalYAML

func (this *LabelValueDef) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type LabelValueType

type LabelValueType int
const (
	LabelValueLiteral           LabelValueType = iota
	LabelValueCaptureGroup      LabelValueType = iota
	LabelValueCaptureGroupNamed LabelValueType = iota
)

type MetricParser

type MetricParser struct {
	Name    string         `yaml:"name,omitempty"`
	Type    MetricType     `yaml:"type,omitempty"`
	Help    string         `yaml:"help,omitempty"`
	Regex   Regexp         `yaml:"regex,omitempty"`
	Labels  []LabelDef     `yaml:"labels,omitempty"`
	Value   ValueDef       `yaml:"value,omitempty"`
	Timeout model.Duration `yaml:"timeout,omitempty"`
}

func (*MetricParser) UnmarshalYAML

func (this *MetricParser) UnmarshalYAML(unmarshal func(interface{}) error) error

type MetricParserErrorNoHelp

type MetricParserErrorNoHelp struct{}

func (MetricParserErrorNoHelp) Error

func (this MetricParserErrorNoHelp) Error() string

type MetricType

type MetricType int

Metric type definitions

const (
	MetricUntyped MetricType = iota
	MetricGauge   MetricType = iota
	MetricCounter MetricType = iota
)

func (*MetricType) MarshalYAML

func (this *MetricType) MarshalYAML() (interface{}, error)

func (*MetricType) UnmarshalYAML

func (this *MetricType) UnmarshalYAML(unmarshal func(interface{}) error) error

type Regexp

type Regexp struct {
	pcre.Regexp
	// contains filtered or unexported fields
}

Regexp encapsulates a regexp.Regexp and makes it YAML marshallable.

func MustNewRegexp

func MustNewRegexp(s flaggedRegex) *Regexp

MustNewRegexp works like NewRegexp, but panics if the regular expression does not compile.

func NewRegexp

func NewRegexp(s flaggedRegex) (*Regexp, error)

NewRegexp creates a new anchored Regexp and returns an error if the passed-in regular expression does not compile.

func (*Regexp) MarshalYAML

func (re *Regexp) MarshalYAML() (interface{}, error)

MarshalYAML implements the yaml.Marshaler interface.

func (*Regexp) UnmarshalYAML

func (re *Regexp) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type RegexpCompileError

type RegexpCompileError struct {
	*pcre.CompileError
}

RegexpCompileError wraps the pcre Compile error

func (RegexpCompileError) Error

func (this RegexpCompileError) Error() string

type RegexpFlagsError

type RegexpFlagsError struct {
	// contains filtered or unexported fields
}

RegexpFlagsError provides a useful error message when bad flags are found for the supplied regexp

func (RegexpFlagsError) Error

func (this RegexpFlagsError) Error() string

type ValueDef

type ValueDef struct {
	ValueOp          ValueOpType
	ValueSource      ValueSourceType
	Literal          float64
	CaptureGroup     int
	CaptureGroupName string
}

ValueDef is the definition for numeric values which will be assigned to metrics

func (*ValueDef) MarshalYAML

func (this *ValueDef) MarshalYAML() (interface{}, error)

MarshalYAML implements the yaml.Marshaler interface

func (*ValueDef) UnmarshalYAML

func (this *ValueDef) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type ValueOpType

type ValueOpType int

ValueSourceType specifies the sourcex

const (
	ValueOpAdd ValueOpType = iota
	ValueOpSubtract
	ValueOpEquals
)

type ValueSourceType

type ValueSourceType int
const (
	// Assign the specified value directly to the metric
	ValueSourceLiteral ValueSourceType = iota
	// Assign the value from the capture group to the metric
	ValueSourceCaptureGroup
	// Assign the value frm the given named capture group to the metric
	ValueSourceNamedCaptureGroup
)

Jump to

Keyboard shortcuts

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