Closed Bug 1387229 Opened 7 years ago Closed 7 years ago

Add API endpoint for querying notes

Categories

(Tree Management :: Treeherder: API, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: coop, Unassigned)

Details

Not sure if this is a dupe of bug 1118212, but I have a real use case for this now.

I have a set of 15 contractors starting soon who will be assisting with sheriffing duties. Since one of the primary sheriff tasks is starring failures, I would like to be able to report on notes created per sheriff per unit time so that I can help evaluate contractor activity.

AFAICT the current note endpoint will only return detail for a single job, e.g. https://treeherder.mozilla.org/api/project/mozilla-inbound/note/?job_id=120750370

How hard would it be to whip this up?
This is doable now using redash, if that helps? (Bug 1335172 open to mention this on Treeherder's RTD page)
https://sql.telemetry.mozilla.org/
(In reply to Ed Morley [:emorley] from comment #1)
> This is doable now using redash, if that helps? (Bug 1335172 open to mention
> this on Treeherder's RTD page)
> https://sql.telemetry.mozilla.org/

Thanks, Ed. I try and whip up a dashboard tomorrow and close that out if I'm successful.
The tables you'll need are (some classifications are bug numbers, others are comments aka notes):
* treeherder.bug_job_map
* treeherder.job_note
* treeherder.auth_user (the `id` field on this table foreign-keys to `user_id` on the other two)
(In reply to Ed Morley [:emorley] from comment #3)
> The tables you'll need are (some classifications are bug numbers, others are
> comments aka notes):
> * treeherder.bug_job_map
> * treeherder.job_note
> * treeherder.auth_user (the `id` field on this table foreign-keys to
> `user_id` on the other two)

I'm unclear on the relationship between job_note and bug_job_map. Is a note created for every starring interaction, but only some are mapped to bugs? 

I have the following query to grab notes for August: https://sql.telemetry.mozilla.org/queries/11935/source#table

The distribution looks good, but I'm not sure if it's accurate or whether I'm over-counting or under-counting just based on job_notes.
(In reply to Chris Cooper [:coop] from comment #4)
> I'm unclear on the relationship between job_note and bug_job_map. Is a note
> created for every starring interaction, but only some are mapped to bugs? 

They are completely independent - there are two fields in the UI: one for adding a bug number and one for adding a category+free-form string. Users can add either one or both at the same time.
(In reply to Ed Morley [:emorley] from comment #5)
> (In reply to Chris Cooper [:coop] from comment #4)
> > I'm unclear on the relationship between job_note and bug_job_map. Is a note
> > created for every starring interaction, but only some are mapped to bugs? 
> 
> They are completely independent - there are two fields in the UI: one for
> adding a bug number and one for adding a category+free-form string. Users
> can add either one or both at the same time.

So I guess I should be grouping by job id then too.

I'm also interested in how often single jobs need to be re-starred, so looking for jobs with multiple notes or bugs could be a separate query.
I'm using this as a basic query:

https://sql.telemetry.mozilla.org/queries/11986/source#28562

I can adjust the timescales as needed. Thanks for the pointers!
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.