Skip to content
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

[bugfix] logql: vectorExpr run fail when query_range: parallelise_shardable_queries: true #7045

Merged
merged 4 commits into from
Sep 22, 2022

Conversation

liguozhong
Copy link
Contributor

…hardable_queries: true

What this PR does / why we need it:
A grafana error occurred when I deployed the vector(0) function to our online loki cluster.
It was finally found because online loki has a configuration

unexpected expr type (*syntax.VectorExpr) for ASTMapper type (logql.ShardMapper)

query_range:
   parallelise_shardable_queries: true

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:
error snapssnapshot
image
with this pr,success snapshot
image

Checklist

  • Documentation added
  • Tests updated
  • Is this an important fix or new feature? Add an entry in the CHANGELOG.md.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/upgrading/_index.md

@liguozhong liguozhong requested a review from a team as a code owner September 5, 2022 03:59
Copy link
Contributor

@kavirajk kavirajk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @liguozhong. Should we add some tests?

@liguozhong
Copy link
Contributor Author

Thanks @liguozhong. Should we add some tests?

👌

@pull-request-size pull-request-size bot added size/M and removed size/XS labels Sep 5, 2022
@liguozhong
Copy link
Contributor Author

Thanks @liguozhong. Should we add some tests?

done,thanks.

@@ -782,6 +782,67 @@ func TestMapping(t *testing.T) {
},
},
},
{
in: `vector(0) or sum (rate({foo="bar"}[5m]))`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test seems to be failing.
https://drone.grafana.net/grafana/loki/15228/2/5

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original testcase is indeed wrong, and the 'Group' field is not considered.
I just submitted a commit to fix this testcase

@grafanabot
Copy link
Collaborator

./tools/diff_coverage.sh ../loki-main/test_results.txt test_results.txt ingester,distributor,querier,querier/queryrange,iter,storage,chunkenc,logql,loki

Change in test coverage per package. Green indicates 0 or positive change, red indicates that test coverage for a package fell.

+           ingester	0%
+        distributor	0%
+            querier	0%
+ querier/queryrange	0%
+               iter	0%
+            storage	0%
+           chunkenc	0%
+              logql	0%
+               loki	0%

Copy link
Contributor

@kavirajk kavirajk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @liguozhong LGTM

@grafanabot
Copy link
Collaborator

./tools/diff_coverage.sh ../loki-main/test_results.txt test_results.txt ingester,distributor,querier,querier/queryrange,iter,storage,chunkenc,logql,loki

Change in test coverage per package. Green indicates 0 or positive change, red indicates that test coverage for a package fell.

+           ingester	0%
+        distributor	0%
+            querier	0%
+ querier/queryrange	0%
+               iter	0%
+            storage	0%
+           chunkenc	0%
+              logql	0%
+               loki	0%

@kavirajk kavirajk merged commit 557fdf2 into grafana:main Sep 22, 2022
ssncferreira added a commit that referenced this pull request Sep 29, 2022
**What this PR does / why we need it**:
The new expression type VectorExpr introduced recently in
[PR](#7007), is not taken into
account in the query mapping in the AST mapper rangemapper.
The AST mapper shardmapper was updated in
[PR](#7045).

**Special notes for your reviewer**:

**Checklist**
- [ ] Reviewed the `CONTRIBUTING.md` guide
- [ ] Documentation added
- [x] Tests updated
- [x] `CHANGELOG.md` updated
- [ ] Changes that require user attention or interaction to upgrade are
documented in `docs/sources/upgrading/_index.md`
lxwzy pushed a commit to lxwzy/loki that referenced this pull request Nov 7, 2022
…rdable_queries: true (grafana#7045)

…hardable_queries: true

<!--  Thanks for sending a pull request!  Before submitting:

1. Read our CONTRIBUTING.md guide
2. Name your PR as `<Feature Area>: Describe your change`.
a. Do not end the title with punctuation. It will be added in the
changelog.
b. Start with an imperative verb. Example: Fix the latency between
System A and System B.
  c. Use sentence case, not title case.
d. Use a complete phrase or sentence. The PR title will appear in a
changelog, so help other people understand what your change will be.
3. Rebase your PR if it gets out of sync with main
-->

**What this PR does / why we need it**:
A grafana error occurred when I deployed the vector(0) function to our
online loki cluster.
It was finally found because online loki has a configuration


`unexpected expr type (*syntax.VectorExpr) for ASTMapper type
(logql.ShardMapper)
`
```yaml
query_range:
   parallelise_shardable_queries: true
```
**Which issue(s) this PR fixes**:
Fixes #

**Special notes for your reviewer**:
error snapssnapshot

![image](https://user-images.githubusercontent.com/9583245/188357957-e573e589-a789-4e5e-a1c3-b91c019ceb62.png)
with this pr,success snapshot

![image](https://user-images.githubusercontent.com/9583245/188358036-5ca0d9be-c2b6-4516-807c-c027445ee62d.png)

<!--
Note about CHANGELOG entries, if a change adds:
* an important feature
* fixes an issue present in a previous release, 
* causes a change in operation that would be useful for an operator of
Loki to know
then please add a CHANGELOG entry.

For documentation changes, build changes, simple fixes etc please skip
this step. We are attempting to curate a changelog of the most relevant
and important changes to be easier to ingest by end users of Loki.

Note about the upgrade guide, if this changes:
* default configuration values
* metric names or label names
* changes existing log lines such as the metrics.go query output line
* configuration parameters 
* anything to do with any API
* any other change that would require special attention or extra steps
to upgrade
Please document clearly what changed AND what needs to be done in the
upgrade guide.
-->
**Checklist**
- [ ] Documentation added
- [ ] Tests updated
- [ ] Is this an important fix or new feature? Add an entry in the
`CHANGELOG.md`.
- [ ] Changes that require user attention or interaction to upgrade are
documented in `docs/sources/upgrading/_index.md`
lxwzy pushed a commit to lxwzy/loki that referenced this pull request Nov 7, 2022
**What this PR does / why we need it**:
The new expression type VectorExpr introduced recently in
[PR](grafana#7007), is not taken into
account in the query mapping in the AST mapper rangemapper.
The AST mapper shardmapper was updated in
[PR](grafana#7045).

**Special notes for your reviewer**:

**Checklist**
- [ ] Reviewed the `CONTRIBUTING.md` guide
- [ ] Documentation added
- [x] Tests updated
- [x] `CHANGELOG.md` updated
- [ ] Changes that require user attention or interaction to upgrade are
documented in `docs/sources/upgrading/_index.md`
changhyuni pushed a commit to changhyuni/loki that referenced this pull request Nov 8, 2022
**What this PR does / why we need it**:
The new expression type VectorExpr introduced recently in
[PR](grafana#7007), is not taken into
account in the query mapping in the AST mapper rangemapper.
The AST mapper shardmapper was updated in
[PR](grafana#7045).

**Special notes for your reviewer**:

**Checklist**
- [ ] Reviewed the `CONTRIBUTING.md` guide
- [ ] Documentation added
- [x] Tests updated
- [x] `CHANGELOG.md` updated
- [ ] Changes that require user attention or interaction to upgrade are
documented in `docs/sources/upgrading/_index.md`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants