Skip to content
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

feat: debug logging #195

Merged
merged 2 commits into from
Feb 6, 2018
Merged

feat: debug logging #195

merged 2 commits into from
Feb 6, 2018

Conversation

richardschneider
Copy link
Contributor

Just some simple debug statements to figure out what is happening.

@ghost ghost added the status/in-progress In progress label Jan 29, 2018
@dryajov
Copy link
Member

dryajov commented Jan 29, 2018

@richardschneider thanks! We have to be careful to scope debug output correctly and only use that scope when debugging, otherwise it will turn ipfs logging, which will break our stdout/stderr parsing.

@richardschneider
Copy link
Contributor Author

@dryajov not sure what you are saying?

These are debug statements for ipfsd-ctl. it has nothing to do with issue #193

Copy link
Member

@dryajov dryajov left a comment

Choose a reason for hiding this comment

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

LGTM besides the comment below

package.json Outdated
"detect-node": "^2.0.3",
"hapi": "^16.6.2",
"hat": "0.0.3",
"ipfs-api": "^17.3.0",
Copy link
Member

Choose a reason for hiding this comment

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

this needs to be moved to devDependencies

Copy link
Member

Choose a reason for hiding this comment

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

@dryajov why devDep and not dep?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dryajov Doesn't ipfsd-ctl need ipfs-api to control the remote daemon?

Copy link
Member

Choose a reason for hiding this comment

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

@richardschneider it does, but we've had issues bundling deps like that before (it was ipfs proper in that case, but it applies to ipfs-api as well).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it a circular reference, both need each other?

Copy link
Member

Choose a reason for hiding this comment

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

Why does it apply to ipfs-api as well? ipfs caused issues because it brought in some native dependencies that were causing trouble for ipfs-desktop. It was ok to move ipfs to devDep because we moved it to be injected by the user (the other option being go-ipfs-dep). However, ipfs-api is always used and doesn't make sense that a user needs to inject as well.

Copy link
Member

Choose a reason for hiding this comment

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

IMO, we should not bundle neither ipfs not ipfs-api and let the consumer bundle their own, because we can't guarantee which version is going to be ultimately used by ipfsd-ctl in either case.

However, ipfs-api is always used and doesn't make sense that a user needs to inject as well.

So is js-ipfs, the consuming project might have a different version bundled already.

I'm fine with bundling ipfs-api, I don't think it's going to cause any issues, but allowing the consuming project use their own, IMO gives it more control. It's not a big issue either way, because the consumer can alway explicitly use their own ipfs-api version with IpfsApi(ipfsd.apiAddr).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey guys, I just want some debug logging. Please make a decision.

Copy link
Member

Choose a reason for hiding this comment

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

I'm fine including it 👍

Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with bundling ipfs-api, I don't think it's going to cause any issues, but allowing the consuming project use their own, IMO gives it more control.

What kind of control do you expect? ipfs-api is the client library to talk with daemons.

If I understand correctly, the only reason why we don't pack in ipfs and npm-go-ipfs-dep by default is due to issues with electron, not because of control.

@richardschneider
Copy link
Contributor Author

@diasdavid are you happy to merge?

@daviddias
Copy link
Member

@richardschneider I'm now worried that the lack including ipfs-api here was enabling the tests on js-ipfs-api to pass because of how require works. Could you double check and test that js-ipfs, js-ipfs-api and ipfs/interop tests pass with this version?

@richardschneider
Copy link
Contributor Author

@diasdavid CI tests are failing all over the place.

Running js-ipfs, js-ipfs-api and ipfs-interop will take most of my day and then most likely yield false positive results. If the code base can not handle adding a few debug statements into a module, then we have very serious issues.

I am adding this PR, so I can figure out why tests are running so slow. Blaming Travis or sprinkling this.timeout is just not working.

@dryajov
Copy link
Member

dryajov commented Feb 1, 2018

@richardschneider could you point to what's failing?

@diasdavid in js-ipfs-api we use the current js-ipfs-api from src/ and instantiate it explicitly using IpfsApi(ipfsd.apiAddr). js-ipfs and interop would pick up the latest ipfs-api from their dependencies. Not sure how this would have affected it, specially with later versions of npm doing explicit implicit dedup on those dependencies.

@richardschneider
Copy link
Contributor Author

@dryajov
Copy link
Member

dryajov commented Feb 1, 2018

@richardschneider I don't think they are related to this changes, I've seen them come up randomly at different times.

https://circleci.com/gh/ipfs/js-ipfs-api/1655?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link - I believe its been mentioned somewhere else might be due to webpack.

https://travis-ci.org/ipfs/js-ipfs/jobs/335828903 - has been a consistent random error on travis that pops up now and then, restarting the build fixes it. I'm sure there is a race condition somewhere that might be causing that and we should definitely investigate, but it's been around for a while and predates using ipfsd-ctl.

@dryajov
Copy link
Member

dryajov commented Feb 1, 2018

To clarify, and make sure we're on the same page.

  • ipfsd-ctl was shipped with ipfs-api as a devDependency in hopes it would cause less conflicts and allow consuming projects use the latests available ipfs-api to them without having to update ipsd-ctl constantly
  • js-ipfs is also a devDependency, however the initial reason for moving it there was due to the native dependencies that were affecting electron builds, however, we have the same side effect as with ipfs-api - i.e. we can use the latest js-ipfs in consuming projects without having to ship a new versions of ipfsd-ctl every time

The concerns are that, shipping ipfs-api as a devDependency could affect testing across the different projects.

I don't believe that it's the case, because:

  • in js-ipfs-api, ipfsd-ctl uses the ipfs-api from its src/ dir, by explicitly instantiating it with IpfsApi(ipfsd.apiAddr)
  • in the all other projects, it should default to using the version of js-ipfs and ipfs-api declared in their dependencies

I must be missing something and I would love to see where the issues might lie.

@daviddias
Copy link
Member

@dryajov you are missing all the projects that use ipfsd-ctl to spawn go-ipfs daemons that are not js-ipfs nor js-ipfs-api.

@dryajov
Copy link
Member

dryajov commented Feb 1, 2018

@dryajov you are missing all the projects that use ipfsd-ctl to spawn go-ipfs daemons that are not js-ipfs nor js-ipfs-api.

Fair point, thanks for bringing that up. As I said, I'm fine moving ipfs-api back to dependencies.

I'm not clear on why it would affect existing tests in js-ipfs and interop though?

@daviddias
Copy link
Member

daviddias commented Feb 1, 2018

I'm not clear on why it would affect existing tests in js-ipfs and interop though?

I'm not saying that it will. I just want us to be diligent and make sure that we test the dependents when we make breaking changes. I've seen multiple times PRs that "ready" to later see quick fixes all over when things start failing on the dependents. I know it is a cumbersome process and ideally CI would handle all of this, but until we have the tooling it has to be done manually.

@dryajov
Copy link
Member

dryajov commented Feb 1, 2018

@diasdavid got you! Thanks for clarifying. Agree on being diligent - point taken.

@richardschneider
Copy link
Contributor Author

@dryajov @diasdavid any progress?

@richardschneider
Copy link
Contributor Author

@diasdavid could you just merge this (not release to NPM). I really need this to test some speedups.

Pretty please with a cherry on the top.

@daviddias
Copy link
Member

@richardschneider what would merge to master enable you to do that on a branch it wouldn't?

Copy link
Member

@daviddias daviddias left a comment

Choose a reason for hiding this comment

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

I actually do not see why this can't be merged

@ghost ghost assigned daviddias Feb 6, 2018
@daviddias daviddias merged commit 86b0ab0 into master Feb 6, 2018
@ghost ghost removed the status/in-progress In progress label Feb 6, 2018
@daviddias daviddias deleted the debug-logging branch February 6, 2018 05:51
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.

3 participants