Documentation
¶
Overview ¶
Package common defines the Setup structure that allows setup scripts to define packages and configurations to install.
Index ¶
- Constants
- Variables
- type Config
- type DatadogConfig
- type DatadogConfigDJM
- type DatadogConfigInstaller
- type DatadogConfigInstallerRegistry
- type DatadogConfigProcessConfig
- type DatadogConfigProxy
- type InjectTracerConfig
- type InjectTracerConfigEnvVar
- type IntegrationConfig
- type IntegrationConfigInstanceSpark
- type IntegrationConfigInstanceYarn
- type IntegrationConfigLogs
- type Output
- type Packages
- type RuntimeSecurityConfig
- type SecurityAgentComplianceConfig
- type SecurityAgentConfig
- type Setup
- type SystemProbeConfig
Constants ¶
const ( // DatadogInstallerPackage is the datadog installer package DatadogInstallerPackage string = "datadog-installer" // DatadogAgentPackage is the datadog agent package DatadogAgentPackage string = "datadog-agent" // DatadogAPMInjectPackage is the datadog apm inject package DatadogAPMInjectPackage string = "datadog-apm-inject" // DatadogAPMLibraryJavaPackage is the datadog apm library java package DatadogAPMLibraryJavaPackage string = "datadog-apm-library-java" // DatadogAPMLibraryPythonPackage is the datadog apm library python package DatadogAPMLibraryPythonPackage string = "datadog-apm-library-python" // DatadogAPMLibraryRubyPackage is the datadog apm library ruby package DatadogAPMLibraryRubyPackage string = "datadog-apm-library-ruby" // DatadogAPMLibraryJSPackage is the datadog apm library js package DatadogAPMLibraryJSPackage string = "datadog-apm-library-js" // DatadogAPMLibraryDotNetPackage is the datadog apm library dotnet package DatadogAPMLibraryDotNetPackage string = "datadog-apm-library-dotnet" // DatadogAPMLibraryPHPPackage is the datadog apm library php package DatadogAPMLibraryPHPPackage string = "datadog-apm-library-php" )
Variables ¶
var ( // ApmLibraries is a list of all the apm libraries ApmLibraries = []string{ DatadogAPMLibraryJavaPackage, DatadogAPMLibraryPythonPackage, DatadogAPMLibraryRubyPackage, DatadogAPMLibraryJSPackage, DatadogAPMLibraryDotNetPackage, DatadogAPMLibraryPHPPackage, } )
var ( // ErrNoAPIKey is returned when no API key is provided. ErrNoAPIKey = errors.New("no API key provided") )
var ExecuteCommandWithTimeout = func(s *Setup, command string, args ...string) (output []byte, err error) { span, _ := telemetry.StartSpanFromContext(s.Ctx, "setup.command") span.SetResourceName(command) defer func() { span.Finish(err) }() ctx, cancel := context.WithTimeout(context.Background(), commandTimeoutDuration) defer cancel() cmd := exec.CommandContext(ctx, command, args...) output, err = cmd.Output() if output != nil { span.SetTag("command_output", string(output)) } if err != nil { span.SetTag("command_error", err.Error()) span.Finish(err) return nil, err } return output, nil }
ExecuteCommandWithTimeout executes a bash command with args and times out if the command has not finished
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// DatadogYAML is the content of the datadog.yaml file
DatadogYAML DatadogConfig
// SecurityAgentYAML is the content of the security-agent.yaml file
SecurityAgentYAML *SecurityAgentConfig
// SystemProbeYAML is the content of the system-probe.yaml file
SystemProbeYAML *SystemProbeConfig
// InjectTracerYAML is the content of the inject/tracer.yaml file
InjectTracerYAML InjectTracerConfig
// IntegrationConfigs is the content of the integration configuration files under conf.d/
IntegrationConfigs map[string]IntegrationConfig
}
Config represents the configuration to write in /etc/datadog-agent
type DatadogConfig ¶
type DatadogConfig struct {
APIKey string `yaml:"api_key"`
Hostname string `yaml:"hostname,omitempty"`
Site string `yaml:"site,omitempty"`
Proxy DatadogConfigProxy `yaml:"proxy,omitempty"`
Env string `yaml:"env,omitempty"`
Tags []string `yaml:"tags,omitempty"`
LogsEnabled bool `yaml:"logs_enabled,omitempty"`
DJM DatadogConfigDJM `yaml:"djm_config,omitempty"`
ProcessConfig DatadogConfigProcessConfig `yaml:"process_config,omitempty"`
ExpectedTagsDuration string `yaml:"expected_tags_duration,omitempty"`
RemoteUpdates bool `yaml:"remote_updates,omitempty"`
Installer DatadogConfigInstaller `yaml:"installer,omitempty"`
DDURL string `yaml:"dd_url,omitempty"`
}
DatadogConfig represents the configuration to write in /etc/datadog-agent/datadog.yaml
type DatadogConfigDJM ¶
type DatadogConfigDJM struct {
Enabled bool `yaml:"enabled,omitempty"`
}
DatadogConfigDJM represents the configuration for the Data Jobs Monitoring
type DatadogConfigInstaller ¶
type DatadogConfigInstaller struct {
Registry DatadogConfigInstallerRegistry `yaml:"registry,omitempty"`
}
DatadogConfigInstaller represents the configuration for the installer
type DatadogConfigInstallerRegistry ¶
type DatadogConfigInstallerRegistry struct {
URL string `yaml:"url,omitempty"`
Auth string `yaml:"auth,omitempty"`
}
DatadogConfigInstallerRegistry represents the configuration for the installer registry
type DatadogConfigProcessConfig ¶
type DatadogConfigProcessConfig struct {
ExpvarPort int `yaml:"expvar_port,omitempty"`
}
DatadogConfigProcessConfig represents the configuration for the process agent
type DatadogConfigProxy ¶
type DatadogConfigProxy struct {
HTTP string `yaml:"http,omitempty"`
HTTPS string `yaml:"https,omitempty"`
NoProxy []string `yaml:"no_proxy,omitempty"`
}
DatadogConfigProxy represents the configuration for the proxy
type InjectTracerConfig ¶
type InjectTracerConfig struct {
Version int `yaml:"version,omitempty"`
ConfigSources string `yaml:"config_sources,omitempty"`
AdditionalEnvironmentVariables []InjectTracerConfigEnvVar `yaml:"additional_environment_variables,omitempty"`
}
InjectTracerConfig represents the configuration to write in /etc/datadog-agent/inject/tracer.yaml
type InjectTracerConfigEnvVar ¶
InjectTracerConfigEnvVar represents an environment variable to inject
type IntegrationConfig ¶
type IntegrationConfig struct {
InitConfig any `yaml:"init_config"`
Instances []any `yaml:"instances,omitempty"`
Logs []IntegrationConfigLogs `yaml:"logs,omitempty"`
}
IntegrationConfig represents the configuration for an integration under conf.d/
type IntegrationConfigInstanceSpark ¶
type IntegrationConfigInstanceSpark struct {
SparkURL string `yaml:"spark_url"`
SparkClusterMode string `yaml:"spark_cluster_mode"`
ClusterName string `yaml:"cluster_name"`
StreamingMetrics bool `yaml:"streaming_metrics"`
}
IntegrationConfigInstanceSpark represents the configuration for the Spark integration
type IntegrationConfigInstanceYarn ¶
type IntegrationConfigInstanceYarn struct {
ResourceManagerURI string `yaml:"resourcemanager_uri"`
ClusterName string `yaml:"cluster_name"`
}
IntegrationConfigInstanceYarn represents the configuration for the Yarn integration
type IntegrationConfigLogs ¶
type IntegrationConfigLogs struct {
Type string `yaml:"type,omitempty"`
Path string `yaml:"path,omitempty"`
Service string `yaml:"service,omitempty"`
Source string `yaml:"source,omitempty"`
Tags string `yaml:"tags,omitempty"`
}
IntegrationConfigLogs represents the configuration for the logs of an integration
type Output ¶
type Output struct {
// contains filtered or unexported fields
}
Output is a writer for the output. It will support some ANSI escape sequences to format the output.
func (*Output) WriteString ¶
WriteString writes a string to the output.
type Packages ¶
type Packages struct {
// contains filtered or unexported fields
}
Packages is a list of packages to install
func (*Packages) InstallInstaller ¶ added in v0.65.0
func (p *Packages) InstallInstaller()
InstallInstaller marks the installer package to be installed
type RuntimeSecurityConfig ¶
type RuntimeSecurityConfig struct {
Enabled bool `yaml:"enabled,omitempty"`
}
RuntimeSecurityConfig represents the configuration for the runtime security
type SecurityAgentComplianceConfig ¶
type SecurityAgentComplianceConfig struct {
Enabled bool `yaml:"enabled,omitempty"`
}
SecurityAgentComplianceConfig represents the configuration for the compliance
type SecurityAgentConfig ¶
type SecurityAgentConfig struct {
ComplianceConfig SecurityAgentComplianceConfig `yaml:"compliance_config,omitempty"`
RuntimeSecurityConfig RuntimeSecurityConfig `yaml:"runtime_security_config,omitempty"`
}
SecurityAgentConfig represents the configuration to write in /etc/datadog-agent/security-agent.yaml
type Setup ¶
type Setup struct {
Out *Output
Env *env.Env
Ctx context.Context
Span *telemetry.Span
Packages Packages
Config Config
DdAgentAdditionalGroups []string
// contains filtered or unexported fields
}
Setup allows setup scripts to define packages and configurations to install.
type SystemProbeConfig ¶
type SystemProbeConfig struct {
RuntimeSecurityConfig RuntimeSecurityConfig `yaml:"runtime_security_config,omitempty"`
}
SystemProbeConfig represents the configuration to write in /etc/datadog-agent/system-probe.yaml