GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — chore: Remove old metrics code by sentrivana · Pull Request #4899 · getsentry/sentry-python

Conversation

@sentrivana

@sentrivana sentrivana commented Oct 9, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Description

Remove old metrics code to make way for #4898

Metrics was always an experimental feature and Sentry stopped accepting metrics a year ago.

Issues

Reminders

  • Please add tests to validate your changes, and lint your code using tox -e linters.
  • Add GH Issue ID & Linear ID (if applicable)
  • PR title should use conventional commit style (feat:, fix:, ref:, meta:)
  • For external contributors: CONTRIBUTING.md, Sentry SDK development docs, Discord community

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

seer-by-sentry[bot] reacted with hooray emoji
All reactions
  • 🎉 1 reaction
@sentrivana
chore: Remove old metrics code
3fb89dc
alexander-alderman-webb
alexander-alderman-webb approved these changes Oct 9, 2025
View reviewed changes
@sentrivana
sentrivana marked this pull request as ready for review October 9, 2025 08:12
@sentrivana
sentrivana requested a review from a team as a code owner October 9, 2025 08:12
cursor[bot]
cursor Bot reviewed Oct 9, 2025
View reviewed changes
Comment thread sentry_sdk/envelope.py
# and remove it (if it is present, i.e. not the very last char in an eof terminated envelope)
payload = f.readline().rstrip(b"\n")
if headers.get("type") in ("event", "transaction", "metric_buckets"):
if headers.get("type") in ("event", "transaction"):

@cursor cursor Bot Oct 9, 2025

Copy link
Copy Markdown

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.

Bug: Metric Buckets Payload Deserialization Failure

The deserialize_from method stopped parsing metric_buckets payloads as JSON. This means existing envelopes with metric_buckets will now be deserialized as raw bytes, which could cause runtime errors when a parsed object is expected.

Fix in Cursor Fix in Web

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sentrivana
sentrivana merged commit 7997368 into master Oct 9, 2025
@sentrivana
sentrivana deleted the ivana/remove-metrics branch October 9, 2025 08:27
@sentrivana sentrivana mentioned this pull request Oct 9, 2025
feat(metrics): Add trace metrics behind an experiments flag #4898
Merged
@sentry-junior sentry-junior Bot mentioned this pull request Oct 29, 2026
ref(utils): Remove unused to_timestamp helper and epoch constant #8147
Merged
sentrivana pushed a commit that referenced this pull request Oct 29, 2026
@sentry-junior
ref(utils): Remove unused to_timestamp helper and epoch constant (#8147)
876a82f
### Description

Removes `to_timestamp()` and the module-level `epoch` constant from
`sentry_sdk/utils.py`. Nothing uses either of them.

#4899 (removing the old metrics code) deleted the last three callers of
`to_timestamp`, all in `sentry_sdk/metrics.py`, plus its import there.
`epoch` was only ever used inside `to_timestamp`.

**Evidence**
- `grep -rnw to_timestamp sentry_sdk tests scripts` only matches the
definition.
- `grep -rnw epoch sentry_sdk tests` only matches the definition and its
use in `to_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 tests` shows #4899 as the
last change to touch a call site.
- No open PR diff in this repo mentions `to_timestamp` or `epoch`.

**Why it's safe**
- `sentry_sdk.utils` is an internal module. Neither name is re-exported
from `sentry_sdk` or listed in `docs/`, and neither appears in
`CHANGELOG.md` or `MIGRATION_GUIDE.md`.
- The helper had a latent bug: it subtracted from a naive
`datetime(1970, 1, 1)`, so passing it a timezone-aware datetime (the SDK
uses aware UTC datetimes everywhere) raised `TypeError`. Leaving it
around invites someone to reuse it by mistake.
- `datetime` is still imported and used elsewhere in the module.
- No runtime behavior changes.

**Checks**
- `uv run ruff check sentry_sdk tests` and `ruff format --check` pass.
- `uv run --group typing mypy sentry_sdk` passes 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.

<!-- junior-request-attribution:start -->
via [automation
`sched_65eed06cc199036c2b13411096f412d4`](https://junior-prod.sentry.dev/automations/sched_65eed06cc199036c2b13411096f412d4)
· Run ID `sched_65eed06cc199036c2b13411096f412d4:1793267961442`.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!--
junior-conversation-id:agent-dispatch%3Adispatch_de360d426db36e075f636e5b35173292
-->

--

[View Junior
Session](https://junior-prod.sentry.dev/conversations/agent-dispatch%3Adispatch_de360d426db36e075f636e5b35173292)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent-dispatch%3Adispatch_de360d426db36e075f636e5b35173292/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cursor cursor[bot] cursor[bot] left review comments
@alexander-alderman-webb alexander-alderman-webb alexander-alderman-webb approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@sentrivana @alexander-alderman-webb
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.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.