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) {
 | 
			
		||||
	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(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue