dd-trace-py
dd-trace-py copied to clipboard
chore(internal): remove time functions from compat module
This PR removes 4 time-related functions from ddtrace.internal.compat that existed for compatibility with Python < 3.7, and replaces all uses with the corresponding functions from the builtin time module: time_ns, monotonic, monotonic_ns, process_time_ns.
The original motivation for this was noticing that the fallback code for time_ns had the wrong multiplier [edit: it's not actually wrong, just written in a weird way], and then checking that we don't really need these functions anymore, as we only support Python >= 3.7.
Checklist
- [x] 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
- [x] 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
CODEOWNERS have been resolved as:
benchmarks/rate_limiter/scenario.py @DataDog/apm-core-python
ddtrace/_trace/span.py @DataDog/apm-sdk-api-python
ddtrace/contrib/internal/botocore/services/kinesis.py @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/kafka/patch.py @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/debugging/_debugger.py @DataDog/debugger-python
ddtrace/internal/compat.py @DataDog/python-guild @DataDog/apm-core-python
ddtrace/internal/opentelemetry/span.py @DataDog/apm-sdk-api-python
ddtrace/internal/rate_limiter.py @DataDog/apm-core-python
ddtrace/internal/utils/time.py @DataDog/apm-core-python
ddtrace/profiling/collector/_lock.py @DataDog/profiling-python
ddtrace/profiling/collector/memalloc.py @DataDog/profiling-python
ddtrace/profiling/collector/stack.pyx @DataDog/profiling-python
ddtrace/profiling/scheduler.py @DataDog/profiling-python
tests/debugging/mocking.py @DataDog/debugger-python
tests/integration/test_sampling.py @DataDog/apm-core-python
tests/profiling/exporter/test_http.py @DataDog/profiling-python
tests/profiling/test_accuracy.py @DataDog/profiling-python
tests/profiling/test_scheduler.py @DataDog/profiling-python
tests/submod/stuff.py @DataDog/apm-core-python
tests/tracer/test_rate_limiter.py @DataDog/apm-sdk-api-python
Datadog Report
Branch report: vitor-de-araujo/remove-compat-time-ns
Commit report: 4c5eb19
Test service: dd-trace-py
:white_check_mark: 0 Failed, 1286 Passed, 0 Skipped, 31m 40.61s Total duration (6m 40.36s time saved)
Benchmarks
Benchmark execution time: 2024-10-15 10:03:54
Comparing candidate commit 4c5eb19c51fccee93876a8d19b552b08def18755 in PR branch vitor-de-araujo/remove-compat-time-ns with baseline commit 6505d83260f8aaae96d19dbfec7e0fb35ca13b49 in branch main.
Found 0 performance improvements and 0 performance regressions! Performance is the same for 371 metrics, 53 unstable metrics.