config

package
v0.17.0-patch2 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: BSD-2-Clause Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config = ConfigType{
	ExtrapolateExperiment: false,
	Buckets:               10,
	Concurency:            1000,
	MaxBatchSize:          100,
	ResponseCacheConfig: CacheConfig{
		Type:              "mem",
		DefaultTimeoutSec: 60,
		ShortTimeoutSec:   0,
		ShortDuration:     0,
	},
	BackendCacheConfig: CacheConfig{
		Type:              "null",
		DefaultTimeoutSec: 0,
		ShortTimeoutSec:   0,
	},
	TimezoneString: "",
	Graphite: GraphiteConfig{
		Pattern:  "{prefix}.{fqdn}",
		Host:     "",
		Interval: 60 * time.Second,
		Prefix:   "carbon.api",
	},
	Cpus:            0,
	IdleConnections: 10,
	PidFile:         "",

	ResponseCache: cache.NullCache{},
	BackendCache:  cache.NullCache{},

	DefaultTimeZone: time.Local,
	Logger:          []zapwriter.Config{DefaultLoggerConfig},

	Upstreams: zipperCfg.Config{
		Buckets:          10,
		SlowLogThreshold: 1 * time.Second,
		Timeouts: zipperTypes.Timeouts{
			Render:  10000 * time.Second,
			Find:    2 * time.Second,
			Connect: 200 * time.Millisecond,
		},
		KeepAliveInterval: 30 * time.Second,

		MaxIdleConnsPerHost: 100,
	},
	ExpireDelaySec:             10 * 60,
	GraphiteWeb09Compatibility: false,
	Prefix:                     "",
	Expvar: ExpvarConfig{
		Listen:       "",
		Enabled:      true,
		PProfEnabled: false,
	},
	NotFoundStatusCode:     200,
	HTTPResponseStackTrace: true,
	UseCachingDNSResolver:  false,
	CachingDNSRefreshTime:  1 * time.Minute,
}
View Source
var DefaultLoggerConfig = zapwriter.Config{
	Logger:           "",
	File:             "stdout",
	Level:            "info",
	Encoding:         "console",
	EncodingTime:     "iso8601",
	EncodingDuration: "seconds",
}

Functions

func SetUpConfig

func SetUpConfig(logger *zap.Logger, BuildVersion string)

func SetUpConfigUpstreams

func SetUpConfigUpstreams(logger *zap.Logger)

func SetUpViper

func SetUpViper(logger *zap.Logger, configPath *string, exactConfig bool, viperPrefix string)

Types

type CacheConfig

type CacheConfig struct {
	Type                string        `mapstructure:"type"`
	Size                int           `mapstructure:"size_mb"`
	MemcachedServers    []string      `mapstructure:"memcachedServers"`
	DefaultTimeoutSec   int32         `mapstructure:"defaultTimeoutSec"`
	ShortTimeoutSec     int32         `mapstructure:"shortTimeoutSec"`
	ShortDuration       time.Duration `mapstructure:"shortDuration"`
	ShortUntilOffsetSec int64         `mapstructure:"shortUntilOffsetSec"`
}

type ConfigType

