-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Heimdall instrumentation #4510
Heimdall instrumentation #4510
Conversation
The .json files generated by the instrumentation runner should be added to git-ignore, that's the bulk of the line changes. Will prune those out in a moment |
Awesome. I suspect we may (once this matures) shake out pieces into their own repo's and modules, but keeping it together during experimentation seems legit. |
beat me to it. nice! |
it would be great to allow instrumentation from the outside. on example would be to add some instrumentation for "how many models/requests were loaded during this route transition", but that's probably a separate thing i could implement (sorry thinking aloud in github comments :P) |
I made some progress on reducing the cost of the instrumentation itself, so we may be able to leave some of it in for people if they want and use babel transforms to strip the rest of it out for production builds. |
This is an excellent suggestion and, unless I've misunderstood you, also something heimdalljs explicitly supports. This is how we use it to track fs usage within ember-cli for instance. see: |
8e3b420
to
360d272
Compare
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.
yay cleanup
e25a653
to
f5dc86b
Compare
Getting happier, I've squashed and rebased. Got more instrumentation tweaks to make, need to push out an alpha release for heimdall-query and the heimdal babel transform, and figure out what is breaking tests. |
@igorT not sure why this test is failing, could use some help tracking it down. |
@@ -18,6 +18,7 @@ function babelOptions(libraryName, _options) { | |||
'es6.constants', | |||
'es6.modules' | |||
], | |||
externalHelpers: true, |
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 from implementing a plugin to strip classCallCheck while investigating alternative adapters, it should be removed.
@@ -47,6 +48,7 @@ | |||
"devDependencies": { | |||
"bower": "^1.6.5", | |||
"broccoli-asset-rev": "^2.1.2", | |||
"broccoli-babel-transpiler": "^5.6.1", |
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 creeping in here was accidental, will be removed.
"loader.js": "^4.0.0", | ||
"lodash": "^4.15.0", |
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.
I'm not sure lodash is directly needed anymore, I'll do a quick review to make sure. I believe this was only here for what is now heimdall-query.
@@ -0,0 +1,51 @@ | |||
/* global heimdall */ |
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.
despite setting this globally many places ESLint was yelling at me if I didn't set it at the top of files :/ This should be worked out.
heimdall.stop(token); | ||
// console.log('ember-data-end', stats.endTime); | ||
// console.profileEnd(label); | ||
// console.info('findAll#item -> fetched ' + get(records, 'length') + ' records'); |
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.
all these console call comments should be removed.
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.
Almost ready for PR to be reviewed for merging.
@@ -44,6 +44,24 @@ function retrieveFromCurrentState(key) { | |||
} | |||
|
|||
var guid = 0; | |||
|
|||
const [ | |||
__a, __b, __c, __d, __e, __f, __g, __h, __i, |
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.
we should use more descriptive names?
i think a small facade layer between heimdall and ember data would be nice. this allows us to document it as part of the Ember Data API and also change the implementation more easily if we needed to in the future. |
@fivetanley Describe what you are thinking. I had no intentions of the instrumentation being public beyond a user being able to leave it in their build and provide their own heimdall instance if desired. |
@fivetanley I believe the public API you seek is heimdall itself. As it aims to provide cross cutting instrumentation (Ember/loader/ember-data/custom app code) etc. |
Does it have a public API? I didn't think it was stable yet (don't see a 1.x or anything)... |
@rwjblue we're narrowing in on it, 0.3.x is close to stable |
@rwjblue and fwiw, the public API in heimdall 0.3.x-alpha3 is at this point highly unlikely to change (the last thing likely to change was the switch over from returning an array to returning an object when calling registerMonitor which I just made this morning), we're mostly playing around with internals at this point. |
Is this PR for benchmarking, or is it desired to also be useful to end users? |
first benchmarking, later developers caring about performance (maybe the extension and tests etc.) |
@fivetanley this PR is part of a concerted effort to have consistent instrumentation across ember-cli, ember, glimmer2, and ember-data to help us more quickly identify performance problems and regressions. Benchmarking is secondary, but nice. One of the awesome things about this approach is that our instrumentation cost is low enough that it can be left in for end users when they desire, but easily stripped out for the primary case. Soon an end user wanting in depth measurements can select to not strip heimdall and provide their own heimdall instance for use. |
'send', | ||
'transitionTo', | ||
'_triggerDeferredTriggers' | ||
); |
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.
@stefanpenner style preference here? Expanded like this or moved onto fewer lines?
@runspired I'm going to kill some CI jobs that you have running that are clogging up the concurrency. |
@igorT code review cleanup is now complete. |
Overall this pr looks good to me @runspired. 👍 |
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.
Looks good but a few things need addressing. Also instructions for using/running heimdall need to be in the README before merging.
|
||
if (environment === 'development') { | ||
// uncomment when running baseline development benchmarks | ||
// plugins.push(stripHeimdall); |
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.
would prefer an environment variable here. inevitably this comment to not commit it will be skipped or forgotten or not seen in a code review.
}), | ||
// comment out when running non-baseline production benchmarks | ||
// WARNING do not ever commit the commented out version! | ||
stripHeimdall |
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.
would prefer an environment variable here. inevitably this comment to not commit it will be skipped or not seen in a code review.
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.
@fivetanley I've found it very hard to replicate a production build without using the production env, if you have suggestions I'm open. Was going to look into a process flag to use as a toggle to keep us safe.
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.
production builds are issued on CI requests and tags auto publish to bower. I wouldn't want heimdall to get in there accidentally; historically build related changes have been difficult to track down and reproduce. something like process.env.ENABLE_HEIMDALL
would prevent this change from accidentally being checked into source control.
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.
Was going to look into a process flag to use as a toggle to keep us safe.
Agreed ;)
This should be good now, Travis tests will pass I think appveryor was just a fluke. cc @fivetanley I added a bit of documentation to CONTRIBUTING.md, and cc @HeroicEric the counters are now alphabetized :) |
we'll need to double check with @tricknotes and other globals-mode users to ensure this works in gems/bower. it looks great from a build perspective but just trying to be careful since we tend to have build-related regressions whenever we change this stuff. |
e60ca71
to
4b3b32b
Compare
@igor passing :) |
@runspired do you mind rebasing this pr? |
@bmac I don't but did you know you can rebase and squash from the merge button now? 💃 |
4b3b32b
to
7a1a957
Compare
@bmac rebased :) |
@tricknotes do you have some cycles so we can make sure this still works in the globals version of ember data? |
@fivetanley I'd like to merge this pr into the master branch. I can cut an alpha gem release to make testing easer and we will have plenty of time to fix any regressions because these changes will have to go through a full beta cycle. Does that sound good to you? |
Sounds good to me. I'll open a tracking issue. |
@fivetanley Sorry to my late :< |
This is a WIP branch that allows us to easily measure where our performance costs are in different record loading scenarios.
Example: