cfg

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: BSD-2-Clause Imports: 8 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() zap.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"`

	ResolveGlobs            int           `yaml:"resolveGlobs"`
	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 {
	// possible values are: null, mem, memcache, replicatedMemcache
	Type             string   `yaml:"type"`
	Size             int      `yaml:"size_mb"`
	MemcachedServers []string `yaml:"memcachedServers"`
	// TODO (grzkv): This looks to be used as expiration time for cache
	DefaultTimeoutSec int32  `yaml:"defaultTimeoutSec"`
	QueryTimeoutMs    uint64 `yaml:"queryTimeoutMs"`
	Prefix            string `yaml:"prefix"`
}

CacheConfig configs the cache

type Cluster added in v0.2.0

type Cluster struct {
	Name     string   `yaml:"name"`
	Backends []string `yaml:"backends"`
}

Cluster is a definition for set of backends

type Common

type Common struct {
	Listen            string    `yaml:"listen"`
	ListenInternal    string    `yaml:"listenInternal"`
	Backends          []string  `yaml:"backends"`
	BackendsByCluster []Cluster `yaml:"backendsByCluster"`
	BackendsByDC      []DC      `yaml:"backendsByDC"`

	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"`
	InternalRoutingCache       int32 `yaml:"internalRoutingCache"`
	GraphiteWeb09Compatibility bool  `yaml:"graphite09compat"`

	Buckets      int            `yaml:"buckets"`
	Graphite     GraphiteConfig `yaml:"graphite"`
	LoggerConfig zap.Config     `yaml:"loggerConfig"`

	Monitoring MonitoringConfig `yaml:"monitoring"`

	Traces               Traces `yaml:"traces"`
	PrintErrorStackTrace bool   `yaml:"printErrorStackTrace"`

	// RenderReplicaMismatchConfig configures the render mismatch related operations.
	RenderReplicaMismatchConfig RenderReplicaMismatchConfig `yaml:"renderReplicaMismatchConfig"`
}

Common is the configuration shared by carbonapi and carbonzipper

func DefaultCommonConfig

func DefaultCommonConfig() Common

DefaultCommonConfig gives the default config shared by carbonapi and zipper

func ParseCommon

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

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

func (Common) GetBackends added in v0.2.0

func (common Common) GetBackends() []string

GetBackends returns the list of backends from common configuration

func (Common) InfoOfBackend added in v0.2.0

func (common Common) InfoOfBackend(address string) (string, string, error)

InfoOfBackend returns the dc and cluster of a given backend address from common configuration

type DC added in v0.2.0

type DC struct {
	Name     string    `yaml:"name"`
	Clusters []Cluster `yaml:"clusters"`
}

DC is a definition for data-cemter with set of clusters

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"`
	RenderDurationExp       HistogramConfig `yaml:"renderDurationExpHistogram"`
	RenderDurationLinSimple HistogramConfig `yaml:"renderDurationLinHistogram"`
	FindDurationExp         HistogramConfig `yaml:"findDurationExpHistogram"`
	FindDurationLin         HistogramConfig `yaml:"findDurationLinHistogram"`
	FindDurationLinSimple   HistogramConfig `yaml:"findDurationSimpleLinHistogram"`
	FindDurationLinComplex  HistogramConfig `yaml:"findDurationComplexLinHistogram"`
	TimeInQueueExpHistogram HistogramConfig `yaml:"timeInQueueExpHistogram"`
	TimeInQueueLinHistogram HistogramConfig `yaml:"timeInQueueLinHistogram"`
}

MonitoringConfig allows setting custom monitoring parameters

type RenderReplicaMismatchConfig added in v0.3.0

type RenderReplicaMismatchConfig struct {
	// RenderReplicaMismatchApproximateCheck enables the approximate float equality
	// check while checking for mismatches.
	RenderReplicaMismatchApproximateCheck bool `yaml:"renderReplicaMismatchApproximateCheck"`

	// RenderReplicaMatchMode indicates how carbonzipper merges the metrics from replica backends.
	// Possible values are:
	//
	// * `normal` - ignore the mismatches and only heal null points (default)
	//
	// * `check` - look for mismatches, and expose metrics
	//
	// * `majority` - choose the values of majority of backends in addition to exposing metrics
	RenderReplicaMatchMode ReplicaMatchMode `yaml:"renderReplicaMatchMode"`

	// RenderReplicaMismatchReportLimit limits the number of mismatched metrics to be logged
	// for a single render request.
	RenderReplicaMismatchReportLimit int `yaml:"renderReplicaMismatchReportLimit"`
}

func (*RenderReplicaMismatchConfig) String added in v0.3.0

func (c *RenderReplicaMismatchConfig) String() string

type ReplicaMatchMode added in v0.3.0

type ReplicaMatchMode string
const (
	ReplicaMatchModeNormal   ReplicaMatchMode = "normal"
	ReplicaMatchModeCheck    ReplicaMatchMode = "check"
	ReplicaMatchModeMajority ReplicaMatchMode = "majority"
)

func (*ReplicaMatchMode) UnmarshalYAML added in v0.3.0

func (cm *ReplicaMatchMode) UnmarshalYAML(unmarshal func(interface{}) error) error

type Tags added in v0.2.0

type Tags map[string]string

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 Traces added in v0.2.0

type Traces struct {
	JaegerEndpoint       string        `yaml:"jaegerEndpoint"`
	Timeout              time.Duration `yaml:"timeout"`
	Tags                 Tags          `yaml:"tags"`
	JaegerBufferMaxCount int           `yaml:"jaegerBufferMaxCount"`
	JaegerBatchMaxCount  int           `yaml:"jaegerBatchMaxCount"`
}

Traces holds configuration related to tracing

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