dd-trace-py
dd-trace-py copied to clipboard
chore: tidy to_unicode() in compat.py
As part of APMAPI-1159 this is to replace code that supports < python 3.8.
Removing comments about the six library as those are outdated. six is a library to assist with python 2/3 compatibility.
Kept duck typing for future proofing and to support bytearray.
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:
ddtrace/internal/compat.py @DataDog/python-guild @DataDog/apm-core-python
Bootstrap import analysis
Comparison of import times between this PR and base.
Summary
The average import time from this PR is: 268 ± 5 ms.
The average import time from base is: 268 ± 6 ms.
The import time difference between this PR and base is: 0.8 ± 0.2 ms.
Import time breakdown
The following import paths have grown:
ddtrace.auto
0.017 ms
(0.01%)
ddtrace
0.017 ms
(0.01%)
ddtrace._logger
0.017 ms
(0.01%)
ddtrace.internal.telemetry
0.017 ms
(0.01%)
ddtrace.internal.utils.formats
0.017 ms
(0.01%)
ddtrace.internal.compat
0.017 ms
(0.01%)
The following import paths have shrunk:
ddtrace.auto
1.194 ms
(0.44%)
ddtrace
0.644 ms
(0.24%)
ddtrace.internal._unpatched
0.025 ms
(0.01%)
json
0.025 ms
(0.01%)
json.decoder
0.025 ms
(0.01%)
re
0.025 ms
(0.01%)
enum
0.025 ms
(0.01%)
types
0.025 ms
(0.01%)
ddtrace.bootstrap.sitecustomize
0.549 ms
(0.20%)
ddtrace.bootstrap.preload
0.549 ms
(0.20%)
ddtrace.internal.remoteconfig.client
0.549 ms
(0.20%)
Benchmarks
Benchmark execution time: 2025-07-02 00:49:51
Comparing candidate commit 0f344d970f0f77832fda7636ec3586960933a10c in PR branch vparfait/update_unicode_compat with baseline commit 44c505b078dae61d5c240e2463f75a4bebfe7db3 in branch main.
Found 0 performance improvements and 1 performance regressions! Performance is the same for 567 metrics, 4 unstable metrics.
scenario:telemetryaddmetric-1-distribution-metric-1-times
- 🟥
execution_time[+304.478ns; +380.554ns] or [+10.476%; +13.093%]