Skip to content

Bug 2053207 - Use glean-sym for places telemetry [ci full] - #7468

Open
bendk wants to merge 1 commit into
mozilla:mainfrom
bendk:bdk/push-xpvmlnrlprkk
Open

Bug 2053207 - Use glean-sym for places telemetry [ci full]#7468
bendk wants to merge 1 commit into
mozilla:mainfrom
bendk:bdk/push-xpvmlnrlprkk

Conversation

@bendk

@bendk bendk commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Use glean-sym for real, rather than just for test metrics. Added support for Desktop/FOG. Removed the metrics meant to test glean-sym.

Simplified run_maintenance now that we can record metrics in Rust.

Updated chrono to 0.4.45 for compatibility with glean

Pull Request checklist

  • Breaking changes: This PR follows our breaking change policy
    • This PR follows the breaking change policy:
      • This PR has no breaking API changes, or
      • There are corresponding PRs for our consumer applications that resolve the breaking changes and have been approved
  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGELOG.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due diligence applied in selecting them.

@bendk
bendk requested review from badboy and mhammond July 10, 2026 17:57
Comment thread components/places/android/metrics.yaml
Comment thread components/places/Cargo.toml Outdated
Comment thread components/places/src/ffi.rs Outdated
@bendk

bendk commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

This seems to be working and I even did a quick check that the FOG stuff works on desktop. However, I'm not sure about a couple things and I left comments for them.

@bendk
bendk force-pushed the bdk/push-xpvmlnrlprkk branch from b7dcf9b to 6a9a5e6 Compare July 10, 2026 18:09
@bendk

bendk commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

The tests are failing because pip3 can't find the right glean_parser version. I'm not sure what's happening there, any ideas?

@badboy

badboy commented Jul 28, 2026

Copy link
Copy Markdown
Member

The tests are failing because pip3 can't find the right glean_parser version. I'm not sure what's happening there, any ideas?

❯ docker run -it --rm --platform linux/amd64 cimg/rust:1.53.0 python3 --version
Python 3.8.5

Pretty sure that's because the image in use is way too old to have a recent Python

Edit: #7505

Use glean-sym for real, rather than just for test metrics. Added support
for Desktop/FOG. Removed the metrics meant to test glean-sym.

Simplified `run_maintenance` now that we can record metrics in Rust.

Updated chrono to `0.4.45` for compatibility with `glean`
@bendk

bendk commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Pushing a new version of this based on all the nice Glean changes in main (thanks Jan-Erik). Do not merge this until these are in a Glean release and we've updated the Cargo.toml files to point to that release.

[target.'cfg(any(target_os = "android", target_os = "ios"))'.dependencies]
glean-sym = { git = "https://github.com/mozilla/glean", tag = "v68.0.0", optional = true }
glean = { git = "https://github.com/mozilla/glean", branch = "main", optional = true }
glean-sym = { git = "https://github.com/mozilla/glean", branch = "main" }

@bendk bendk Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the introduction of the glean-sym/noop feature this gets much nicer:

  • For Android, we build without any feature flags and use glean-sym for the metrics
  • For Desktop, we build with the glean-fog feature flag and use that for the metrics. TODO: double check that the APIs are identical and everything compiles cleanly.
  • For testing, we build with the glean-sym/noop feature.

This means that can always just record metrics and never need #[cfg] attributes to conditionally enable them.

The main downside I see is that it's a bit weird for the "default" build, i.e. if I just run cargo build -p places. In that case, we use glean-sym and everything will fail unless it ends up linked to another library like libxul that provides the symbols. This is because we can't have a feature flag that disables glean-sym/noop, only one that enables it. I don't think this is that big of a deal, but I wonder if we could swap the way glean-sym works so that it's noop by default and there's a feature flag to enable the metrics recording. Alternatively, maybe glean-sym could always go into no-op mode if the library failed to load.

The other downside is that we're depending on glean-sym for the Desktop case, when we don't really need it. AFAIK, glean-sym is very lightweight though so I don't care about this at all.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Disable it when library couldn't be loaded" -- I initially tried writing the code that way but it was very unwieldy (and that was before we thought about a "real noop" mode). It either requires null-routing all the function pointers or constant checks if function pointers are non-null. Not impossible, but annoying to put together.

No-op by default however seems possible I guess. Cargo features are indeed not perfect for toggling between these modes, so I'm sure we can also find problems with that, so I need to think about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants