Closed Bug 1124842 Opened 9 years ago Closed 9 years ago

BugzillaBugRequest and OrangeFactorBugRequest should output the error response body to the celery log

Categories

(Tree Management :: Treeherder, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: emorley)

References

Details

Attachments

(1 file)

In bug 1114785, we're seeing errors in the celery logs like:

[2015-01-13 15:56:14,628: INFO/Worker-6] Sending data to https://bugzilla.mozilla.org/rest/bug/1114541/comment: {'comment': u'submit_timestamp: 2015-01-13T15:26:04\nlog: 
...
[2015-01-13 15:56:14,630: INFO/Worker-6] Starting new HTTPS connection (1): bugzilla.mozilla.org
[2015-01-13 15:56:15,011: ERROR/MainProcess] Task submit-bug-comment[c3319a20-0ef8-4580-9656-6ee555d1b855] raised unexpected: HTTPError('400 Client Error: Bad Request',)
Traceback (most recent call last):
...
  File "/data/www/treeherder.mozilla.org/treeherder-service/treeherder/etl/tasks/tbpl_tasks.py", line 38, in submit_bug_comment
    req.send_request()
  File "/data/www/treeherder.mozilla.org/treeherder-service/treeherder/etl/tbpl.py", line 163, in send_request
    r.raise_for_status()
  File "/usr/lib/python2.6/site-packages/requests/models.py", line 773, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
HTTPError: 400 Client Error: Bad Request

In the case of !200 return codes, we should output the response body to the celery log too, so we actually know what the server was complaining about (in this case, likely the size of the comment)

https://github.com/mozilla/treeherder-service/blob/1b03238a5ad4885ffd69a315e6bf680b23fd82eb/treeherder/etl/tbpl.py#L165

We should probably do the same for ElasticSearch:
https://github.com/mozilla/treeherder-service/blob/1b03238a5ad4885ffd69a315e6bf680b23fd82eb/treeherder/etl/tbpl.py#L82
Assignee: nobody → emorley
Blocks: 1114785
Status: NEW → ASSIGNED
Priority: -- → P2
Comment on attachment 8553322 [details] [review]
Log the server response for Bugzilla/ES submission errors

lgtm!
Attachment #8553322 - Flags: review?(cdawson) → review+
Commit pushed to master at https://github.com/mozilla/treeherder-service

https://github.com/mozilla/treeherder-service/commit/cae85ae8c4cc5cb9fdecd86ffbdcf2367782b4d6
Bug 1124842 - Log the server response for Bugzilla/ES submission errors

Previously we only get the HTTPError code in the exception, without the
server response that gives more context. The latter would help explain
the 400s in bug 1114785.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: