config

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2018 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	DefaultPrefix:        "",
	EnableTags:           false,
	UseOpenMetricsFormat: false,
	Write: WriteConfig{
		CarbonAddress:           "",
		CarbonTransport:         "tcp",
		CarbonReconnectInterval: 1 * time.Hour,
		EnablePathsCache:        true,
		PathsCacheTTL:           1 * time.Hour,
		PathsCachePurgeInterval: 2 * time.Hour,
	},
	Read: ReadConfig{
		URL: "",
	},
}

DefaultConfig is the default graphite configuration.

Functions

func AddCommandLine

func AddCommandLine(app *kingpin.Application, cfg *Config)

AddCommandLine setup Graphite specific cli args and flags.

Types

type Config

type Config struct {
	Write                WriteConfig `yaml:"write,omitempty" json:"write,omitempty"`
	Read                 ReadConfig  `yaml:"read,omitempty" json:"read,omitempty"`
	DefaultPrefix        string      `yaml:"default_prefix,omitempty" json:"default_prefix,omitempty"`
	EnableTags           bool        `yaml:"enable_tags,omitempty" json:"enable_tags,omitempty"`
	UseOpenMetricsFormat bool        `yaml:"openmetrics,omitempty" json:"openmetrics,omitempty"`

	// Catches all undefined fields and must be empty after parsing.
	XXX map[string]interface{} `yaml:",inline" json:"-"`
}

Config is the graphite configuration.

func (Config) String

func (c Config) String() string

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type LabelSet

type LabelSet map[model.LabelName]model.LabelValue

LabelSet pairs a LabelName to a LabelValue.

type LabelSetRE

type LabelSetRE map[model.LabelName]Regexp

LabelSetRE defines pairs like LabelSet but does regular expression

type ReadConfig

type ReadConfig struct {
	URL string `yaml:"url,omitempty" json:"url,omitempty"`

	// Catches all undefined fields and must be empty after parsing.
	XXX map[string]interface{} `yaml:",inline" json:"-"`
}

ReadConfig is the read graphite configuration.

func (*ReadConfig) UnmarshalYAML

func (c *ReadConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type Regexp

type Regexp struct {
	*regexp.Regexp
}

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

func (Regexp) MarshalJSON

func (re Regexp) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

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 Rule

type Rule struct {
	Tmpl     Template   `yaml:"template,omitempty" json:"template,omitempty"`
	Match    LabelSet   `yaml:"match,omitempty" json:"match,omitempty"`
	MatchRE  LabelSetRE `yaml:"match_re,omitempty" json:"match_re,omitempty"`
	Continue bool       `yaml:"continue,omitempty" json:"continue,omitempty"`

	// Catches all undefined fields and must be empty after parsing.
	XXX map[string]interface{} `yaml:",inline" json:"-"`
}

Rule defines a templating rule that customize graphite path using the Tmpl if a metric matching the labels exists.

func (*Rule) UnmarshalYAML

func (r *Rule) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type Template

type Template struct {
	*template.Template
	// contains filtered or unexported fields
}

Template is a parsable template.

func (Template) MarshalYAML

func (tmpl Template) MarshalYAML() (interface{}, error)

MarshalYAML implements the yaml.Marshaler interface.

func (*Template) UnmarshalYAML

func (tmpl *Template) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type WriteConfig

type WriteConfig struct {
	CarbonAddress           string                 `yaml:"carbon_address,omitempty" json:"carbon_address,omitempty"`
	CarbonTransport         string                 `yaml:"carbon_transport,omitempty" json:"carbon_transport,omitempty"`
	CarbonReconnectInterval time.Duration          `yaml:"carbon_reconnect_interval,omitempty" json:"carbon_reconnect_interval,omitempty"`
	EnablePathsCache        bool                   `yaml:"enable_paths_cache,omitempty" json:"enable_paths_cache,omitempty"`
	PathsCacheTTL           time.Duration          `yaml:"paths_cache_ttl,omitempty" json:"paths_cache_ttl,omitempty"`
	PathsCachePurgeInterval time.Duration          `yaml:"paths_cache_purge_interval,omitempty" json:"paths_cache_purge_interval,omitempty"`
	TemplateData            map[string]interface{} `yaml:"template_data,omitempty" json:"template_data,omitempty"`
	Rules                   []*Rule                `yaml:"rules,omitempty" json:"rules,omitempty"`

	// Catches all undefined fields and must be empty after parsing.
	XXX map[string]interface{} `yaml:",inline" json:"-"`
}

WriteConfig is the write graphite configuration.

func (*WriteConfig) UnmarshalYAML

func (c *WriteConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

Jump to

Keyboard shortcuts

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