fix(query): Fix histogram query rewrite to exclude summaries #1887
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request checklist
Today we ingest summaries are three or more time series. For example, for a summary named
foo
:foo
. Today, this is ingested as a gauge in FiloDB.foo_sum
. This is a counter.foo_count
. This is also a counter.Details in the original prom doc
Problem:
When
foo_count
is queried, we lookup to see if metric namefoo
exists. If it exists, we simply rewrite the query tofoo::count
which ends up querying thecount
column onfoo
. This is for backward compatibility on prometheus histograms.In the case of summaries, the
count
column does not exist onfoo
and it leads to query failure.Fix:
Rewrite the query only if the second lookup exists, and additionally has a column called
count
. This additional check will be true for histograms only.Testing:
Existing unit tests in
MultiSchemaPartitionsExecSpec
cover this case.