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

fix(ci_visibility): get default environment from agent when DD_ENV is not set #11478

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

Conversation

romainkomorndatadog
Copy link
Collaborator

@romainkomorndatadog romainkomorndatadog commented Nov 21, 2024

This fixes an issue where, if we are in EVP mode, and the agent has a custom default environment set (eg: using DD_APM_ENV), but DD_ENV is not set in the environment, we would incorrectly set the environment to None.

Instead, we now query the agent's info page and use the config.default_env key to choose the environment value.

In somewhat-related changes, we now also explicitly default the environment to "none" in agentless mode if it is not set by the user, whereas before we would use a None value which would serialize to null, and we would rely on the backend to perform the null -> "none" change. Since the backend was already enforcing this behavior, it should be a no-op from the user's perspective.

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

Copy link
Contributor

github-actions bot commented Nov 21, 2024

CODEOWNERS have been resolved as:

releasenotes/notes/ci_visibility-get_agent_default_env-bf4a11283dccdf87.yaml  @DataDog/apm-python
ddtrace/internal/ci_visibility/recorder.py                              @DataDog/ci-app-libraries
tests/ci_visibility/api_client/test_ci_visibility_api_client.py         @DataDog/ci-app-libraries

@codecov-commenter
Copy link

Codecov Report

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

Project coverage is 3.60%. Comparing base (74e3d51) to head (6b6e97c).

Files with missing lines Patch % Lines
ddtrace/internal/ci_visibility/recorder.py 31.25% 11 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main   #11478       +/-   ##
===========================================
- Coverage   14.09%    3.60%   -10.50%     
===========================================
  Files        1536     1487       -49     
  Lines      133599   128946     -4653     
===========================================
- Hits        18829     4643    -14186     
- Misses     114770   124303     +9533     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@romainkomorndatadog romainkomorndatadog self-assigned this Nov 21, 2024
@romainkomorndatadog romainkomorndatadog changed the title WIP fix(ci_visibility): get default environment from agent when DD_ENV is not set fix(ci_visibility): get default environment from agent when DD_ENV is not set Nov 21, 2024
@romainkomorndatadog romainkomorndatadog marked this pull request as ready for review November 21, 2024 13:36
@romainkomorndatadog
Copy link
Collaborator Author

/merge

@dd-devflow
Copy link

dd-devflow bot commented Nov 21, 2024

Devflow running: /merge

View all feedbacks in Devflow UI.


2024-11-21 13:37:43 UTC ℹ️ MergeQueue: waiting for PR to be ready

This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2024-11-21 14:21:43 UTC ℹ️ MergeQueue: merge request added to the queue

The median merge time in main is 35m.


2024-11-21 21:42:02 UTC ⚠️ MergeQueue: This merge request build was cancelled

This merge request build was cancelled

@pr-commenter
Copy link

pr-commenter bot commented Nov 21, 2024

Benchmarks

Benchmark execution time: 2024-11-21 14:19:21

Comparing candidate commit cc649bc in PR branch romain.komorn/chore/fix_env_in_evp_proxy_cases with baseline commit 74e3d51 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 388 metrics, 2 unstable metrics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants