Skip to content

Commit

Permalink
Merge pull request #7 from rzrbld/feature/fix-release
Browse files Browse the repository at this point in the history
Feature/fix release
  • Loading branch information
rzrbld authored Apr 5, 2020
2 parents c8b7b60 + 3486ed4 commit fecc365
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ main
run.sh
runc.sh
rung.sh
runl.sh
33 changes: 30 additions & 3 deletions src/handlers/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,26 @@ import (
"github.com/prometheus/client_golang/prometheus/promauto"
)

var opsProcessed = promauto.NewGaugeVec(prometheus.GaugeOpts{
var bucketsSizes = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "bucket_size_current",
Help: "bucket size in kbytes",
}, []string{"bucket"})

var objectsCount = promauto.NewGauge(prometheus.GaugeOpts{
Name: "objects_count_current",
Help: "number of objects on cluster",
})

var objectsSize = promauto.NewGauge(prometheus.GaugeOpts{
Name: "objects_total_size_current",
Help: "size of objects on cluster",
})

var bucketsCount = promauto.NewGauge(prometheus.GaugeOpts{
Name: "bucket_count_current",
Help: "number of buckets on cluster",
})

func RecordMetrics() {
go func() {
for {
Expand All @@ -22,11 +37,23 @@ func RecordMetrics() {
} else {
if len(du.BucketsSizes) != 0 {
for k, v := range du.BucketsSizes {
opsProcessed.WithLabelValues(string(k)).Set(float64(v))
bucketsSizes.WithLabelValues(string(k)).Set(float64(v))
}
}

if du.ObjectsCount >= 0 {
objectsCount.Set(float64(du.ObjectsCount))
}

if du.ObjectsTotalSize >= 0 {
objectsSize.Set(float64(du.ObjectsTotalSize))
}

if du.BucketsCount >= 0 {
bucketsCount.Set(float64(du.BucketsCount))
}
}
time.Sleep(30 * time.Minute)
time.Sleep(2 * time.Minute)
}
}()
}

0 comments on commit fecc365

Please sign in to comment.