-
Notifications
You must be signed in to change notification settings - Fork 413
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(profiling): vendor protobuf #8797
Conversation
BenchmarksBenchmark execution time: 2024-03-29 19:27:55 Comparing candidate commit 89fc729 in PR branch Found 14 performance improvements and 11 performance regressions! Performance is the same for 176 metrics, 9 unstable metrics. scenario:coreapiscenario-context_with_data_no_listeners
scenario:coreapiscenario-core_dispatch_no_listeners
scenario:coreapiscenario-core_dispatch_with_results_no_listeners
scenario:flasksimple-debugger
scenario:httppropagationextract-datadog_tracecontext_tracestate_not_propagated_on_trace_id_no_match
scenario:httppropagationextract-datadog_tracecontext_tracestate_propagated_on_trace_id_match
scenario:httppropagationextract-invalid_span_id_header
scenario:httppropagationextract-large_valid_headers_all
scenario:httppropagationextract-medium_valid_headers_all
scenario:httppropagationextract-none_propagation_style
scenario:httppropagationextract-tracecontext_headers
scenario:httppropagationextract-valid_headers_all
scenario:httppropagationextract-wsgi_invalid_priority_header
scenario:httppropagationextract-wsgi_large_valid_headers_all
scenario:httppropagationextract-wsgi_medium_valid_headers_all
scenario:httppropagationextract-wsgi_valid_headers_all
scenario:httppropagationinject-with_dd_origin
scenario:otelspan-start
scenario:otelspan-start-finish
scenario:otelspan-start-finish-telemetry
scenario:sethttpmeta-obfuscation-worst-case-explicit-query
scenario:span-start-finish-telemetry
scenario:span-start-finish-traceid128
scenario:tracer-large
scenario:tracer-small
|
Datadog ReportBranch report: ✅ 0 Failed, 4037 Passed, 7278 Skipped, 1h 22m 14.22s Total duration (1h 38m 3.62s time saved) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, this change ends ends up being surprisingly minimal in terms of change to ddtrace!
I have a concern about ddsketch having a dependency on protobuf which will still be pulled in. I think we could resolve it by storing the ddsketch protobuf in ddtrace and relaxing the protobuf dependency of the ddsketch package.
Pull request was converted to draft
New plan, after discovering that vendoring protobuf requires a lot more work than previously thought: |
This change upgrades the ddsketch dependency to one that doesn't depend on protobuf. This aids the bugfix in #8797 by completely removing protobuf from the entire dependency tree. ## Checklist - [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] If change touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a review from `@DataDog/security-design-and-guidance`. ## Reviewer Checklist - [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)
This change upgrades the ddsketch dependency to one that doesn't depend on protobuf. This aids the bugfix in #8797 by completely removing protobuf from the entire dependency tree. ## Checklist - [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] If change touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a review from `@DataDog/security-design-and-guidance`. ## Reviewer Checklist - [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) (cherry picked from commit 6c68609)
Backport 6c68609 from #8810 to 2.7. This change upgrades the ddsketch dependency to one that doesn't depend on protobuf. This aids the bugfix in #8797 by completely removing protobuf from the entire dependency tree. ## Checklist - [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] If change touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a review from `@DataDog/security-design-and-guidance`. ## Reviewer Checklist - [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>
This change fixes issues like #3766 in which incompatibility can arise between the version of protobuf that ddtrace brings with it and the version that the customer's app uses. In practice these issues occur under lib-injection, because in such scenarios ddtrace's requirements are finalized before the app's requirements are known. The reason this change fixes such issues is that it avoids using the
google.protobuf
module that the application may care about, instead using its ownddtrace.vendor.protobuf.google.protobuf
module.The fix is to vendor the most recent release of protobuf, and use the vendored version for all Python runtime versions that support it. Experimentally, this set of versions seems to be 3.8+. The behavior of the protobuf library under 3.7 is unchanged in this pull request. Vendoring protobuf for 3.7 would require adding another copy of the protobuf code to the repo.
The code in
vendor/protobuf
was taken from an unzipped wheel of 5.26.0 downloaded from PyPI. I chose this method instead of building from source in setup.py because protobuf has a complex build process managed by Bazel, and I didn't want to add Bazel as a dependency of ddtrace's build process.There are changes to the riotfile to stop installing protobuf in test environments that will use the vendored version. There is also a new
pprof
file added that imports the vendored code. This file was created by copypasting the existingpprof
file with the highest number and changing the imports.Passing existing functional tests is sufficient because there's no new functionality added here.
Files you can ignore in code review:
ddtrace/vendor
*_pb2*
Checklist
changelog/no-changelog
is set@DataDog/apm-tees
.@DataDog/security-design-and-guidance
.Reviewer Checklist