Skip to content

Commit

Permalink
fix gomod/vendor
Browse files Browse the repository at this point in the history
  • Loading branch information
deniszh committed Jun 24, 2024
2 parents 460ede9 + c9ef183 commit 1b60739
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 11 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ max-size = 1000000
# "noop" - pick metrics to write in unspecified order,
# requires least CPU and improves cache responsiveness
write-strategy = "max"
# If > 0 use bloom filter to detect new metrics instead of cache
bloom-size = 0

[udp]
listen = ":2003"
Expand Down
11 changes: 7 additions & 4 deletions cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (c *Cache) SetMaxSize(maxSize uint32) {
c.settings.Store(&newSettings)
}

// SetMaxSize of bloom filter
// SetBloomSize of bloom filter
func (c *Cache) SetBloomSize(bloomSize uint) {
if bloomSize > 0 {
c.newMetricCf = cuckoo.NewFilter(bloomSize)
Expand All @@ -161,7 +161,7 @@ func (c *Cache) Stat(send helper.StatCallback) {
send("maxSize", float64(s.maxSize))
send("notConfirmed", float64(c.NotConfirmedLength()))
// report elements in bloom filter
if c.newMetricsChan != nil && c.newMetricCf != nil {
if c.newMetricCf != nil {
send("cfCount", float64(c.newMetricCf.Count()))
}

Expand Down Expand Up @@ -321,11 +321,12 @@ func (c *Cache) Add(p *points.Points) {
values.Data = append(values.Data, p.Data...)
} else {
shard.items[p.Metric] = p

if shard.adds != nil {
shard.adds[p.Metric] = struct{}{}
}
// if no bloom filter - just add metric to new channel
// if missed in cache
// if missed in cache, as it was before
if c.newMetricsChan != nil && c.newMetricCf == nil {
sendMetricToNewMetricChan(c, p.Metric)
}
Expand All @@ -334,7 +335,7 @@ func (c *Cache) Add(p *points.Points) {
// if we have both new metric channel and bloom filter
if c.newMetricsChan != nil && c.newMetricCf != nil {
// add metric to new metric channel if missed in bloom
// despite that we have it in cache
// despite what we have it in cache (new behaviour)
if !c.newMetricCf.Lookup([]byte(p.Metric)) {
sendMetricToNewMetricChan(c, p.Metric)
}
Expand All @@ -351,6 +352,7 @@ func (c *Cache) Pop(key string) (p *points.Points, exists bool) {
p, exists = shard.items[key]
delete(shard.items, key)
shard.Unlock()

// we probably can skip that, but I'm a bit worry
// of effectiveness of bloom filter over time
if c.newMetricsChan != nil && c.newMetricCf != nil {
Expand Down Expand Up @@ -380,6 +382,7 @@ func (c *Cache) PopNotConfirmed(key string) (p *points.Points, exists bool) {
shard.notConfirmedUsed++
}
shard.Unlock()

// we probably can skip that, but I'm a bit worry
// of effectiveness of bloom filter over time
if c.newMetricsChan != nil && c.newMetricCf != nil {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-metro v0.0.0-20200812162917-85c65e2d0165 // indirect
github.com/dgryski/go-metro v0.0.0-20211217172704-adc40b04c140 // indirect
github.com/eapache/go-resiliency v1.6.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect
github.com/eapache/queue v1.1.0 // indirect
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgryski/go-expirecache v0.0.0-20170314133854-743ef98b2adb h1:X9MwMz6mVZEWcbhsri5TwaCm/Q4USFdAAmy1T7RCGjw=
github.com/dgryski/go-expirecache v0.0.0-20170314133854-743ef98b2adb/go.mod h1:pD/+9DfmmQ+xvOI1fxUltHV69BxC1aeTILPQg9Kw1hE=
github.com/dgryski/go-metro v0.0.0-20200812162917-85c65e2d0165 h1:BS21ZUJ/B5X2UVUbczfmdWH7GapPWAhxcMsDnjJTU1E=
github.com/dgryski/go-metro v0.0.0-20200812162917-85c65e2d0165/go.mod h1:c9O8+fpSOX1DM8cPNSkX/qsBWdkD4yd2dpciOWQjpBw=
github.com/dgryski/go-metro v0.0.0-20211217172704-adc40b04c140 h1:y7y0Oa6UawqTFPCDw9JG6pdKt4F9pAhHv0B7FMGaGD0=
github.com/dgryski/go-metro v0.0.0-20211217172704-adc40b04c140/go.mod h1:c9O8+fpSOX1DM8cPNSkX/qsBWdkD4yd2dpciOWQjpBw=
github.com/dgryski/go-trigram v0.0.0-20160407183937-79ec494e1ad0 h1:b+7JSiBM+hnLQjP/lXztks5hnLt1PS46hktG9VOJgzo=
github.com/dgryski/go-trigram v0.0.0-20160407183937-79ec494e1ad0/go.mod h1:qzKC/DpcxK67zaSHdCmIv3L9WJViHVinYXN2S7l3RM8=
github.com/dgryski/httputil v0.0.0-20160116060654-189c2918cd08 h1:BGzXzhmOgLHlylvQ27Tcgz235JvonPEgdMtpaZaeZt0=
Expand Down
3 changes: 2 additions & 1 deletion vendor/github.com/dgryski/go-metro/metro64.go

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

3 changes: 2 additions & 1 deletion vendor/github.com/dgryski/go-metro/metro_amd64.s

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

4 changes: 2 additions & 2 deletions vendor/github.com/dgryski/go-metro/metro_stub.go

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

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ github.com/davecgh/go-spew/spew
# github.com/dgryski/go-expirecache v0.0.0-20170314133854-743ef98b2adb
## explicit
github.com/dgryski/go-expirecache
# github.com/dgryski/go-metro v0.0.0-20200812162917-85c65e2d0165
# github.com/dgryski/go-metro v0.0.0-20211217172704-adc40b04c140
## explicit
github.com/dgryski/go-metro
# github.com/dgryski/go-trigram v0.0.0-20160407183937-79ec494e1ad0
Expand Down

0 comments on commit 1b60739

Please sign in to comment.