-
Notifications
You must be signed in to change notification settings - Fork 24.7k
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
EQL: [Tests] enable server side debugging #64308
Conversation
Register a new task `runEqlCorrectnessNode` which enables developers to start an ES node in debug mode, properly restore the correctness data and then run queries against it.
Pinging @elastic/es-ql (:Query Languages/EQL) |
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.
Added some comments.
Thank you for adding this task, for me at least is really helpful.
@@ -105,18 +77,6 @@ public static void logTotalExecutionTime() { | |||
LOGGER.info("Total time: {} ms", totalTime); | |||
} | |||
|
|||
@AfterClass |
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 removing this method?
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.
Because when you have a running ES node and you try to execute a single query against it with gradle, the termination of the suite will delete the data, and you'd have to rerun the EqlDataLoader.
// Need to setup the log configuration properly to avoid messages when creating a new RestClient | ||
PluginManager.addPackage(LogConfigurator.class.getPackage().getName()); | ||
|
||
Properties configuration = loadConfiguration(); |
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.
You could load the Properties inside the try() { .... }
block.
} | ||
|
||
static Properties loadConfiguration() throws IOException { | ||
try (InputStream is = EsEQLCorrectnessIT.class.getClassLoader().getResourceAsStream(PROPERTIES_FILENAME)) { |
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.
To be 100% correct, I think it should be EqlDataLoader's class loader to load the properties file.
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.
yep, copy paste leftover.
Once the ES node is up and running, the data can be restored from the snapshot by running the `main` of the | ||
`EqlDataLoader` class. | ||
|
||
Once the data is loaded, a specific query can ber run against the running ES node with: |
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.
Typo: can ber run
If one wants to run an ES node manually (most probably to be able to debug the server), needs to run the following: | ||
|
||
```shell script | ||
./gradlew -p x-pack/plugin/eql/qa/correctness runEqlCorrectnessNode --debug-jvm |
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 below you provided an example gradlew
command without using -p
, I think it's better to be consistent and either use here the same format as the other command or use -p
in both places. Not sure of the differences though, but I've been advised lately to stop using the -p
format in favor of something like gradlew :x-pack:plugin:eql:qa:correctness:runEqlCorrectness --debug-jvm
RequestOptions.DEFAULT | ||
); | ||
} | ||
EqlDataLoader.restoreSnapshot(client(), highLevelClient(), CFG); |
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 highLevelClient has a reference to the rest client already (through getLowLevelClient()
), I don't think you need to pass client()
here.
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.
Thx, missed that.
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
@@ -5,10 +5,11 @@ | |||
# | |||
|
|||
index_name=mitre | |||
index_doc_count=3950632 |
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.
👍
@@ -36,3 +44,8 @@ tasks.named('javaRestTest').configure { | |||
showStandardStreams = true | |||
} | |||
} | |||
|
|||
tasks.register("runEqlCorrectnessNode", RunTask) { |
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
Register a new task `runEqlCorrectnessNode` which enables developers to start an ES node in debug mode, properly restore the correctness data and then run queries against it. Assert the index is restored correctly and use new snapshot. (cherry picked from commit fc8c6dd)
Register a new task `runEqlCorrectnessNode` which enables developers to start an ES node in debug mode, properly restore the correctness data and then run queries against it. Assert the index is restored correctly and use new snapshot. (cherry picked from commit fc8c6dd)
Register a new task `runEqlCorrectnessNode` which enables developers to start an ES node in debug mode, properly restore the correctness data and then run queries against it. Assert the index is restored correctly and use new snapshot. (cherry picked from commit fc8c6dd)
Register a new task `runEqlCorrectnessNode` which enables developers to start an ES node in debug mode, properly restore the correctness data and then run queries against it. Assert the index is restored correctly and use new snapshot. (cherry picked from commit fc8c6dd)
Register a new task
runEqlCorrectnessNode
which enables developers tostart an ES node in debug mode, properly restore the correctness data
and then run queries against it.