-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
XContent: Factor deprecation handling into callback #28449
XContent: Factor deprecation handling into callback #28449
Conversation
Factors the way in which XContent parsing handles deprecated fields into a callback that is set at parser construction time. The goals here are: 1. Remove Log4J as a dependency of XContent so that XContent can be used by clients without forcing log4j and our particular deprecation handling scheme. 2. Simplify handling of deprecated fields in tests. Now tests can listen directly for the deprecation callback rather than digging through a ThreadLocal. More accurately, this change begins this work. It deprecates a number of methods, pointing folks to the new versions of those methods that take `DeprecationHandler`. The plan is to slowly drop these deprecated methods. Once they are entirely removed we can remove Log4j as dependency of XContent.
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 LGTM, I appreciate you breaking it up so it's easier to digest. I left one cosmetic comment
@@ -95,8 +96,7 @@ public Factory(ScriptService scriptService) { | |||
public ScriptProcessor create(Map<String, Processor.Factory> registry, String processorTag, | |||
Map<String, Object> config) throws Exception { | |||
XContentBuilder builder = XContentBuilder.builder(JsonXContent.jsonXContent).map(config); | |||
JsonXContentParser parser = new JsonXContentParser(NamedXContentRegistry.EMPTY, | |||
JSON_FACTORY.createParser(builder.bytes().streamInput())); | |||
XContentParser parser = JsonXContent.jsonXContent.createParser(NamedXContentRegistry.EMPTY, builder.bytes().streamInput()); |
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 does this one use JsonXContent.jsonXContent.createParser(...)
and the one below use XContentType.JSON.xContent().createParser(...)
? They're the same thing so I think we should standardize on one (probably the XContentType one?)
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.
I suppose because I'm used to the top one and forgot about the bottom one. I'll make them line up.
Factors the way in which XContent parsing handles deprecated fields into a callback that is set at parser construction time. The goals here are: 1. Remove Log4J as a dependency of XContent so that XContent can be used by clients without forcing log4j and our particular deprecation handling scheme. 2. Simplify handling of deprecated fields in tests. Now tests can listen directly for the deprecation callback rather than digging through a ThreadLocal. More accurately, this change begins this work. It deprecates a number of methods, pointing folks to the new versions of those methods that take `DeprecationHandler`. The plan is to slowly drop these deprecated methods. Once they are entirely removed we can remove Log4j as dependency of XContent.
This commit switches all the modules and server test code to use the non-deprecated `ParseField.match` method, passing in the logging deprecation handler. Relates to elastic#28449
This commit switches all the modules and server test code to use the non-deprecated `ParseField.match` method, passing in the parser's deprecation handler or the logging deprecation handler when a parser is not available (like in tests). Relates to elastic#28449
This commit switches all the modules and server test code to use the non-deprecated `ParseField.match` method, passing in the parser's deprecation handler or the logging deprecation handler when a parser is not available (like in tests). Relates to #28449
This commit switches all the modules and server test code to use the non-deprecated `ParseField.match` method, passing in the parser's deprecation handler or the logging deprecation handler when a parser is not available (like in tests). Relates to #28449
This moves away from one of the now-deprecated XContentHelper.createParser methods in favor of specifying the deprecation logger at parser creation time. Relates to elastic#28449 Note that this doesn't move all the `createParser` calls because some of them use the already-deprecated method that doesn't specify the XContentType.
* Move to non-deprecated XContentHelper.createParser(...) This moves away from one of the now-deprecated XContentHelper.createParser methods in favor of specifying the deprecation logger at parser creation time. Relates to #28449 Note that this doesn't move all the `createParser` calls because some of them use the already-deprecated method that doesn't specify the XContentType. * Remove the deprecated (and now non-needed) createParser method
* Move to non-deprecated XContentHelper.createParser(...) This moves away from one of the now-deprecated XContentHelper.createParser methods in favor of specifying the deprecation logger at parser creation time. Relates to #28449 Note that this doesn't move all the `createParser` calls because some of them use the already-deprecated method that doesn't specify the XContentType. * Remove the deprecated (and now non-needed) createParser method
Pinging @elastic/es-core-infra |
Factors the way in which XContent parsing handles deprecated fields
into a callback that is set at parser construction time. The goals here
are:
by clients without forcing log4j and our particular deprecation handling
scheme.
directly for the deprecation callback rather than digging through a
ThreadLocal.
More accurately, this change begins this work. It deprecates a number of
methods, pointing folks to the new versions of those methods that take
DeprecationHandler
. The plan is to slowly drop these deprecatedmethods. Once they are entirely removed we can remove Log4j as
dependency of XContent.
Replaces #27955.