common

package
v0.66.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2025 License: Apache-2.0 Imports: 20 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package common defines the Setup structure that allows setup scripts to define packages and configurations to install.

Index

Constants

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

View Source
var (
	// ErrNoAPIKey is returned when no API key is provided.
	ErrNoAPIKey = errors.New("no API key provided")
)
View Source
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"`
	ExtraTags            []string                   `yaml:"extra_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

type InjectTracerConfigEnvVar struct {
	Key   string `yaml:"key"`
	Value string `yaml:"value"`
}

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"`
	AutoMultiLineDetection bool                `yaml:"auto_multi_line_detection,omitempty"`
	LogProcessingRules     []LogProcessingRule `yaml:"log_processing_rules,omitempty"`
}

IntegrationConfigLogs represents the configuration for the logs of an integration

type LogProcessingRule added in v0.66.0

type LogProcessingRule struct {
	Type    string `yaml:"type"`
	Name    string `yaml:"name"`
	Pattern string `yaml:"pattern"`
}

LogProcessingRule represents the configuration for a log processing rule

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

func (o *Output) WriteString(s string)

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) Install

func (p *Packages) Install(pkg string, version string)

Install marks a package to be installed

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.

func NewSetup

func NewSetup(ctx context.Context, env *env.Env, flavor string, flavorPath string, logOutput io.Writer) (*Setup, error)

NewSetup creates a new Setup structure with some default values.

func (*Setup) Run

func (s *Setup) Run() (err error)

Run installs the packages and writes the configurations

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

Jump to

Keyboard shortcuts

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