feat(onboarding): early exit conditions in lib-injection [backport 2.9]#10563
Merged
emmettbutler merged 4 commits into2.9from Sep 9, 2024
Merged
feat(onboarding): early exit conditions in lib-injection [backport 2.9]#10563emmettbutler merged 4 commits into2.9from
emmettbutler merged 4 commits into2.9from
Conversation
This pull request adds "guardrails" to the "library injection" process. These are early exit conditions from the instrumentation process intended to avoid sending any traces when undefined behavior is likely. The code makes this determination on the basis of software versions present in the application environment, both of Python packages and the Python runtime itself. The biggest risk here is that instrumentation is disabled when it's not intended to be. I think existing tests in `tests/lib-injection` cover this pretty well. There's a new test added that verifies instrumentation was cancelled when an unsupported package version is present. Contains changes from #9418 Related RFC: "[RFC] One Step Guardrails" - [x] minimum package version checks - [x] Testing - [x] replace envvars with inject_force - [x] figure out what to use instead of pkg_resources - [x] replace local file path with `DD_TELEMETRY_FORWARDER_PATH` - [x] Change(s) are motivated and described in the PR description - [x] Testing strategy is described if automated tests are not included in the PR - [x] Risks are described (performance impact, potential for breakage, maintainability) - [x] Change is maintainable (easy to change, telemetry, documentation) - [x] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) are followed or label `changelog/no-changelog` is set - [x] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)) - [x] Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) - [x] If this PR changes the public interface, I've notified `@DataDog/apm-tees`. - [x] Title is accurate - [x] All changes are related to the pull request's stated goal - [x] Description motivates each change - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - [x] Testing strategy adequately addresses listed risks - [x] Change is maintainable (easy to change, telemetry, documentation) - [x] Release note makes sense to a user of the library - [x] Author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - [x] Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) --------- Co-authored-by: Emmett Butler <723615+emmettbutler@users.noreply.github.com> Co-authored-by: Emmett Butler <emmett.butler321@gmail.com> (cherry picked from commit 0c38e09)
2 tasks
tests/lib-injection/dd-lib-python-init-test-django-unsupported-package-force/Dockerfile
Show resolved
Hide resolved
tests/lib-injection/dd-lib-python-init-test-django-unsupported-python/Dockerfile
Show resolved
Hide resolved
tests/lib-injection/dd-lib-python-init-test-django-unsupported-package/Dockerfile
Show resolved
Hide resolved
brettlangdon
approved these changes
Sep 9, 2024
Datadog ReportBranch report: ❌ 1 Failed (0 Known Flaky), 160353 Passed, 15474 Skipped, 8h 58m 36.28s Total duration (2h 1m 12.31s time saved) ❌ Failed Tests (1)
⌛ Performance Regressions vs Default Branch (11)
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 2.9 #10563 +/- ##
==========================================
- Coverage 10.22% 10.15% -0.07%
==========================================
Files 1258 1258
Lines 120899 120919 +20
==========================================
- Hits 12356 12281 -75
- Misses 108543 108638 +95 ☔ View full report in Codecov by Sentry. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds "guardrails" to the "library injection" process. These are early exit conditions from the instrumentation process intended to avoid sending any traces when undefined behavior is likely. The code makes this determination on the basis of software versions present in the application environment, both of Python packages and the Python runtime itself.
The biggest risk here is that instrumentation is disabled when it's not intended to be. I think existing tests in
tests/lib-injectioncover this pretty well. There's a new test added that verifies instrumentation was cancelled when an unsupported package version is present.Contains changes from #9418 Related RFC: "[RFC] One Step Guardrails"
minimum package version checks
Testing
replace envvars with inject_force
figure out what to use instead of pkg_resources
replace local file path with
DD_TELEMETRY_FORWARDER_PATHChange(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-changelogis setDocumentation 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.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