Closed Bug 937915 Opened 6 years ago Closed 6 years ago

Restore DB filenames in Telemetry SlowSQL strings

Categories

(Toolkit :: Telemetry, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla29
Tracking Status
firefox27 --- fixed
firefox28 --- fixed
firefox29 --- fixed

People

(Reporter: vladan, Assigned: vladan)

Details

(Whiteboard: [qa-])

Attachments

(1 file)

bug 896737 accidentally caused us to stop reporting the DB filenames in Telemetry slowSQL strings
Attachment #831166 - Flags: review?(dteller)
Comment on attachment 831166 [details] [diff] [review]
always append the DB name as a comment

Review of attachment 831166 [details] [diff] [review]:
-----------------------------------------------------------------

r=me, with the changes below

::: toolkit/components/telemetry/Telemetry.cpp
@@ +2029,2 @@
>      }
> +    sanitizedSQL.AppendPrintf(" /* %s */", dbName.BeginReading());

If I recall correctly, the chartype* returned by BeginReading() is not necessarily 0-terminated. I'd be more comfortable with a series of calls to Append().

@@ +2036,5 @@
>      StoreSlowSQL(aggregate, delay, Sanitized);
>    }
>  
>    nsAutoCString fullSQL(sql);
> +  fullSQL.AppendPrintf(" /* %s */", dbName.BeginReading());

Same here.
Attachment #831166 - Flags: review?(dteller) → review+
nsString/nsCString are guaranteed to be null-terminated, and nsAutoCString is derived from nsCString

https://developer.mozilla.org/en-US/docs/Mozilla_internal_string_guide#The_Major_String_Classes

I could use get() if you prefer?

https://developer.mozilla.org/en-US/docs/nsAutoString#get

Your call.
Flags: needinfo?(dteller)
(In reply to Vladan Djeric (:vladan) from comment #2)
> nsString/nsCString are guaranteed to be null-terminated, and nsAutoCString
> is derived from nsCString

Well, yes, but you are using a nsACString argument which has no such guarantee. I seem to remember that you should nsPromiseFlatCString()-ify it before you call get() or BeginReading(). Which should be a no-copy if your string is a nsAutoCString.
Flags: needinfo?(dteller)
https://hg.mozilla.org/mozilla-central/rev/6d8762404e6f
Assignee: nobody → vdjeric
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
Comment on attachment 831166 [details] [diff] [review]
always append the DB name as a comment

[Approval Request Comment]
Bug caused by (feature/regressing bug #): bug 896737
User impact if declined: None, but Telemetry data collected by Firefox will be incomplete
Testing completed (on m-c, etc.): Tested locally and on Nightly for a couple of days
Risk to taking this patch (and alternatives if risky): None really
String or IDL/UUID changes made by this patch: None
Attachment #831166 - Flags: approval-mozilla-beta?
Attachment #831166 - Flags: approval-mozilla-aurora?
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attachment #831166 - Flags: approval-mozilla-beta?
Attachment #831166 - Flags: approval-mozilla-beta+
Attachment #831166 - Flags: approval-mozilla-aurora?
Attachment #831166 - Flags: approval-mozilla-aurora+
Status: REOPENED → RESOLVED
Closed: 6 years ago6 years ago
Resolution: --- → FIXED
Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.