I’m using Sessions API to monitor number of active sessions for each release.
The problem I’m facing is that calling API with groupBy
returns zero for number of active sessions in some intervals and for some (if not all) releases.
For instance, using groupBy
,
curl -H "Authorization: Bearer ${TOKEN}" \
"${SENTRY_URL}/api/0/organizations/sentry/sessions/\
?project=4&field=sum(session)&statsPeriod=1d&interval=1h&groupBy=release" > out.json
I get the following active sessions for release versionX
:
[49666,0,45261,2995,47781,54684,0,48263...
Note two random zeros in active sessions. However, if I instead use query
parameter to filter results for versionX
,
curl -H "Authorization: Bearer ${TOKEN}" \
"${SENTRY_URL}/api/0/organizations/sentry/sessions/\
?project=4&field=sum(session)&statsPeriod=1d&interval=1h&query=release:versionX" > out.json
I get the following result for active sessions which is expected:
[49666,46860,45261,2995,47781,54684,51826,48263...
I have included more detailed responses in the following:
API response using groupBy=release
(results other than versionX
is omitted but they also have similar issue):
{"start":"2021-06-01T09:00:00Z","end":"2021-06-02T08:28:00Z","query":"","intervals":["2021-06-01T09:00:00Z","2021-06-01T10:00:00Z","2021-06-01T11:00:00Z","2021-06-01T12:00:00Z","2021-06-01T13:00:00Z","2021-06-01T14:00:00Z","2021-06-01T15:00:00Z","2021-06-01T16:00:00Z","2021-06-01T17:00:00Z","2021-06-01T18:00:00Z","2021-06-01T19:00:00Z","2021-06-01T20:00:00Z","2021-06-01T21:00:00Z","2021-06-01T22:00:00Z","2021-06-01T23:00:00Z","2021-06-02T00:00:00Z","2021-06-02T01:00:00Z","2021-06-02T02:00:00Z","2021-06-02T03:00:00Z","2021-06-02T04:00:00Z","2021-06-02T05:00:00Z","2021-06-02T06:00:00Z","2021-06-02T07:00:00Z","2021-06-02T08:00:00Z"],"groups":[...,{"by":{"release":"versionX"},"totals":{"sum(session)":729052},"series":{"sum(session)":[49666,0,45261,2995,47781,54684,0,48263,0,28118,19901,0,0,0,3304,3625,7256,16497,27317,36504,46387,50850,52521,27095]}},,...]}
API response for Using query=release:versionX
:
{"start":"2021-06-01T09:00:00Z","end":"2021-06-02T08:28:00Z","query":"release:versionX","intervals":["2021-06-01T09:00:00Z","2021-06-01T10:00:00Z","2021-06-01T11:00:00Z","2021-06-01T12:00:00Z","2021-06-01T13:00:00Z","2021-06-01T14:00:00Z","2021-06-01T15:00:00Z","2021-06-01T16:00:00Z","2021-06-01T17:00:00Z","2021-06-01T18:00:00Z","2021-06-01T19:00:00Z","2021-06-01T20:00:00Z","2021-06-01T21:00:00Z","2021-06-01T22:00:00Z","2021-06-01T23:00:00Z","2021-06-02T00:00:00Z","2021-06-02T01:00:00Z","2021-06-02T02:00:00Z","2021-06-02T03:00:00Z","2021-06-02T04:00:00Z","2021-06-02T05:00:00Z","2021-06-02T06:00:00Z","2021-06-02T07:00:00Z","2021-06-02T08:00:00Z"],"groups":[{"by":{},"totals":{"sum(session)":729052},"series":{"sum(session)":[49666,46860,45261,2995,47781,54684,51826,48263,38723,28118,19901,12388,6881,4359,3304,3625,7256,16497,27317,36504,46387,50850,52521,27085]}}]}