FOG Rust Labeled submetric instances are recreated on every call to `get`
Categories
(Toolkit :: Telemetry, enhancement, P1)
Tracking
()
People
(Reporter: chutten, Assigned: chutten)
Details
(Theoretically this is a defect for any rust test depending on the result of get
matching across calls, but as we don't advertise that capability nor have any tests exercising that, it's an Enhancement for the performance impact)
When you call get()
on a labeled metric, you get a submetric. If that get
comes from C++ or JS it goes through FFI which uses the submetric maps to always return you the same instance for a given labeled metric and label. If that get
comes from Rust, it creates a new FOG metric instance to wrap the (cached) Glean SDK metric instance returned from the inner get
.
This was fine while these submetrics were zero-sized or at least cheap. But new labeled types are a little more expensive (looking at you labeled_timing_distribution
) and are likely to get heavier over time.
So let's move the submetric map handling to impl Sealed::from_glean_metric
from macros.rs
to reduce the memory fingerprint of using the Rust API and to support having every submetric reachable by its submetric id across all three languages.
Assignee | ||
Updated•4 days ago
|
Description
•