Skip to content

Commit

Permalink
Merge pull request #5635 from IntersectMBO/jutaro/tracer-docs
Browse files Browse the repository at this point in the history
trace-dispatcher: documentation
  • Loading branch information
jutaro committed Jan 22, 2024
2 parents ffa05ec + 342933a commit 671afa2
Show file tree
Hide file tree
Showing 7 changed files with 508 additions and 540 deletions.
1,030 changes: 495 additions & 535 deletions trace-dispatcher/doc/trace-dispatcher.md

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion trace-dispatcher/src/Cardano/Logging/Configuration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ import Cardano.Logging.TraceDispatcherMessage
import Cardano.Logging.Types


-- | Call this function at initialisation, and later for reconfiguration
-- | Call this function at initialisation, and later for reconfiguration.
-- Config reflection is used to optimise the tracers and has to collect
-- information about the tracers. Although it is possible to give more then
-- one tracer of the same time, it is not a common case to do this.
configureTracers :: forall a m.
(MetaTrace a
, MonadIO m)
Expand Down
3 changes: 2 additions & 1 deletion trace-dispatcher/src/Cardano/Logging/Consistency.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ newtype NSLookup = NSLookup (Map.Map T.Text NSLookup)
-- Warns if namespaces in all namespaces are not unique,
-- Warns if namespaces in all namespaces are ending in the
-- middle of another namespace.
-- TODO TRACING: add more checks from documentation
-- The namespaces in allNamespaces are consistent with the namespaces for the
-- severityFor, privacyFor, detailsFor, documentFor and metricsDofFor functions.
checkTraceConfiguration ::
FilePath
-> TraceConfig
Expand Down
2 changes: 1 addition & 1 deletion trace-dispatcher/src/Cardano/Logging/Trace.hs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ contramapM' rFunc =
Trace $ T.Tracer $ T.emit rFunc

-- | Folds the monadic cata function with acc over a.
-- Uses an IORef to store the state
-- Uses an MVar to store the state
foldTraceM :: forall a acc m . (MonadUnliftIO m)
=> (acc -> LoggingContext -> a -> m acc)
-> acc
Expand Down
2 changes: 2 additions & 0 deletions trace-dispatcher/src/Cardano/Logging/Tracer/EKG.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import qualified System.Metrics.Label as Label
import System.Remote.Monitoring (Server, getCounter, getGauge, getLabel)


-- | It is mandatory to construct only one standard tracer in any application!
-- Throwing away a standard tracer and using a new one will result in an exception
ekgTracer :: MonadIO m => Either Metrics.Store Server-> m (Trace m FormattedMessage)
ekgTracer storeOrServer = liftIO $ do
rgsGauges <- newMVar Map.empty
Expand Down
2 changes: 2 additions & 0 deletions trace-dispatcher/src/Cardano/Logging/Tracer/Forward.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import Cardano.Logging.Types

---------------------------------------------------------------------------

-- | It is mandatory to construct only one forwardTracer tracer in any application!
-- Throwing away a forwardTracer tracer and using a new one will result in an exception
forwardTracer :: forall m. (MonadIO m)
=> ForwardSink TraceObject
-> Trace m FormattedMessage
Expand Down
4 changes: 2 additions & 2 deletions trace-dispatcher/src/Cardano/Logging/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,9 @@ data ConfigOption =
-- | Detail level (default is DNormal)
| ConfDetail {detail :: DetailLevel}
-- | To which backend to pass
-- Default is [EKGBackend, Forwarder, Stdout HumanFormatColoured]
-- Default is [EKGBackend, Forwarder, Stdout MachineFormat]
| ConfBackend {backends :: [BackendConfig]}
-- | Construct a limiter with name (Text) and limiting to the Double,
-- | Construct a limiter with limiting to the Double,
-- which represents frequency in number of messages per second
| ConfLimiter {maxFrequency :: Double}
deriving (Eq, Ord, Show, Generic)
Expand Down

0 comments on commit 671afa2

Please sign in to comment.