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 extra logging around build queue #2388

Merged
merged 2 commits into from
Nov 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions ghcide/src/Development/IDE/Core/Shake.hs
Original file line number Diff line number Diff line change
Expand Up @@ -618,11 +618,13 @@ shakeRestart IdeState{..} reason acts =
(stopTime,()) <- duration (cancelShakeSession runner)
res <- shakeDatabaseProfile shakeDb
backlog <- readIORef $ dirtyKeys shakeExtras
queue <- atomically $ peekInProgress $ actionQueue shakeExtras
let profile = case res of
Just fp -> ", profile saved at " <> fp
_ -> ""
let msg = T.pack $ "Restarting build session " ++ reason' ++ keysMsg ++ abortMsg
let msg = T.pack $ "Restarting build session " ++ reason' ++ queueMsg ++ keysMsg ++ abortMsg
reason' = "due to " ++ reason
queueMsg = " with queue " ++ show (map actionName queue)
keysMsg = " for keys " ++ show (HSet.toList backlog) ++ " "
abortMsg = "(aborting the previous one took " ++ showDuration stopTime ++ profile ++ ")"
logDebug (logger shakeExtras) msg
Expand Down Expand Up @@ -700,7 +702,8 @@ newSession extras@ShakeExtras{..} shakeDb acts reason = do
-- The inferred type signature doesn't work in ghc >= 9.0.1
workRun :: (forall b. IO b -> IO b) -> IO (IO ())
workRun restore = withSpan "Shake session" $ \otSpan -> do
setTag otSpan "_reason" (fromString reason)
setTag otSpan "reason" (fromString reason)
setTag otSpan "queue" (fromString $ unlines $ map actionName reenqueued)
whenJust allPendingKeys $ \kk -> setTag otSpan "keys" (BS8.pack $ unlines $ map show $ toList kk)
let keysActs = pumpActionThread otSpan : map (run otSpan) (reenqueued ++ acts)
res <- try @SomeException $
Expand Down Expand Up @@ -893,7 +896,7 @@ useWithStaleFast' key file = do

-- Async trigger the key to be built anyway because we want to
-- keep updating the value in the key.
wait <- delayedAction $ mkDelayedAction ("C:" ++ show key) Debug $ use key file
wait <- delayedAction $ mkDelayedAction ("C:" ++ show key ++ ":" ++ fromNormalizedFilePath file) Debug $ use key file

s@ShakeExtras{state} <- askShake
r <- liftIO $ getValues state key file
Expand Down