Skip to content

Conversation

@Dexterp37
Copy link
Contributor

@Dexterp37 Dexterp37 commented Apr 13, 2021

As discussed with @brizental , this introduces a new shared state object called Context and uses that in the metric types, instead of referring to the Glean object (creating circular dependencies).

It additionally makes the Dispatcher a singleton.

Finally, it enabled the circular dependencies checker on CI.

This will allow us to remove the circular dependencies
from the metric types in other commits.
This enables us to remove circular dependencies from the
metric types files to the Glean.ts object.
This removes all our circular dependencies.
@Dexterp37 Dexterp37 requested a review from brizental April 13, 2021 11:26
@Dexterp37 Dexterp37 self-assigned this Apr 13, 2021
Copy link
Contributor

@brizental brizental left a comment

Choose a reason for hiding this comment

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

r+wc.

All my comments can be dealt with as follow ups, the only one I'd prefer to deal with before merging is the one about the dispatcher, I think it should not be a singleton by itself, but be in the Context. Unless I am missing something.

We should also file a bug for documenting this architecture and why the Context is important, and if we haven't yet a bug about removing the default export from Glean.ts and exporting it as something like export const DO_NOT_IMPORT_ME_UNLESS_YOU_KNOW_WHAT_YOU_ARE_DOING = Glean :D

Finally, did you check that this fixes the original bug about import order of Glean singleton and Metrics?

@Dexterp37 Dexterp37 requested a review from brizental April 13, 2021 12:42
The check is currently broken due to some version
incompatibility.
@Dexterp37 Dexterp37 merged commit aa65607 into mozilla:main Apr 13, 2021
@Dexterp37 Dexterp37 deleted the glean_context branch April 13, 2021 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants