Skip to content

fix(ourlogs): break ordering ties with timestamp.sequence - #120451

Draft
JoshuaKGoldberg wants to merge 4 commits into
masterfrom
joshgoldberg/logs-569-handle-logs-ordering-with-same-timestamptimestamp_precise
Draft

fix(ourlogs): break ordering ties with timestamp.sequence#120451
JoshuaKGoldberg wants to merge 4 commits into
masterfrom
joshgoldberg/logs-569-handle-logs-ordering-with-same-timestamptimestamp_precise

Conversation

@JoshuaKGoldberg

@JoshuaKGoldberg JoshuaKGoldberg commented Jul 23, 2026

Copy link
Copy Markdown
Member

SDKs emit a per-millisecond sentry.timestamp.sequence counter so logs sharing a millisecond timestamp keep their emission order.

timestamp_precise can't recover that order on its own: it's stored as a float64, and at current epoch values a float64 only resolves down to ~256ns. So same-millisecond logs aren't reliably distinguishable by timestamp_precise. Wamp wump.

This adds the timestamp.sequence alias and orders by it as a tiebreaker after timestamp and timestamp_precise. So we get back the nice ordering it's meant for.

#120452 contains corresponding frontend changes to hide it in the UI. That PR should land first so we don't get an awkward blip of showing it to users.

Starts on LOGS-569.

@linear-code

linear-code Bot commented Jul 23, 2026

Copy link
Copy Markdown

LOGS-569

@github-actions github-actions Bot added Scope: Frontend Automatically applied to PRs that change frontend components Scope: Backend Automatically applied to PRs that change backend components labels Jul 23, 2026
@github-actions

This comment was marked as resolved.

@JoshuaKGoldberg JoshuaKGoldberg changed the title feat(logs): Break ordering ties with timestamp.sequence fix(logs): break ordering ties with timestamp.sequence Jul 23, 2026
Logs emitted in quick succession can share an identical timestamp_precise
when the SDK environment can't produce sub-millisecond timestamps. Order
by the SDK's monotonic timestamp.sequence attribute to break those ties.
@JoshuaKGoldberg
JoshuaKGoldberg force-pushed the joshgoldberg/logs-569-handle-logs-ordering-with-same-timestamptimestamp_precise branch from 7300e5d to 1335adc Compare July 23, 2026 14:32
@JoshuaKGoldberg JoshuaKGoldberg changed the title fix(logs): break ordering ties with timestamp.sequence fix(ourlogs): break ordering ties with timestamp.sequence Jul 23, 2026
@JoshuaKGoldberg JoshuaKGoldberg removed the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 23, 2026
@JoshuaKGoldberg

Copy link
Copy Markdown
Member Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 17f8851. Configure here.

@JoshuaKGoldberg
JoshuaKGoldberg marked this pull request as ready for review July 23, 2026 15:46
@JoshuaKGoldberg
JoshuaKGoldberg requested review from a team as code owners July 23, 2026 15:46
Comment thread src/sentry/snuba/ourlogs.py
JoshuaKGoldberg added a commit that referenced this pull request Jul 29, 2026
#120451 will expose an internal `timestamp.sequence` attribute used to
break log ordering ties when logs share an identical
`timestamp_precise`. It's an ordering aid, not something users should
see, so this hides it from the logs UI alongside the other internal
timestamp fields.

This PR should land first, before #120451, so users never see the field.

Closes LOGS-569.
@JoshuaKGoldberg

Copy link
Copy Markdown
Member Author

(needs more backend work and Kevan is out, moving back to draft for now)

@JoshuaKGoldberg
JoshuaKGoldberg marked this pull request as draft August 10, 2026 14:09
@getsantry

getsantry Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you add the label WIP, I will leave it alone unless WIP is removed ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry Bot added the Stale label Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants