Exemple #1
0
package fcm

import (
	"github.com/smancke/guble/server/metrics"
	"time"
)

var (
	ns                                = metrics.NS("fcm")
	mTotalSentMessages                = ns.NewInt("total_sent_messages")
	mTotalSendErrors                  = ns.NewInt("total_sent_message_errors")
	mTotalResponseErrors              = ns.NewInt("total_response_errors")
	mTotalResponseInternalErrors      = ns.NewInt("total_response_internal_errors")
	mTotalResponseNotRegisteredErrors = ns.NewInt("total_response_not_registered_errors")
	mTotalReplacedCanonicalErrors     = ns.NewInt("total_replaced_canonical_errors")
	mTotalResponseOtherErrors         = ns.NewInt("total_response_other_errors")
	mMinute                           = ns.NewMap("minute")
	mHour                             = ns.NewMap("hour")
	mDay                              = ns.NewMap("day")
)

const (
	currentTotalMessagesLatenciesKey = "current_messages_total_latencies_nanos"
	currentTotalMessagesKey          = "current_messages_count"
	currentTotalErrorsLatenciesKey   = "current_errors_total_latencies_nanos"
	currentTotalErrorsKey            = "current_errors_count"
)

func processAndResetIntervalMetrics(m metrics.Map, td time.Duration, t time.Time) {
	msgLatenciesValue := m.Get(currentTotalMessagesLatenciesKey)
	msgNumberValue := m.Get(currentTotalMessagesKey)
Exemple #2
0
package apns

import (
	"github.com/smancke/guble/server/metrics"
	"time"
)

var (
	ns                               = metrics.NS("apns")
	mTotalSentMessages               = ns.NewInt("total_sent_messages")
	mTotalSendErrors                 = ns.NewInt("total_sent_message_errors")
	mTotalResponseErrors             = ns.NewInt("total_response_errors")
	mTotalResponseInternalErrors     = ns.NewInt("total_response_internal_errors")
	mTotalResponseRegistrationErrors = ns.NewInt("total_response_registration_errors")
	mTotalResponseOtherErrors        = ns.NewInt("total_response_other_errors")
	mMinute                          = ns.NewMap("minute")
	mHour                            = ns.NewMap("hour")
	mDay                             = ns.NewMap("day")
)

const (
	currentTotalMessagesLatenciesKey = "current_messages_total_latencies_nanos"
	currentTotalMessagesKey          = "current_messages_count"
	currentTotalErrorsLatenciesKey   = "current_errors_total_latencies_nanos"
	currentTotalErrorsKey            = "current_errors_count"
)

func processAndResetIntervalMetrics(m metrics.Map, td time.Duration, t time.Time) {
	msgLatenciesValue := m.Get(currentTotalMessagesLatenciesKey)
	msgNumberValue := m.Get(currentTotalMessagesKey)
	errLatenciesValue := m.Get(currentTotalErrorsLatenciesKey)