sentry icon indicating copy to clipboard operation
sentry copied to clipboard

[API] statsPeriod parameter not respected in list project's issues endpoint

Open rodolfoBee opened this issue 1 year ago • 3 comments

Environment

SaaS (https://sentry.io/)

Steps to Reproduce

  1. List all issues in a project using this endpoint: https://docs.sentry.io/api/events/list-a-projects-issues/

Expected Result

When omiting statsPeriod the response will show stats for the organisation's retention as detailed in the documentation:

An optional stat period (can be one of "24h", "14d", and ""). If not provided, the API will return the max time period for the project (90 days for paid accounts, 30 days for free).

GET https://sentry.io/api/0/projects/dev-curumas/notjava/issues/

"id": "5686141479",
....
"stats": {
   "90d": [
...
    ]
}

Actual Result

The endpoint returns 24h stats instead of 90d as described in the documentation. For example: GET https://sentry.io/api/0/projects/dev-curumas/notjava/issues/

"id": "5686141479",
....
"stats": {
   "24h": [
...
    ]
}

Setting it to 14d returns the expected information: GET https://sentry.io/api/0/projects/dev-curumas/notjava/issues/?statsPeriod=14d

"id": "5686141479",
....
"stats": {
   "14d": [
...
    ]
}

Product Area

APIs

Link

No response

DSN

No response

Version

No response

rodolfoBee avatar Aug 08 '24 05:08 rodolfoBee

Assigning to @getsentry/support for routing ⏲️

getsantry[bot] avatar Aug 08 '24 05:08 getsantry[bot]

Routing to @getsentry/product-owners-apis for triage ⏲️

getsantry[bot] avatar Aug 08 '24 16:08 getsantry[bot]

The doc has now changed to

he statsPeriod parameter can be used to select the timeline stats which should be present. Possible values are: "" (disable),"24h" (default), "14d"

And no matter the value, it always returns a 90D period. Note we are on a paid account.

13013SwagR avatar Oct 04 '24 20:10 13013SwagR

Routing to @getsentry/product-owners-issues for triage ⏲️

getsantry[bot] avatar Oct 07 '24 16:10 getsantry[bot]

@13013SwagR can you confirm you're using the project issues endpoint and not the undocumented organization issues endpoint?

mrduncan avatar Oct 07 '24 18:10 mrduncan

@mrduncan We were using projects/<org>/<project>/issues/, but we learned that the statsPeriod parameter actually filters the events on each issue and that the endpoint always returns issues from the last 90 days... To get issues from the last 14 days, for example, we had to use organizations/<org>/issues/ and use the project filter. This returned issues from the defined statsPeriod

13013SwagR avatar Oct 31 '24 19:10 13013SwagR

@13013SwagR This is helpful info, thanks! We can work on getting the docs to explain better what it controls.

lobsterkatie avatar Nov 01 '24 21:11 lobsterkatie