Skip to content

Commit

Permalink
feat(error tracking): add core agent and error tracking standalone se…
Browse files Browse the repository at this point in the history
…ttings (#1553)

* Add core agent and error tracking standalone settings

* Simplify bool condition

* set up defaults

* add tests

* add example

* fix tests

* rework into ErrorTracking.Mode

* rework into single errorTrackingStandalone variable

* fix typo

* update generated files

* doc fixes

---------

Co-authored-by: Eloy Toro <[email protected]>
Co-authored-by: levan-m <[email protected]>
Co-authored-by: Levan Machablishvili <[email protected]>
  • Loading branch information
4 people authored Feb 24, 2025
1 parent 8ba3647 commit b5120af
Show file tree
Hide file tree
Showing 14 changed files with 268 additions and 20 deletions.
16 changes: 15 additions & 1 deletion api/datadoghq/v2alpha1/datadogagent_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,20 @@ type APMFeatureConfig struct {
// Enabled Default: false
// +optional
SingleStepInstrumentation *SingleStepInstrumentation `json:"instrumentation,omitempty"`

// ErrorTrackingStandalone contains the configuration for the Error Tracking standalone feature.
// Feature is in preview.
// +optional
ErrorTrackingStandalone *ErrorTrackingStandalone `json:"errorTrackingStandalone,omitempty"`
}

// ErrorTrackingStandalone contains the configuration for the Error Tracking standalone feature.
// +k8s:openapi-gen=true
type ErrorTrackingStandalone struct {
// Enables Error Tracking for backend services.
// Default: false
// +optional
Enabled *bool `json:"enabled,omitempty"`
}

// SingleStepInstrumentation contains the config for the namespaces to target and the library to inject.
Expand Down Expand Up @@ -1307,7 +1321,7 @@ type GlobalConfig struct {
// +listType=set
Tags []string `json:"tags,omitempty"`

//Env contains a list of environment variables that are set for all Agents.
// Env contains a list of environment variables that are set for all Agents.
// +optional
// +listType=map
// +listMapKey=name
Expand Down
25 changes: 25 additions & 0 deletions api/datadoghq/v2alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions api/datadoghq/v2alpha1/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions config/crd/bases/v1/datadoghq.com_datadogagents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,17 @@ spec:
Enabled enables Application Performance Monitoring.
Default: true
type: boolean
errorTrackingStandalone:
description: |-
ErrorTrackingStandalone contains the configuration for the Error Tracking standalone feature.
Feature is in preview.
properties:
enabled:
description: |-
Enables Error Tracking for backend services.
Default: false
type: boolean
type: object
hostPortConfig:
description: |-
HostPortConfig contains host port configuration.
Expand Down Expand Up @@ -7380,6 +7391,17 @@ spec:
Enabled enables Application Performance Monitoring.
Default: true
type: boolean
errorTrackingStandalone:
description: |-
ErrorTrackingStandalone contains the configuration for the Error Tracking standalone feature.
Feature is in preview.
properties:
enabled:
description: |-
Enables Error Tracking for backend services.
Default: false
type: boolean
type: object
hostPortConfig:
description: |-
HostPortConfig contains host port configuration.
Expand Down
22 changes: 22 additions & 0 deletions config/crd/bases/v1/datadoghq.com_datadogagents_v2alpha1.json
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,17 @@
"description": "Enabled enables Application Performance Monitoring.\nDefault: true",
"type": "boolean"
},
"errorTrackingStandalone": {
"additionalProperties": false,
"description": "ErrorTrackingStandalone contains the configuration for the Error Tracking standalone feature.\nFeature is in preview.",
"properties": {
"enabled": {
"description": "Enables Error Tracking for backend services.\nDefault: false",
"type": "boolean"
}
},
"type": "object"
},
"hostPortConfig": {
"additionalProperties": false,
"description": "HostPortConfig contains host port configuration.\nEnabled Default: false\nPort Default: 8126",
Expand Down Expand Up @@ -7326,6 +7337,17 @@
"description": "Enabled enables Application Performance Monitoring.\nDefault: true",
"type": "boolean"
},
"errorTrackingStandalone": {
"additionalProperties": false,
"description": "ErrorTrackingStandalone contains the configuration for the Error Tracking standalone feature.\nFeature is in preview.",
"properties": {
"enabled": {
"description": "Enables Error Tracking for backend services.\nDefault: false",
"type": "boolean"
}
},
"type": "object"
},
"hostPortConfig": {
"additionalProperties": false,
"description": "HostPortConfig contains host port configuration.\nEnabled Default: false\nPort Default: 8126",
Expand Down
1 change: 1 addition & 0 deletions docs/configuration.v2alpha1.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ spec:
| features.admissionController.validation.enabled | Enables the Admission Controller validation webhook. Default: true |
| features.admissionController.webhookName | WebhookName is a custom name for the MutatingWebhookConfiguration. Default: "datadog-webhook" |
| features.apm.enabled | Enables Application Performance Monitoring. Default: true |
| features.apm.errorTrackingStandalone.enabled | Enables Error Tracking for backend services. Default: false |
| features.apm.hostPortConfig.enabled | Enables host port configuration |
| features.apm.hostPortConfig.hostPort | Port takes a port number (0 < x < 65536) to expose on the host. (Most containers do not need this.) If HostNetwork is enabled, this value must match the ContainerPort. |
| features.apm.instrumentation.disabledNamespaces | DisabledNamespaces disables injecting the Datadog APM libraries into pods in specific namespaces. |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: datadoghq.com/v2alpha1
kind: DatadogAgent
metadata:
name: datadog
spec:
features:
apm:
enabled: true
errorTrackingStandalone:
enabled: true
global:
env:
- name: DD_ENABLE_PAYLOADS_EVENTS
value: "false"
- name: DD_ENABLE_PAYLOADS_SERIES
value: "false"
- name: DD_ENABLE_PAYLOADS_SERVICE_CHECKS
value: "false"
- name: DD_ENABLE_PAYLOADS_SKETCHES
value: "false"
clusterName: local-k8s
credentials:
apiKey: <DATADOG_API_KEY>
appKey: <DATADOG_APP_KEY>
kubelet:
tlsVerify: false
39 changes: 20 additions & 19 deletions internal/controller/datadogagent/common/envvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,26 @@
package common

const (
DDAPMEnabled = "DD_APM_ENABLED"
DDAPMInstrumentationInstallTime = "DD_INSTRUMENTATION_INSTALL_TIME"
DDAPMInstrumentationInstallId = "DD_INSTRUMENTATION_INSTALL_ID"
DDAPMInstrumentationInstallType = "DD_INSTRUMENTATION_INSTALL_TYPE"
DDClusterAgentEnabled = "DD_CLUSTER_AGENT_ENABLED"
DDClusterAgentKubeServiceName = "DD_CLUSTER_AGENT_KUBERNETES_SERVICE_NAME"
DDClusterAgentTokenName = "DD_CLUSTER_AGENT_TOKEN_NAME"
DDContainerCollectionEnabled = "DD_PROCESS_CONFIG_CONTAINER_COLLECTION_ENABLED"
DDDogstatsdEnabled = "DD_USE_DOGSTATSD"
DDHealthPort = "DD_HEALTH_PORT"
DDHostRootEnvVar = "HOST_ROOT"
DDKubeletHost = "DD_KUBERNETES_KUBELET_HOST"
DDLeaderElection = "DD_LEADER_ELECTION"
DDLogsEnabled = "DD_LOGS_ENABLED"
DDProcessCollectionEnabled = "DD_PROCESS_CONFIG_PROCESS_COLLECTION_ENABLED"
DDProcessConfigRunInCoreAgent = "DD_PROCESS_CONFIG_RUN_IN_CORE_AGENT_ENABLED"
DDSystemProbeEnabled = "DD_SYSTEM_PROBE_ENABLED"
DDSystemProbeExternal = "DD_SYSTEM_PROBE_EXTERNAL"
DDSystemProbeSocket = "DD_SYSPROBE_SOCKET"
DDAPMEnabled = "DD_APM_ENABLED"
DDAPMInstrumentationInstallTime = "DD_INSTRUMENTATION_INSTALL_TIME"
DDAPMInstrumentationInstallId = "DD_INSTRUMENTATION_INSTALL_ID"
DDAPMInstrumentationInstallType = "DD_INSTRUMENTATION_INSTALL_TYPE"
DDAPMErrorTrackingStandaloneEnabled = "DD_APM_ERROR_TRACKING_STANDALONE_ENABLED"
DDClusterAgentEnabled = "DD_CLUSTER_AGENT_ENABLED"
DDClusterAgentKubeServiceName = "DD_CLUSTER_AGENT_KUBERNETES_SERVICE_NAME"
DDClusterAgentTokenName = "DD_CLUSTER_AGENT_TOKEN_NAME"
DDContainerCollectionEnabled = "DD_PROCESS_CONFIG_CONTAINER_COLLECTION_ENABLED"
DDDogstatsdEnabled = "DD_USE_DOGSTATSD"
DDHealthPort = "DD_HEALTH_PORT"
DDHostRootEnvVar = "HOST_ROOT"
DDKubeletHost = "DD_KUBERNETES_KUBELET_HOST"
DDLeaderElection = "DD_LEADER_ELECTION"
DDLogsEnabled = "DD_LOGS_ENABLED"
DDProcessCollectionEnabled = "DD_PROCESS_CONFIG_PROCESS_COLLECTION_ENABLED"
DDProcessConfigRunInCoreAgent = "DD_PROCESS_CONFIG_RUN_IN_CORE_AGENT_ENABLED"
DDSystemProbeEnabled = "DD_SYSTEM_PROBE_ENABLED"
DDSystemProbeExternal = "DD_SYSTEM_PROBE_EXTERNAL"
DDSystemProbeSocket = "DD_SYSPROBE_SOCKET"

// KubernetesEnvvarName Env var used by the Datadog Agent container entrypoint
// to add kubelet config provider and listener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ func defaultEnvVars(dda metav1.Object) []corev1.EnvVar {
},
},
},
{
Name: common.DDAPMErrorTrackingStandaloneEnabled,
Value: "false",
},
}

