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

Add consul snapshot decode command #20824

Merged
merged 1 commit into from
Mar 14, 2024
Merged

Add consul snapshot decode command #20824

merged 1 commit into from
Mar 14, 2024

Conversation

mkeeler
Copy link
Member

@mkeeler mkeeler commented Mar 11, 2024

Description

Often in debugging Consul, users want to be able to see what is in a snapshot. The snapshot data itself is encoded in a non-human readable format. This PR introduces a consul snapshot decode command. This command reads in a snapshot and outputs a stream of line delimited JSON objects. The expectation is that the user can then post-process the stream with some other tool like jq to find/display some relevant data.

Each object at the top level has the form: {"Type": "<type name>", "Data": <JSON encoded data value>}. The <type name> comes from the string form of the request type. In addition to all the various request types specified in the structs package, a SnapshotHeader type is also used to pass back the snapshot header metadata to the user within the JSON object stream.

For forwards compatibility and for a CE binary operating on an enterprise snapshot, if the request type byte isn't known to the CLI then the <type name> will be Unknown(<type byte integer value>).

Testing & Reproduction steps

  • New unit tests including some golden file tests.

@github-actions github-actions bot added the theme/cli Flags and documentation for the CLI interface label Mar 11, 2024
@mkeeler mkeeler added pr/no-backport and removed theme/cli Flags and documentation for the CLI interface labels Mar 11, 2024
@mkeeler mkeeler requested review from rboyer and erichaberkorn March 11, 2024 18:04
@mkeeler mkeeler requested a review from rboyer March 12, 2024 16:51
@mkeeler mkeeler merged commit 8fcafb1 into main Mar 14, 2024
84 of 85 checks passed
@mkeeler mkeeler deleted the snapshot-decode branch March 14, 2024 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants