-
Notifications
You must be signed in to change notification settings - Fork 44
JSON logging cleanup #3881
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
JSON logging cleanup #3881
Conversation
emitEquationTrace term eq.attributes.location eq.attributes.ruleLabel eq.attributes.uniqueId res | ||
handler | ||
(\t -> setChanged >> pure t) | ||
( \t -> setChanged >> (withContext (LogContext eq) $ withContext "success" $ withTermContext t $ pure t) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this change. I think it fixes a bug in logging that I've found but haven't got to report yet.
The bug was that we would not emit 'success' messages for individual equations, and instead only emit a single 'success' message at the very end after attempting/applying all equations.
scripts/booster-integration-tests.sh
Outdated
"log-simplify-json") | ||
SERVER="${KORE_RPC_BOOSTER} --log-format json -l Simplify --log-file test-$name/simplify-log.txt" ./runDirectoryTest.sh test-$name $@ | ||
;; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made several changes here, including adding the conversion from the original custom log levels tot he context filtering. Also renamed --simplification-log-file
to just --log-file
, ("SimplifyKore", "Log all simplification in kore-rpc") | ||
, ("SimplifySuccess", "Log successful simplifications (booster and kore-rpc)") | ||
, ("Depth", "Log the current depth of the state") | ||
, ("SMT", "Log the SMT-solver interactions") | ||
, ("ErrorDetails", "Log error conditions with extensive details") | ||
] | ||
|
||
levelToContext :: Map Text [ContextFilter] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here are some of the common log filter we may want. Let me know if you think we should add any other ones
@@ -860,13 +808,15 @@ applyEquations theory handler term = do | |||
processEquations [] = | |||
pure term -- nothing to do, term stays the same | |||
processEquations (eq : rest) = do | |||
res <- applyEquation term eq | |||
res <- withRuleContext eq $ applyEquation term eq | |||
emitEquationTrace term eq.attributes.location eq.attributes.ruleLabel eq.attributes.uniqueId res |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that -l SImplify
is re-implemented through the contextual logging, and the simplification RPC traces are to be remove in a pending PR, we are fee to drop the calls to emitEquationTrace
, and the function itself too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to leave that for another pr, because we actually still log via the old logger interface within this function. Until we migrate our tools to contextual logging these may still be necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, let's keep it for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the comment about emitEquationTrace
, I understand that you planned to follow up with another PR? Then we can merge this and leave the following to the next iteration:
- There is some (more) dead code left to clean up
- The context-log replacement for
-l Aborts
needs some more attention - Generally we should remove all old-style customLevels that have a replacement. This probably means removing most levels, except the
Abort
one as it is now. Once that is addressed, thelevelFilter
can just handle the standardError,Warn,Info
levels (but we should rather remove those, too).
booster/library/Booster/CLOptions.hs
Outdated
( "Aborts" | ||
, | ||
[ [ctxt| booster|kore>match,abort |] | ||
] | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-l Aborts
does something different than log aborted matching, it reports any condition that leads to an aborted
result:
- uncertain match
- uncertain conditions
- match of a rule that might not preserve definedness
In addition, it outputs the diff before and after kore-rpc
simplification in (internal and external) simplify requests.
We could introduce an extra thing for the diff (there is no rigid use case for it), but we should make sure the logs for aborted rewrites have the same information as before so we can use them in the analysis script.
@@ -1,3 +1,4 @@ | |||
{-# LANGUAGE QuasiQuotes #-} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😎 🆒
logLevelToKoreLogEntryMap = | ||
Map.fromList | ||
[ (LevelOther "SimplifyKore", ["DebugAttemptEquation", "DebugTerm"]) | ||
, (LevelOther "SimplifyJson", ["DebugAttemptEquation", "DebugTerm"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is dead code. kore-rpc-dev
has another copy of it which is still used (maybe not for a good reason, though?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we still need to pass these (e.g. DebugAttemptEquation
) to actually get context logging in the old backend, because it has multiple layers of filtering. We could just enable all of them tho...
getKoreEntriesForLevel :: LogLevel -> [Text.Text] | ||
getKoreEntriesForLevel level = concat . maybeToList $ Map.lookup level logLevelToKoreLogEntryMap | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably makes the logLevelToKoreLogEntryMap
dead code here, too.
test-log-simplify-json
rpc test with a much smaller footprint, as we want to just track the context logging format-l Simplify --log-format json