Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introducing persiter.oooDiscardedPoints metric #463

Merged
merged 2 commits into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Changelog
##### master
* carbonserver: introduce new empty-result option to allow for empty results with carbonserver #TBD

* introducing `persiter.oooDiscardedPoints` metric
##### version 0.16.2
* Another attempt to fix issues with release upload #449

Expand Down
22 changes: 9 additions & 13 deletions cache/writeout_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ package cache
import (
"sync"
"time"

"go.uber.org/zap"

"github.com/lomik/zapwriter"
)

type WriteoutQueue struct {
Expand Down Expand Up @@ -37,17 +33,17 @@ func (q *WriteoutQueue) makeRebuildCallback(nextRebuildTime time.Time) func(chan
// next rebuild
nextRebuildOnce.Do(func() {
now := time.Now()
logger := zapwriter.Logger("cache")
// logger := zapwriter.Logger("cache")

logger.Debug("WriteoutQueue.nextRebuildOnce.Do",
zap.String("now", now.String()),
zap.String("next", nextRebuildTime.String()),
)
// logger.Debug("WriteoutQueue.nextRebuildOnce.Do",
// zap.String("now", now.String()),
// zap.String("next", nextRebuildTime.String()),
// )
if now.Before(nextRebuildTime) {
sleepTime := nextRebuildTime.Sub(now)
logger.Debug("WriteoutQueue sleep before rebuild",
zap.String("sleepTime", sleepTime.String()),
)
// logger.Debug("WriteoutQueue sleep before rebuild",
// zap.String("sleepTime", sleepTime.String()),
// )

select {
case <-time.After(sleepTime):
Expand Down Expand Up @@ -102,6 +98,6 @@ QueueLoop:
}
}

func (q *WriteoutQueue) Get(abort chan bool) string {
func (q *WriteoutQueue) Get(abort chan bool) string { // skipcq: RVV-B0001
return q.get(abort)
}
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/dgryski/go-trigram v0.0.0-20160407183937-79ec494e1ad0
github.com/dgryski/httputil v0.0.0-20160116060654-189c2918cd08
github.com/go-graphite/carbonzipper v0.0.0-20180329125635-fedce067a794
github.com/go-graphite/go-whisper v0.0.0-20191220103904-f154aca40cdb
github.com/go-graphite/go-whisper v0.0.0-20220426133541-b1ea42367ab4
github.com/go-graphite/protocol v0.4.3-0.20180731190405-5ae324d48067
github.com/gogo/protobuf v1.1.2-0.20180830160456-5669497fd644
github.com/google/go-cmp v0.5.0
Expand Down Expand Up @@ -69,7 +69,7 @@ require (
golang.org/x/mod v0.2.0 // indirect
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a // indirect
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1 // indirect
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 // indirect
golang.org/x/text v0.3.2 // indirect
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4 // indirect
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect
Expand Down
7 changes: 4 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-graphite/carbonzipper v0.0.0-20180329125635-fedce067a794 h1:9N+1I8z47huAZdcBWVIqfZZPzIzMyXqGd3uR21QN5mA=
github.com/go-graphite/carbonzipper v0.0.0-20180329125635-fedce067a794/go.mod h1:sfZ+AkP8/bBcWSGVqhseV6t6e/+C0i/PkTpA32W5rXs=
github.com/go-graphite/go-whisper v0.0.0-20191220103904-f154aca40cdb h1:XkDrq9Z5YFcFfWUgLNJgO5Olx6csDoyJnWpn6O5Sq3k=
github.com/go-graphite/go-whisper v0.0.0-20191220103904-f154aca40cdb/go.mod h1:XnU8q9X8C3OhD8R7gAlRLI6VXU2KMwqgTO9Tshub2qE=
github.com/go-graphite/go-whisper v0.0.0-20220426133541-b1ea42367ab4 h1:ztjpW09cYf5/rrqcXTAR+gJBehzvNnmrjTJlgOvOKdM=
github.com/go-graphite/go-whisper v0.0.0-20220426133541-b1ea42367ab4/go.mod h1:XnU8q9X8C3OhD8R7gAlRLI6VXU2KMwqgTO9Tshub2qE=
github.com/go-graphite/protocol v0.4.3-0.20180731190405-5ae324d48067 h1:3xaKhHeiu8sY1oFpgw8mou3IztFUB92FIGwDncZKJCs=
github.com/go-graphite/protocol v0.4.3-0.20180731190405-5ae324d48067/go.mod h1:tJs3CWCesQ9Laqjz5pbMDHqJlPHDUZv502EtN7qujzQ=
github.com/gogo/protobuf v1.1.2-0.20180830160456-5669497fd644 h1:GsuTRapGULopujrq87TLdlXsp6m3q/tOwxgx7EEwhKc=
Expand Down Expand Up @@ -305,8 +305,9 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1 h1:ogLJMz+qpzav7lGMh10LMvAkM/fAoGlaiiHYiFYdm80=
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 h1:xHms4gcpe1YE7A3yIllJXP16CMAGuqwO2lX1mTyyRRc=
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
13 changes: 13 additions & 0 deletions persister/whisper.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type Whisper struct {
throttledCreates uint32 // counter
updateOperations uint32 // counter
committedPoints uint32 // counter
oooDiscardedPoints uint32 // counter
extended uint32 // counter
sparse bool
flock bool
Expand Down Expand Up @@ -180,6 +181,14 @@ func (p *Whisper) updateMany(w *whisper.Whisper, path string, points []*whisper.
atomic.AddUint32(&p.extended, 1)
p.logger.Info("cwhisper file has extended", zap.String("path", path))
}

// update oooDiscardedPoints counter
if w.DiscardedPoints > 0 {
atomic.AddUint32(&p.oooDiscardedPoints, uint32(w.DiscardedPoints))
p.logger.Debug("cwhisper file has ooo-discarded points",
zap.Int("w.DiscardedPoints", int(w.DiscardedPoints)),
zap.String("path", path))
}
}

func (p *Whisper) store(metric string) {
Expand Down Expand Up @@ -426,6 +435,9 @@ func (p *Whisper) Stat(send helper.StatCallback) {
throttledCreates := atomic.LoadUint32(&p.throttledCreates)
atomic.AddUint32(&p.throttledCreates, -throttledCreates)

oooDiscardedPoints := atomic.LoadUint32(&p.oooDiscardedPoints)
atomic.AddUint32(&p.oooDiscardedPoints, -oooDiscardedPoints)

send("updateOperations", float64(updateOperations))
send("committedPoints", float64(committedPoints))
if updateOperations > 0 {
Expand All @@ -436,6 +448,7 @@ func (p *Whisper) Stat(send helper.StatCallback) {

send("created", float64(created))
send("throttledCreates", float64(throttledCreates))
send("oooDiscardedPoints", float64(oooDiscardedPoints))
send("maxCreatesPerSecond", float64(p.maxCreatesPerSecond))

send("maxUpdatesPerSecond", float64(p.maxUpdatesPerSecond))
Expand Down
1 change: 1 addition & 0 deletions vendor/github.com/go-graphite/go-whisper/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions vendor/github.com/go-graphite/go-whisper/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.