Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Ouroboros.Network.PeerSelection.PeerMetric
Synopsis
- data PeerMetrics m p
- newtype PeerMetricsConfiguration = PeerMetricsConfiguration {}
- newPeerMetric ∷ (MonadLabelledSTM m, NoThunks p, NFData p) ⇒ PeerMetricsConfiguration → m (PeerMetrics m p)
- joinedPeerMetricAt ∷ ∀ p m. MonadSTM m ⇒ Ord p ⇒ PeerMetrics m p → STM m (Map p SlotNo)
- upstreamyness ∷ ∀ p m. MonadSTM m ⇒ Ord p ⇒ PeerMetrics m p → STM m (Map p Int)
- fetchynessBytes ∷ ∀ p m. MonadSTM m ⇒ Ord p ⇒ PeerMetrics m p → STM m (Map p Int)
- fetchynessBlocks ∷ ∀ p m. MonadSTM m ⇒ Ord p ⇒ PeerMetrics m p → STM m (Map p Int)
- headerMetricTracer ∷ ∀ m p. (MonadSTM m, Ord p) ⇒ PeerMetricsConfiguration → PeerMetrics m p → Tracer (STM m) (TraceLabelPeer (ConnectionId p) (SlotNo, Time))
- fetchedMetricTracer ∷ ∀ m p. (MonadSTM m, Ord p) ⇒ PeerMetricsConfiguration → PeerMetrics m p → Tracer (STM m) (TraceLabelPeer (ConnectionId p) (SizeInBytes, SlotNo, Time))
- data ReportPeerMetrics (m ∷ Type → Type) peerAddr = ReportPeerMetrics {
- reportHeader ∷ Tracer (STM m) (TraceLabelPeer peerAddr (SlotNo, Time))
- reportFetch ∷ Tracer (STM m) (TraceLabelPeer peerAddr (SizeInBytes, SlotNo, Time))
- nullMetric ∷ MonadSTM m ⇒ ReportPeerMetrics m p
- reportMetric ∷ ∀ m p. (MonadSTM m, Ord p) ⇒ PeerMetricsConfiguration → PeerMetrics m p → ReportPeerMetrics m (ConnectionId p)
- type SlotMetric p = IntPSQ SlotNo (p, Time)
- newPeerMetric' ∷ (MonadLabelledSTM m, NoThunks p, NFData p) ⇒ SlotMetric p → SlotMetric (p, SizeInBytes) → PeerMetricsConfiguration → m (PeerMetrics m p)
Peer metrics
data PeerMetrics m p Source #
Mutable peer metrics state accessible via STM
.
newtype PeerMetricsConfiguration Source #
Constructors
PeerMetricsConfiguration | |
Fields
|
Instances
Generic PeerMetricsConfiguration Source # | |
Defined in Ouroboros.Network.PeerSelection.PeerMetric Associated Types type Rep PeerMetricsConfiguration ∷ Type → Type # | |
Show PeerMetricsConfiguration Source # | |
Defined in Ouroboros.Network.PeerSelection.PeerMetric Methods showsPrec ∷ Int → PeerMetricsConfiguration → ShowS # | |
NFData PeerMetricsConfiguration Source # | |
Defined in Ouroboros.Network.PeerSelection.PeerMetric Methods rnf ∷ PeerMetricsConfiguration → () # | |
NoThunks PeerMetricsConfiguration Source # | |
Defined in Ouroboros.Network.PeerSelection.PeerMetric | |
type Rep PeerMetricsConfiguration Source # | |
Defined in Ouroboros.Network.PeerSelection.PeerMetric type Rep PeerMetricsConfiguration = D1 ('MetaData "PeerMetricsConfiguration" "Ouroboros.Network.PeerSelection.PeerMetric" "ouroboros-network-0.10.1.0-inplace" 'True) (C1 ('MetaCons "PeerMetricsConfiguration" 'PrefixI 'True) (S1 ('MetaSel ('Just "maxEntriesToTrack") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))) |
newPeerMetric ∷ (MonadLabelledSTM m, NoThunks p, NFData p) ⇒ PeerMetricsConfiguration → m (PeerMetrics m p) Source #
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) ⇒ PeerMetricsConfiguration → PeerMetrics 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) ⇒ PeerMetricsConfiguration → PeerMetrics 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 ∷ Type → Type) peerAddr Source #
Constructors
ReportPeerMetrics | |
Fields
|
nullMetric ∷ MonadSTM m ⇒ ReportPeerMetrics m p Source #
reportMetric ∷ ∀ m p. (MonadSTM m, Ord p) ⇒ PeerMetricsConfiguration → PeerMetrics m p → ReportPeerMetrics m (ConnectionId p) Source #
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.
newPeerMetric' ∷ (MonadLabelledSTM m, NoThunks p, NFData p) ⇒ SlotMetric p → SlotMetric (p, SizeInBytes) → PeerMetricsConfiguration → m (PeerMetrics m p) Source #