Documentation
¶
Overview ¶
Package env contains environment related configurations
Index ¶
- func DetectFeatures(cfg model.Reader)
- func IsAnyContainerFeaturePresent() bool
- func IsAutoconfigEnabled(cfg model.Reader) bool
- func IsContainerized() bool
- func IsDockerRuntime() bool
- func IsECS() bool
- func IsECSFargate() bool
- func IsECSManagedInstances() bool
- func IsECSManagedInstancesDaemonMode(cfg model.Reader) bool
- func IsECSSidecarMode(cfg model.Reader) bool
- func IsFeaturePresent(feature Feature) bool
- func IsHostProcAvailable() bool
- func IsHostSysAvailable() bool
- func IsKubernetes() bool
- type Feature
- type FeatureMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectFeatures ¶
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 ¶
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 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 IsECSManagedInstancesDaemonMode ¶ added in v0.77.0
IsECSManagedInstancesDaemonMode returns true when the agent is running on ECS Managed Instances in daemon mode (i.e. not sidecar). Callers should use this when behavior differs between daemon and sidecar on Managed Instances (e.g. hostname resolution via EC2 IMDS).
func IsECSSidecarMode ¶ added in v0.73.0
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 ¶
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
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" // KubeletConfigOrchestratorCheck can be enabled KubeletConfigOrchestratorCheck = "kubelet_config_orchestrator_check" // 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" // KubernetesDevicePlugins socket directory present and accessible KubernetesDevicePlugins Feature = "kubernetes_deviceplugins" // NonstandardCRIRuntime is a fallback value for when customers supply a CRI compliant runtime via the // cri_socket_path configuration field NonstandardCRIRuntime = "nonstandard-cri-runtime" )
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