setup

package module
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 28 Imported by: 10

Documentation

Overview

Package setup defines the configuration of the agent

Index

Constants

View Source
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
	// DefaultAPIKeyValidationInterval is the default interval of api key validation checks
	DefaultAPIKeyValidationInterval = 60

	// 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

	// DefaultBatchMaxConcurrentSend is the default HTTP batch max concurrent send for logs
	DefaultBatchMaxConcurrentSend = 0

	// DefaultBatchMaxSize is the default HTTP batch max size (maximum number of events in a single batch) for logs
	DefaultBatchMaxSize = 1000

	// DefaultInputChanSize is the default input chan size for events
	DefaultInputChanSize = 100

	// DefaultBatchMaxContentSize is the default HTTP batch max content size (before compression) for logs
	// It is also the maximum possible size of a single event. Events exceeding this limit are dropped.
	DefaultBatchMaxContentSize = 5000000

	// DefaultAuditorTTL is the default logs auditor TTL in hours
	DefaultAuditorTTL = 23

	// DefaultRuntimePoliciesDir is the default policies directory used by the runtime security module
	DefaultRuntimePoliciesDir = "/etc/datadog-agent/runtime-security.d"

	// DefaultLogsSenderBackoffFactor is the default logs sender backoff randomness factor
	DefaultLogsSenderBackoffFactor = 2.0

	// DefaultLogsSenderBackoffBase is the default logs sender base backoff time, seconds
	DefaultLogsSenderBackoffBase = 1.0

	// DefaultLogsSenderBackoffMax is the default logs sender maximum backoff time, seconds
	DefaultLogsSenderBackoffMax = 120.0

	// DefaultLogsSenderBackoffRecoveryInterval is the default logs sender backoff recovery interval
	DefaultLogsSenderBackoffRecoveryInterval = 2

	// DefaultLocalProcessCollectorInterval is the interval at which processes are collected and sent to the workloadmeta
	// in the core agent if the process check is disabled.
	DefaultLocalProcessCollectorInterval = 1 * time.Minute

	// DefaultMaxMessageSizeBytes is the default value for max_message_size_bytes
	// If a log message is larger than this byte limit, the overflow bytes will be truncated.
	DefaultMaxMessageSizeBytes = 256 * 1000
)
View Source
const (

	// DefaultUpdaterLogFile is the default updater log file
	DefaultUpdaterLogFile = "/var/log/datadog/updater.log"
	// DefaultSecurityAgentLogFile points to the log file that will be used by the security-agent if not configured
	DefaultSecurityAgentLogFile = "/var/log/datadog/security-agent.log"
	// DefaultProcessAgentLogFile is the default process-agent log file
	DefaultProcessAgentLogFile = "/var/log/datadog/process-agent.log"
)
View Source
const (
	OTLPSection               = "otlp_config"
	OTLPTracesSubSectionKey   = "traces"
	OTLPTracePort             = OTLPSection + "." + OTLPTracesSubSectionKey + ".internal_port"
	OTLPTracesEnabled         = OTLPSection + "." + OTLPTracesSubSectionKey + ".enabled"
	OTLPLogsSubSectionKey     = "logs"
	OTLPLogsEnabled           = OTLPSection + "." + OTLPLogsSubSectionKey + ".enabled"
	OTLPReceiverSubSectionKey = "receiver"
	OTLPReceiverSection       = OTLPSection + "." + OTLPReceiverSubSectionKey
	OTLPMetricsSubSectionKey  = "metrics"
	OTLPMetrics               = OTLPSection + "." + OTLPMetricsSubSectionKey
	OTLPMetricsEnabled        = OTLPSection + "." + OTLPMetricsSubSectionKey + ".enabled"
	OTLPTagCardinalityKey     = OTLPMetrics + ".tag_cardinality"
	OTLPDebugKey              = "debug"
	OTLPDebug                 = OTLPSection + "." + OTLPDebugKey
)

OTLP configuration paths.

