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

bucket inspect: support machine-readable output formats #4180

Closed
matthiasr opened this issue May 5, 2021 · 9 comments · Fixed by #4228
Closed

bucket inspect: support machine-readable output formats #4180

matthiasr opened this issue May 5, 2021 · 9 comments · Fixed by #4228

Comments

@matthiasr
Copy link

Is your proposal related to a problem?

When I want to do an action on a specific subset of blocks, I need a list of those blocks.
thanos tools bucket ls gives me a list of all buckets, but does not allow filtering.
thanos tools bucket inspect does exactly the filtering it needs, but the output is geared towards human readability.
I need to do awk gymnastics to extract the block ID.

Describe the solution you'd like

Add a --output / -o flag to thanos tools bucket inspect, which allows selecting output formats.
Ideas for formats:

  • table: current format, default
  • id: block IDs only, similar to ls
  • csv: quoted comma-separated values
  • tsv: tab-separated values, great for consumption with Unix tools
  • json: JSON encoding (exact format tbd), great for consumption with jq or scripting languages

Describe alternatives you've considered

  • Currently possible:
thanos tools bucket inspect … | awk '$1 == "|" && $2 != "ULID" { print $2 }'
  • add label filtering to bucket ls – solves my concrete issue, but is less generally useful. Making all the information machine readable allows all kinds of integrations. Harder to judge whether the filter is correct.

Additional context

I chose the proposed flag to be in line with kubectls multiple outputs.
I don't think Thanos needs the full power of that just yet but keeping the flags similar makes them easier to remember.

@wiardvanrij
Copy link
Member

Well explained and I think this would provide good value. Would you be interested on creating this feature or an initial draft for it?

@matthiasr
Copy link
Author

Unfortunately I won't have the time anytime soon, but I wanted to put the idea out there 😃

@someshkoli
Copy link
Contributor

Created an initial draft for this, PTAL @wiardvanrij @matthiasr

@stale
Copy link

stale bot commented Jul 11, 2021

Hello 👋 Looks like there was no activity on this issue for the last two months.
Do you mind updating us on the status? Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗
If there will be no activity in the next two weeks, this issue will be closed (we can always reopen an issue if we need!). Alternatively, use remind command if you wish to be reminded at some point in future.

@stale stale bot added the stale label Jul 11, 2021
@stale
Copy link

stale bot commented Jul 26, 2021

Closing for now as promised, let us know if you need this to be reopened! 🤗

@stale stale bot closed this as completed Jul 26, 2021
@wiardvanrij
Copy link
Member

PR still open, relevant

@wiardvanrij wiardvanrij reopened this Jul 28, 2021
@stale stale bot removed the stale label Jul 28, 2021
@stale
Copy link

stale bot commented Oct 11, 2021

Hello 👋 Looks like there was no activity on this issue for the last two months.
Do you mind updating us on the status? Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗
If there will be no activity in the next two weeks, this issue will be closed (we can always reopen an issue if we need!). Alternatively, use remind command if you wish to be reminded at some point in future.

@stale stale bot added the stale label Oct 11, 2021
@matthiasr
Copy link
Author

PR is open and waiting for a review.

@stale stale bot removed the stale label Oct 11, 2021
@matthiasr
Copy link
Author

We're gonna need an anti-stalebot-bot soon …

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants