File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -115,15 +115,6 @@ func (dc *diskCollector) collect() {
115
115
dc .historyIOTime [deviceName ] = ioCountersStat .IoTime
116
116
dc .historyWeightedIO [deviceName ] = ioCountersStat .WeightedIO
117
117
118
- if ! historyExist {
119
- // Ignore first collected stats.
120
- return
121
- }
122
- avgQueueLen := float64 (0.0 )
123
- if lastIOTime != ioCountersStat .IoTime {
124
- avgQueueLen = float64 (ioCountersStat .WeightedIO - lastWeightedIO ) / float64 (ioCountersStat .IoTime - lastIOTime )
125
- }
126
-
127
118
// Attach label {"device_name": deviceName} to the metrics.
128
119
tags := map [string ]string {deviceNameLabel : deviceName }
129
120
if dc .mIOTime != nil {
@@ -132,8 +123,14 @@ func (dc *diskCollector) collect() {
132
123
if dc .mWeightedIO != nil {
133
124
dc .mWeightedIO .Record (tags , int64 (ioCountersStat .WeightedIO - lastWeightedIO ))
134
125
}
135
- if dc .mAvgQueueLen != nil {
136
- dc .mAvgQueueLen .Record (tags , avgQueueLen )
126
+ if historyExist {
127
+ avgQueueLen := float64 (0.0 )
128
+ if lastIOTime != ioCountersStat .IoTime {
129
+ avgQueueLen = float64 (ioCountersStat .WeightedIO - lastWeightedIO ) / float64 (ioCountersStat .IoTime - lastIOTime )
130
+ }
131
+ if dc .mAvgQueueLen != nil {
132
+ dc .mAvgQueueLen .Record (tags , avgQueueLen )
133
+ }
137
134
}
138
135
}
139
136
}
You can’t perform that action at this time.
0 commit comments