config

package
v0.0.0-...-a64bcf8 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultConfig = Config{
		Factories: []FactoryConfig{
			DefaultFactoryConfig,
		},
	}
	DefaultFactoryConfig = FactoryConfig{
		ExpositionPath:   "/metrics",
		ExpositionFormat: model.ExpositionFormatPrometheus,
		Vectors: []VectorConfig{
			DefaultVectorConfig,
		},
	}
	DefaultSampleGeneratorConfig = SampleGeneratorConfig{
		Distribution: model.DistributionRandom,
		Interval:     prommodel.Duration(time.Second),
		Precision:    3,
	}
	DefaultVectorConfig = VectorConfig{
		Type:                  model.MetricTypeGauge,
		LabelCount:            3,
		LabelCardinality:      10,
		SampleGeneratorConfig: DefaultSampleGeneratorConfig,
	}
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Factories []FactoryConfig `yaml:"factories"`
}

func Load

func Load(in []byte) (*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.

func (*Config) String

func (c *Config) String() string

String implements fmt.Stringer interface.

func (*Config) UnmarshalYAML

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

UnmarshalYAML implements the yaml.Unmarshaler interface.

type FactoryConfig

type FactoryConfig struct {
	ExpositionPath    string                 `yaml:"exposition_path"`
	ExpositionFormat  model.ExpositionFormat `yaml:"exposition_format,omitempty"`
	InstrumentHandler bool                   `yaml:"instrument_handler,omitempty"`
	Vectors           []VectorConfig         `yaml:"vectors,omitempty"`
}

func (*FactoryConfig) String

func (c *FactoryConfig) String() string

String implements fmt.Stringer interface.

func (*FactoryConfig) UnmarshalYAML

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

UnmarshalYAML implements the yaml.Unmarshaler interface.

type SampleGeneratorConfig

type SampleGeneratorConfig struct {
	Distribution model.SampleDistribution `yaml:"distribution"`
	Interval     prommodel.Duration       `yaml:"sample_interval"`
	Precision    int                      `yaml:"sample_precision,omitempty"`
	Max          string                   `yaml:"sample_max,omitempty"`
	Min          string                   `yaml:"sample_min,omitempty"`

	// StdDev for normal distribution
	StdDev string `yaml:"sample_std_dev,omitempty"`
	// Mean for normal distribution
	Mean string `yaml:"sample_mean,omitempty"`

	// RateParameter for exponential distribution
	RateParameter string `yaml:"rate_parameter,omitempty"`
}

func (*SampleGeneratorConfig) String

func (c *SampleGeneratorConfig) String() string

String implements fmt.Stringer interface.

func (*SampleGeneratorConfig) UnmarshalYAML

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

UnmarshalYAML implements the yaml.Unmarshaler interface.

type VectorConfig

type VectorConfig struct {
	Type                  model.MetricType      `yaml:"type"`
	NamePrefix            string                `yaml:"name_prefix,omitempty"`
	Buckets               []string              `yaml:"buckets,omitempty"`
	LabelCount            int                   `yaml:"label_count"`
	LabelCardinality      int                   `yaml:"label_cardinality"`
	SampleGeneratorConfig SampleGeneratorConfig `yaml:",inline"`
}

func (*VectorConfig) String

func (c *VectorConfig) String() string

String implements fmt.Stringer interface.

func (*VectorConfig) UnmarshalYAML

func (c *VectorConfig) 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