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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

GianlucaBortoli
Copy link
Member

@GianlucaBortoli GianlucaBortoli commented Dec 10, 2024

NOTE: @eloytoro has taken over the development of this feature

What does this PR do?

original PR description It introduces the `errorTrackingStandalone` feature under APM as well as the `coreAgent` flag

It introduces the errorTracking feature under APM which has the mode property which can be one of three values: "full", "disabled" or "standalone"

Motivation

We wish to inject the DD_APM_ERROR_TRACKING_STANDALONE_ENABLED and DD_CORE_AGENT_ENABLED env variables into the trace agent when they're provided in the config so customers can enable them and use error tracking mode of the agent which only reports spans with errors and not every span

Additional Notes

I've added an example on how to use the new flag

Minimum Agent Versions

Are there minimum versions of the Datadog Agent and/or Cluster Agent required?

Describe your test plan

I tested this locally and I can confirm that the env var is added when the config is supplied (check the example config in this PR)

    Environment:
      KUBERNETES:                                      yes
      DD_CLUSTER_AGENT_ENABLED:                        true
      DD_CLUSTER_AGENT_KUBERNETES_SERVICE_NAME:        datadog-cluster-agent
      DD_CLUSTER_AGENT_TOKEN_NAME:                     datadog-token
      DD_KUBERNETES_KUBELET_HOST:                       (v1:status.hostIP)
      DD_CLUSTER_NAME:                                 local-k8s
      DD_SITE:                                         datadoghq.com
      DD_LOG_LEVEL:                                    info
      DD_KUBELET_TLS_VERIFY:                           false
      DD_CLUSTER_AGENT_AUTH_TOKEN:                     <set to the key 'token' in secret 'datadog-token'>     Optional: false
      DD_API_KEY:                                      <set to the key 'api_key' in secret 'datadog-secret'>  Optional: false
      DD_APP_KEY:                                      <set to the key 'app_key' in secret 'datadog-secret'>  Optional: false
      DD_DOGSTATSD_SOCKET:                             /var/run/datadog/dsd.socket
      DD_PROCESS_CONFIG_RUN_IN_CORE_AGENT_ENABLED:     false
      DD_PROCESS_CONFIG_CONTAINER_COLLECTION_ENABLED:  true
      DD_PROCESS_CONFIG_PROCESS_DISCOVERY_ENABLED:     true
      DD_REMOTE_CONFIGURATION_ENABLED:                 true

I've also added unit tests

Checklist

  • PR has at least one valid label: bug, enhancement, refactoring, documentation, tooling, and/or dependencies
  • PR has a milestone or the qa/skip-qa label

@GianlucaBortoli GianlucaBortoli added the enhancement New feature or request label Dec 10, 2024
@GianlucaBortoli GianlucaBortoli added this to the v1.11.0 milestone Dec 10, 2024
@codecov-commenter
Copy link

codecov-commenter commented Dec 10, 2024

Codecov Report

Attention: Patch coverage is 71.05263% with 11 lines in your changes missing coverage. Please review.

Project coverage is 49.37%. Comparing base (1c16822) to head (058aa97).

Files with missing lines Patch % Lines
...adogagent/component/clusterchecksrunner/default.go 0.00% 8 Missing ⚠️
...nal/controller/datadogagent/feature/apm/feature.go 84.21% 2 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1553      +/-   ##
==========================================
+ Coverage   49.33%   49.37%   +0.03%     
==========================================
  Files         219      219              
  Lines       21314    21352      +38     
==========================================
+ Hits        10515    10542      +27     
- Misses      10252    10262      +10     
- Partials      547      548       +1     
Flag Coverage Δ
unittests 49.37% <71.05%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ller/datadogagent/defaults/datadogagent_default.go 91.56% <100.00%> (+0.10%) ⬆️
pkg/testutils/builder.go 91.75% <100.00%> (+0.07%) ⬆️
...nal/controller/datadogagent/feature/apm/feature.go 66.66% <84.21%> (+1.14%) ⬆️
...adogagent/component/clusterchecksrunner/default.go 9.25% <0.00%> (-0.34%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1c16822...058aa97. Read the comment docs.

@levan-m levan-m modified the milestones: v1.11.0, v1.12.0 Dec 16, 2024
@levan-m levan-m modified the milestones: v1.12.0, v1.13.0 Dec 30, 2024
@eloytoro eloytoro marked this pull request as ready for review February 5, 2025 15:22
@eloytoro eloytoro requested review from a team as code owners February 5, 2025 15:22
@eloytoro eloytoro force-pushed the gianluca/ERRORT-4860-add-env-vars-to-operator branch from 62ef741 to 82cd4d9 Compare February 6, 2025 11:21

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This config doesn't really enabled/disable core agent. The value is just added as an env var to bunch of components.
What is this configuration for? How would customer determine whether to set it to true or false?

@eloytoro eloytoro requested a review from levan-m February 14, 2025 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants