Skip to content

Commit

Permalink
fix casing
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Feb 28, 2021
1 parent 7ff4e19 commit 45b9c23
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ type Container struct {
}

type ObjectStorageUsage struct {
containers []Container
quota float64
total_usage float64
containers []Container
quota float64
totalUsage float64
}

// オブジェクトストレージの使用容量を取得
Expand All @@ -222,15 +222,15 @@ func (cc *ConohaClient) ObjectStorageUsage() (*ObjectStorageUsage, error) {
return nil, err
}

total_usage, err := strconv.ParseFloat(headers.Get("X-Account-Bytes-Used"), 64)
totalUsage, err := strconv.ParseFloat(headers.Get("X-Account-Bytes-Used"), 64)
if err != nil {
return nil, err
}

return &ObjectStorageUsage{
containers: uResp,
quota: quota,
total_usage: total_usage,
containers: uResp,
quota: quota,
totalUsage: totalUsage,
}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (cc *ConohaCollector) AutoUpdate() {
log.Fatal(err)
}
metrics = append(metrics, prometheus.MustNewConstMetric(cc.describes[1], prometheus.GaugeValue, usage.quota))
metrics = append(metrics, prometheus.MustNewConstMetric(cc.describes[2], prometheus.GaugeValue, usage.total_usage))
metrics = append(metrics, prometheus.MustNewConstMetric(cc.describes[2], prometheus.GaugeValue, usage.totalUsage))

for _, container := range usage.containers {
metrics = append(metrics, prometheus.MustNewConstMetric(cc.describes[3], prometheus.GaugeValue, float64(container.Bytes), container.Name))
Expand Down

0 comments on commit 45b9c23

Please sign in to comment.