hydra-cluster-0.15.0: Integration test suite using a local cluster of cardano and hydra nodes
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.LogFilter

Description

Utility functions to filter and simplify raw logs.

Synopsis

Documentation

data Trace tx Source #

A trace of an event or effect for a specific transaction.

Constructors

TraceEvent 

Fields

  • timestamp :: UTCTime

    The starting point in time for this event.

  • txid :: TxIdType tx

    The transaction id this event applies to.

  • us :: NominalDiffTime

    The duration of the event, expressed as a number of seconds with a $10^12$ precision.

  • event :: Text

    A string identifying this event.

TraceEffect 

Fields

  • timestamp :: UTCTime

    The starting point in time for this event.

  • txid :: TxIdType tx

    The transaction id this event applies to.

  • us :: NominalDiffTime

    The duration of the event, expressed as a number of seconds with a $10^12$ precision.

  • effect :: Text

    A string identifying this effect.

Instances

Instances details
IsTx tx => ToJSON (Trace tx) Source # 
Instance details

Defined in Hydra.LogFilter

Methods

toJSON :: Trace tx -> Value

toEncoding :: Trace tx -> Encoding

toJSONList :: [Trace tx] -> Value

toEncodingList :: [Trace tx] -> Encoding

Generic (Trace tx) Source # 
Instance details

Defined in Hydra.LogFilter

Associated Types

type Rep (Trace tx) :: Type -> Type Source #

Methods

from :: Trace tx -> Rep (Trace tx) x Source #

to :: Rep (Trace tx) x -> Trace tx Source #

IsTx tx => Show (Trace tx) Source # 
Instance details

Defined in Hydra.LogFilter

Methods

showsPrec :: Int -> Trace tx -> ShowS Source #

show :: Trace tx -> String Source #

showList :: [Trace tx] -> ShowS Source #

IsTx tx => Eq (Trace tx) Source # 
Instance details

Defined in Hydra.LogFilter

Methods

(==) :: Trace tx -> Trace tx -> Bool Source #

(/=) :: Trace tx -> Trace tx -> Bool Source #

type Rep (Trace tx) Source # 
Instance details

Defined in Hydra.LogFilter

tracePerformance :: IsTx tx => Envelope (HydraLog tx (Message tx)) -> State (Map TraceKey [Trace tx]) [Trace tx] Source #

Compute duration of some Events and Effects from logs.

This function is meant to be used with a sequence in order to traverse a stream of log entries and output list of Trace as begin/end pairs are found and identified. Each Trace emitted is tied to a specific transaction id which provides an easy way to identify in which part of their journey through Hydra transactions are spending time.

It currently compute duration of: * NewTx, ReqTx, ReqSn events, * ReqTx, TxValid and SnapshotConfirmed effects.

NOTE: Some potential improvements * Move this function to Monitoring and expose an histogram kind of metric for each type of event / effect * Handle more events, in particular the AckSn which is slightly problematic as it does not contain a direct reference to a transaction id so we would need to carry around a secondary map to keep track of this link.