mirror of
https://github.com/NotAShelf/watchdog.git
synced 2026-04-17 15:50:18 +00:00
internal/aggregate: implement hourly salt rotation for unique visitors
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I5861c5bb55153349d0710cc07c1595a96a6a6964
This commit is contained in:
parent
093160a42a
commit
d975c7b2d1
3 changed files with 41 additions and 34 deletions
|
|
@ -33,7 +33,7 @@ func TestDailySalt(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestUniquesEstimator(t *testing.T) {
|
||||
estimator := NewUniquesEstimator()
|
||||
estimator := NewUniquesEstimator("daily")
|
||||
|
||||
// Initially should be zero
|
||||
if count := estimator.Estimate(); count != 0 {
|
||||
|
|
@ -87,7 +87,7 @@ func TestUniquesEstimatorDailyRotation(t *testing.T) {
|
|||
}
|
||||
|
||||
// Verify estimator uses current day's salt
|
||||
estimator := NewUniquesEstimator()
|
||||
estimator := NewUniquesEstimator("daily")
|
||||
currentSalt := estimator.CurrentSalt()
|
||||
expectedSalt := DailySalt(time.Now())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue