From 90a0e8620b3166df714845fdd3325535d51b3a7d Mon Sep 17 00:00:00 2001 From: Yupanqui Date: Tue, 16 Jan 2024 19:17:19 +0100 Subject: [PATCH] trace-dispatcher: more fixes --- trace-dispatcher/doc/trace-dispatcher.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/trace-dispatcher/doc/trace-dispatcher.md b/trace-dispatcher/doc/trace-dispatcher.md index bf546f2304d..729a795c7b6 100644 --- a/trace-dispatcher/doc/trace-dispatcher.md +++ b/trace-dispatcher/doc/trace-dispatcher.md @@ -100,7 +100,7 @@ data TraceAddBlockEvent blk = -- * 'trStdout': stdout tracing -- * 'trForward': trace forwarding -- * 'mbTrEkg': (optional) EKG monitoring --- The tracer is supplied with a 'name' as an array of text, which is appended to its namespace. +-- The tracer is supplied with a 'name' as an array of text, which is prepended to its namespace. -- This function returns the new tracer. mkCardanoTracer :: forall evt. @@ -142,7 +142,10 @@ To emit a trace, employing a message and its corresponding tracer, utilize the ` ```haskell traceWith :: Trace m a -> a -> m () -- For example: -traceWith trAddBlock (IgnoreBlockOlderThanK p) +addBlockTracer <- mkCardanoTracer trStdout trForward (Just trEkg) ["ChainDB"] +configureTracers configReflect config [addBlockTracer] +.. +traceWith addBlockTracer (IgnoreBlockOlderThanK p) ``` ## Namespace Concept Explanation @@ -161,6 +164,12 @@ data Namespace a = Namespace { , nsInner :: [Text]} ``` +Every namespace is composed of: + +- system namespace (empty for cardano, but was cardano in old tracing) +- tracer namespace (argument of mkCardanoTracer) +- inner namespace (provided by the MetaTrace typeclass) + The tracer namespace serves pivotal roles in: - __Documentation__: It defines the overall structure of the generated documentation output. @@ -430,7 +439,7 @@ For instance, you can create a filter function to display only _Public_ messages ```haskell filterTrace (\(c, _) -> case lcPrivacy c of Just s -> s == Public - Nothing -> True) + Nothing -> False) -- privacy unknown, don't send out ``` This capability allows for flexible and fine-grained control over the inclusion or exclusion of messages based on a variety of contextual criteria.