Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(error tracking): add core agent and error tracking standalone settings #1553

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion api/datadoghq/common/envvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ const (
DDAdmissionControllerAppsecSCAEnabled = "DD_ADMISSION_CONTROLLER_AUTO_INSTRUMENTATION_APPSEC_SCA_ENABLED"
DDAdmissionControllerIASTEnabled = "DD_ADMISSION_CONTROLLER_AUTO_INSTRUMENTATION_IAST_ENABLED"
DDAPIKey = "DD_API_KEY"
DDCoreAgentEnabled = "DD_CORE_AGENT_ENABLED"
DDAPMEnabled = "DD_APM_ENABLED"
DDAPMErrorTrackingStandaloneEnabled = "DD_APM_ERROR_TRACKING_STANDALONE_ENABLED"
DDAPMInstrumentationInstallTime = "DD_INSTRUMENTATION_INSTALL_TIME"
DDAPMInstrumentationInstallId = "DD_INSTRUMENTATION_INSTALL_ID"
DDAPMInstrumentationInstallType = "DD_INSTRUMENTATION_INSTALL_TYPE"
Expand Down Expand Up @@ -178,7 +180,7 @@ const (
DDOTLPgRPCEndpoint = "DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_GRPC_ENDPOINT"
DDOTLPHTTPEndpoint = "DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_HTTP_ENDPOINT"

// KubernetesEnvvarName Env var used by the Datadog Agent container entrypoint
// KubernetesEnvVar Env var used by the Datadog Agent container entrypoint
// to add kubelet config provider and listener
KubernetesEnvVar = "KUBERNETES"

Expand Down
29 changes: 28 additions & 1 deletion api/datadoghq/v2alpha1/datadogagent_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,20 @@ type APMFeatureConfig struct {
// Enabled Default: false
// +optional
SingleStepInstrumentation *SingleStepInstrumentation `json:"instrumentation,omitempty"`

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

// ErrorTrackingStandalone contains the configuration for Error Tracking standalone.
// +k8s:openapi-gen=true
type ErrorTrackingStandalone struct {
// Enabled enables Error Tracking backend standalone.
// 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 @@ -1215,7 +1229,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 Expand Up @@ -1314,6 +1328,19 @@ type GlobalConfig struct {
// Default: 'false'
// +optional
RunProcessChecksInCoreAgent *bool `json:"runProcessChecksInCoreAgent,omitempty"`

// CoreAgent contains the settings for the core agent.
// +optional
CoreAgent *CoreAgent `json:"coreAgent,omitempty"`
}

// CoreAgent contains the core agent configuration.
// +k8s:openapi-gen=true
type CoreAgent struct {
// Enabled enables the Core Agent.
// Default: true
// +optional
Enabled *bool `json:"enabled,omitempty"`
}

// DatadogCredentials is a generic structure that holds credentials to access Datadog.
Expand Down
15 changes: 15 additions & 0 deletions api/datadoghq/v2alpha1/test/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ func (builder *DatadogAgentBuilder) WithAnnotations(annotations map[string]strin
return builder
}

func (builder *DatadogAgentBuilder) WithCoreAgent(enabled bool) *DatadogAgentBuilder {
builder.datadogAgent.Spec.Global.CoreAgent = &v2alpha1.CoreAgent{
Enabled: apiutils.NewBoolPointer(enabled),
}
return builder
}

// Global environment variable
func (builder *DatadogAgentBuilder) WithEnvVars(envs []corev1.EnvVar) *DatadogAgentBuilder {
builder.datadogAgent.Spec.Global.Env = envs
Expand Down Expand Up @@ -577,6 +584,14 @@ func (builder *DatadogAgentBuilder) WithAPMEnabled(enabled bool) *DatadogAgentBu
return builder
}

func (builder *DatadogAgentBuilder) WithErrorTrackingStandalone(enabled bool) *DatadogAgentBuilder {
builder.initAPM()
builder.datadogAgent.Spec.Features.APM.ErrorTrackingStandalone = &v2alpha1.ErrorTrackingStandalone{
Enabled: apiutils.NewBoolPointer(enabled),
}
return builder
}

func (builder *DatadogAgentBuilder) WithAPMHostPortEnabled(enabled bool, port *int32) *DatadogAgentBuilder {
builder.initAPM()
builder.datadogAgent.Spec.Features.APM.HostPortConfig = &v2alpha1.HostPortConfig{
Expand Down
50 changes: 50 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.

42 changes: 42 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.

31 changes: 31 additions & 0 deletions config/crd/bases/v1/datadoghq.com_datadogagents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,17 @@ spec:
Enabled enables Application Performance Monitoring.
Default: true
type: boolean
errorTrackingStandalone:
description: |-
ErrorTrackingStandalone contains the configuration for Error Tracking backends standalone.
Feature is in beta.
properties:
enabled:
description: |-
Enabled enables Error Tracking backend standalone.
Default: false
type: boolean
type: object
hostPortConfig:
description: |-
HostPortConfig contains host port configuration.
Expand Down Expand Up @@ -1502,6 +1513,15 @@ spec:
ContainerStrategy determines whether agents run in a single or multiple containers.
Default: 'optimized'
type: string
coreAgent:
description: CoreAgent contains the settings for the core agent.
properties:
enabled:
description: |-
Enabled enables the Core Agent.
Default: true
type: boolean
type: object
credentials:
description: Credentials defines the Datadog credentials used to submit data to/query data from Datadog.
properties:
Expand Down Expand Up @@ -7207,6 +7227,17 @@ spec:
Enabled enables Application Performance Monitoring.
Default: true
type: boolean
errorTrackingStandalone:
description: |-
ErrorTrackingStandalone contains the configuration for Error Tracking backends standalone.
Feature is in beta.
properties:
enabled:
description: |-
Enabled enables Error Tracking backend standalone.
Default: false
type: boolean
type: object
hostPortConfig:
description: |-
HostPortConfig contains host port configuration.
Expand Down
33 changes: 33 additions & 0 deletions config/crd/bases/v1/datadoghq.com_datadogagents_v2alpha1.json
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,17 @@
"description": "Enabled enables Application Performance Monitoring.\nDefault: true",
"type": "boolean"
},
"errorTrackingStandalone": {
"additionalProperties": false,
"description": "ErrorTrackingStandalone contains the configuration for Error Tracking backends standalone.\nFeature is in beta.",
"properties": {
"enabled": {
"description": "Enabled enables Error Tracking backend standalone.\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 @@ -1589,6 +1600,17 @@
"description": "ContainerStrategy determines whether agents run in a single or multiple containers.\nDefault: 'optimized'",
"type": "string"
},
"coreAgent": {
"additionalProperties": false,
"description": "CoreAgent contains the settings for the core agent.",
"properties": {
"enabled": {
"description": "Enabled enables the Core Agent.\nDefault: true",
"type": "boolean"
}
},
"type": "object"
},
"credentials": {
"additionalProperties": false,
"description": "Credentials defines the Datadog credentials used to submit data to/query data from Datadog.",
Expand Down Expand Up @@ -7148,6 +7170,17 @@
"description": "Enabled enables Application Performance Monitoring.\nDefault: true",
"type": "boolean"
},
"errorTrackingStandalone": {
"additionalProperties": false,
"description": "ErrorTrackingStandalone contains the configuration for Error Tracking backends standalone.\nFeature is in beta.",
"properties": {
"enabled": {
"description": "Enabled enables Error Tracking backend standalone.\nDefault: false",
"type": "boolean"
}
},
"type": "object"
},
"hostPortConfig": {
"additionalProperties": false,
"description": "HostPortConfig contains host port configuration.\nEnabled Default: false\nPort Default: 8126",
Expand Down
2 changes: 2 additions & 0 deletions docs/configuration.v2alpha1.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,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 backend standalone. 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 Expand Up @@ -171,6 +172,7 @@ spec:
| global.clusterAgentTokenSecret.secretName | SecretName is the name of the secret. |
| global.clusterName | ClusterName sets a unique cluster name for the deployment to easily scope monitoring data in the Datadog app. |
| global.containerStrategy | ContainerStrategy determines whether agents run in a single or multiple containers. Default: 'optimized' |
| global.coreAgent.enabled | Enables the Core Agent. Default: true |
| global.credentials.apiKey | APIKey configures your Datadog API key. See also: https://app.datadoghq.com/account/settings#agent/kubernetes |
| global.credentials.apiSecret.keyName | KeyName is the key of the secret to use. |
| global.credentials.apiSecret.secretName | SecretName is the name of the secret. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,14 @@ func defaultEnvVars(dda metav1.Object) []corev1.EnvVar {
},
},
},
{
Name: apicommon.DDAPMErrorTrackingStandaloneEnabled,
Value: "false",
},
{
Name: apicommon.DDCoreAgentEnabled,
Value: "true",
},
}

return envVars
Expand Down
Loading
Loading