Skip to content

Commit

Permalink
trace-dispatcher: more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jutaro committed Jan 16, 2024
1 parent 2bd57e5 commit 90a0e86
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions trace-dispatcher/doc/trace-dispatcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 90a0e86

Please sign in to comment.