Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data PeerMetrics (m :: Type -> Type) p
- newtype PeerMetricsConfiguration = PeerMetricsConfiguration {}
- newPeerMetric :: (MonadLabelledSTM m, NoThunks p, NFData p) => PeerMetricsConfiguration -> m (PeerMetrics m p)
- joinedPeerMetricAt :: forall p (m :: Type -> Type). (MonadSTM m, Ord p) => PeerMetrics m p -> STM m (Map p SlotNo)
- upstreamyness :: forall p (m :: Type -> Type). (MonadSTM m, Ord p) => PeerMetrics m p -> STM m (Map p Int)
- fetchynessBytes :: forall p (m :: Type -> Type). (MonadSTM m, Ord p) => PeerMetrics m p -> STM m (Map p Int)
- fetchynessBlocks :: forall p (m :: Type -> Type). (MonadSTM m, Ord p) => PeerMetrics m p -> STM m (Map p Int)
- headerMetricTracer :: forall (m :: Type -> Type) p. (MonadSTM m, Ord p) => PeerMetricsConfiguration -> PeerMetrics m p -> Tracer (STM m) (TraceLabelPeer (ConnectionId p) (SlotNo, Time))
- fetchedMetricTracer :: forall (m :: Type -> Type) 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 :: forall (m :: Type -> Type) p. MonadSTM m => ReportPeerMetrics m p
- reportMetric :: forall (m :: Type -> Type) 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
newtype PeerMetricsConfiguration Source #
PeerMetricsConfiguration | |
|
Instances
newPeerMetric :: (MonadLabelledSTM m, NoThunks p, NFData p) => PeerMetricsConfiguration -> m (PeerMetrics m p) Source #
Metric calculations
joinedPeerMetricAt :: forall p (m :: Type -> Type). (MonadSTM m, Ord p) => PeerMetrics m p -> STM m (Map p SlotNo) Source #
upstreamyness :: forall p (m :: Type -> Type). (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 :: forall p (m :: Type -> Type). (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 :: forall p (m :: Type -> Type). (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 :: forall (m :: Type -> Type) 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 :: forall (m :: Type -> Type) 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 #
ReportPeerMetrics | |
|
nullMetric :: forall (m :: Type -> Type) p. MonadSTM m => ReportPeerMetrics m p Source #
reportMetric :: forall (m :: Type -> Type) 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 #