Change metric type from Gauge to Counter (#569)

This commit is contained in:
Jason Murray 2021-05-14 16:05:54 -07:00 committed by GitHub
parent 937bca3f37
commit 1c21eb8e87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 13 deletions

View File

@ -81,37 +81,37 @@ func (c Metrics) Describe(ch chan<- *prometheus.Desc) {
func (c Metrics) Collect(ch chan<- prometheus.Metric) {
ch <- prometheus.MustNewConstMetric(
c.TotalPushCount,
prometheus.GaugeValue,
prometheus.CounterValue,
float64(StatStorage.GetTotalCount()),
)
ch <- prometheus.MustNewConstMetric(
c.IosSuccess,
prometheus.GaugeValue,
prometheus.CounterValue,
float64(StatStorage.GetIosSuccess()),
)
ch <- prometheus.MustNewConstMetric(
c.IosError,
prometheus.GaugeValue,
prometheus.CounterValue,
float64(StatStorage.GetIosError()),
)
ch <- prometheus.MustNewConstMetric(
c.AndroidSuccess,
prometheus.GaugeValue,
prometheus.CounterValue,
float64(StatStorage.GetAndroidSuccess()),
)
ch <- prometheus.MustNewConstMetric(
c.AndroidError,
prometheus.GaugeValue,
prometheus.CounterValue,
float64(StatStorage.GetAndroidError()),
)
ch <- prometheus.MustNewConstMetric(
c.HuaweiSuccess,
prometheus.GaugeValue,
prometheus.CounterValue,
float64(StatStorage.GetHuaweiSuccess()),
)
ch <- prometheus.MustNewConstMetric(
c.HuaweiError,
prometheus.GaugeValue,
prometheus.CounterValue,
float64(StatStorage.GetHuaweiError()),
)
ch <- prometheus.MustNewConstMetric(

View File

@ -159,11 +159,13 @@ func newApnsClient(certificate tls.Certificate) (*apns2.Client, error) {
IdleConnTimeout: idleConnTimeout,
}
if h2Transport, err := http2.ConfigureTransports(transport); err != nil {
h2Transport, err := http2.ConfigureTransports(transport)
if err != nil {
return nil, err
} else {
configureHTTP2ConnHealthCheck(h2Transport)
}
configureHTTP2ConnHealthCheck(h2Transport)
client.HTTPClient.Transport = transport
return client, nil
@ -188,12 +190,13 @@ func newApnsTokenClient(token *token.Token) (*apns2.Client, error) {
IdleConnTimeout: idleConnTimeout,
}
if h2Transport, err := http2.ConfigureTransports(transport); err != nil {
h2Transport, err := http2.ConfigureTransports(transport)
if err != nil {
return nil, err
} else {
configureHTTP2ConnHealthCheck(h2Transport)
}
configureHTTP2ConnHealthCheck(h2Transport)
client.HTTPClient.Transport = transport
return client, nil