-
Notifications
You must be signed in to change notification settings - Fork 454
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
[query] Fix temporal function tag application bug #2231
Conversation
Does this commit also assume some other dependencies? I cherry-picked the commit on top of 0.15rc3 and result still seems similar as bug #2214 (= spurious blips on promql, when using e.g.)
in Grafana, which turns to this promql on API ( unquoted for your convenience ):
For example for one of the things matching, there seems to be (still) bleed-over from other time series (from Grafana query inspector, too lazy to run promql query by hand + search for it from json):
Test setup: 1 coordinator, 6 db nodes, rf=3, all with this patch + 0.15rc3. |
Codecov Report
@@ Coverage Diff @@
## master #2231 +/- ##
========================================
+ Coverage 72.4% 72.5% +0.1%
========================================
Files 1024 1024
Lines 89129 89079 -50
========================================
+ Hits 64541 64639 +98
+ Misses 20241 20097 -144
+ Partials 4347 4343 -4
Continue to review full report at Codecov.
|
src/query/block/column_test.go
Outdated
ctx := models.NewQueryContext(context.Background(), | ||
tally.NoopScope, cost.NoopChainedEnforcer(), | ||
models.QueryContextOptions{}) | ||
var ctx = models.NewQueryContext(context.Background(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super nit: Maybe make this a method? In case contexts conflict across tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with super minor comments
result := ts.Datapoint{Timestamp: enc.tsEncoderState.PrevTime} | ||
result := ts.Datapoint{ | ||
Timestamp: enc.tsEncoderState.PrevTime, | ||
TimestampNanos: xtime.ToUnixNano(enc.tsEncoderState.PrevTime), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, should we move to add a method called NewDatapoint(t time.Time, v float64)
and then always add the fields ourselves?
Otherwise I think other callsites might miss this as well.
We can change the Timestamp
and Value
to unexported and add methods to access them (which will likely get inlined by Go). (i.e. Timestamp() time.Time
and TimestampNanos() int64
and Value() float64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was thinking that... I think there are a lot of places this will touch though; ok to do it as a follow up?
meta = meta.CombineMetadata(insertResult.meta) | ||
res := <-result.ResultChan() | ||
if res.Err != nil { | ||
return emptyResult, res.Err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, should we add back the defer func() { for range resultChan {} }()
before returning here? Otherwise could see it possible to leak goroutines that are blocked tryring to publish to resultCh
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The channel can only ever have a single value, so that's not actually necessary here
aggDuration: xtime.UnixNano(c.op.duration), | ||
stepSize: xtime.UnixNano(bounds.StepSize), | ||
steps: steps, | ||
steps: bounds.Steps(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, any reason we're not excluding name part any more? (as per prior comment // rename series to exclude their __name__ tag as part of function processing.
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still around, just moved some logic around; will readd this comment around the relevant paths 👍
) | ||
|
||
if stats.Enabled { | ||
decodeDuration += stats.DecodeDuration | ||
} | ||
|
||
seriesMeta.Tags = seriesMeta.Tags.WithoutName() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps add // rename series to exclude their __name__ tag as part of function processing.
above this line for consistency with other code path and explaining why without name is called?
@@ -237,6 +237,8 @@ func (cb ColumnBlockBuilder) PopulateColumns(size int) { | |||
for i := range cb.block.columns { | |||
cb.block.columns[i] = column{Values: cols[size*i : size*(i+1)]} | |||
} | |||
|
|||
cb.block.seriesMeta = make([]SeriesMeta, size) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add test coverage that this is always size of cols now? Seems like was just missing before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, luckily the new test fails without this statement 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #2214
Fixes an issue where batched processing of temporal functions would sometimes cause series tag mismatches.
TODO: add regression test data for this case