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
Script engines should be aware of the script name #6653
Comments
Heya @dakrone are you working on this? If not can you elaborate on what you mean? Where should the script name be available but it isn't? |
@javanna when exceptions are thrown in a script, it's nice to know in the logs which script (if it came from on disk) the error came from, I believe right now we use: private String generateScriptName() {
return "Script" + counter.incrementAndGet() + ".groovy";
} Which works for dynamic scripts (maybe we want to rename it "dynamic-script1.groovy" or something to be extra clear. The on-disk ones should have their name clearly in the exception/logging. |
Modified ScriptEngineService to pass in a CompiledScript object to several methods with newly added name and type member variables. This can in turn be used to give better scripting error messages with the type of script used and the name of the script. Required slight modifications to the caching mechanism. closes elastic#6653
Modified ScriptEngineService to pass in a CompiledScript object to several methods with newly added name and type member variables. This can in turn be used to give better scripting error messages with the type of script used and the name of the script. Required slight modifications to the caching mechanism. closes elastic#6653 closes elastic#11449
@rjernst Would you please take a look when you get a chance? Thanks! |
Modified ScriptEngineService to pass in a CompiledScript object with newly added name and type member variables. This can in turn be used to give better scripting error messages with the type of script used and the name of the script. Required slight modifications to the caching mechanism. Note that this does not enforce good behavior in that plugins will have to write exceptions that also output the name of the script in order to be effective. There was no way to wrap the script methods in a try/catch block properly further up the chain because many have script-like objects passed back that can be run at a later time. closes elastic#6653 closes elastic#11449
It would be nice if we could access the name of the script from the script engine framework so it could be logged when errors occur. This would be especially helpful for additional logging for users with dynamic scripting disabled.
The text was updated successfully, but these errors were encountered: