Documentation ¶
Index ¶
- Constants
- Variables
- func AddAgentVersionToDomain(DDURL string, app string) (string, error)
- func AddOverrides(vars map[string]interface{})
- func FileUsedDir() string
- func GetEnv(key, def string) string
- func GetIPCAddress() (string, error)
- func GetMainEndpoint(prefix string, ddURLKey string) string
- func GetMainEndpointWithConfig(config Config, prefix string, ddURLKey string) (resolvedDDURL string)
- func GetMainInfraEndpoint() string
- func GetMultipleEndpoints() (map[string][]string, error)
- func GetRuntimeSetting(setting string) (interface{}, error)
- func GetSyslogURI() string
- func IsContainerized() bool
- func IsKubernetes() bool
- func Load() error
- func LoadWithoutSecret() error
- func ResolveSecrets(config Config, origin string) error
- func RuntimeSettings() map[string]RuntimeSetting
- func SetRuntimeSetting(setting string, value interface{}) error
- func SetupLogger(loggerName LoggerName, logLevel, logFile, syslogURI string, ...) error
- type Config
- type ConfigurationProviders
- type ErrorLogWriter
- type LegacyConfigConverter
- type Listeners
- type LoggerName
- type MappingProfile
- type MetadataProviders
- type MetricMapping
- type MockConfig
- type Proxy
- type RuntimeSetting
- type SettingNotFoundError
- type SyslogReceiver
Constants ¶
const ( // DefaultSite is the default site the Agent sends data to. DefaultSite = "datadoghq.com" // DefaultNumWorkers default number of workers for our check runner DefaultNumWorkers = 4 // MaxNumWorkers maximum number of workers for our check runner MaxNumWorkers = 25 // DefaultForwarderRecoveryInterval is the default recovery interval, // also used if the user-provided value is invalid. DefaultForwarderRecoveryInterval = 2 // DefaultBatchWait is the default HTTP batch wait in second for logs DefaultBatchWait = 5 // ClusterIDCacheKey is the key name for the orchestrator cluster id in the agent in-mem cache ClusterIDCacheKey = "orchestratorClusterID" )
Variables ¶
var ( DefaultPython string // ForceDefaultPython has its value set to true at compile time if we should ignore // the Python version set in the configuration and use `DefaultPython` instead. // We use this to force Python 3 in the Agent 7 as it's the only one available. ForceDefaultPython string )
Variables to initialize at build time
var StandardJMXIntegrations = map[string]struct{}{
"activemq": {},
"activemq_58": {},
"cassandra": {},
"jmx": {},
"presto": {},
"solr": {},
"tomcat": {},
"kafka": {},
}
StandardJMXIntegrations is the list of standard jmx integrations
var StandardStatsdPrefixes = []string{
"datadog.agent",
"datadog.dogstatsd",
"datadog.process",
"datadog.trace_agent",
"datadog.tracer",
"activemq",
"activemq_58",
"airflow",
"cassandra",
"confluent",
"hazelcast",
"hive",
"ignite",
"jboss",
"jvm",
"kafka",
"presto",
"sidekiq",
"solr",
"tomcat",
"runtime",
}
StandardStatsdPrefixes is a list of the statsd prefixes used by the agent and its components
Functions ¶
func AddAgentVersionToDomain ¶
AddAgentVersionToDomain prefixes the domain with the agent version: X-Y-Z.domain
func AddOverrides ¶
func AddOverrides(vars map[string]interface{})
AddOverrides provides an externally accessible method for overriding config variables. This method must be called before Load() to be effective.
func FileUsedDir ¶
func FileUsedDir() string
FileUsedDir returns the absolute path to the folder containing the config file used to populate the registry
func GetEnv ¶
GetEnv retrieves the value of the environment variable named by the key, or def if the environment variable was not set.
func GetIPCAddress ¶
GetIPCAddress returns the IPC address or an error if the address is not local
func GetMainEndpoint ¶
GetMainEndpoint returns the main DD URL defined in the config, based on `site` and the prefix, or ddURLKey
func GetMainEndpointWithConfig ¶
func GetMainEndpointWithConfig(config Config, prefix string, ddURLKey string) (resolvedDDURL string)
GetMainEndpointWithConfig implements the logic to extract the DD URL from a config, based on `site` and ddURLKey
func GetMainInfraEndpoint ¶
func GetMainInfraEndpoint() string
GetMainInfraEndpoint returns the main DD Infra URL defined in the config, based on the value of `site` and `dd_url`
func GetMultipleEndpoints ¶
GetMultipleEndpoints returns the api keys per domain specified in the main agent config
func GetRuntimeSetting ¶
GetRuntimeSetting returns the value of a runtime configurable setting
func GetSyslogURI ¶
func GetSyslogURI() string
GetSyslogURI returns the configured/default syslog uri. Returns an empty string when syslog is disabled.
func IsContainerized ¶
func IsContainerized() bool
IsContainerized returns whether the Agent is running on a Docker container
func IsKubernetes ¶
func IsKubernetes() bool
IsKubernetes returns whether the Agent is running on a kubernetes cluster
func LoadWithoutSecret ¶
func LoadWithoutSecret() error
LoadWithoutSecret reads configs files, initializes the config module without decrypting any secrets
func ResolveSecrets ¶
ResolveSecrets merges all the secret values from origin into config. Secret values are identified by a value of the form "ENC[key]" where key is the secret key. See: https://github.com/DataDog/datadog-agent/blob/master/docs/agent/secrets.md
func RuntimeSettings ¶
func RuntimeSettings() map[string]RuntimeSetting
RuntimeSettings returns all runtime configurable settings
func SetRuntimeSetting ¶
SetRuntimeSetting changes the value of a runtime configurable setting
func SetupLogger ¶
func SetupLogger(loggerName LoggerName, logLevel, logFile, syslogURI string, syslogRFC, logToConsole, jsonFormat bool) error
SetupLogger sets up a logger with the specified logger name and log level if a non empty logFile is provided, it will also log to the file a non empty syslogURI will enable syslog, and format them following RFC 5424 if specified you can also specify to log to the console and in JSON format
Types ¶
type Config ¶
type Config interface { Set(key string, value interface{}) SetDefault(key string, value interface{}) SetFs(fs afero.Fs) IsSet(key string) bool Get(key string) interface{} GetString(key string) string GetBool(key string) bool GetInt(key string) int GetInt64(key string) int64 GetFloat64(key string) float64 GetTime(key string) time.Time GetDuration(key string) time.Duration GetStringSlice(key string) []string GetStringMap(key string) map[string]interface{} GetStringMapString(key string) map[string]string GetStringMapStringSlice(key string) map[string][]string GetSizeInBytes(key string) uint SetEnvPrefix(in string) BindEnv(input ...string) error SetEnvKeyReplacer(r *strings.Replacer) UnmarshalKey(key string, rawVal interface{}) error Unmarshal(rawVal interface{}) error UnmarshalExact(rawVal interface{}) error ReadInConfig() error ReadConfig(in io.Reader) error MergeConfig(in io.Reader) error MergeConfigOverride(in io.Reader) error AllSettings() map[string]interface{} AllKeys() []string AddConfigPath(in string) SetConfigName(in string) SetConfigFile(in string) SetConfigType(in string) ConfigFileUsed() string BindPFlag(key string, flag *pflag.Flag) error // SetKnown adds a key to the set of known valid config keys SetKnown(key string) // GetKnownKeys returns all the keys that meet at least one of these criteria: // 1) have a default, 2) have an environment variable binded, 3) are an alias or 4) have been SetKnown() GetKnownKeys() map[string]interface{} // BindEnvAndSetDefault sets the default value for a config parameter and adds an env binding // in one call, used for most config options BindEnvAndSetDefault(key string, val interface{}) // GetEnvVars returns a list of the non-sensitive env vars that the config supports GetEnvVars() []string }
Config represents an object that can load and store configuration parameters coming from different kind of sources: - defaults - files - environment variables - flags
var (
Datadog Config
)
Datadog is the global configuration object
type ConfigurationProviders ¶
type ConfigurationProviders struct { Name string `mapstructure:"name"` Polling bool `mapstructure:"polling"` PollInterval string `mapstructure:"poll_interval"` TemplateURL string `mapstructure:"template_url"` TemplateDir string `mapstructure:"template_dir"` Username string `mapstructure:"username"` Password string `mapstructure:"password"` CAFile string `mapstructure:"ca_file"` CAPath string `mapstructure:"ca_path"` CertFile string `mapstructure:"cert_file"` KeyFile string `mapstructure:"key_file"` Token string `mapstructure:"token"` GraceTimeSeconds int `mapstructure:"grace_time_seconds"` }
ConfigurationProviders helps unmarshalling `config_providers` config param
type ErrorLogWriter ¶
type ErrorLogWriter struct {
AdditionalDepth int
}
ErrorLogWriter is a Writer that logs all written messages with the global seelog logger at an error level
type LegacyConfigConverter ¶
type LegacyConfigConverter struct {
Config
}
LegacyConfigConverter is used in the legacy package to convert A5 config to A6
func NewConfigConverter ¶
func NewConfigConverter() *LegacyConfigConverter
NewConfigConverter is creating and returning a config converter
func (*LegacyConfigConverter) Set ¶
func (c *LegacyConfigConverter) Set(key string, value interface{})
Set is used for setting configuration from A5 config
type Listeners ¶
type Listeners struct {
Name string `mapstructure:"name"`
}
Listeners helps unmarshalling `listeners` config param
type MappingProfile ¶
type MappingProfile struct { Name string `mapstructure:"name"` Prefix string `mapstructure:"prefix"` Mappings []MetricMapping `mapstructure:"mappings"` }
MappingProfile represent a group of mappings
func GetDogstatsdMappingProfiles ¶
func GetDogstatsdMappingProfiles() ([]MappingProfile, error)
GetDogstatsdMappingProfiles returns mapping profiles used in DogStatsD mapper
type MetadataProviders ¶
type MetadataProviders struct { Name string `mapstructure:"name"` Interval time.Duration `mapstructure:"interval"` }
MetadataProviders helps unmarshalling `metadata_providers` config param
type MetricMapping ¶
type MetricMapping struct { Match string `mapstructure:"match"` MatchType string `mapstructure:"match_type"` Name string `mapstructure:"name"` Tags map[string]string `mapstructure:"tags"` }
MetricMapping represent one mapping rule
type MockConfig ¶
type MockConfig struct {
Config
}
MockConfig should only be used in tests
func (*MockConfig) Set ¶
func (c *MockConfig) Set(key string, value interface{})
Set is used for setting configuration in tests
type Proxy ¶
type Proxy struct { HTTP string `mapstructure:"http"` HTTPS string `mapstructure:"https"` NoProxy []string `mapstructure:"no_proxy"` }
Proxy represents the configuration for proxies in the agent
func GetProxies ¶
func GetProxies() *Proxy
GetProxies returns the proxy settings from the configuration
type RuntimeSetting ¶
type RuntimeSetting interface { Get() (interface{}, error) Set(v interface{}) error Name() string Description() string }
RuntimeSetting represents a setting that can be changed and read at runtime.
type SettingNotFoundError ¶
type SettingNotFoundError struct {
// contains filtered or unexported fields
}
SettingNotFoundError is used to warn about non existing/not registered runtime setting
func (*SettingNotFoundError) Error ¶
func (e *SettingNotFoundError) Error() string
type SyslogReceiver ¶
type SyslogReceiver struct {
// contains filtered or unexported fields
}
SyslogReceiver implements seelog.CustomReceiver
func (*SyslogReceiver) AfterParse ¶
func (s *SyslogReceiver) AfterParse(initArgs seelog.CustomReceiverInitArgs) error
AfterParse parses the receiver configuration
func (*SyslogReceiver) Close ¶
func (s *SyslogReceiver) Close() error
Close is a NOP in current implementation
func (*SyslogReceiver) Flush ¶
func (s *SyslogReceiver) Flush()
Flush is a NOP in current implementation
func (*SyslogReceiver) ReceiveMessage ¶
func (s *SyslogReceiver) ReceiveMessage(message string, level seelog.LogLevel, context seelog.LogContextInterface) error
ReceiveMessage process current log message