-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Make PROMQL a source command #138687
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
base: main
Are you sure you want to change the base?
Make PROMQL a source command #138687
Conversation
|
@stratoula fyi about this grammar change for PromQL |
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
| // Simple unquoted identifier for parameter names and values | ||
| PROMQL_UNQUOTED_IDENTIFIER | ||
| : [a-z0-9][a-z0-9_]* // Starts with letter/digit, followed by letters/digits/underscores | ||
| | [_@][a-z0-9_]+ // OR starts with _/@ followed by at least one alphanumeric/underscore | ||
| ; | ||
|
|
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 to reviewers: I removed this in favor of UNQUOTED_SOURCE as the tokens would overlap otherwise. Alphanumeric tokens would always be interpreted as a PROMQL_UNQUOTED_IDENTIFIER, and never "fall though" to UNQUOTED_SOURCE.
This means a slightly different character set is now allowed for param key/values but that seems fine.
|
@felixbarny I tested with |
|
Hm, that's strange. How did you test that? When adding this test in public void testNhat() {
PromqlCommand promqlCommand = parse("PROMQL hosts step 1m (sum(avg_over_time(cpu[1m])))");
assertThat(promqlCommand.step().value(), equalTo(Duration.ofMinutes(1)));
List<UnresolvedRelation> unresolvedRelations = promqlCommand.collect(UnresolvedRelation.class);
assertThat(unresolvedRelations, hasSize(1));
assertThat(unresolvedRelations.getFirst().indexPattern().indexPattern(), equalTo("hosts"));
}There are also similar csv test cases in |
Maybe you were using an old version of this branch? I’ve removed this token in favor of UNQUOTED_SOURCE as highlighted above: #138687 (review) |
|
Yes, it works with the latest revision - thanks Felix. Just to confirm, do we want PromQL to be used only as a source command, or as both a source and a processing command? |
Changes the PROMQL command from being a processing command that should be nested under the
TSsource command to be a standalone source command.Example: