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

ipfs stats bw doesn't support --enc json #5594

Open
MichaelMure opened this issue Oct 12, 2018 · 5 comments · May be fixed by #8358
Open

ipfs stats bw doesn't support --enc json #5594

MichaelMure opened this issue Oct 12, 2018 · 5 comments · May be fixed by #8358
Labels
effort/days Estimated to take multiple days, but less than a week exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) P3 Low: Not priority right now

Comments

@MichaelMure
Copy link
Contributor

Version information:

go-ipfs 0.4.17 and git master

Type:

Bug

Description:

All commands should support the --enc options. It doesn't work for ipfs stats bw I suppose because the result of the command is formatted in a PostRun instead of an Encoders.

@overbool
Copy link
Contributor

@MichaelMure ipfs stats bw has a option --poll that supports uninterrupted output. Therefore, I think it's not easy to achieve this feature by using Encoders instead of PostRun.

@Stebalien Stebalien added the kind/bug A bug in existing code (including security flaws) label Oct 13, 2018
@Stebalien
Copy link
Member

This looks fixable, it's just a bit tricky. The encoder will be called once per item.

@magik6k magik6k added the help wanted Seeking public contribution on this issue label Oct 14, 2018
@kevina kevina self-assigned this Nov 28, 2018
@kevina
Copy link
Contributor

kevina commented Nov 28, 2018

How important is this. Maybe this is something we should wait on until we fix the need for using PostRun in most cases otherwise we run into the same problems we had with ipfs ls --stream in particular it appears a header is outputted is some cases.

@Stebalien
Copy link
Member

IMO, low priority. Most clients will just use HTTP directly.

@Stebalien Stebalien added the P3 Low: Not priority right now label May 29, 2020
@autonome autonome added the status/ready Ready to be worked label May 29, 2020
@Stebalien Stebalien added exp/expert Having worked on the specific codebase is important effort/days Estimated to take multiple days, but less than a week and removed status/ready Ready to be worked labels May 29, 2020
jbouwman pushed a commit to jbouwman/go-ipfs-cmds that referenced this issue Aug 19, 2021
Several open issues mention problems with interaction of the
global `--encoding=` flag and the Encoders and PostRun fields of
command structs. This branch contains experimental refactors that
explore approaches to consistent command execution patterns across
offline, online and http modes.

Specific tickets:

- ipfs/kubo#7050 json encoding for `ls`
- ipfs/kubo#1121 json encoding for `add`
- ipfs/kubo#5594 json encoding for `stats bw`
- ipfs#115 postrun design

Possibly related:

- ipfs/kubo#6640 global flags on subcommands

Incomplete PRs:

- ipfs/kubo#5620 json for 'stat'
jbouwman added a commit to jbouwman/go-ipfs-cmds that referenced this issue Aug 21, 2021
Following the approach described in ipfs#115, define a new method signature on `Command` that supports full processing of the `Response` object when text encoding is requested.

Add an encoding check and dispatch to DisplayCLI in local, http client, and http handler code paths.

Unblocks resolution of `encoding` option processing in multiple go-ipfs issues.

- ipfs/kubo#7050 json encoding for `ls`
- ipfs/kubo#1121 json encoding for `add`
- ipfs/kubo#5594 json encoding for `stats bw`
jbouwman added a commit to jbouwman/go-ipfs-cmds that referenced this issue Sep 8, 2021
Following the approach described in ipfs#115, define a new method signature on `Command` that supports full processing of the `Response` object when text encoding is requested.

Add an encoding check and dispatch to DisplayCLI in local, http client, and http handler code paths.

Unblocks resolution of `encoding` option processing in multiple go-ipfs issues.

- ipfs/kubo#7050 json encoding for `ls`
- ipfs/kubo#1121 json encoding for `add`
- ipfs/kubo#5594 json encoding for `stats bw`
@lidel
Copy link
Member

lidel commented Dec 9, 2021

Confirmed this is still a problem in 0.11.

Extracting specific value via ipfs stats bw --enc=json | jq <selector> would be easier and more future-proof than parsing text with sed/awk. If it makes fix easier, we don't need to support JSON output in --poll mode, fixing the default output would be more than enough.

@BigLep BigLep added this to the Best Effort Track milestone Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/days Estimated to take multiple days, but less than a week exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) P3 Low: Not priority right now
Projects
No open projects
Status: 🔎 In Review
Development

Successfully merging a pull request may close this issue.

8 participants