Repository navigation
ref(utils): Remove unused to_timestamp helper and epoch constant - #8147
Merged
Merged
Conversation
The last callers of to_timestamp were removed with the old metrics code in #4899. epoch was only used by to_timestamp.
sentrivana
approved these changes
Oct 29, 2026
Contributor
Coverage Results 📊✅ 136856 passed | ⏭️ 7456 skipped | Total: 144312 | Pass Rate: 94.83% | Execution Time: 451m 50s 📊 Comparison with Base Branch
➖ Removed Tests (1)View removed tests
All tests are passing successfully. ✅ Patch coverage is 100.00% (no changed executable lines found; target 80%). Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## master #8147 +/-##
==========================================
+ Coverage 90.28% 90.29% +0.01%
==========================================
Files 203 203 —
Tracked lines 26883 26880 -3
Branches 10046 10046 —
==========================================
- Hits 24272 24271 -1
+ Misses 2611 2609 -2
+ Partials 1518 1517 -1Generated by Coverage Action |
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.
Description
Removes
to_timestamp()and the module-levelepochconstant fromsentry_sdk/utils.py. Nothing uses either of them.#4899 (removing the old metrics code) deleted the last three callers of
to_timestamp, all insentry_sdk/metrics.py, plus its import there.epochwas only ever used insideto_timestamp.Evidence
grep -rnw to_timestamp sentry_sdk tests scriptsonly matches the definition.grep -rnw epoch sentry_sdk testsonly matches the definition and its use into_timestamp. The other match is the(?P<epoch>...)regex group in the version parser, which isn't related.git log -S "to_timestamp(" -- sentry_sdk testsshows chore: Remove old metrics code #4899 as the last change to touch a call site.to_timestamporepoch.Why it's safe
sentry_sdk.utilsis an internal module. Neither name is re-exported fromsentry_sdkor listed indocs/, and neither appears inCHANGELOG.mdorMIGRATION_GUIDE.md.datetime(1970, 1, 1), so passing it a timezone-aware datetime (the SDK uses aware UTC datetimes everywhere) raisedTypeError. Leaving it around invites someone to reuse it by mistake.datetimeis still imported and used elsewhere in the module.Checks
uv run ruff check sentry_sdk testsandruff format --checkpass.uv run --group typing mypy sentry_sdkpasses with no issues.TESTPATH="tests/test_utils.py tests/test_basics.py tests/test_client.py" uv run tox -e py3.14-common: 587 passed, 3 skipped.Issues
None. Found by a dead-code sweep.
via automation
sched_65eed06cc199036c2b13411096f412d4· Run IDsched_65eed06cc199036c2b13411096f412d4:1793267961442.--
View Junior Session [Sentry]