diff --git a/gorush/metrics.go b/gorush/metrics.go index 058c021..0f47053 100644 --- a/gorush/metrics.go +++ b/gorush/metrics.go @@ -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( diff --git a/gorush/notification_apns.go b/gorush/notification_apns.go index ee7a5c3..f7f057d 100644 --- a/gorush/notification_apns.go +++ b/gorush/notification_apns.go @@ -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