feat(tools-performance): Add subdomains and a metro perfLoggerFactory implementation#4090
Open
feat(tools-performance): Add subdomains and a metro perfLoggerFactory implementation#4090
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
There are a few main parts to this change:
Subdomain Support
Nothing fancy here, subdomains are just domains that can be enabled by themselves or via the root key. Because the enabled check should be very fast, this just adds the subdomains directly to the enabled set. It also creates a mapping table that allows that to happen in any order. This also adds a
registerSubdomainfunction to allow for callers to set up that association. Note that this will do nothing if perf tracking is not enabled. See the metro implementation for an example.Metro
unstable_perfLoggerFactoryImplementationThis adds a create function to create a perf logger factory. It is mainly focused on the wider datasets (tracked by subdomains) and point to point tracking. This uses a new bit of functionality on
PerfDomainsfor starting and finishing an event with a given name. This hooks into whatever strategy is being used (node or timing) and creates single timing entry for the two points.The perf logger factory will return empty factories if it is not enabled.
Changed the packages from "module" to "commonjs"
While packages on recent versions of node can cleanly interop with ESM packages, given that metro.config.js files are typically CJS and aren't necessarily on the latest node, switching to CJS makes this easier. Making it explicitly "commonjs" rather than removing it removes warnings when running typescript test files directly about ambiguous module systems.