BMO/Integration Best Practice

From MozillaWiki
< BMO
Revision as of 15:39, 2 April 2014 by Dlawrence (talk | contribs) (→‎API)
Jump to navigation Jump to search

If you are writing tools to integrate with bugzilla.mozilla.org (BMO), you want to make sure they keep working as intended as Bugzilla changes, and they avoid placing strain on the Bugzila infrastructure. Here are some tips and suggestions:

Guidelines

  • Do not poll more frequently than every 5 minutes
    • Seriously, you don't need to poll every minute
  • Ask for bugs updated since your last poll, or track a bug's last modified date
    • If your system is polling for bugs, you should ask BMO for bugs updated since your last poll.
    • The chfieldfrom argument will accept times as well as dates (eg. "2012-10-08 00:00")
    • Search results generally return a bug's last-modified date; there's no need to re-request the bug if it hasn't been modified since the last time you saw it
  • Only request the fields that you are interested in
    • By default all APIs return more information than you probably require - use the include_fields parameter to specify the exact fields you need (BzAPI)(XMLRPC/JSONRPC)
    • When searching with BzAPI, avoid specifying non-bold columns if you can avoid it, because it'll be slower and user server-side resources
  • Coalesce queries where possible
    • If you have multiple bugs, components, etc to query, it can be more efficient issue a single request rather than iterating over your list and issuing multiple requests

API

If starting a new project that needs access to BMO data via a webservice API, please talk to the BMO Team about using the native API instead. The BzAPI is a proxy that was originally created to address some of the webservice issues that Bugzilla had in the past and may no longer be needed for your project due to many recent improvements.

Searching

  • When searching among all closed or all open bugs, don't explicitly enumerate the states, as states may be added or removed. For open bugs, you can use "resolution=---" or "bug_status=__open__" (status=__open__ for BzAPI). For closed bugs, you can use "bug_status=__closed__".
  • Similarly, when searching for bugs which were not fixed, don't enumerate all of the not-fixed resolutions. Instead do a custom search using the "is not empty" operator.