Socorro:Feeds:ServiceSpec

From MozillaWiki
Jump to: navigation, search

For the rewrite of the FeedController the following middleware service will be required to gather the needed data to generate the relevant feeds.

FIRST PROPOSAL For the rewrite of the FeedController the following middleware service will be required to gather the needed data to generate the relevant feeds.

FIRST PROPOSAL

Create a matview that is filled daily via a cronjob with the latest crashes across products and operating systems from which we can extract data for the feeds.

The matview should contain the following fields:

url
uuid
signature
date_processed
product
version
os

SQL

According to the original requirement the following types of result sets should be possible:

  • All the latest crashes for Firefox on Windows
  • All the latest crashes for Firefox 8.0.1 on Mac
  • All the latest crashes for all products on Linux
  • All the latest crashes for Firefox across all operating systems
SELECT url, uuid, signature, date_processed
FROM feeds
WHERE os_name = 'Windows' AND
date_processed BETWEEN ‘2012-02-01’ AND ‘2012-02-08’;

The term ‘latest crashes’ is not defined anywhere in the original requirement so, I am merely using the dates above to demonstrate a possible query. The actual range can potential be the last 24hrs, the last three days etc.

The Service Call

The service call from the PHP side would look something like:

$resp = $this->service->get("$this->host/feeds/product/$product/version/$version/os/$os/to_date/$end_date/duration/$duration", 'json', $lifetime);

The above would then produce a feed such as :: All the latest crashes for Firefox 8.0.1 on Mac

As mentioned above though, product, version and OS should be optional and in the case where one is not specified it should default to ALL. This means a service call such as the following should be valid:

$resp = $this->service->get("$this->host/feeds/os/$os/to_date/$end_date/duration/$duration", 'json', $lifetime);

So the above would result in something like the following :: All the latest crashes for all products, all versions on Linux

Data Object

The result returned from the service call should be a JSON object that is similar to the following:

{
   "results": [
       {
           "url": "sampleurl",
           "uuid": "8ab9fc43-28f3-4cbf-8200-e09d72120218",
           "signature": "hang|WaitForSingleObjectEx|WaitForSingleObject|",
           "date_processed": "validdateformat"
       },
       {
           "url": "sampleurl",
           "uuid": "8ab9fc43-28f3-4cbf-8200-e09d72120218",
           "signature": "hang|WaitForSingleObjectEx|WaitForSingleObject|",
           "date_processed": "validdateformat"
       }
   ]
}