libp2p
    Preparing search index...
    • A collection of metrics used throughout the Gossipsub behaviour. NOTE: except for special reasons, do not add more than 1 label for frequent metrics, there's a performance penalty as of June 2023.

      Parameters

      • register: MetricsRegister
      • topicStrToLabel: TopicStrToLabel
      • opts: {
            behaviourPenaltyThreshold: number;
            gossipPromiseExpireSec: number;
            maxMeshMessageDeliveriesWindowSec: number;
        }

      Returns {
          acceptedMessagesTotal: Gauge<{ topic: string }>;
          asyncValidationDelayFromFirstSeenSec: Histogram<NoLabels>;
          asyncValidationMcacheHit: Gauge<{ hit: "hit" | "miss" }>;
          asyncValidationUnknownFirstSeen: Gauge<NoLabels>;
          behaviourPenalty: Histogram<NoLabels>;
          cacheSize: Gauge<{ cache: string }>;
          connectedPeersBackoffSec: Histogram<NoLabels>;
          directPeersPublishedTotal: Gauge<{ topic: string }>;
          duplicateMsgDeliveryDelay: Histogram<{ topic: string }>;
          duplicateMsgIgnored: Gauge<{ topic: string }>;
          duplicateMsgLateDelivery: Gauge<{ topic: string }>;
          fanoutPeersPublishedTotal: Gauge<{ topic: string }>;
          fastMsgIdCacheCollision: Gauge<NoLabels>;
          floodsubPeersPublishedTotal: Gauge<{ topic: string }>;
          heartbeatDuration: Histogram<NoLabels>;
          heartbeatSkipped: Gauge<NoLabels>;
          idontwantRcvDonthaveMsgids: Gauge<NoLabels>;
          idontwantRcvMsgids: Gauge<NoLabels>;
          ignoredMessagesTotal: Gauge<{ topic: string }>;
          ihaveRcvIgnored: Gauge<{ reason: IHaveIgnoreReason }>;
          ihaveRcvMsgids: Gauge<{ topic: string }>;
          ihaveRcvNotSeenMsgids: Gauge<{ topic: string }>;
          iwantMessagePruned: Gauge<NoLabels>;
          iwantPromiseBroken: Gauge<NoLabels>;
          iwantPromiseDeliveryTime: Histogram<NoLabels>;
          iwantPromiseResolved: Gauge<NoLabels>;
          iwantPromiseResolvedFromDuplicate: Gauge<NoLabels>;
          iwantPromiseResolvedPeers: Gauge<NoLabels>;
          iwantPromiseStarted: Gauge<NoLabels>;
          iwantPromiseUntracked: Gauge<NoLabels>;
          iwantRcvDonthaveMsgids: Gauge<NoLabels>;
          iwantRcvMsgids: Gauge<{ topic: string }>;
          mcacheNotValidatedCount: Gauge<NoLabels>;
          mcacheSize: Gauge<NoLabels>;
          meshPeerChurnEventsBadScore: Gauge<{ topic: string }>;
          meshPeerChurnEventsDisconnected: Gauge<{ topic: string }>;
          meshPeerChurnEventsExcess: Gauge<{ topic: string }>;
          meshPeerChurnEventsPrune: Gauge<{ topic: string }>;
          meshPeerChurnEventsUnknown: Gauge<{ topic: string }>;
          meshPeerCounts: Gauge<{ topicStr: string }>;
          meshPeerInclusionEventsFanout: Gauge<{ topic: string }>;
          meshPeerInclusionEventsNotEnough: Gauge<{ topic: string }>;
          meshPeerInclusionEventsOpportunistic: Gauge<{ topic: string }>;
          meshPeerInclusionEventsOutbound: Gauge<{ topic: string }>;
          meshPeerInclusionEventsRandom: Gauge<{ topic: string }>;
          meshPeerInclusionEventsSubscribed: Gauge<{ topic: string }>;
          meshPeerInclusionEventsUnknown: Gauge<{ topic: string }>;
          meshPeersPublishedTotal: Gauge<{ topic: string }>;
          msgForwardCount: Gauge<{ topic: string }>;
          msgForwardPeers: Gauge<{ topic: string }>;
          msgPublishBytes: Gauge<{ topic: string }>;
          msgPublishCount: Gauge<{ topic: string }>;
          msgPublishPeersByTopic: Gauge<{ topic: string }>;
          msgPublishTime: Histogram<{ topic: string }>;
          msgReceivedError: Gauge<{ topic: string }>;
          msgReceivedInvalid: Gauge<{ error: RejectReason | ValidateError }>;
          msgReceivedInvalidByTopic: Gauge<{ topic: string }>;
          msgReceivedPreValidation: Gauge<{ topic: string }>;
          newConnectionCount: Gauge<{ status: string }>;
          peerReadStreamError: Gauge<NoLabels>;
          peersByScoreThreshold: Gauge<{ threshold: ScoreThreshold }>;
          peersPerProtocol: Gauge<{ protocol: string }>;
          prevalidationDuplicateTotal: Gauge<{ topic: string }>;
          prevalidationInvalidTotal: Gauge<{ topic: string }>;
          prevalidationUnknownTotal: Gauge<{ topic: string }>;
          prevalidationValidTotal: Gauge<{ topic: string }>;
          protocolsEnabled: Gauge<{ protocol: string }>;
          rejectedMessagesTotal: Gauge<{ topic: string }>;
          rpcDataError: Gauge<NoLabels>;
          rpcRecvBytes: Gauge<NoLabels>;
          rpcRecvControl: Gauge<NoLabels>;
          rpcRecvCount: Gauge<NoLabels>;
          rpcRecvError: Gauge<NoLabels>;
          rpcRecvGraft: Gauge<NoLabels>;
          rpcRecvIHave: Gauge<NoLabels>;
          rpcRecvIWant: Gauge<NoLabels>;
          rpcRecvMessage: Gauge<NoLabels>;
          rpcRecvNotAccepted: Gauge<NoLabels>;
          rpcRecvPrune: Gauge<NoLabels>;
          rpcRecvSubscription: Gauge<NoLabels>;
          rpcSentBytes: Gauge<NoLabels>;
          rpcSentControl: Gauge<NoLabels>;
          rpcSentCount: Gauge<NoLabels>;
          rpcSentGraft: Gauge<NoLabels>;
          rpcSentIDontWant: Gauge<NoLabels>;
          rpcSentIHave: Gauge<NoLabels>;
          rpcSentIWant: Gauge<NoLabels>;
          rpcSentMessage: Gauge<NoLabels>;
          rpcSentPrune: Gauge<NoLabels>;
          rpcSentSubscription: Gauge<NoLabels>;
          score: AvgMinMax<NoLabels>;
          scoreCachedDelta: Histogram<NoLabels>;
          scoreFnCalls: Gauge<NoLabels>;
          scoreFnRuns: Gauge<NoLabels>;
          scorePerMesh: AvgMinMax<{ topic: string }>;
          scoreWeights: AvgMinMax<{ p: string; topic?: string }>;
          scoringPenalties: Gauge<{ penalty: ScorePenalty }>;
          topicPeersCount: Gauge<{ topicStr: string }>;
          topicStrToLabel: TopicStrToLabel;
          topicSubscriptionStatus: Gauge<{ topicStr: string }>;
          unknownValidationResultsTotal: Gauge<{ topic: string }>;
          onAddToMesh(topicStr: string, reason: InclusionReason, count: number): void;
          onDuplicateMsgDelivery(
              topicStr: string,
              deliveryDelayMs: number,
              isLateDelivery: boolean,
          ): void;
          onForwardMsg(topicStr: string, tosendCount: number): void;
          onIdontwantRcv(idontwant: number, idontwantDonthave: number): void;
          onIhaveRcv(topicStr: string, ihave: number, idonthave: number): void;
          onIwantRcv(iwantByTopic: Map<string, number>, iwantDonthave: number): void;
          onJoin(topicStr: string): void;
          onLeave(topicStr: string): void;
          onMsgRecvError(topicStr: string): void;
          onMsgRecvInvalid(topicStr: string, reason: RejectReasonObj): void;
          onMsgRecvPreValidation(topicStr: string): void;
          onPeerReadStreamError(): void;
          onPrevalidationResult(topicStr: string, status: MessageStatus): void;
          onPublishDuplicateMsg(topicStr: string): void;
          onPublishMsg(
              topicStr: string,
              tosendGroupCount: ToSendGroupCount,
              tosendCount: number,
              dataLen: number,
              ms: number,
          ): void;
          onRemoveFromMesh(
              topicStr: string,
              reason: ChurnReason,
              count: number,
          ): void;
          onReportValidation(
              messageRecord: null | { message: { topic: string } },
              acceptance: TopicValidatorResult,
              firstSeenTimestampMs: null | number,
          ): void;
          onRpcDataError(): void;
          onRpcRecv(rpc: RPC, rpcBytes: number): void;
          onRpcRecvError(): void;
          onRpcSent(rpc: RPC, rpcBytes: number): void;
          onScorePenalty(penalty: ScorePenalty): void;
          registerScorePerMesh(
              mesh: Map<string, Set<string>>,
              scoreByPeer: Map<string, number>,
          ): void;
          registerScores(
              scores: number[],
              scoreThresholds: PeerScoreThresholds,
          ): void;
          registerScoreWeights(sw: ScoreWeights<number[]>): void;
          toTopic(topicStr: string): string;
      }

      • acceptedMessagesTotal: Gauge<{ topic: string }>

        Message validation results for each topic. Invalid == Reject? = rust-libp2p invalid_messages, accepted_messages, ignored_messages, rejected_messages

      • asyncValidationDelayFromFirstSeenSec: Histogram<NoLabels>
      • asyncValidationMcacheHit: Gauge<{ hit: "hit" | "miss" }>

        When the user validates a message, it tries to re propagate it to its mesh peers. If the message expires from the memcache before it can be validated, we count this a cache miss and it is an indicator that the memcache size should be increased. = rust-libp2p mcache_misses

      • asyncValidationUnknownFirstSeen: Gauge<NoLabels>
      • behaviourPenalty: Histogram<NoLabels>
      • cacheSize: Gauge<{ cache: string }>

        Unbounded cache sizes

      • connectedPeersBackoffSec: Histogram<NoLabels>

        Backoff time

      • directPeersPublishedTotal: Gauge<{ topic: string }>

        Total count of peers (by group) that we publish a msg to

      • duplicateMsgDeliveryDelay: Histogram<{ topic: string }>

        Track duplicate message delivery time

      • duplicateMsgIgnored: Gauge<{ topic: string }>
      • duplicateMsgLateDelivery: Gauge<{ topic: string }>

        Total count of late msg delivery total by topic

      • fanoutPeersPublishedTotal: Gauge<{ topic: string }>
      • fastMsgIdCacheCollision: Gauge<NoLabels>
      • floodsubPeersPublishedTotal: Gauge<{ topic: string }>
      • heartbeatDuration: Histogram<NoLabels>

        The time it takes to complete one iteration of the heartbeat.

      • heartbeatSkipped: Gauge<NoLabels>

        Heartbeat run took longer than heartbeat interval so next is skipped

      • idontwantRcvDonthaveMsgids: Gauge<NoLabels>

        Total received IDONTWANT messageIDs that we don't have

      • idontwantRcvMsgids: Gauge<NoLabels>

        Total received IDONTWANT messages

      • ignoredMessagesTotal: Gauge<{ topic: string }>
      • ihaveRcvIgnored: Gauge<{ reason: IHaveIgnoreReason }>

        Total received IHAVE messages that we ignore for some reason

      • ihaveRcvMsgids: Gauge<{ topic: string }>

        Total received IHAVE messages by topic

      • ihaveRcvNotSeenMsgids: Gauge<{ topic: string }>

        Total messages per topic we don't have. Not actual requests. The number of times we have decided that an IWANT control message is required for this topic. A very high metric might indicate an underperforming network. = rust-libp2p topic_iwant_msgs

      • iwantMessagePruned: Gauge<NoLabels>
      • iwantPromiseBroken: Gauge<NoLabels>
      • iwantPromiseDeliveryTime: Histogram<NoLabels>

        Histogram of delivery time of resolved IWANT promises

      • iwantPromiseResolved: Gauge<NoLabels>

        Total count of resolved IWANT promises

      • iwantPromiseResolvedFromDuplicate: Gauge<NoLabels>

        Total count of resolved IWANT promises from duplicate messages

      • iwantPromiseResolvedPeers: Gauge<NoLabels>

        Total count of peers we have asked IWANT promises that are resolved

      • iwantPromiseStarted: Gauge<NoLabels>
      • iwantPromiseUntracked: Gauge<NoLabels>
      • iwantRcvDonthaveMsgids: Gauge<NoLabels>

        Total requested messageIDs that we don't have

      • iwantRcvMsgids: Gauge<{ topic: string }>

        Total received IWANT messages by topic

      • mcacheNotValidatedCount: Gauge<NoLabels>
      • mcacheSize: Gauge<NoLabels>

        Current mcache msg count

      • meshPeerChurnEventsBadScore: Gauge<{ topic: string }>
      • meshPeerChurnEventsDisconnected: Gauge<{ topic: string }>

        Number of times we remove peers in a topic mesh for different reasons. = rust-libp2p mesh_peer_churn_events

      • meshPeerChurnEventsExcess: Gauge<{ topic: string }>
      • meshPeerChurnEventsPrune: Gauge<{ topic: string }>
      • meshPeerChurnEventsUnknown: Gauge<{ topic: string }>
      • meshPeerCounts: Gauge<{ topicStr: string }>

        Number of peers in our mesh. This metric should be updated with the count of peers for a topic in the mesh regardless of inclusion and churn events. = rust-libp2p mesh_peer_counts

      • meshPeerInclusionEventsFanout: Gauge<{ topic: string }>

        Number of times we include peers in a topic mesh for different reasons. = rust-libp2p mesh_peer_inclusion_events

      • meshPeerInclusionEventsNotEnough: Gauge<{ topic: string }>
      • meshPeerInclusionEventsOpportunistic: Gauge<{ topic: string }>
      • meshPeerInclusionEventsOutbound: Gauge<{ topic: string }>
      • meshPeerInclusionEventsRandom: Gauge<{ topic: string }>
      • meshPeerInclusionEventsSubscribed: Gauge<{ topic: string }>
      • meshPeerInclusionEventsUnknown: Gauge<{ topic: string }>
      • meshPeersPublishedTotal: Gauge<{ topic: string }>
      • msgForwardCount: Gauge<{ topic: string }>

        Total count of msg forwarded by topic

      • msgForwardPeers: Gauge<{ topic: string }>

        Total count of peers that we forward a msg to

      • msgPublishBytes: Gauge<{ topic: string }>

        Total count of msg publish data.length bytes

      • msgPublishCount: Gauge<{ topic: string }>

        Total count of msg published by topic

      • msgPublishPeersByTopic: Gauge<{ topic: string }>

        Total count of peers that we publish a msg to

      • msgPublishTime: Histogram<{ topic: string }>

        Total time in seconds to publish a message

      • msgReceivedError: Gauge<{ topic: string }>

        Total count of recv msgs error

      • msgReceivedInvalid: Gauge<{ error: RejectReason | ValidateError }>

        Tracks specific reason of invalid

      • msgReceivedInvalidByTopic: Gauge<{ topic: string }>
      • msgReceivedPreValidation: Gauge<{ topic: string }>

        Total count of recv msgs before any validation

      • newConnectionCount: Gauge<{ status: string }>
      • peerReadStreamError: Gauge<NoLabels>
      • peersByScoreThreshold: Gauge<{ threshold: ScoreThreshold }>

        Current count of peers by score threshold

      • peersPerProtocol: Gauge<{ protocol: string }>

        Gossipsub supports floodsub, gossipsub v1.0, v1.1, and v1.2. Peers are classified based on which protocol they support. This metric keeps track of the number of peers that are connected of each type.

      • prevalidationDuplicateTotal: Gauge<{ topic: string }>
      • prevalidationInvalidTotal: Gauge<{ topic: string }>

        Tracks distribution of recv msgs by duplicate, invalid, valid

      • prevalidationUnknownTotal: Gauge<{ topic: string }>
      • prevalidationValidTotal: Gauge<{ topic: string }>
      • protocolsEnabled: Gauge<{ protocol: string }>
      • rejectedMessagesTotal: Gauge<{ topic: string }>
      • rpcDataError: Gauge<NoLabels>
      • rpcRecvBytes: Gauge<NoLabels>
      • rpcRecvControl: Gauge<NoLabels>
      • rpcRecvCount: Gauge<NoLabels>
      • rpcRecvError: Gauge<NoLabels>
      • rpcRecvGraft: Gauge<NoLabels>
      • rpcRecvIHave: Gauge<NoLabels>
      • rpcRecvIWant: Gauge<NoLabels>
      • rpcRecvMessage: Gauge<NoLabels>
      • rpcRecvNotAccepted: Gauge<NoLabels>

        Total count of RPC dropped because acceptFrom() == false

      • rpcRecvPrune: Gauge<NoLabels>
      • rpcRecvSubscription: Gauge<NoLabels>
      • rpcSentBytes: Gauge<NoLabels>
      • rpcSentControl: Gauge<NoLabels>
      • rpcSentCount: Gauge<NoLabels>
      • rpcSentGraft: Gauge<NoLabels>
      • rpcSentIDontWant: Gauge<NoLabels>
      • rpcSentIHave: Gauge<NoLabels>
      • rpcSentIWant: Gauge<NoLabels>
      • rpcSentMessage: Gauge<NoLabels>
      • rpcSentPrune: Gauge<NoLabels>
      • rpcSentSubscription: Gauge<NoLabels>
      • score: AvgMinMax<NoLabels>
      • scoreCachedDelta: Histogram<NoLabels>
      • scoreFnCalls: Gauge<NoLabels>

        Total times score() is called

      • scoreFnRuns: Gauge<NoLabels>

        Total times score() call actually computed computeScore(), no cache

      • scorePerMesh: AvgMinMax<{ topic: string }>

        Histogram of the scores for each mesh topic.

      • scoreWeights: AvgMinMax<{ p: string; topic?: string }>

        Separate score weights Need to use 2-label metrics in this case to debug the score weights

      • scoringPenalties: Gauge<{ penalty: ScorePenalty }>

        A counter of the kind of penalties being applied to peers.

      • topicPeersCount: Gauge<{ topicStr: string }>

        Number of peers subscribed to each topic. This allows us to analyze a topic's behaviour regardless of our subscription status.

      • topicStrToLabel: TopicStrToLabel
      • topicSubscriptionStatus: Gauge<{ topicStr: string }>

        Status of our subscription to this topic. This metric allows analyzing other topic metrics filtered by our current subscription status. = rust-libp2p topic_subscription_status

      • unknownValidationResultsTotal: Gauge<{ topic: string }>
      • onAddToMesh: function
      • onDuplicateMsgDelivery: function
        • Parameters

          • topicStr: string
          • deliveryDelayMs: number
          • isLateDelivery: boolean

          Returns void

      • onForwardMsg: function
      • onIdontwantRcv: function
      • onIhaveRcv: function
      • onIwantRcv: function
      • onJoin: function
      • onLeave: function
      • onMsgRecvError: function
      • onMsgRecvInvalid: function
      • onMsgRecvPreValidation: function
      • onPeerReadStreamError: function
      • onPrevalidationResult: function
      • onPublishDuplicateMsg: function
      • onPublishMsg: function
      • onRemoveFromMesh: function
      • onReportValidation: function
        • Update validation result to metrics

          Parameters

          • messageRecord: null | { message: { topic: string } }

            null means the message's mcache record was not known at the time of acceptance report

          • acceptance: TopicValidatorResult
          • firstSeenTimestampMs: null | number

          Returns void

      • onRpcDataError: function
      • onRpcRecv: function
      • onRpcRecvError: function
      • onRpcSent: function
      • onScorePenalty: function
          • in handle_graft() Penalty::GraftBackoff
          • in apply_iwant_penalties() Penalty::BrokenPromise
          • in metric_score() P3 Penalty::MessageDeficit
          • in metric_score() P6 Penalty::IPColocation

          Parameters

          Returns void

      • registerScorePerMesh: function
      • registerScores: function
      • registerScoreWeights: function
      • toTopic: function