common

package
v0.73.2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const (
	// DatadogAgentPackage is the datadog agent package
	DatadogAgentPackage string = "datadog-agent"
	// DatadogAgentDDOTPackage is the datadog agent ddot package
	DatadogAgentDDOTPackage string = "datadog-ddot"
	// 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 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

func ScheduleDelayedAgentRestart added in v0.69.0

func ScheduleDelayedAgentRestart(s *Setup, delay time.Duration, logFile string)

ScheduleDelayedAgentRestart schedules an agent restart after the specified delay

Types

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) WriteSSIInstaller added in v0.68.0

func (p *Packages) WriteSSIInstaller()

WriteSSIInstaller marks that the installer should be copied to /opt/datadog-packages/run/datadog-installer-ssi Use this when installing SSI without the agent, so that the installer can be used later to remove the packages.

type Setup

type Setup struct {
	Out                       *Output
	Env                       *env.Env
	Ctx                       context.Context
	Span                      *telemetry.Span
	Packages                  Packages
	Config                    config.Config
	DdAgentAdditionalGroups   []string
	DelayedAgentRestartConfig config.DelayedAgentRestartConfig
	NoConfig                  bool
	// 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

Jump to

Keyboard shortcuts

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