View Source
const (
	// DefaultGRPCConnectionTimeoutSecs sets the default value for timeout when connecting to the agent
	DefaultGRPCConnectionTimeoutSecs = 60

	// DefaultProcessQueueSize is the default max amount of process-agent checks that can be buffered in memory if the forwarder can't consume them fast enough (e.g. due to network disruption)
	// This can be fairly high as the input should get throttled by queue bytes first.
	// Assuming we generate ~8 checks/minute (for process/network), this should allow buffering of ~30 minutes of data assuming it fits within the queue bytes memory budget
	DefaultProcessQueueSize = 256

	// DefaultProcessRTQueueSize is the default max amount of process-agent realtime checks that can be buffered in memory
	// We set a small queue size for real-time message because they get staled very quickly, thus we only keep the latest several payloads
	DefaultProcessRTQueueSize = 5

	// DefaultProcessQueueBytes is the default amount of process-agent check data (in bytes) that can be buffered in memory
	// Allow buffering up to 60 megabytes of payload data in total
	DefaultProcessQueueBytes = 60 * 1000 * 1000

	// DefaultProcessMaxPerMessage is the default maximum number of processes, or containers per message. Note: Only change if the defaults are causing issues.
	DefaultProcessMaxPerMessage = 100

	// ProcessMaxPerMessageLimit is the maximum allowed value for maximum number of processes, or containers per message.
	ProcessMaxPerMessageLimit = 10000

	// DefaultProcessMaxMessageBytes is the default max for size of a message containing processes or container data. Note: Only change if the defaults are causing issues.
	DefaultProcessMaxMessageBytes = 1000000

	// ProcessMaxMessageBytesLimit is the maximum allowed value for the maximum size of a message containing processes or container data.
	ProcessMaxMessageBytesLimit = 4000000

	// DefaultProcessExpVarPort is the default port used by the process-agent expvar server
	DefaultProcessExpVarPort = 6062

	// DefaultProcessCmdPort is the default port used by process-agent to run a runtime settings server
	DefaultProcessCmdPort = 6162

	// DefaultProcessEntityStreamPort is the default port used by the process-agent to expose Process Entities
	DefaultProcessEntityStreamPort = 6262

	// DefaultProcessEndpoint is the default endpoint for the process agent to send payloads to
	DefaultProcessEndpoint = "https://process.datadoghq.com"

	// DefaultProcessEventsEndpoint is the default endpoint for the process agent to send event payloads to
	DefaultProcessEventsEndpoint = "https://process-events.datadoghq.com"

	// DefaultProcessEventStoreMaxItems is the default maximum amount of events that can be stored in the Event Store
	DefaultProcessEventStoreMaxItems = 200

	// DefaultProcessEventStoreMaxPendingPushes is the default amount of pending push operations can be handled by the Event Store
	DefaultProcessEventStoreMaxPendingPushes = 10

	// DefaultProcessEventStoreMaxPendingPulls is the default amount of pending pull operations can be handled by the Event Store
	DefaultProcessEventStoreMaxPendingPulls = 10

	// DefaultProcessEventStoreStatsInterval is the default frequency at which the event store sends stats about expired events, in seconds
	DefaultProcessEventStoreStatsInterval = 20

	// DefaultProcessEventsMinCheckInterval is the minimum interval allowed for the process_events check
	DefaultProcessEventsMinCheckInterval = time.Second

	// DefaultProcessEventsCheckInterval is the default interval used by the process_events check
	DefaultProcessEventsCheckInterval = 10 * time.Second

	// DefaultProcessDiscoveryHintFrequency is the default frequency in terms of number of checks which we send a process discovery hint
	DefaultProcessDiscoveryHintFrequency = 60
)

Variables

View Source
var (
	Datadog     pkgconfigmodel.Config
	SystemProbe pkgconfigmodel.Config
)

Datadog is the global configuration object

View Source
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

View Source
var (
	// StartTime is the agent startup time
	StartTime = time.Now()

	// DefaultSecurityProfilesDir is the default directory used to store Security Profiles by the runtime security module
	DefaultSecurityProfilesDir = filepath.Join(defaultRunPath, "runtime-security", "profiles")
)

Variables to initialize at start time

View Source
var (

	// DefaultDDAgentBin the process agent's binary
	DefaultDDAgentBin = filepath.Join(InstallPath, "bin/agent/agent")
)
View Source
var (
	// InstallPath is the default install path for the agent
	// It might be overridden at build time
	InstallPath = "/opt/datadog-agent"
)

