Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

correct for delayed lastUpdate updates #1532

Merged
merged 2 commits into from
Nov 14, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions idx/bigtable/bigtable.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,17 @@ func (b *BigtableIdx) updateBigtable(now uint32, inMemory bool, archive idx.Arch
return archive
}

func (b *BigtableIdx) Find(orgId uint32, pattern string, from int64) ([]idx.Node, error) {
// The lastUpdate timestamp does not get updated in the bigtable index every time when
// a data point is received, there can be a delay of up to b.cfg.updateInterval32. To
// avoid falsely excluding a metric based on its lastUpdate timestamp we offset the
// from time by updateInterval32, this way we err on the "too inclusive" side
if from > int64(b.cfg.updateInterval32) {
from -= int64(b.cfg.updateInterval32)
}
return b.MemoryIndex.Find(orgId, pattern, from)
}

func (b *BigtableIdx) rebuildIndex() {
log.Info("bigtable-idx: Rebuilding Memory Index from metricDefinitions in bigtable")
pre := time.Now()
Expand Down
11 changes: 11 additions & 0 deletions idx/cassandra/cassandra.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,17 @@ func (c *CasIdx) updateCassandra(now uint32, inMemory bool, archive idx.Archive,
return archive
}

func (c *CasIdx) Find(orgId uint32, pattern string, from int64) ([]idx.Node, error) {
// The lastUpdate timestamp does not get updated in the cassandra index every time when
// a data point is received, there can be a delay of up to c.updateInterval32. To avoid
// falsely excluding a metric based on its lastUpdate timestamp we offset the from time
// by updateInterval32, this way we err on the "too inclusive" side
if from > int64(c.updateInterval32) {
from -= int64(c.updateInterval32)
}
return c.MemoryIndex.Find(orgId, pattern, from)
}

func (c *CasIdx) rebuildIndex() {
log.Info("cassandra-idx: Rebuilding Memory Index from metricDefinitions in Cassandra")
pre := time.Now()
Expand Down