github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/broker/federation/stats/stats.go (about)

     1  // Copyright (c) 2017-2021, R.I. Pienaar and the Choria Project contributors
     2  //
     3  // SPDX-License-Identifier: Apache-2.0
     4  
     5  package stats
     6  
     7  import (
     8  	"github.com/prometheus/client_golang/prometheus"
     9  )
    10  
    11  var (
    12  	ReceivedMsgsCtr = prometheus.NewCounterVec(prometheus.CounterOpts{
    13  		Name: "choria_federation_received_msgs",
    14  		Help: "Number of messages received by a Federation Broker worker",
    15  	}, []string{"name", "worker", "connected_to", "cluster", "identity"})
    16  
    17  	PublishedMsgsCtr = prometheus.NewCounterVec(prometheus.CounterOpts{
    18  		Name: "choria_federation_published_msgs",
    19  		Help: "Number of messages published by a Federation Broker worker",
    20  	}, []string{"name", "worker", "connected_to", "cluster", "identity"})
    21  
    22  	ErrorCtr = prometheus.NewCounterVec(prometheus.CounterOpts{
    23  		Name: "choria_federation_errors",
    24  		Help: "Messages that could not be handled",
    25  	}, []string{"name", "worker", "connected_to", "cluster", "identity"})
    26  
    27  	ProcessTime = prometheus.NewSummaryVec(prometheus.SummaryOpts{
    28  		Name: "choria_federation_time",
    29  		Help: "Time taken to process messages",
    30  	}, []string{"name", "worker", "connected_to", "cluster", "identity"})
    31  )
    32  
    33  func init() {
    34  	prometheus.MustRegister(ReceivedMsgsCtr)
    35  	prometheus.MustRegister(PublishedMsgsCtr)
    36  	prometheus.MustRegister(ErrorCtr)
    37  	prometheus.MustRegister(ProcessTime)
    38  }