-
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): separate phase from gatherMode #12370
Conversation
adriana liked "observations" |
Quick opinions:
|
One thing we talked about is that even though this adds API surface, it actually makes gatherer usage/interdependencies easier to understand vs careful ordering in the config (plus possibly ignoring some stuff in the trace). If we come to the end of the FR transition and we find that they're overkill, only a few gatherers will be using them and it'll be easy to remove. While writing a gatherer it won't always be obvious if things should be in sensitive instrumentation vs just regular instrumentation, while in practice almost everything should go in regular instrumentation. We should make that clear at least in docs/jsdocs ("if you're wondering if maybe your code should go in |
I've been partial to I was going to suggest |
Outcome of meeting today:
|
b9e2734
to
de7366c
Compare
alright, bring it on reviews! |
Summary
After trying to prototype out a few of the tougher gatherers we'll eventually want to convert, they required some hacky maneuvering to fit into the current phase structure of Fraggle Rock. After talking with @paulirish we came to the conclusion it'd be better if the concept of
phase
andgatherMode
weren't so tied to together. It was convenient to understand and reason about when it all worked seamlessly, but just made things really confusing when gatherers became more complex (where do you need to write gatherer functionality to get it to run? I want this to run in timespan and navigation modes willbeforeTimespan
be called if I also usebeforeNavigation
?) .This PR...
beforeTimespan
->startInstrumentation
afterTimespan
->stopInstrumentation
startSensitiveInstrumentation
/stopSensitiveInstrumentation
-> better separates the performance sensitive observations that should capture as little of Lighthouse overhead as possible (i.e. tracing, network logs, debugger, etc)beforeNavigation
/afterNavigation
no longer needed, instrumentation methods are invoked for both timespan and navigation gatherModes and gatherers can decide if they want to alter their behavior or not.snapshot
->getArtifact
getArtifact
. This might feel reminiscent of the ancient times when every gatherer had to store information onthis
before returning it in a "collect" method but it's a little different because every snapshot gatherer still won't have to touchthis
andtimespan
gatherers mostly already have to store their data onthis
during observations anyway, so we still get many of the benefits. This is technically an optional change, but I think it further reinforces the idea that instop*
methods the ONLY thing that should be done is to stop observing, and all heavier logic should happen ingetArtifact
. The fact that it's optional means if we regret this decision in the future we could always undo it later, but if we start with allowingstop*
to return artifacts we can't really go back on it.stopInstrumentation
phase (because the artifact is only computed ingetArtifact
)Feedback I'm Looking For
stopInstrumentation
for ease and more dependency opportunities?Alternative Phase Names
If you'd like to 🚲 🏠 the new phase names, here were some others thrown around...
startObservations
/endObservations
startHeavyInstrumentation
beginDelicateInstrumentation
collectArtifact
gather
collect
analyze
TODO
Validate names with the teamUpdate all the FR runner tests for the new model of executionDo final searches for any occurrences of the old namesRelated Issues/PRs
ref #11313