ouroboros-network-0.16.0.0: A networking layer for the Ouroboros blockchain protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Network.PeerSelection.PeerMetric

Synopsis

Peer metrics

data PeerMetrics m p Source #

Mutable peer metrics state accessible via STM.

newtype PeerMetricsConfiguration Source #

Constructors

PeerMetricsConfiguration 

Fields

  • maxEntriesToTrackInt

    The maximum numbers of slots we will store data for. On some chains sometimes this corresponds to 1h worth of metrics *sighs*.

    this number MUST correspond to number of headers / blocks which are produced in one hour.

Instances

Instances details
Generic PeerMetricsConfiguration Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerMetric

Associated Types

type Rep PeerMetricsConfigurationTypeType #

Show PeerMetricsConfiguration Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerMetric

NFData PeerMetricsConfiguration Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerMetric

Methods

rnfPeerMetricsConfiguration → () #

NoThunks PeerMetricsConfiguration Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerMetric

type Rep PeerMetricsConfiguration Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerMetric

type Rep PeerMetricsConfiguration = D1 ('MetaData "PeerMetricsConfiguration" "Ouroboros.Network.PeerSelection.PeerMetric" "ouroboros-network-0.16.0.0-inplace" 'True) (C1 ('MetaCons "PeerMetricsConfiguration" 'PrefixI 'True) (S1 ('MetaSel ('Just "maxEntriesToTrack") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))

Metric calculations

joinedPeerMetricAt ∷ ∀ p m. MonadSTM m ⇒ Ord p ⇒ PeerMetrics m p → STM m (Map p SlotNo) Source #

upstreamyness ∷ ∀ p m. MonadSTM m ⇒ Ord p ⇒ PeerMetrics m p → STM m (Map p Int) Source #

Returns a Map which counts the number of times a given peer was the first to present us with a block/header.

fetchynessBytes ∷ ∀ p m. MonadSTM m ⇒ Ord p ⇒ PeerMetrics m p → STM m (Map p Int) Source #

Returns a Map which counts the number of bytes downloaded for a given peer.

fetchynessBlocks ∷ ∀ p m. MonadSTM m ⇒ Ord p ⇒ PeerMetrics m p → STM m (Map p Int) Source #

Returns a Map which counts the number of times a given peer was the first we downloaded a block from.

Tracers

headerMetricTracer ∷ ∀ m p. (MonadSTM m, Ord p) ⇒ PeerMetricsConfigurationPeerMetrics m p → Tracer (STM m) (TraceLabelPeer (ConnectionId p) (SlotNo, Time)) Source #

Tracer which updates header metrics (upstreameness) and inserts new peers into peerRegistry.

fetchedMetricTracer ∷ ∀ m p. (MonadSTM m, Ord p) ⇒ PeerMetricsConfigurationPeerMetrics m p → Tracer (STM m) (TraceLabelPeer (ConnectionId p) (SizeInBytes, SlotNo, Time)) Source #

Tracer which updates fetched metrics (fetchyness) and inserts new peers into peerRegistry.

Metrics reporters

data ReportPeerMetrics (m ∷ TypeType) peerAddr Source #

Constructors

ReportPeerMetrics 

Internals

type SlotMetric p = IntPSQ SlotNo (p, Time) Source #

Integer based metric ordered by SlotNo which holds the peer and time.

The p parameter is truly polymorphic. For upstreamyness and we use peer address, and for fetchyness it is a pair of peer id and bytes downloaded.