env

package module
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: 13 Imported by: 2

Documentation

Overview

Package env contains environment related configurations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectFeatures

func DetectFeatures(cfg model.Reader)

DetectFeatures runs the feature detection. We guarantee that Datadog configuration is entirely loaded (env + YAML) before this function is called

func IsAnyContainerFeaturePresent

func IsAnyContainerFeaturePresent() bool

IsAnyContainerFeaturePresent checks if any of known container features is present

func IsAutoconfigEnabled

func IsAutoconfigEnabled(cfg model.Reader) bool

IsAutoconfigEnabled returns if autoconfig from environment is activated or not

func IsContainerized

func IsContainerized() bool

IsContainerized returns whether the Agent is running on a Docker container DOCKER_DD_AGENT is set in our official Dockerfile

func IsDockerRuntime

func IsDockerRuntime() bool

IsDockerRuntime returns true if we are to find the /.dockerenv file which is typically only set by Docker

func IsECS

func IsECS() bool

IsECS returns whether the Agent is running on ECS

func IsECSFargate

func IsECSFargate() bool

IsECSFargate returns whether the Agent is running in ECS Fargate

func IsECSManagedInstances added in v0.73.0

func IsECSManagedInstances() bool

IsECSManagedInstances returns whether the Agent is running in ECS Managed Instances

func IsECSSidecarMode added in v0.73.0

func IsECSSidecarMode(cfg model.Reader) bool

IsECSSidecarMode returns true if the agent is running in ECS sidecar mode. This includes Fargate (always sidecar) and Managed Instances when explicitly configured as sidecar.

func IsFeaturePresent

func IsFeaturePresent(feature Feature) bool

IsFeaturePresent returns if a particular feature is activated

func IsHostProcAvailable

func IsHostProcAvailable() bool

IsHostProcAvailable returns whether host proc is available or not

func IsHostSysAvailable

func IsHostSysAvailable() bool

IsHostSysAvailable returns whether host proc is available or not

func IsKubernetes

func IsKubernetes() bool

IsKubernetes returns whether the Agent is running on a kubernetes cluster

func IsLambda added in v0.73.0

func IsLambda() bool

IsLambda returns whether the Agent is running in a Lambda function

Types

type Feature

type Feature string

Feature represents a feature of current environment

const (
	// Docker socket present
	Docker Feature = "docker"
	// Containerd socket present
	Containerd Feature = "containerd"
	// Cri is any cri socket present
	Cri Feature = "cri"
	// Crio socket present
	Crio Feature = "crio"
	// Kubernetes environment
	Kubernetes Feature = "kubernetes"
	// ECSEC2 environment
	ECSEC2 Feature = "ecsec2"
	// ECSFargate environment
	ECSFargate Feature = "ecsfargate"
	// ECSManagedInstances environment
	ECSManagedInstances Feature = "ecsmanagedinstances"
	// EKSFargate environment
	EKSFargate Feature = "eksfargate"
	// KubeOrchestratorExplorer can be enabled
	KubeOrchestratorExplorer Feature = "kube_orchestratorexplorer"
	// ECSOrchestratorExplorer can be enabled
	ECSOrchestratorExplorer Feature = "ecs_orchestratorexplorer"
	// CloudFoundry socket present
	CloudFoundry Feature = "cloudfoundry"
	// Podman containers storage path accessible
	Podman Feature = "podman"
	// PodResources socket present
	PodResources Feature = "podresources"
	// NVML library present for GPU detection
	NVML Feature = "nvml"
)

Remember to also register feature in init()

type FeatureMap

type FeatureMap map[Feature]struct{}

FeatureMap represents all detected features

func GetDetectedFeatures

func GetDetectedFeatures() FeatureMap

GetDetectedFeatures returns all detected features (detection only performed once)

func (FeatureMap) String

func (fm FeatureMap) String() string

Jump to

Keyboard shortcuts

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