Skip to content

Commit

Permalink
Optimize tagged finder when tagged-use-daily=false (#242)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Dunaev <[email protected]>
  • Loading branch information
lexx-bright and Alexander Dunaev authored Aug 8, 2023
1 parent 7c6fce1 commit e4a415f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions finder/tagged.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,12 @@ func (t *TaggedFinder) whereFilter(terms []TaggedTerm, from int64, until int64)
date.FromTimestampToDaysFormat(from),
date.UntilTimestampToDaysFormat(until),
)
} else {

w.Andf(
"Date >='%s'",
date.FromTimestampToDaysFormat(from),
)
}
return w, pw, nil
}
Expand Down
5 changes: 3 additions & 2 deletions finder/tagged_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,9 @@ func TestTaggedFinder_whereFilter(t *testing.T) {
from: 1668106860, // 2022-11-11 00:01:00 +05:00
until: 1668106870, // 2022-11-11 00:01:10 +05:00
dailyEnabled: false,
want: "Tag1='__name__=metric'",
wantPre: "",
want: "(Tag1='__name__=metric') AND (Date >='" +
date.FromTimestampToDaysFormat(1668106860) + "')",
wantPre: "",
},
{
name: "midnight at utc (direct)",
Expand Down

0 comments on commit e4a415f

Please sign in to comment.