Page MenuHomePhabricator

Responses on pageview API should be lighter
Open, MediumPublic

Description

Everyitem on a pageview API response repeats request parameters: "access":"all-access","agent":"user","granularity":"daily".

We should remove redundancy (rolling out a new version?) of data on response.

Look into factoring out the repeated parameters, above the items level. Not sure how this works with hyperswitch.

Related Objects

StatusSubtypeAssignedTask
StalledNone
In ProgressNone
In Progress DAbad
ResolvedNone
OpenNone

Event Timeline

check out GraphQL when thinking about this

Milimetric triaged this task as Medium priority.Sep 19 2016, 3:36 PM
Milimetric moved this task from Incoming to Wikistats on the Analytics board.

I think it would be favourable to still return the request data but at the base of the response, something like:

{
  article: 'Example',
  access: 'all-access',
  agent: 'user',
  granularity: 'daily',
  project: 'en.wikipedia',
  items: [
    {
      timestamp: "2016090700",
      views: 123
    }, {
      timestamp: "2016090800",
      views: 456
    }
  ]
}

This is useful for applications making multiple asynchronous requests, so that the "promises" callbacks have all the data they need for processing. Depending on the implementation, we'd otherwise have to keep track of the request data outside of the callbacks, which is tricky since each promise may be resolved at a different time, if that makes sense. Also, if no items are returned, we lose the request data entirely. I can provide some pseudocode if that would be helpful.

Yes, we can make the optimization factor out everything that won't vary in the reaponse.

Atieno removed Atieno as the assignee of this task.Jan 2 2024, 4:12 PM
Atieno subscribed.