Skip to content

Commit

Permalink
ensure get the metrics that have been aggregated (#509)
Browse files Browse the repository at this point in the history
  • Loading branch information
iyacontrol authored and ahmelsayed committed Dec 19, 2019
1 parent 91f7c15 commit fa13062
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/scalers/huawei_cloudeye_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ func (h *huaweiCloudeyeScaler) GetCloudeyeMetrics() (float64, error) {
MetricName: h.metadata.metricsName,
},
},
From: time.Now().Add(time.Second*-1*time.Duration(h.metadata.metricCollectionTime)).UnixNano() / 1e6,
To: time.Now().UnixNano() / 1e6,
From: time.Now().Truncate(time.Minute).Add(time.Second*-1*time.Duration(h.metadata.metricCollectionTime)).UnixNano() / 1e6,
To: time.Now().Truncate(time.Minute).UnixNano() / 1e6,
Period: h.metadata.metricPeriod,
Filter: h.metadata.metricFilter,
}
Expand All @@ -323,7 +323,7 @@ func (h *huaweiCloudeyeScaler) GetCloudeyeMetrics() (float64, error) {

var metricValue float64

if metricdatas[0].Datapoints != nil {
if metricdatas[0].Datapoints != nil && len(metricdatas[0].Datapoints) > 0 {
v, ok := metricdatas[0].Datapoints[0][h.metadata.metricFilter].(float64)
if ok {
metricValue = v
Expand Down

0 comments on commit fa13062

Please sign in to comment.