Conversation
|
looks like |
|
for reference, the output from the |
| indent, | ||
| } = self; | ||
| writeln!(f, "{:indent$}fault management analysis report", "")?; | ||
| writeln!(f, "{:indent$}----- ---------- -------- ------", "")?; |
There was a problem hiding this comment.
nit: can we remove the spaces? I parsed this as a table at first
There was a problem hiding this comment.
the inputs report is formatted similarly, but i'll get rid of it there as well!
| pub struct EventLog(Vec<LogEntry>); | ||
|
|
||
| #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] | ||
| pub struct LogEntry { |
There was a problem hiding this comment.
It's probably fine for this to be extremely generic right now - this whole thing is pretty much "Stringly typed" - but we may want a more strongly-typed set of decisions in the future.
E.g.; I'm taking an "Action", or I'm "Awaiting More Information", or something else. etc. This would probably help with testing / ensuring coverage / consistency / etc
But for now this is fine
There was a problem hiding this comment.
So, again, this is intended to just be a human-readable log. I can imagine wanting to have an enum or something so that we can format different kinds of log entry differently, but I think that if we're testing the actual DE logic by asserting that the log contains certain entries, something has already gone wrong. And, part of why we might want it to be relatively stringly-typed is so that we can have some loose backwards/forwards-compatibility when displaying them.
The current thing uses #[serde(flatten)] on the KV map so that it's essentially saying "there's a field named "entry" in here, as well as any arbitrary k/v pairs in here. if one happens to be named "comment", we special-case it and format it differently." This way, we can add additional things that are handled in a special way later but if there's version drift, OMDB is not going to choke on it and die.
There was a problem hiding this comment.
I think I'm gonna go ahead and change the BTreeMap to String, JsonValue so you can stuff arbitrarily nested objects in here if you want to
| "assignment_id" => %assignment_id, | ||
| ); | ||
|
|
||
| self.report_log |
There was a problem hiding this comment.
So my comment below about strong/weak types is, I guess, a little more about this:
- I 100% understand the desire for weak types in displays, to deal with backwards compatibility, etc
- ... but jumping directly to weak types, from the builder, makes it a little tougher to test that e.g. "adding an ereport adds this event log entry". My interpretation is that this event log could also be used by DEs? so it could be pretty arbitrary "what conditions cause it to trigger"
Anyway, I was just saying - if we have a strongly-typed interface + output here, and can convert that to the weakly-typed interface you're using for a nice display.
There was a problem hiding this comment.
but also: we don't need to do this now
There was a problem hiding this comment.
Oh, I see, your point was about testing that the event log is correct, not using the event log as a signal to make assertions about. Hmm. I do agree that there is value in being able to test that the debugging output is correct, but I also feel like...well, we don't test every single slog macro, and I don't think we should. And, I don't want to make adding a new event log entry take a lot of effort.
How would you feel about a little more structure, in the form of an enum like
pub enum CaseEventType {
Opened,
Closed,
AddedEreport,
RequestedAlert,
RequestedBundle,
ArbitraryDeThing(String),
}or something?
My resistance here is mostly that I would prefer to make it as low friction as possible to record arbitrary strings from a DE, and that I'm not super convinced that there's that much value in testing that an event log entry is added when the way you do that is just one function call. The entire goal of the report system is just to be able to print some strings in OMDB...
There was a problem hiding this comment.
Per our additional back-and-forth on this on Matrix yesterday, I've renamed this to "debug logs", and we've agreed that the more structured "planning report" analogue would be added if we need that to actually track state across planning steps in a machineable way.
This branch adds an initial and kind of crappy pass at having the
SitrepBuilderAPI produce anAnalysisReporttype providing a human-readable summary of what changes were made to the sitrep during analysis. This is intended to be used for debugging purposes only, and will be included in thefm_analysisbackground task status. Eventually, it may be stuffed in CRDB when a sitrep is committed, for eventual retrieval and display by OMDB.I think there room to make this a lot nicer over time as we keep working on this stuff, but I kinda want to just put a pin in it now so that I can move on to actually starting some initial diagnosis engine skeletons. As we actually implement more FM analysis, we can keep iterating on what goes in the reports and how they're formatted and stored.