Variables to initialize at build time

View Source
var StandardJMXIntegrations = map[string]struct{}{
	"activemq":    {},
	"activemq_58": {},
	"cassandra":   {},
	"jmx":         {},
	"presto":      {},
	"solr":        {},
	"tomcat":      {},
	"kafka":       {},
}

StandardJMXIntegrations is the list of standard jmx integrations. This list is used by the Agent to determine if an integration is JMXFetch-based, based only on the integration name. DEPRECATED: this list is only used for backward compatibility with older JMXFetch integration configs. All JMXFetch integrations should instead define `is_jmx: true` at the init_config or instance level.

View Source
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 EnvVarAreSetAndNotEqual

func EnvVarAreSetAndNotEqual(lhsName string, rhsName string) bool

EnvVarAreSetAndNotEqual returns true if two given variables are set in environment and are not equal.

func GetBindHost

func GetBindHost(config pkgconfigmodel.Reader) string

GetBindHost returns `bind_host` variable or default value Not using `config.BindEnvAndSetDefault` as some processes need to know if value was default one or not (e.g. trace-agent)

func GetBindHostFromConfig

func GetBindHostFromConfig(cfg pkgconfigmodel.Reader) string

GetBindHostFromConfig returns the bind_host value from the config

func GetIPCAddress

func GetIPCAddress(config pkgconfigmodel.Reader) (string, error)

GetIPCAddress returns the IPC address or an error if the address is not local

func GetIPCPort

func GetIPCPort() string

GetIPCPort returns the IPC port

func GetObsPipelineURL

func GetObsPipelineURL(datatype DataType, config pkgconfigmodel.Reader) (string, error)

GetObsPipelineURL returns the URL under the 'observability_pipelines_worker.' prefix for the given datatype

func GetProcessAPIAddressPort

func GetProcessAPIAddressPort(config pkgconfigmodel.Reader) (string, error)

GetProcessAPIAddressPort returns the API endpoint of the process agent

func GetRemoteConfigurationAllowedIntegrations

func GetRemoteConfigurationAllowedIntegrations(cfg pkgconfigmodel.Reader) map[string]bool

GetRemoteConfigurationAllowedIntegrations returns the list of integrations that can be scheduled with remote-config

func GetValidHostAliases

func GetValidHostAliases(_ context.Context, config pkgconfigmodel.Reader) ([]string, error)

GetValidHostAliases validates host aliases set in `host_aliases` variable and returns only valid ones.

func InitConfig

func InitConfig(config pkgconfigmodel.Config)

InitConfig initializes the config defaults on a config

func InitSystemProbeConfig

func InitSystemProbeConfig(cfg pkgconfigmodel.Config)

InitSystemProbeConfig declares all the configuration values normally read from system-probe.yaml.

func IsCLCRunner

func IsCLCRunner(config pkgconfigmodel.Reader) bool

IsCLCRunner returns whether the Agent is in cluster check runner mode

func IsCloudProviderEnabled

func IsCloudProviderEnabled(cloudProviderName string, config pkgconfigmodel.Reader) bool

IsCloudProviderEnabled checks the cloud provider family provided in pkg/util/<cloud_provider>.go against the value for cloud_provider: on the global config object Datadog

func IsRemoteConfigEnabled

func IsRemoteConfigEnabled(cfg pkgconfigmodel.Reader) bool

IsRemoteConfigEnabled returns true if Remote Configuration should be enabled

func LoadCustom

func LoadCustom(config pkgconfigmodel.Config, origin string, secretResolver optional.Option[secrets.Component], additionalKnownEnvVars []string) (*pkgconfigmodel.Warnings, error)

LoadCustom reads config into the provided config object

func LoadDatadogCustom

func LoadDatadogCustom(config pkgconfigmodel.Config, origin string, secretResolver optional.Option[secrets.Component], additionalKnownEnvVars []string) (*pkgconfigmodel.Warnings, error)

LoadDatadogCustom loads the datadog config in the given config

func LoadProxyFromEnv

func LoadProxyFromEnv(config pkgconfigmodel.Config)

