-
Notifications
You must be signed in to change notification settings - Fork 170
Update PromQL from upstream #1295
Update PromQL from upstream #1295
Conversation
a000390
to
6afe7ee
Compare
6afe7ee
to
b1b8af4
Compare
Checks aren't passing so taking myself off the review. Please request re-review when this PR is ready and all checks pass |
b1b8af4
to
d85e3be
Compare
d85e3be
to
99bf22b
Compare
google.golang.org/grpc v1.46.0 | ||
google.golang.org/protobuf v1.28.0 | ||
gopkg.in/yaml.v2 v2.4.0 | ||
) | ||
|
||
// Make sure Prometheus version is pinned as Prometheus semver does not include Go APIs. | ||
replace github.com/prometheus/prometheus => github.com/prometheus/prometheus v1.8.2-0.20220117154355-4855a0c067e2 |
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.
Do you think we can update to latest prometheus and not use git hash anymore?
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.
If you mean @latest
, I think we should stick to git hash (monthly wise). Otherwise, I have seen incompatibility with @latest
mod version, which is not good, as anyone who updates the mod next might have to fix the incompatibilities.
"strconv" | ||
"strings" | ||
"time" | ||
|
||
"github.com/grafana/regexp" |
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.
Why using this package instead of default golang one? I mean what are the benefits?
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.
Well, the point is to make outputs similar to what Prometheus does. Recently, Prometheus shifted from go regex to grafana regex. I don't know the reason, will try to see the godoc APIs. But, there might be an edge case in response comparison if we shifted back to the original.
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.
This repo is a fork of the upstream Go regexp package, with some code optimisations to make it run faster.
99bf22b
to
343bfa8
Compare
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.
Looks good in general.
I'd like us to verify that these traces that are now being generated in the query engine are compatible with our setup and that we can actually use them ourselves.
@antekresic yes, it does. We can apply jaeger traces endpoint and get the input. We can also provide otel-collector and direct the traces there and then back to promscale. |
if warning != nil { | ||
// An invalid content type is being passed, which should not happen | ||
// in this context. | ||
panic(warning) |
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 really panic here because of invalid contentType? I am not sure where this is being used
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.
This is a direct copy from Prometheus
But I agree, we can replace that with a warning log.
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've noticed it's borrowed code. Just wanted to make sure we have full understanding and doing the right thing in our context.
@@ -89,6 +89,7 @@ func queryRange(promqlConf *query.Config, queryEngine *promql.Engine, queryable | |||
|
|||
qry, err := queryEngine.NewRangeQuery( | |||
queryable, | |||
&promql.QueryOpts{EnablePerStepStats: true}, |
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.
Can you explain why we want stats enabled? Do we use these stats?
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.
This allows the stats feature to work.
promscale/pkg/promql/engine.go
Line 479 in 343bfa8
sampleStats: stats.NewQuerySamples(ng.enablePerStepStats && opts.EnablePerStepStats), |
If you see how the feature works, there is a logical AND condition between
- Input of
-enable-feature=promql-per-step-stats
that is supplied in the CLI (ng.enablePerStepStats
part) - Input from the caller creating query (range & instant) (
opts.EnablePerStepStats
part). This one is the line you commented on
So, the feature will work only when 1 && 2 == true
. 1
is based on user, 2
is Promscale enabling the feature. Hence, we pass in &promql.QueryOpts{EnablePerStepStats: true}
so that the stats feature is now enabled.
why we want stats enabled?
It's a PromQL feature that we were lacking. Prometheus provides it, but we don't, as it was recently merged into Prometheus master. With this PR, we are again up to date with the master.
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.
Note: We do not enable this, the enabling will happen only when the user passes in -enable-feature=promql-per-step-stats
. We just do not want to block the feature from being enabled.
@Harkishen-Singh Btw since you do mention that this brings in new features. Do we miss some tests for new features? I've only seen |
Test on this new feature is again borrowed from the Prometheus side in this case. That should be enough. promscale/pkg/promql/engine_test.go Line 761 in 343bfa8
|
Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> This commit updates the PromQL code upto commit 3e4bd4d9135200f6e74a2ba3ef47dba1de8656d9 This commit also includes the changes for the new PromQL stats support which is an optional feature.
Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>
343bfa8
to
7ce6fa7
Compare
Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com> This commit enables the `promql-per-step-stats` feature. This is done by passing `&QueryOpts{EnablePerStepStats: true}` when creating a query. This result goes with logical AND with `-enable-feature=promql-per-step-stats` applied as Promscale starts.
7ce6fa7
to
7e51415
Compare
Fixes: #1296
This PR updates the PromQL module with the latest commits from upstream. It also contains the newly implemented feature for PromQL evaluation statistics.