receiver/pubsub/pubsub.go
func (rcv *PubSub) Stat(send helper.StatCallback) {
	messagesReceived := atomic.LoadUint32(&rcv.messagesReceived)
	send("messagesReceived", float64(messagesReceived))

	metricsReceived := atomic.LoadUint32(&rcv.metricsReceived)
	send("metricsReceived", float64(metricsReceived))

	errors := atomic.LoadUint32(&rcv.errors)
	send("errors", float64(errors))

	if !rcv.statsAsCounters {
		atomic.AddUint32(&rcv.messagesReceived, -messagesReceived)
		atomic.AddUint32(&rcv.metricsReceived, -metricsReceived)
		atomic.AddUint32(&rcv.errors, -errors)
	}
}
func (rcv *PubSub) Stat(send helper.StatCallback) {
	messagesReceived := atomic.LoadUint32(&rcv.messagesReceived)
	send("messagesReceived", float64(messagesReceived))

	metricsReceived := atomic.LoadUint32(&rcv.metricsReceived)
	send("metricsReceived", float64(metricsReceived))

	errors := atomic.LoadUint32(&rcv.errors)
	send("errors", float64(errors))

	if !rcv.statsAsCounters {
		atomic.AddUint32(&rcv.messagesReceived, -messagesReceived)
		atomic.AddUint32(&rcv.metricsReceived, -metricsReceived)
		atomic.AddUint32(&rcv.errors, -errors)
	}
}
func ( rcv * PubSub ) Stat ( send helper . StatCallback ) { messagesReceived := atomic . LoadUint32 ( & rcv . messagesReceived ) send ( " " , float64 ( messagesReceived ) ) metricsReceived := atomic . LoadUint32 ( & rcv . metricsReceived ) send ( " " , float64 ( metricsReceived ) ) errors := atomic . LoadUint32 ( & rcv . errors ) send ( " " , float64 ( errors ) ) if ! rcv . statsAsCounters { atomic . AddUint32 ( & rcv . messagesReceived , - messagesReceived ) atomic . AddUint32 ( & rcv . metricsReceived , - metricsReceived ) atomic . AddUint32 ( & rcv . errors , - errors ) } }
// Stat sends pubsub receiver's internal stats to specified callback
Stat sends pubsub receiver s internal stats to specified callback