omdb: one ereport pretty-printer to rule them all#10486
Open
hawkw wants to merge 5 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As seen in today's Demo Friday, I have put together a little pretty-printer for formatting ereport JSON in a human-focused way. The format it outputs is a little less full of delimiters than the JSON object, as it's indentation delimited, and should look pretty familiar to anyone who's used
fmdump -eVor similar. More importantly, though, giving us a custom formatter gives us opportunities to prettify and enrich specific fields and structures which commonly occur in ereports by convention. Currently, the most interesting example of this is PMBus status registers from ereports that SPs emit about PMBus devices.For example, let's consider an ereport that I harvested from the dogfood rack's PSC. In the current (JSON) format, it looks like this:
With the new formatter, it looks like this:
Note that Bryan's
pmbuscrate is used to decode the PMBus status registers, which should allow folks to get a sense for what happened here without having to manually interpret the status register bitflags.I've put this new formatter in a crate, named
erebor--- this is either a portmanteau of "ereport" and "CBOR", or a reference to the Lonely Mountain of Middle-Earth, named "Erebor" in Sindarin; where Smaug destroyed the Dwarves' kingdom in an event that one assumes must have produced a great deal of ereports. This is intended to allow reusing it inomdb, in thefaux-mgs ereportscommand, and perhaps elsewhere, eventually.This branch adds it to
omdb. Since I am sure there are situations where one would want to get the output as JSON, I've also added new--jsonadn--rawflags for doing that.