cfg

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2019 License: BSD-2-Clause Imports: 5 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DEBUG bool = false

TODO (grzkv): Remove from global scope. Probably should be replaced with flags

Functions

func GetDefaultLoggerConfig

func GetDefaultLoggerConfig() zapwriter.Config

GetDefaultLoggerConfig returns sane default for the logger conf

Types

type API

type API struct {
	// TODO (grzkv): Why does carbonapi config refer to zipper config?
	// It should probably refer to the common one
	Zipper `yaml:",inline"`

	ExtrapolateExperiment   bool          `yaml:"extrapolateExperiment"`
	SendGlobsAsIs           bool          `yaml:"sendGlobsAsIs"`
	AlwaysSendGlobsAsIs     bool          `yaml:"alwaysSendGlobsAsIs"`
	MaxBatchSize            int           `yaml:"maxBatchSize"`
	Cache                   CacheConfig   `yaml:"cache"`
	TimezoneString          string        `yaml:"tz"`
	PidFile                 string        `yaml:"pidFile"`
	BlockHeaderFile         string        `yaml:"blockHeaderFile"`
	BlockHeaderUpdatePeriod time.Duration `yaml:"blockHeaderUpdatePeriod"`
	HeadersToLog            []string      `yaml:"headersToLog"`

	UnicodeRangeTables        []string          `yaml:"unicodeRangeTables"`
	IgnoreClientTimeout       bool              `yaml:"ignoreClientTimeout"`
	DefaultColors             map[string]string `yaml:"defaultColors"`
	FunctionsConfigs          map[string]string `yaml:"functionsConfig"`
	GraphiteVersionForGrafana string            `yaml:"graphiteVersionForGrafana"`
}

API is carbonapi-specific config

func DefaultAPIConfig

func DefaultAPIConfig() API

DefaultAPIConfig gives a starter carbonapi conf

func ParseAPIConfig

func ParseAPIConfig(r io.Reader) (API, error)

ParseAPIConfig reads carbonapi-specific config

type CacheConfig

type CacheConfig struct {
	Type              string   `yaml:"type"`
	Size              int      `yaml:"size_mb"`
	MemcachedServers  []string `yaml:"memcachedServers"`
	DefaultTimeoutSec int32    `yaml:"defaultTimeoutSec"`
}

CacheConfig configs the cache

type Common

type Common struct {
	Listen         string   `yaml:"listen"`
	ListenInternal string   `yaml:"listenInternal"`
	Backends       []string `yaml:"backends"`

	MaxProcs                  int           `yaml:"maxProcs"`
	Timeouts                  Timeouts      `yaml:"timeouts"`
	ConcurrencyLimitPerServer int           `yaml:"concurrencyLimit"`
	KeepAliveInterval         time.Duration `yaml:"keepAliveInterval"`
	MaxIdleConnsPerHost       int           `yaml:"maxIdleConnsPerHost"`

	ExpireDelaySec             int32   `yaml:"expireDelaySec"`
	GraphiteWeb09Compatibility bool    `yaml:"graphite09compat"`
	CorruptionThreshold        float64 `yaml:"corruptionThreshold"`

	Buckets  int                `yaml:"buckets"`
	Graphite GraphiteConfig     `yaml:"graphite"`
	Logger   []zapwriter.Config `yaml:"logger"`

	Monitoring MonitoringConfig `yaml:"monitoring"`
}

Common is the configuration shared by carbonapi and carbonzipper

func DefaultCommonConfig

func DefaultCommonConfig() Common

func ParseCommon

func ParseCommon(r io.Reader) (Common, error)

ParseCommon sets the default config, parses input one, and overrides the defaults

type GraphiteConfig

type GraphiteConfig struct {
	Pattern  string
	Host     string
	Interval time.Duration
	Prefix   string
}

GraphiteConfig does not makes real sense

type HistogramConfig

type HistogramConfig struct {
	Start      float64 `yaml:"start"`
	BucketsNum int     `yaml:"bucketsNum"`
	BucketSize float64 `yaml:"bucketSize"`
}

HistogramConfig is histogram config for Prometheus metrics

type MonitoringConfig

type MonitoringConfig struct {
	RequestDurationExp      HistogramConfig `yaml:"requestDurationExpHistogram"`
	RequestDurationLin      HistogramConfig `yaml:"requestDurationLinHistogram"`
	TimeInQueueExpHistogram HistogramConfig `yaml:"timeInQueueExpHistogram"`
}

MonitoringConfig allows setting custom monitoring parameters

type Timeouts

type Timeouts struct {
	Global       time.Duration `yaml:"global"`
	AfterStarted time.Duration `yaml:"afterStarted"`
	Connect      time.Duration `yaml:"connect"`
}

Timeouts needs some figuring out

type Zipper

type Zipper struct {
	Common    `yaml:",inline"`
	PathCache pathcache.PathCache
}

Zipper is the zipper config

func DefaultZipperConfig

func DefaultZipperConfig() Zipper

DefaultZipperConfig makes a testable default config

func ParseZipperConfig

func ParseZipperConfig(r io.Reader) (Zipper, error)

ParseZipperConfig reads the zipper config from a supplied reader

Jump to

Keyboard shortcuts

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