Perfomatic:API: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
 
(36 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The graph server API is a REST API with a JSON only response format.
==Overview==


===Documented endpoints===
Staging server up at: http://graphs-stage2.mozilla.org
* '''/api/tests''' - returns list of all tests
 
The graph server API is a REST API with a JSON-only response format.
 
The API is scheduled to launch in Q1.
 
Test server will be ready early Q1.
 
==Using getdata.cgi?==
If you are, things are going to change.
 
The biggest change is how we store tests. Currently, a test id can give you test results in time:value intervals. In the new architecture a test id will only get you a description of that test, nothing more.
 
In order to get test data, you have to know the test AND build AND machine you want results for. The current architecture assumes this based on test id.
 
For example, let's assume you want test results for Tp3 tests. Querying graphs.mozilla.org/api/test gives you a list of tests by build and OS.
 
==Documented endpoints==
 
=== List tests ===
* http://graphs.mozilla.org/api/test
* Returns list of all tests run per os per branch per machine.
** Example response:
** Example response:
  {
  {
     'stat':'ok',
     'stat':'ok',
     'test': [
     'tests': [
             {
             {
                 'id':123,
                 'id':123,
                 'name':'Tp3',
                 'name':'Tp3',
                 'branch':'1.9',
                 'branch':
                 'os':'WinXP',
                {
                 'machine':'qm-pxp03-cycles-5',
                    'name':'1.9',
                    'id':3
                },
                 'os':
                {
                    'name':'WinXP',
                    'id':2
                },
                 'machine':
                {
                    'name':'qm-mini-ubuntu01 ',
                    'id':2
                }
             },
             },
             {
             {
                 'id':23,
                 'id':23,
                 'name':'Ts',
                 'name':'Ts',
                 'branch:'1.8',
                 'branch':
                 'os':'Vista'
                {
                 'machine':'qm-pxp03-cycles-20',
                    'name':'1.9',
                    'id':3
                }
                 'os':
                {
                    'name':'Vista',
                    'id':3
                }
                 'machine':
                {
                    'name':'qm-mini-xp01',
                    'id':2
                }
             }
             }
     ]
     ]
  }
  }
* '''/api/test/'''''testId'' - returns information for a specific testId
=== Get test ===
 
* http://graphs.mozilla.org/api/test?testId=TESTID&branchid=BRANCHID&machine=MACHINEID
* Returns information for a specific testId and branch and machine
** Example response:
** Example response:
  {
  {
    'stat':'ok',
    'id':23,
    'test': {
    'name':'Ts',
        'id':123,
    'branch':
        'name':'Tp3',
    {
        'branch':'1.9',
        'name':'1.9',
        'os':'WinXP'
        'id':3
    }
    },
    'os':
    {
        'name':'Vista',
        'id':3
    },
    'machine':
    {
        'name':'qm-mini-xp01',
        'id':2
    }
  }
  }
               
 
* '''/api/test/''testId''/runs/''' - returns test runs for a specific testId, default date limit is 4 weeks, sorted by date descending
=== Get test runs (data) ===               
* http://graphs.mozilla.org/api/test/runs?id=TESTID&branchid=BRANCHID&machineid=MACHINEID
* returns test runs for a specific test, build and machine, default date limit is 4 weeks, sorted by date descending
** Data is sent in a compressed form due to the large amount of information
** Data is sent in a compressed form due to the large amount of information
** Indexes:
** Indexes:
Line 43: Line 102:
**** 1: refbuildid
**** 1: refbuildid
**** 2: changeset
**** 2: changeset
**** 3: OS
*** 2: date
*** 2: date
*** 3: average
*** 3: average
*** 4: annotations (array)
*** 4: run_number
*** 5: annotations (array)
**** 0: note
**** 0: note
**** 1: bugid
**** 1: bugid
Line 53: Line 112:
   'stat':'ok',
   'stat':'ok',
   'test_runs': [
   'test_runs': [
         [98, {23, '2007072704', '572a00c0e251', 'Vista'}, 1208830929, 92.4, <nowiki>[['Something happened here', 988740]]],</nowiki>
         [98, [23, '2007072704', '572a00c0e251'], 1208830929, 92.4, <nowiki>[['Something happened here', 988740]]],</nowiki>
         [99, {23, '2007072704', '572a00c0e251', 'Vista'}, 1208834503, 87.3]
         [99, [23, '2007072704', '572a00c0e251'], 1208834503, 87.3]
     ]
     ]
  }
  }
