Open Bug 2012752 Opened 3 months ago Updated 2 months ago

Allow shared Rust components to send metric data directly

Categories

(Data Platform and Tools :: Glean: SDK, enhancement, P3)

enhancement

Tracking

(Not tracked)

People

(Reporter: bdk, Unassigned)

References

(Depends on 1 open bug)

Details

(Whiteboard: [glean-sdk-jira])

As of now, shared Rust components can't directly report Glean metric. If they want to record telemetry they need to use workarounds like defining a callback interface for the metrics, implementing it on the foreign side, and having the Rust code call into it when it wants to record a metric. It would be great to have a better solution here.

I believe the main issue is that Glean and the Rust components may have been built by different rustc invocations and/or in different libraries. This means we can't make Rust calls directly because Rust doesn't have a stable ABI. This is complicated by the fact that Desktop, iOS, and Android all have a different library/linking setups.

Ideally, we would be able to use the Rust generated bindings. However, if we had to use the lower-level glean crate directly, that would be a big improvement over the current setup.

IMO, the most important feature is only needing to land a single PR in the Rust Components repo in order to start collecting new data. Having to land PRs in multiple repos and requiring cross-team review makes it much harder to add metrics. Right now the "Rust components repo" is application-services, but it will hopefully be moz-central in the near future.

Component: General → Glean: SDK

Adding https://bugzilla.mozilla.org/show_bug.cgi?id=1950226 as a blocker to this. I don't think it blocks planning/discussion, but we probably don't want to implement anything while we're also in the middle of migrating application-services to the moz-central repo.

Depends on: 1950226
Whiteboard: [glean-sdk-jira]
You need to log in before you can comment on or make changes to this bug.