Change metric type from Gauge to Counter (#569)
This commit is contained in:
parent
937bca3f37
commit
1c21eb8e87
|
@ -81,37 +81,37 @@ func (c Metrics) Describe(ch chan<- *prometheus.Desc) {
|
||||||
func (c Metrics) Collect(ch chan<- prometheus.Metric) {
|
func (c Metrics) Collect(ch chan<- prometheus.Metric) {
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.TotalPushCount,
|
c.TotalPushCount,
|
||||||
prometheus.GaugeValue,
|
prometheus.CounterValue,
|
||||||
float64(StatStorage.GetTotalCount()),
|
float64(StatStorage.GetTotalCount()),
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.IosSuccess,
|
c.IosSuccess,
|
||||||
prometheus.GaugeValue,
|
prometheus.CounterValue,
|
||||||
float64(StatStorage.GetIosSuccess()),
|
float64(StatStorage.GetIosSuccess()),
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.IosError,
|
c.IosError,
|
||||||
prometheus.GaugeValue,
|
prometheus.CounterValue,
|
||||||
float64(StatStorage.GetIosError()),
|
float64(StatStorage.GetIosError()),
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.AndroidSuccess,
|
c.AndroidSuccess,
|
||||||
prometheus.GaugeValue,
|
prometheus.CounterValue,
|
||||||
float64(StatStorage.GetAndroidSuccess()),
|
float64(StatStorage.GetAndroidSuccess()),
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.AndroidError,
|
c.AndroidError,
|
||||||
prometheus.GaugeValue,
|
prometheus.CounterValue,
|
||||||
float64(StatStorage.GetAndroidError()),
|
float64(StatStorage.GetAndroidError()),
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.HuaweiSuccess,
|
c.HuaweiSuccess,
|
||||||
prometheus.GaugeValue,
|
prometheus.CounterValue,
|
||||||
float64(StatStorage.GetHuaweiSuccess()),
|
float64(StatStorage.GetHuaweiSuccess()),
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.HuaweiError,
|
c.HuaweiError,
|
||||||
prometheus.GaugeValue,
|
prometheus.CounterValue,
|
||||||
float64(StatStorage.GetHuaweiError()),
|
float64(StatStorage.GetHuaweiError()),
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
|
|
@ -159,11 +159,13 @@ func newApnsClient(certificate tls.Certificate) (*apns2.Client, error) {
|
||||||
IdleConnTimeout: idleConnTimeout,
|
IdleConnTimeout: idleConnTimeout,
|
||||||
}
|
}
|
||||||
|
|
||||||
if h2Transport, err := http2.ConfigureTransports(transport); err != nil {
|
h2Transport, err := http2.ConfigureTransports(transport)
|
||||||
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
|
||||||
configureHTTP2ConnHealthCheck(h2Transport)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configureHTTP2ConnHealthCheck(h2Transport)
|
||||||
|
|
||||||
client.HTTPClient.Transport = transport
|
client.HTTPClient.Transport = transport
|
||||||
|
|
||||||
return client, nil
|
return client, nil
|
||||||
|
@ -188,12 +190,13 @@ func newApnsTokenClient(token *token.Token) (*apns2.Client, error) {
|
||||||
IdleConnTimeout: idleConnTimeout,
|
IdleConnTimeout: idleConnTimeout,
|
||||||
}
|
}
|
||||||
|
|
||||||
if h2Transport, err := http2.ConfigureTransports(transport); err != nil {
|
h2Transport, err := http2.ConfigureTransports(transport)
|
||||||
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
|
||||||
configureHTTP2ConnHealthCheck(h2Transport)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configureHTTP2ConnHealthCheck(h2Transport)
|
||||||
|
|
||||||
client.HTTPClient.Transport = transport
|
client.HTTPClient.Transport = transport
|
||||||
|
|
||||||
return client, nil
|
return client, nil
|
||||||
|
|
Loading…
Reference in New Issue