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

Merged
merged 17 commits into from
Feb 24, 2025

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 errorTrackingStandalone feature under APM which has the enabled property which adds the DD_APM_ERROR_TRACKING_STANDALONE env variable to the trace agent

Motivation

We wish to inject the DD_APM_ERROR_TRACKING_STANDALONE_ENABLED env variable 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 74.07407% with 7 lines in your changes missing coverage. Please review.

Project coverage is 49.31%. Comparing base (8ba3647) to head (b5f1ca5).

Files with missing lines Patch % Lines
...adogagent/component/clusterchecksrunner/default.go 0.00% 4 Missing ⚠️
...nal/controller/datadogagent/feature/apm/feature.go 75.00% 2 Missing and 1 partial ⚠️

❌ Your patch status has failed because the patch coverage (74.07%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1553      +/-   ##
==========================================
+ Coverage   49.28%   49.31%   +0.03%     
==========================================
  Files         219      219              
  Lines       21289    21316      +27     
==========================================
+ Hits        10492    10512      +20     
- Misses      10250    10256       +6     
- Partials      547      548       +1     
Flag Coverage Δ
unittests 49.31% <74.07%> (+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 65.89% <75.00%> (+0.37%) ⬆️
...adogagent/component/clusterchecksrunner/default.go 9.41% <0.00%> (-0.18%) ⬇️

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 8ba3647...b5f1ca5. 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
// +k8s:openapi-gen=true
type ErrorTrackingStandalone struct {
// Enables Error Tracking for backend services.
// Default: disabled
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Default: disabled
// Default: false

@eloytoro eloytoro merged commit b5120af into main Feb 24, 2025
19 checks passed
@eloytoro eloytoro deleted the gianluca/ERRORT-4860-add-env-vars-to-operator branch February 24, 2025 10:19
celenechang pushed a commit that referenced this pull request Feb 24, 2025
…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]>
celenechang added a commit that referenced this pull request Feb 24, 2025
…ttings (#1553) (#1724)

* 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: Gianluca Bortoli <[email protected]>
Co-authored-by: Eloy Toro <[email protected]>
Co-authored-by: levan-m <[email protected]>
Co-authored-by: Levan Machablishvili <[email protected]>
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