github.com/ari-anchor/sei-tendermint@v0.0.0-20230519144642-dc826b7b56bb/internal/p2p/metrics.gen.go (about)

     1  // Code generated by metricsgen. DO NOT EDIT.
     2  
     3  package p2p
     4  
     5  import (
     6  	"github.com/go-kit/kit/metrics/discard"
     7  	prometheus "github.com/go-kit/kit/metrics/prometheus"
     8  	stdprometheus "github.com/prometheus/client_golang/prometheus"
     9  )
    10  
    11  func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics {
    12  	labels := []string{}
    13  	for i := 0; i < len(labelsAndValues); i += 2 {
    14  		labels = append(labels, labelsAndValues[i])
    15  	}
    16  	return &Metrics{
    17  		Peers: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
    18  			Namespace: namespace,
    19  			Subsystem: MetricsSubsystem,
    20  			Name:      "peers",
    21  			Help:      "Number of peers.",
    22  		}, labels).With(labelsAndValues...),
    23  		PeerReceiveBytesTotal: prometheus.NewCounterFrom(stdprometheus.CounterOpts{
    24  			Namespace: namespace,
    25  			Subsystem: MetricsSubsystem,
    26  			Name:      "peer_receive_bytes_total",
    27  			Help:      "Number of bytes per channel received from a given peer.",
    28  		}, append(labels, "peer_id", "chID", "message_type")).With(labelsAndValues...),
    29  		PeerSendBytesTotal: prometheus.NewCounterFrom(stdprometheus.CounterOpts{
    30  			Namespace: namespace,
    31  			Subsystem: MetricsSubsystem,
    32  			Name:      "peer_send_bytes_total",
    33  			Help:      "Number of bytes per channel sent to a given peer.",
    34  		}, append(labels, "peer_id", "chID", "message_type")).With(labelsAndValues...),
    35  		PeerPendingSendBytes: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
    36  			Namespace: namespace,
    37  			Subsystem: MetricsSubsystem,
    38  			Name:      "peer_pending_send_bytes",
    39  			Help:      "Number of bytes pending being sent to a given peer.",
    40  		}, append(labels, "peer_id")).With(labelsAndValues...),
    41  		RouterPeerQueueRecv: prometheus.NewHistogramFrom(stdprometheus.HistogramOpts{
    42  			Namespace: namespace,
    43  			Subsystem: MetricsSubsystem,
    44  			Name:      "router_peer_queue_recv",
    45  			Help:      "The time taken to read off of a peer's queue before sending on the connection.",
    46  		}, labels).With(labelsAndValues...),
    47  		RouterPeerQueueSend: prometheus.NewHistogramFrom(stdprometheus.HistogramOpts{
    48  			Namespace: namespace,
    49  			Subsystem: MetricsSubsystem,
    50  			Name:      "router_peer_queue_send",
    51  			Help:      "The time taken to send on a peer's queue which will later be read and sent on the connection.",
    52  		}, labels).With(labelsAndValues...),
    53  		RouterChannelQueueSend: prometheus.NewHistogramFrom(stdprometheus.HistogramOpts{
    54  			Namespace: namespace,
    55  			Subsystem: MetricsSubsystem,
    56  			Name:      "router_channel_queue_send",
    57  			Help:      "The time taken to send on a p2p channel's queue which will later be consued by the corresponding reactor/service.",
    58  		}, labels).With(labelsAndValues...),
    59  		PeerQueueDroppedMsgs: prometheus.NewCounterFrom(stdprometheus.CounterOpts{
    60  			Namespace: namespace,
    61  			Subsystem: MetricsSubsystem,
    62  			Name:      "router_channel_queue_dropped_msgs",
    63  			Help:      "The number of messages dropped from a peer's queue for a specific p2p Channel.",
    64  		}, append(labels, "ch_id")).With(labelsAndValues...),
    65  		PeerQueueMsgSize: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
    66  			Namespace: namespace,
    67  			Subsystem: MetricsSubsystem,
    68  			Name:      "peer_queue_msg_size",
    69  			Help:      "The size of messages sent over a peer's queue for a specific p2p Channel.",
    70  		}, append(labels, "ch_id")).With(labelsAndValues...),
    71  	}
    72  }
    73  
    74  func NopMetrics() *Metrics {
    75  	return &Metrics{
    76  		Peers:                  discard.NewGauge(),
    77  		PeerReceiveBytesTotal:  discard.NewCounter(),
    78  		PeerSendBytesTotal:     discard.NewCounter(),
    79  		PeerPendingSendBytes:   discard.NewGauge(),
    80  		RouterPeerQueueRecv:    discard.NewHistogram(),
    81  		RouterPeerQueueSend:    discard.NewHistogram(),
    82  		RouterChannelQueueSend: discard.NewHistogram(),
    83  		PeerQueueDroppedMsgs:   discard.NewCounter(),
    84  		PeerQueueMsgSize:       discard.NewGauge(),
    85  	}
    86  }