File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,6 @@ import (
28
28
type hostCollector struct {
29
29
tags map [string ]string
30
30
uptime * metrics.Int64Metric
31
- lastUptime int64
32
31
}
33
32
34
33
func NewHostCollectorOrDie (hostConfig * ssmtypes.HostStatsConfig ) * hostCollector {
@@ -52,7 +51,7 @@ func NewHostCollectorOrDie(hostConfig *ssmtypes.HostStatsConfig) *hostCollector
52
51
hostConfig .MetricsConfigs ["host/uptime" ].DisplayName ,
53
52
"The uptime of the operating system" ,
54
53
"second" ,
55
- metrics .Sum ,
54
+ metrics .LastValue ,
56
55
[]string {"kernel_version" , "os_version" })
57
56
if err != nil {
58
57
glog .Fatalf ("Error initializing metric for host/uptime: %v" , err )
@@ -72,10 +71,8 @@ func (hc *hostCollector) collect() {
72
71
glog .Errorf ("Failed to retrieve uptime of the host: %v" , err )
73
72
return
74
73
}
75
- uptimeSeconds := int64 (uptime )
76
74
77
75
if hc .uptime != nil {
78
- hc .uptime .Record (hc .tags , uptimeSeconds - hc . lastUptime )
76
+ hc .uptime .Record (hc .tags , int64 ( uptime ) )
79
77
}
80
- hc .lastUptime = uptimeSeconds
81
- }
78
+ }
You can’t perform that action at this time.
0 commit comments