-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core(fr): add navigation phase + trace gatherer #12098
Conversation
*/ | ||
snapshot(passContext) { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved this just to reflect the order in which they're invoked
@@ -139,43 +137,7 @@ class Driver { | |||
} | |||
|
|||
static get traceCategories() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is part of our public API, so didn't remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we mark deprecated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ya let's do it
@@ -816,15 +778,7 @@ class Driver { | |||
async beginTrace(settings) { | |||
const additionalCategories = (settings && settings.additionalTraceCategories && | |||
settings.additionalTraceCategories.split(',')) || []; | |||
const traceCategories = this._traceCategories.concat(additionalCategories); | |||
|
|||
// In Chrome <71, gotta use the chatty 'toplevel' cat instead of our own. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with Chrome stable up to 88 this feels pretty safe now :)
class TraceCompat extends FRGatherer { | ||
/** @type {LH.Gatherer.GathererMeta<'Trace'>} */ | ||
meta = { | ||
supportedModes: ['navigation'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is actually a fairly important signal that we shouldn't try to compute all the metrics over an arbitrary timespan
longer term I think this evolves into a Trace
and NavigationTrace
artifact or something where the latter is guaranteed to have been collected over a navigation
.toThrow(/Dependency.*is invalid/); | ||
}); | ||
|
||
it('should throw when navigation needs snapshot', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
complete coverage is already in validation-test but covering some more important common mistakes seemed useful
@@ -100,9 +100,11 @@ declare global { | |||
export interface FRGathererInstance<TDependencies extends DependencyKey = DefaultDependenciesKey> { | |||
name: keyof LH.GathererArtifacts; // temporary COMPAT measure until artifact config support is available | |||
meta: GathererMeta<TDependencies>; | |||
snapshot(context: FRTransitionalContext<TDependencies>): PhaseResult; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rearranged to signal the order in which they're invoked
@@ -139,43 +137,7 @@ class Driver { | |||
} | |||
|
|||
static get traceCategories() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we mark deprecated?
Co-authored-by: Connor Clark <[email protected]>
@@ -139,43 +137,7 @@ class Driver { | |||
} | |||
|
|||
static get traceCategories() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ya let's do it
I take it there are no strong feelings about the order of phase execution yet. I wouldn't really expect there to be without hands-on experience yet, so let's leave this as a good first start and if we run into any issues while converting the remaining gatherers we can revisit the decision if necessary. |
Summary
The primary goal of this PR is to add the trace gatherer and support performance metrics in Fraggle Rock navigation mode (as well as pave the way for upgrades to support timespan metrics). That change is pretty small, but this triggered a number of other changes.
beforeNavigation
/afterNavigation
methods to distinguish this new category of "navigation-only" gatherers.Primary Point of Discussion
This PR sets the new execution sequence to the following phase order.
The primary question IMO is when exactly
beforeNavigation
andafterNavigation
should take place.There is an argument for moving
afterNavigation
to happen aftersnapshot
so it can depend on snapshot artifacts, but that means any timespan style recording would include all of the snapshot gatherer work which seems undesirable. I've kept it beforesnapshot
and if anything truly needs thesnapshot
dependency we can think of something likeafterSnapshot
to fill that gap in the future.Implications for Gatherer Authoring
There are 5 potential phases, and this is where that array of supported modes starts enter the territory that concerned me. Really we only have 3 types of valid gatherers. Timespan, Snapshot, or Navigation. We can enforce that fact in config validation if we like. The gatherer of each type should only truly implement the set of methods that are related to it but all the methods of the supported modes will be invoked.
Example: A timespan gatherer says it works for both timespans and navigations, but it only implements
beforeTimespan
andafterTimespan
, leaving the rest as noops. When run in navigation mode,beforeNavigation
andafterNavigation
will still be executed.Related Issues/PRs
ref #11313