return envVars
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const (
defaultCWSSyscallMonitorEnabled bool = false
defaultCWSNetworkEnabled bool = true
defaultCWSSecurityProfilesEnabled bool = true
defaultAPMErrorTrackingStandalone bool = false

defaultNPMEnabled bool = false
defaultNPMEnableConntrack bool = true
Expand Down Expand Up @@ -322,6 +323,12 @@ func defaultFeaturesConfig(ddaSpec *v2alpha1.DatadogAgentSpec) {

apiutils.DefaultBooleanIfUnset(&ddaSpec.Features.APM.SingleStepInstrumentation.Enabled, defaultAPMSingleStepInstrEnabled)
apiutils.DefaultBooleanIfUnset(&ddaSpec.Features.APM.SingleStepInstrumentation.LanguageDetection.Enabled, defaultLanguageDetectionEnabled)

if ddaSpec.Features.APM.ErrorTrackingStandalone == nil {
ddaSpec.Features.APM.ErrorTrackingStandalone = &v2alpha1.ErrorTrackingStandalone{}
}

apiutils.DefaultBooleanIfUnset(&ddaSpec.Features.APM.ErrorTrackingStandalone.Enabled, defaultAPMErrorTrackingStandalone)
}

// ASM Features
Expand Down
Loading

0 comments on commit b5120af

Please sign in to comment.