LoadProxyFromEnv overrides the proxy settings with environment variables

func LoadWithSecret

func LoadWithSecret(config pkgconfigmodel.Config, secretResolver secrets.Component, additionalEnvVars []string) (*pkgconfigmodel.Warnings, error)

LoadWithSecret reads config files and initializes config with decrypted secrets

func LoadWithoutSecret

func LoadWithoutSecret(config pkgconfigmodel.Config, additionalEnvVars []string) (*pkgconfigmodel.Warnings, error)

LoadWithoutSecret reads configs files, initializes the config module without decrypting any secrets

func Merge

func Merge(configPaths []string, config pkgconfigmodel.Config) error

Merge will merge additional configuration into an existing configuration

func OTLP

func OTLP(config pkgconfigmodel.Config)

OTLP related configuration.

func ResolveSecrets

func ResolveSecrets(config pkgconfigmodel.Config, secretResolver secrets.Component, origin string) error

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/main/docs/agent/secrets.md

Types

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"`
	DegradedDeadlineMinutes int    `mapstructure:"degraded_deadline_minutes"`
}

ConfigurationProviders helps unmarshalling `config_providers` config param

type DataType

type DataType string

DataType represent the generic data type (e.g. metrics, logs) that can be sent by the Agent

const (
	// Metrics type covers series & sketches
	Metrics DataType = "metrics"
	// Logs type covers all outgoing logs
	Logs DataType = "logs"
)
const Traces DataType = "traces"

Traces specifies the data type used for Vector override. See https://vector.dev/docs/reference/configuration/sources/datadog_agent/ for additional details.

type Endpoint

type Endpoint struct {
	Site   string `mapstructure:"site" json:"site" yaml:"site"`
	URL    string `mapstructure:"url" json:"url" yaml:"url"`
	APIKey string `mapstructure:"api_key" json:"api_key" yaml:"api_key"`
	APPKey string `mapstructure:"app_key" json:"app_key" yaml:"app_key"`
}

Endpoint represent a datadog endpoint

type Listeners

type Listeners struct {
	Name             string `mapstructure:"name"`
	EnabledProviders map[string]struct{}
}

Listeners helps unmarshalling `listeners` config param

func (*Listeners) IsProviderEnabled

func (l *Listeners) IsProviderEnabled(provider string) bool

IsProviderEnabled returns whether a config provider is enabled

func (*Listeners) SetEnabledProviders

func (l *Listeners) SetEnabledProviders(ep map[string]struct{})

SetEnabledProviders registers the enabled config providers in the listener config

type MappingProfile

type MappingProfile struct {
	Name     string          `mapstructure:"name" json:"name" yaml:"name"`
	Prefix   string          `mapstructure:"prefix" json:"prefix" yaml:"prefix"`
	Mappings []MetricMapping `mapstructure:"mappings" json:"mappings" yaml:"mappings"`
}

MappingProfile represent a group of mappings

func GetDogstatsdMappingProfiles

func GetDogstatsdMappingProfiles(config pkgconfigmodel.Reader) ([]MappingProfile, error)

GetDogstatsdMappingProfiles returns mapping profiles used in DogStatsD mapper

type MetricMapping

type MetricMapping struct {
	Match     string            `mapstructure:"match" json:"match" yaml:"match"`
	MatchType string            `mapstructure:"match_type" json:"match_type" yaml:"match_type"`
	Name      string            `mapstructure:"name" json:"name" yaml:"name"`
	Tags      map[string]string `mapstructure:"tags" json:"tags" yaml:"tags"`
}

MetricMapping represent one mapping rule

type UnexpectedUnicodeCodepoint

type UnexpectedUnicodeCodepoint struct {
	// contains filtered or unexported fields
}

UnexpectedUnicodeCodepoint contains specifics about an occurrence of an unexpected unicode codepoint

func FindUnexpectedUnicode

func FindUnexpectedUnicode(input string) []UnexpectedUnicodeCodepoint

FindUnexpectedUnicode reports any _unexpected_ unicode codepoints found in the given 'input' string Unexpected here generally means invisible whitespace and control chars

Directories

Path Synopsis
Package constants holds constants
Package constants holds constants

Jump to

Keyboard shortcuts

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