Open Bug 1691103 Opened 4 years ago Updated 4 years ago

TimespanMetricType: Allow setting raw values in milliseconds

Categories

(Data Platform and Tools :: Glean: SDK, defect, P4)

defect

Tracking

(Not tracked)

People

(Reporter: sebastian, Unassigned)

References

Details

I was adding a TimespanMetricType and needed to use the raw API to set the value manually. Unfortunately there's only setRawNanos, which required me to do the conversion myself.

Extension methods for other dimensions, or using TimeUnit, or using Duration [still experimental] would have been nice. :)

To add to this: In my case I got confused since I used time_unit: millisecond, needed to provide the value in nanoseconds, but then in the test testGetValue() returned milliseconds again.

setRawNanos was an API added for specific use cases inside Fenix.
I agree that it's not the most ergonomic.
I have a hesitation against adding more setRaw* methods. Having a setRaw should have at a minimum a way to give the unit, as you proposed using TimeUnit maybe.

We have to put that on the backlog for now though.

Priority: -- → P4
See Also: → 1668891
You need to log in before you can comment on or make changes to this bug.