fix(sentry): return timestamps with an explicit UTC zone - #353
Draft
tsan88 wants to merge 3 commits into
Draft
Conversation
added 3 commits
September 4, 2026 15:42
/api/events and /api/events/preview returned every event stored for the requested type/project — FindOptions already had Limit and Offset, but the handlers never filled them in. On a busy instance one preview request weighed 25.8 MB, and the frontend then filtered that in the browser. Both endpoints now accept limit, offset/page, from, to and window (15m, 24h, "7d"; "all" opts out of the configured default), and report what was applied in the response meta so a client can tell a truncated response from an exhausted one. Defaults are deliberately conservative and non-breaking: 1000 events per response, no time window. An operator can set ui.default_window (or UI_DEFAULT_WINDOW) to also narrow lists by time.
…ent and period
The sentry endpoints could only be narrowed by level, handled and trace_id.
project_id and environment are written for every error event but had no reader,
so picking a project in the UI still listed every project's errors — including
in the grouped view, which is what makes it useful on a shared instance. There
was no way to narrow anything by time at all, so reaching a particular hour
meant paging through the entire list.
Adds:
- project and environment filters on /api/sentry/exceptions (both the
chronological and the grouped view);
- environment and release filters on /api/sentry/traces (columns that were
also written but never read);
- from / to / window ("15m", "24h", "7d") on exceptions, traces, logs and
counts.
/api/sentry/counts now respects the same project and period as the lists it
labels, and counts transactions rather than traces — that is what the traces
list shows and the table that carries a timestamp to filter on.
Filters only apply when the parameters are present, so existing clients see no
change.
received_at, first_seen and last_seen are written with datetime('now') — UTC,
but with no zone marker: "2026-09-04 05:33:12". The frontend parses that with
moment(str), which treats a zone-less string as local time, so every timestamp
in the UI was shifted by the viewer's UTC offset. In UTC+3 the grouped view
showed a error that had just arrived as "3 hours ago", and "last seen" could
even read as being in the future for negative offsets.
The columns are now formatted as ...T...Z on the way out. Sorting and filtering
keep using the raw column, so no index is bypassed.
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.
received_at,first_seenandlast_seenare written withdatetime('now')— UTC, but with no zone marker:"2026-09-04 05:33:12".The frontend parses those with
moment(str), which treats a zone-less string as local time. Every timestamp in the sentry UI was therefore shifted by the viewer's UTC offset: in UTC+3 an error that had just arrived showed up in the grouped view as "3 hours ago", and for negative offsets "last seen" could read as being in the future.Changes
received_at,first_seenandlast_seenare formatted as...T...Zon the way out of the exceptions list, the grouped list, the exception detail and the errors related to a trace. Sorting and filtering keep using the raw column, so no index is bypassed, andCOALESCEkeeps an unparseable value passing through instead of turning intonull.Testing
go vet ./...,go test ./...andgo buildpass. AddedTestAPIExceptionsTimestampsAreUTC. Verified in the UI on our instance: "last seen" now matches the wall clock.