Finding raw events in sentry database


We have an on-premise installation of sentry and are trying to figure out how the aggregate “stats” on the sidebar of a sentry message are calculated.

Specifically, the ones shown here:

The following query seems to line up with what we see when going to the “Events” tab on the message, but not the numbers we see in the image above.

date(m.datetime) as event_date
, count(*)
from public.sentry_groupedmessage gm
join public.sentry_message m on m.group_id =
where gm.project_id = 16
and gm.level = 50
and = 175696
group by, date(m.datetime)
order by date(m.datetime) desc

Any guidance would be appreciated!

They’re stored in TSDB and computed/written at process time.

Great, thanks! Does there happen to be a good way to query the TSDB? Is there something like a command-line client?