type ConfigType struct {
	ExtrapolateExperiment      bool               `mapstructure:"extrapolateExperiment"`
	Logger                     []zapwriter.Config `mapstructure:"logger"`
	Listen                     string             `mapstructure:"listen"`
	Listeners                  []Listener         `mapstructure:"listeners"`
	Buckets                    int                `mapstructure:"buckets"`
	Concurency                 int                `mapstructure:"concurency"`
	ResponseCacheConfig        CacheConfig        `mapstructure:"cache"`
	BackendCacheConfig         CacheConfig        `mapstructure:"backendCache"`
	Cpus                       int                `mapstructure:"cpus"`
	TimezoneString             string             `mapstructure:"tz"`
	UnicodeRangeTables         []string           `mapstructure:"unicodeRangeTables"`
	Graphite                   GraphiteConfig     `mapstructure:"graphite"`
	IdleConnections            int                `mapstructure:"idleConnections"`
	PidFile                    string             `mapstructure:"pidFile"`
	SendGlobsAsIs              *bool              `mapstructure:"sendGlobsAsIs"`
	AlwaysSendGlobsAsIs        *bool              `mapstructure:"alwaysSendGlobsAsIs"`
	ExtractTagsFromArgs        bool               `mapstructure:"extractTagsFromArgs"`
	PassFunctionsToBackend     bool               `mapstructure:"passFunctionsToBackend"`
	MaxBatchSize               int                `mapstructure:"maxBatchSize"`
	Zipper                     string             `mapstructure:"zipper"`
	Upstreams                  zipperCfg.Config   `mapstructure:"upstreams"`
	ExpireDelaySec             int32              `mapstructure:"expireDelaySec"`
	GraphiteWeb09Compatibility bool               `mapstructure:"graphite09compat"`
	IgnoreClientTimeout        bool               `mapstructure:"ignoreClientTimeout"`
	DefaultColors              map[string]string  `mapstructure:"defaultColors"`
	GraphTemplates             string             `mapstructure:"graphTemplates"`
	FunctionsConfigs           map[string]string  `mapstructure:"functionsConfig"`
	HeadersToPass              []string           `mapstructure:"headersToPass"`
	HeadersToLog               []string           `mapstructure:"headersToLog"`
	Define                     []Define           `mapstructure:"define"`
	Prefix                     string             `mapstructure:"prefix"`
	Expvar                     ExpvarConfig       `mapstructure:"expvar"`
	NotFoundStatusCode         int                `mapstructure:"notFoundStatusCode"`
	HTTPResponseStackTrace     bool               `mapstructure:"httpResponseStackTrace"`
	UseCachingDNSResolver      bool               `mapstructure:"useCachingDNSResolver"`
	CachingDNSRefreshTime      time.Duration      `mapstructure:"cachingDNSRefreshTime"`

	TruncateTimeMap map[time.Duration]time.Duration `mapstructure:"truncateTime"`
	TruncateTime    []DurationTruncate              `mapstructure:"-" json:"-"` // produce from TruncateTimeMap and sort in reverse order

	MaxQueryLength              uint64 `mapstructure:"maxQueryLength"`
	CombineMultipleTargetsInOne bool   `mapstructure:"combineMultipleTargetsInOne"`

	NudgeStartTimeOnAggregation             bool `mapstructure:"nudgeStartTimeOnAggregation"`
	UseBucketsHighestTimestampOnAggregation bool `mapstructure:"useBucketsHighestTimestampOnAggregation"`

	ResponseCache cache.BytesCache `mapstructure:"-" json:"-"`
	BackendCache  cache.BytesCache `mapstructure:"-" json:"-"`

	DefaultTimeZone *time.Location `mapstructure:"-" json:"-"`

	// ZipperInstance is API entry to carbonzipper
	ZipperInstance zipper.CarbonZipper `mapstructure:"-" json:"-"`

	// Limiter limits concurrent zipper requests
	Limiter limiter.SimpleLimiter `mapstructure:"-" json:"-"`

	Evaluator interfaces.Evaluator `mapstructure:"-" json:"-"`
}

func (*ConfigType) SetZipper added in v0.17.0

func (c *ConfigType) SetZipper(zipper zipper.CarbonZipper) (err error)

func (ConfigType) String

func (c ConfigType) String() string

skipcq: CRT-P0003

type Define added in v0.12.4

type Define struct {
	Name     string `mapstructure:"name"`
	Template string `mapstructure:"template"`
}

type DurationTruncate added in v0.15.5

type DurationTruncate struct {
	Duration time.Duration
	Truncate time.Duration
}

type ExpvarConfig added in v0.12.4

type ExpvarConfig struct {
	Listen       string `mapstructure:"listen"`
	Enabled      bool   `mapstructure:"enabled"`
	PProfEnabled bool   `mapstructure:"pprofEnabled"`
}

type GraphiteConfig

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

type Listener added in v0.15.0

type Listener struct {
	Address string `mapstructure:"address"`

	// Server TLS
	ServerTLSConfig tlsconfig.TLSConfig `mapstructure:"serverTLSConfig"`

	// Client TLS
	ClientTLSConfig tlsconfig.TLSConfig `mapstructure:"clientTLSConfig"`
}

Jump to

Keyboard shortcuts

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