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(django): add dbm trace propagation for django postgres #9601

Merged
merged 32 commits into from
Jun 27, 2024

Conversation

wconti27
Copy link
Contributor

@wconti27 wconti27 commented Jun 20, 2024

Closes: #8239

This PR implements DBM trace propagation for postgres database usage through django.

Checklist

  • Change(s) are motivated and described in the PR description
  • Testing strategy is described if automated tests are not included in the PR
  • Risks are described (performance impact, potential for breakage, maintainability)
  • Change is maintainable (easy to change, telemetry, documentation)
  • Library release note guidelines are followed or label changelog/no-changelog is set
  • Documentation is included (in-code, generated user docs, public corp docs)
  • Backport labels are set (if applicable)
  • If this PR changes the public interface, I've notified @DataDog/apm-tees.

Reviewer Checklist

  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Description motivates each change
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Change is maintainable (easy to change, telemetry, documentation)
  • Release note makes sense to a user of the library
  • 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

@wconti27 wconti27 requested review from a team as code owners June 20, 2024 18:07
@pr-commenter
Copy link

pr-commenter bot commented Jun 20, 2024

Benchmarks

Benchmark execution time: 2024-06-27 16:14:19

Comparing candidate commit 8ba3a04 in PR branch conti/fix-django-dbm-propagation with baseline commit f86e1ef in branch main.

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

@wconti27 wconti27 requested a review from a team as a code owner June 21, 2024 16:58
@wconti27 wconti27 requested a review from juanjux June 21, 2024 16:58
@wconti27 wconti27 changed the title fix(django): fix dbm propagation fix(django): fix dbm propagation Jun 21, 2024
@datadog-dd-trace-py-rkomorn
Copy link

datadog-dd-trace-py-rkomorn bot commented Jun 21, 2024

Datadog Report

Branch report: conti/fix-django-dbm-propagation
Commit report: 535b535
Test service: dd-trace-py

✅ 0 Failed, 130365 Passed, 46266 Skipped, 6h 10m 26.1s Total duration (4h 23m 31.41s time saved)

@wconti27 wconti27 changed the title fix(django): fix dbm propagation feat(django): add dbm trace propagation for django postgres Jun 21, 2024
@wconti27 wconti27 requested a review from a team as a code owner June 21, 2024 20:57
@brettlangdon brettlangdon enabled auto-merge (squash) June 24, 2024 16:47
ddtrace/contrib/django/patch.py Outdated Show resolved Hide resolved
ddtrace/contrib/django/patch.py Outdated Show resolved Hide resolved
ddtrace/contrib/django/patch.py Outdated Show resolved Hide resolved
tests/contrib/django/test_django_dbm.py Outdated Show resolved Hide resolved
@brettlangdon
Copy link
Member

adding @emmettbutler to review the changes I made to core API.

@codecov-commenter
Copy link

codecov-commenter commented Jun 27, 2024

Codecov Report

Attention: Patch coverage is 12.50000% with 161 lines in your changes missing coverage. Please review.

Project coverage is 10.16%. Comparing base (4acfde7) to head (8ba3a04).
Report is 2 commits behind head on main.

Files Patch % Lines
tests/contrib/shared_tests_async.py 0.00% 54 Missing ⚠️
tests/contrib/django/test_django_dbm.py 0.00% 51 Missing ⚠️
tests/contrib/shared_tests.py 0.00% 23 Missing ⚠️
ddtrace/internal/core/event_hub.py 0.00% 11 Missing ⚠️
tests/utils.py 31.25% 11 Missing ⚠️
ddtrace/propagation/_database_monitoring.py 45.45% 6 Missing ⚠️
ddtrace/contrib/django/patch.py 83.33% 2 Missing ⚠️
ddtrace/settings/integration.py 75.00% 1 Missing ⚠️
tests/contrib/aiomysql/test_aiomysql.py 0.00% 1 Missing ⚠️
tests/contrib/pymysql/test_pymysql.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #9601       +/-   ##
===========================================
- Coverage   74.65%   10.16%   -64.49%     
===========================================
  Files        1381     1351       -30     
  Lines      127965   126079     -1886     
===========================================
- Hits        95531    12819    -82712     
- Misses      32434   113260    +80826     

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

Copy link
Member

@brettlangdon brettlangdon left a comment

Choose a reason for hiding this comment

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

question, otherwise lgtm

tests/.suitespec.json Show resolved Hide resolved
Copy link
Collaborator

@emmettbutler emmettbutler left a comment

Choose a reason for hiding this comment

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

The core changes make sense to me

ddtrace/internal/core/event_hub.py Outdated Show resolved Hide resolved
wconti27 and others added 2 commits June 27, 2024 10:08
Co-authored-by: Emmett Butler <723615+emmettbutler@users.noreply.github.com>
@datadog-dd-trace-py-rkomorn
Copy link

datadog-dd-trace-py-rkomorn bot commented Jun 27, 2024

Datadog Report

Branch report: conti/fix-django-dbm-propagation
Commit report: 8ba3a04
Test service: dd-trace-py

✅ 0 Failed, 118418 Passed, 58274 Skipped, 4h 31m 23.96s Total duration (5h 21m 11.37s time saved)

@brettlangdon brettlangdon merged commit 7bd63e7 into main Jun 27, 2024
235 of 241 checks passed
@brettlangdon brettlangdon deleted the conti/fix-django-dbm-propagation branch June 27, 2024 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DD_DBM_PROPAGATION_MODE not working when databases are instrumented through Django
5 participants