* '''/api/testrun/''testRunId''''' - returns test run information for a specific testRunId
 
=== Get values for latest test run for a test ===
* http://graphs.mozilla.org/api/test/runs/latest?id=TESTID&branchid=BRANCHID&machineid=MACHINEID - returns test run values for the latest run test for a specific test, branch and machine id
** Example response
{
    'stat':'ok',
    'id':33,
    'values':[
        {
            'value':22.3,
            'page':'www.yahoo.com'
        },
        {
            'value':29.1,
            'page':'www.myspace.com'
        },
        {
            'value':39.3,
            'page':'www.facebook.com'
        }
    ]
}
 
=== Get test run information ===
* http://graphs.mozilla.org/api/test/runs/info/?id=TESTRUNID - returns test run information for a specific testRunId
** Example response
** Example response
  {
  {
Line 66: Line 149:
             'id':23,
             'id':23,
             'build_id':'2007072704',
             'build_id':'2007072704',
             'changeset':'572a00c0e251',
             'changeset':'572a00c0e251'
            'os':'Vista',
         },
         },
         'date_run':1208830929,
         'date_run':1208830929,
Line 80: Line 162:
  }
  }


* '''/api/testrun/''testRunId''/values''' - returns test run results for a specific testRunId
=== Test run values (formerly discrete data) ===
* http://graphs.mozilla.org/api/test/runs/values?id=TESTRUNID
* returns test run results for a specific testRunId
** Example response
** Example response
  {
  {
     'stat':'ok',
     'stat':'ok',
     'annotations': [
     'id':33,
        {
            'note':'Something happened here',
            'bug_id':988740
        }
    ],
     'values':[
     'values':[
         {
         {
            'id':1,
             'value':22.3,
             'value':22.3,
             'page':'www.yahoo.com'
             'page':'www.yahoo.com'
         },
         },
         {
         {
            'id':3,
             'value':29.1,
             'value':29.1,
             'page':'www.myspace.com'
             'page':'www.myspace.com'
         },
         },
         {
         {
            'id':1,
             'value':39.3,
             'value':39.3,
             'page':'www.facebook.com'
             'page':'www.facebook.com'
Line 108: Line 184:
     ]
     ]
  }
  }
=== Get test data by revision ===
* http://graphs.mozilla.org/api/test/runs/revisions?revision=10d2046d2b64&revision=d16525937c8b
** Example response
    {
      "stat": "ok",
      "revisions": {
        "d16525937c8b": {
          "tscroll": {
            "test_runs": {
              "MacOSX 10.5.8": [
                [
                  3794718,          # test run id
                  20100421051331,  # build id
                  1271853540,      # timestamp
                  19719.5          # average value
                ]
              ],
              "WINNT 6.1": [
                [
                  3794854,
                  20100421053747,
                  1271856720,
                  11871.4
                ]
              ],
              "Fedora 12 x64 - Constantine": [
                [
                  3794354,
                  20100421051525,
                  1271852700,
                  10063.200000000001
                ]
              ],
              "WINNT 5.1": [
                [
                  3794853,
                  20100421053747,
                  1271856720,
                  13063.5
                ]
              ]
            },
            "name": "tscroll",
            "id": 71
          },
      },
    }
  }


=== Error codes===
=== Error codes===

Latest revision as of 21:30, 16 May 2011

Overview

Staging server up at: http://graphs-stage2.mozilla.org

The graph server API is a REST API with a JSON-only response format.

The API is scheduled to launch in Q1.

Test server will be ready early Q1.

Using getdata.cgi?

If you are, things are going to change.

The biggest change is how we store tests. Currently, a test id can give you test results in time:value intervals. In the new architecture a test id will only get you a description of that test, nothing more.

In order to get test data, you have to know the test AND build AND machine you want results for. The current architecture assumes this based on test id.

For example, let's assume you want test results for Tp3 tests. Querying graphs.mozilla.org/api/test gives you a list of tests by build and OS.

Documented endpoints

List tests

{
   'stat':'ok',
   'tests': [
            {
                'id':123,
                'name':'Tp3',
                'branch':
                {
                    'name':'1.9',
                    'id':3
                },
                'os':
                {
                    'name':'WinXP',
                    'id':2
                },
                'machine':
                {
                    'name':'qm-mini-ubuntu01 ',
                    'id':2
                }
            },
            {
                'id':23,
                'name':'Ts',
                'branch':
                {
                    'name':'1.9',
                    'id':3
                }
                'os':
                {
                    'name':'Vista',
                    'id':3
                }
                'machine':
                {
                    'name':'qm-mini-xp01',
                    'id':2
                }
            }
   ]
}

Get test

{
    'id':23,
    'name':'Ts',
    'branch':
    {
        'name':'1.9',
        'id':3
    },
    'os':
    {
        'name':'Vista',
        'id':3
    },
    'machine':
    {
        'name':'qm-mini-xp01',
        'id':2
    }
}

Get test runs (data)

  • http://graphs.mozilla.org/api/test/runs?id=TESTID&branchid=BRANCHID&machineid=MACHINEID
  • returns test runs for a specific test, build and machine, default date limit is 4 weeks, sorted by date descending
    • Data is sent in a compressed form due to the large amount of information
    • Indexes:
      • 0: testrunid
      • 1: build
        • 0: buildid
        • 1: refbuildid
        • 2: changeset
      • 2: date
      • 3: average
      • 4: run_number
      • 5: annotations (array)
        • 0: note
        • 1: bugid
    • Example response:
{
  'stat':'ok',
  'test_runs': [
       [98, [23, '2007072704', '572a00c0e251'], 1208830929, 92.4, [['Something happened here', 988740]]],
       [99, [23, '2007072704', '572a00c0e251'], 1208834503, 87.3]
   ]
}

Get values for latest test run for a test

{ 
   'stat':'ok',
   'id':33,
   'values':[
       {
           'value':22.3,
           'page':'www.yahoo.com'
       },
       {
           'value':29.1,
           'page':'www.myspace.com'
       },
       {
           'value':39.3,
           'page':'www.facebook.com'
       }
   ]
}

Get test run information

{
   'stat':'ok',
   'testrun': {
       'id':98,
       'build': {
           'id':23,
           'build_id':'2007072704',
           'changeset':'572a00c0e251'
       },
       'date_run':1208830929,
       'average':92.4,
       'annotations': [
           {
              'note':'Something happened here',
              'bug_id':988740
           }
       ]
    }
}

Test run values (formerly discrete data)

{
   'stat':'ok',
   'id':33,
   'values':[
       {
           'value':22.3,
           'page':'www.yahoo.com'
       },
       {
           'value':29.1,
           'page':'www.myspace.com'
       },
       {
           'value':39.3,
           'page':'www.facebook.com'
       }
   ]
}

Get test data by revision

   {
     "stat": "ok", 
     "revisions": {
       "d16525937c8b": {
         "tscroll": {
           "test_runs": {
             "MacOSX 10.5.8": [
               [
                 3794718,          # test run id
                 20100421051331,   # build id
                 1271853540,       # timestamp
                 19719.5           # average value
               ]
             ], 
             "WINNT 6.1": [
               [
                 3794854, 
                 20100421053747, 
                 1271856720, 
                 11871.4
               ]
             ], 
             "Fedora 12 x64 - Constantine": [
               [
                 3794354, 
                 20100421051525, 
                 1271852700, 
                 10063.200000000001
               ]
             ], 
             "WINNT 5.1": [
               [
                 3794853, 
                 20100421053747, 
                 1271856720, 
                 13063.5
               ]
             ]
           }, 
           "name": "tscroll", 
           "id": 71
         }, 
      },
    }
  }


Error codes

  • Default error responses are as follows:
{
   'stat':'fail',
   'code':100,
   'message':'Test does not exist'
}