Simplify bugzilla query in cron job



6 months ago
6 months ago


(Reporter: adrian, Assigned: adrian)


Firefox Tracking Flags

(Not tracked)



(1 attachment)



6 months ago
In our bugzilla cron job, we query the following URL: 


This URL is unreadable and contains a lot of unneeded fields. After running some tests, I am able to reduce it to the following:[Bug+creation]&chfield=resolution&chfield=bug_status&chfield=short_desc&chfield=cf_crash_signature&columnlist=bug_id,bug_status,resolution,short_desc,cf_crash_signature&ctype=csv

And after bug 1368498 lands, we won't even need to listen to changes in bug status, resolution or description, so we can simplify it even further (and reduce the number of operations we run):[Bug+creation]&chfield=cf_crash_signature&columnlist=bug_id,cf_crash_signature&ctype=csv
csv?? Is it not possible to use the REST JSON endpoint instead? I remember that dkl said that any advanced search you can do you can convert to a REST JSON endpoint simply by changing the path or something.
The script I use gets back JSON:

The code is terrible for reasons. But maybe that's helpful?

Also, there's a bugzilla python library that also gets back json:

I wouldn't switch to that library without someone doing some work on it for better viability, though (no tests, no install_requires in setup, no indication of what Python versions it supports, and so on). If that's interesting, I'm game for spending some time on it.

Comment 3

6 months ago
Created attachment 8877111 [details] [review]
Link to Github pull-request:

Comment 4

6 months ago
Commit pushed to master at
Fixes bug 1370484 - Refactored bugzilla query to use REST API and JSON. (#3809)

* Fixes bug 1370484 - Refactored bugzilla query to use REST API and JSON.
This query used to be a very long, hand-written URL, using the old bugzilla query system that returned CSV data. With this, it now uses the REST API instead, manipulating JSON data with the requests library. The query is much simpler to read and has only the few arguments it actually needs. Also, the query is not configurable anymore, because that option was never used and it would have made the code less maintainable.

* Added a clear exception when bugzilla fails.

* Use requests.Response.raise_for_status for HTTP errors.


6 months ago
Last Resolved: 6 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.