@@ -59,6 +59,7 @@ import Numeric (showFFloat)
5959import Data.Void (absurd )
6060import Data.Typeable (Typeable , cast )
6161import Ouroboros.Consensus.Peras.SelectView
62+ import qualified Data.Aeson as Aeson
6263
6364-- {-# ANN module ("HLint: ignore Redundant bracket" :: Text) #-}
6465
@@ -2255,40 +2256,89 @@ instance MetaTrace V1.BackingStoreValueHandleTrace where
22552256 V2
22562257-------------------------------------------------------------------------------}
22572258
2259+ enclosingToMachine :: EnclosingTimed -> Aeson. Object
2260+ enclosingToMachine RisingEdge = " enclosing" .= String " rising"
2261+ enclosingToMachine (FallingEdgeWith t) = " enclosing" .= toJSON t
2262+
2263+ enclosingToHuman :: EnclosingTimed -> Text
2264+ enclosingToHuman RisingEdge = " starting"
2265+ enclosingToHuman (FallingEdgeWith t) = " finished, took " <> showT t
2266+
2267+
22582268instance LogFormatting V2. LedgerDBV2Trace where
2259- forMachine _dtal V2. TraceLedgerTablesHandleCreate =
2260- mconcat [ " kind" .= String " LedgerTablesHandleCreate" ]
2261- forMachine _dtal V2. TraceLedgerTablesHandleClose =
2262- mconcat [ " kind" .= String " LedgerTablesHandleClose" ]
2269+ forMachine _dtal (V2. TraceLedgerTablesHandleCreate e) =
2270+ mconcat [ " kind" .= String " LedgerTablesHandleCreate" , enclosingToMachine e ]
2271+ forMachine _dtal (V2. TraceLedgerTablesHandleClose e) =
2272+ mconcat [ " kind" .= String " LedgerTablesHandleClose" , enclosingToMachine e]
2273+ forMachine _dtal (V2. TraceLedgerTablesHandleDuplicate e) =
2274+ mconcat [ " kind" .= String " LedgerTablesHandleDuplicate" , enclosingToMachine e ]
2275+ forMachine _dtal (V2. TraceLedgerTablesHandleRead e) =
2276+ mconcat [ " kind" .= String " LedgerTablesHandleRead" , enclosingToMachine e]
2277+ forMachine _dtal (V2. TraceLedgerTablesHandleCreateFirst e) =
2278+ mconcat [ " kind" .= String " LedgerTablesHandleCreateFirst" , enclosingToMachine e ]
2279+ forMachine _dtal (V2. TraceLedgerTablesHandlePush e) =
2280+ mconcat [ " kind" .= String " LedgerTablesHandlePush" , enclosingToMachine e]
22632281 forMachine dtal (V2. BackendTrace ev) = forMachine dtal ev
22642282
2265- forHuman V2. TraceLedgerTablesHandleCreate =
2266- " Created a new 'LedgerTablesHandle', potentially by duplicating an existing one"
2267- forHuman V2. TraceLedgerTablesHandleClose =
2268- " Closed a 'LedgerTablesHandle'"
2283+ forHuman (V2. TraceLedgerTablesHandleCreate e) =
2284+ " Created a new handle " <> enclosingToHuman e
2285+ forHuman (V2. TraceLedgerTablesHandleClose e) =
2286+ " Closed a handle " <> enclosingToHuman e
2287+ forHuman (V2. TraceLedgerTablesHandleDuplicate e) =
2288+ " Duplicated a handle " <> enclosingToHuman e
2289+ forHuman (V2. TraceLedgerTablesHandleRead e) =
2290+ " Reading from a handle " <> enclosingToHuman e
2291+ forHuman (V2. TraceLedgerTablesHandleCreateFirst e) =
2292+ " Created first handle " <> enclosingToHuman e
2293+ forHuman (V2. TraceLedgerTablesHandlePush e) =
2294+ " Pushing to a handle " <> enclosingToHuman e
22692295 forHuman (V2. BackendTrace ev) = forHuman ev
22702296
22712297instance MetaTrace V2. LedgerDBV2Trace where
2272- namespaceFor V2. TraceLedgerTablesHandleCreate =
2298+ namespaceFor V2. TraceLedgerTablesHandleCreate{} =
22732299 Namespace [] [" LedgerTablesHandleCreate" ]
2274- namespaceFor V2. TraceLedgerTablesHandleClose =
2300+ namespaceFor V2. TraceLedgerTablesHandleClose{} =
22752301 Namespace [] [" LedgerTablesHandleClose" ]
2302+ namespaceFor V2. TraceLedgerTablesHandleRead {} =
2303+ Namespace [] [" LedgerTablesHandleRead" ]
2304+ namespaceFor V2. TraceLedgerTablesHandlePush {} =
2305+ Namespace [] [" LedgerTablesHandlePush" ]
2306+ namespaceFor V2. TraceLedgerTablesHandleDuplicate {} =
2307+ Namespace [] [" LedgerTablesHandleDuplicate" ]
2308+ namespaceFor V2. TraceLedgerTablesHandleCreateFirst {} =
2309+ Namespace [] [" LedgerTablesHandleCreateFirst" ]
22762310 namespaceFor (V2. BackendTrace ev) = nsPrependInner " BackendTrace" (namespaceFor ev)
22772311
22782312 severityFor (Namespace _ [" LedgerTablesHandleCreate" ]) _ = Just Debug
22792313 severityFor (Namespace _ [" LedgerTablesHandleClose" ]) _ = Just Debug
2314+ severityFor (Namespace _ [" LedgerTablesHandleRead" ]) _ = Just Debug
2315+ severityFor (Namespace _ [" LedgerTablesHandlePush" ]) _ = Just Debug
2316+ severityFor (Namespace _ [" LedgerTablesHandleCreateFirst" ]) _ = Just Debug
2317+ severityFor (Namespace _ [" LedgerTablesHandleDuplicate" ]) _ = Just Debug
22802318 severityFor (Namespace _ (" BackendTrace" : _)) _ = Just Debug
22812319 severityFor _ _ = Nothing
22822320
22832321 documentFor (Namespace _ [" LedgerTablesHandleCreate" ]) =
22842322 Just " Created a ledger tables handle"
22852323 documentFor (Namespace _ [" LedgerTablesHandleClose" ]) =
22862324 Just " Closed a ledger tables handle"
2325+ documentFor (Namespace _ [" LedgerTablesHandleRead" ]) =
2326+ Just " Read from ledger tables handle"
2327+ documentFor (Namespace _ [" LedgerTablesHandlePush" ]) =
2328+ Just " Push to ledger tables handle"
2329+ documentFor (Namespace _ [" LedgerTablesHandleCreateFirst" ]) =
2330+ Just " Created first ledger tables handle"
2331+ documentFor (Namespace _ [" LedgerTablesHandleDuplicate" ]) =
2332+ Just " Duplicate a ledger tables handle"
22872333 documentFor _ = Nothing
22882334
22892335 allNamespaces =
22902336 [ Namespace [] [" LedgerTablesHandleCreate" ]
22912337 , Namespace [] [" LedgerTablesHandleClose" ]
2338+ , Namespace [] [" LedgerTablesHandleRead" ]
2339+ , Namespace [] [" LedgerTablesHandlePush" ]
2340+ , Namespace [] [" LedgerTablesHandleCreateFirst" ]
2341+ , Namespace [] [" LedgerTablesHandleDuplicate" ]
22922342 ] ++ map (nsPrependInner " BackendTrace" ) (allNamespaces :: [Namespace V2. SomeBackendTrace ])
22932343
22942344instance LogFormatting V2. SomeBackendTrace where
@@ -2311,18 +2361,52 @@ instance MetaTrace V2.SomeBackendTrace where
23112361
23122362instance LogFormatting (V2. Trace LSM. LSM ) where
23132363 forMachine _dtal (LSM. LSMTreeTrace ev) = mconcat [ " kind" .= String " LSMTreeTrace" , " content" .= showT ev]
2364+ forMachine _dtal (LSM. LSMLookup ev) = mconcat [ " kind" .= String " LSMLookup" , enclosingToMachine ev]
2365+ forMachine _dtal (LSM. LSMUpdate ev) = mconcat [ " kind" .= String " LSMUpdate" , enclosingToMachine ev]
2366+ forMachine _dtal (LSM. LSMSnap ev) = mconcat [ " kind" .= String " LSMSnap" , enclosingToMachine ev]
2367+ forMachine _dtal (LSM. LSMOpenSession ev) = mconcat [ " kind" .= String " LSMOpenSession" , enclosingToMachine ev]
23142368 forHuman (LSM. LSMTreeTrace ev) = showT ev
2369+ forHuman (LSM. LSMLookup ev) =
2370+ " Looking up LSM " <> enclosingToHuman ev
2371+ forHuman (LSM. LSMUpdate ev) =
2372+ " Updating LSM " <> enclosingToHuman ev
2373+ forHuman (LSM. LSMSnap ev) =
2374+ " Creating a snapshot in LSM " <> enclosingToHuman ev
2375+ forHuman (LSM. LSMOpenSession ev) =
2376+ " Opening LSM session " <> enclosingToHuman ev
23152377
23162378instance MetaTrace (V2. Trace LSM. LSM ) where
23172379 namespaceFor LSM. LSMTreeTrace {} = Namespace [] [" LSMTrace" ]
2380+ namespaceFor LSM. LSMLookup {} = Namespace [] [" LSMLookup" ]
2381+ namespaceFor LSM. LSMUpdate {} = Namespace [] [" LSMUpdate" ]
2382+ namespaceFor LSM. LSMSnap {} = Namespace [] [" LSMSnap" ]
2383+ namespaceFor LSM. LSMOpenSession {} = Namespace [] [" LSMOpenSession" ]
23182384 severityFor (Namespace _ [" LSMTrace" ]) _ = Just Debug
2385+ severityFor (Namespace _ [" LSMLookup" ]) _ = Just Debug
2386+ severityFor (Namespace _ [" LSMUpdate" ]) _ = Just Debug
2387+ severityFor (Namespace _ [" LSMSnap" ]) _ = Just Debug
2388+ severityFor (Namespace _ [" LSMOpenSession" ]) _ = Just Debug
23192389 severityFor _ _ = Nothing
23202390
23212391 documentFor (Namespace _ [" LSMTrace" ]) =
23222392 Just " A trace from the LSM-trees backend"
2393+ documentFor (Namespace _ [" LSMLookup" ]) =
2394+ Just " Performing a lookup in LSM-trees backend"
2395+ documentFor (Namespace _ [" LSMUpdate" ]) =
2396+ Just " Performing an update in LSM-trees backend"
2397+ documentFor (Namespace _ [" LSMSnap" ]) =
2398+ Just " Taking a snapshot in LSM-trees backend"
2399+ documentFor (Namespace _ [" LSMOpenSession" ]) =
2400+ Just " Opening the LSM-trees backend session"
23232401 documentFor _ = Nothing
23242402
2325- allNamespaces = [Namespace [] [" LSMTrace" ]]
2403+ allNamespaces =
2404+ [ Namespace [] [" LSMTrace" ]
2405+ , Namespace [] [" LSMLookup" ]
2406+ , Namespace [] [" LSMUpdate" ]
2407+ , Namespace [] [" LSMSnap" ]
2408+ , Namespace [] [" LSMOpenSession" ]
2409+ ]
23262410
23272411unwrapV2Trace :: forall a backend . Typeable backend => (V2. Trace LSM. LSM -> a ) -> V2. Trace backend -> a
23282412unwrapV2Trace g ev =
0 commit comments