Studies should have a way to write metadata

RESOLVED FIXED in 1.2

Status

P1
critical
RESOLVED FIXED
8 years ago
3 years ago

People

(Reporter: jono, Unassigned)

Tracking

unspecified

Details

(Whiteboard: api)

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

8 years ago
This came up in a discussion about the garbage collection study; the study would like to be able to record metadata about the user's hardware.  This is essentially study-specific metadata.  Up until now we've done stuff like this by writing the value into one of the columns of the schema as a special 'status' event, but that's a really ugly kluge (it violates the schema and makes it hard to filter on when querying the database).

There's currently no way for a study to write to metadata because the metadata object doesn't exist until submission time.  We can implement this either by creating temp metadata storage earlier in the process (a database table or something) and providing an API to write to it; or else (and this is easier) having the task object query the study to say "any more metadata for me?" when collecting all the other metadata right before submission.  So a study can optionally implement a provideMetadata() method.
(Reporter)

Updated

8 years ago
Severity: normal → critical
Priority: -- → P1
Whiteboard: api
Target Milestone: --- → 1.2
(Reporter)

Comment 1

8 years ago
Implemented in http://hg.mozilla.org/labs/testpilot/rev/7dd6788c1500

I tried to write it in as error-tolerant a way as possible (it will do the right thing if a study's getStudyMetadata() method throws an exception or if it returns something that's not an array) but we're not currently sanitizing name or value strings; should think about whether doing so is needed for security reasons.
(Reporter)

Comment 2

8 years ago
Also how to handle the case where it returns an invalid object or where name or value is not a string.
(Reporter)

Comment 3

8 years ago
Created attachment 524919 [details] [diff] [review]
Patch to mozilla-central to add this feature
Attachment #524919 - Flags: review?(mark.finkle)
Comment on attachment 524919 [details] [diff] [review]
Patch to mozilla-central to add this feature

Should TestPilotExperiment_getStudyMetadata use a try/catch in case the task method throws an exception?
(Reporter)

Comment 5

8 years ago
Created attachment 525207 [details] [diff] [review]
Better patch, with exception handling

Yes it should.  Here's a patch with exception handling.
Attachment #524919 - Attachment is obsolete: true
Attachment #524919 - Flags: review?(mark.finkle)
(Reporter)

Updated

8 years ago
Attachment #525207 - Flags: review?(mark.finkle)
Attachment #525207 - Flags: review?(mark.finkle) → review+
(Reporter)

Updated

8 years ago
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
(Assignee)

Updated

3 years ago
Product: Mozilla Labs → Mozilla Labs Graveyard
You need to log in before you can comment on or make changes to this bug.